qid
int64
1
74.7M
question
stringlengths
0
58.3k
date
stringlengths
10
10
metadata
list
response_j
stringlengths
2
48.3k
response_k
stringlengths
2
40.5k
52,543,171
Based on user-selected options, my ComboBox needs to display different content. So i have to throw out the existing Items, and load a new List. Currently i have (and this works) ``` myComboBox.getItems().clear(); myComboBox.getItems().addAll(myList); ``` However I want to chain them: ``` myComboBox.ge...
2018/09/27
[ "https://Stackoverflow.com/questions/52543171", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4314250/" ]
If the combo box is from javaFX you can use this: ``` myComboBox.getItems().setAll(<collection>); ``` where is any collection that will replace the existring one (Usually List or ArrayList).
You can also do, ``` myComboBox = new ComboBox(myList); ```
45,525,923
Using Bootstrap, I am trying to get a larger margin space on the left and right of the screen and a thin space between images. Attempted to individually target images and play around with the margin but that changes the image size and since different images has different margin sizes, the images are not even. Attempt...
2017/08/05
[ "https://Stackoverflow.com/questions/45525923", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5728508/" ]
To achieve expected result, use below CSS ``` .top-img-custom{ margin-left: 20px; margin-right: 20px; padding-left:20px; padding-right:20px; } .text-center { text-align: center!important; padding: 1px; } img{ width:100%; } ``` <https://codepen.io/nagasai/pen/dzNGqv> And as I mentioned be...
```css body{ background-color: #f2f2f2!important; } .top-img-custom{ margin:10px 25px!important; } .top-img-custom .text-center{ padding: 0 1px!important; } ``` ```html <link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/> <div class="row"> ...
45,525,923
Using Bootstrap, I am trying to get a larger margin space on the left and right of the screen and a thin space between images. Attempted to individually target images and play around with the margin but that changes the image size and since different images has different margin sizes, the images are not even. Attempt...
2017/08/05
[ "https://Stackoverflow.com/questions/45525923", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5728508/" ]
```css body{ background-color: #f2f2f2!important; } .top-img-custom{ margin:10px 25px!important; } .top-img-custom .text-center{ padding: 0 1px!important; } ``` ```html <link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/> <div class="row"> ...
This behaviour won't come totally easy to the bootstrap grid system - it is pretty much designed for 15px padding in each of its `col-` classes, and a negative margin on the containing `row` classes to compensate at the edges. Messing with those, it is pretty easy to get some accidental element wrapping or horizontal s...
45,525,923
Using Bootstrap, I am trying to get a larger margin space on the left and right of the screen and a thin space between images. Attempted to individually target images and play around with the margin but that changes the image size and since different images has different margin sizes, the images are not even. Attempt...
2017/08/05
[ "https://Stackoverflow.com/questions/45525923", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5728508/" ]
To achieve expected result, use below CSS ``` .top-img-custom{ margin-left: 20px; margin-right: 20px; padding-left:20px; padding-right:20px; } .text-center { text-align: center!important; padding: 1px; } img{ width:100%; } ``` <https://codepen.io/nagasai/pen/dzNGqv> And as I mentioned be...
This behaviour won't come totally easy to the bootstrap grid system - it is pretty much designed for 15px padding in each of its `col-` classes, and a negative margin on the containing `row` classes to compensate at the edges. Messing with those, it is pretty easy to get some accidental element wrapping or horizontal s...
65,876,057
I have been trying to scrape dynamic content (Restaurant Title, Rating, Type of Restaurant) from Doordash and It is not just one website that I am trying to scrape, but rather multiple websites, probably around 100 - 1000 pages on a single domain on Doordash. I got a 'single scrape" to work, however, when I used the c...
2021/01/24
[ "https://Stackoverflow.com/questions/65876057", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5220666/" ]
Try using Volume instead of Bind Mount for the data folder by changing this: ``` - ./db-data:/var/lib/postgresql/data ``` To this: ``` - db-data:/var/lib/postgresql/data ``` And adding this section to the end of the compose file: ``` volumes: db-data: ``` You can read more about bind mounts vs volumes [he...
I found it. The issue is not in docker, but in the compiler. I'm using [ncc](https://github.com/vercel/ncc) and it breaks my postgres client. I opened an issue in their repo with a minimal reproducible example <https://github.com/vercel/ncc/issues/646> Thanks a lot for your help
1,253,523
**Final update** Similar issue has been reported [here](https://github.com/ros-infrastructure/rosinstall_generator/issues/69). Discourse announcement: [Build/CI failures with ros-testing repository enabled?](https://discourse.ros.org/t/build-ci-failures-with-ros-testing-repository-enabled/15006) --- **Update2** Ac...
2020/06/25
[ "https://askubuntu.com/questions/1253523", "https://askubuntu.com", "https://askubuntu.com/users/707605/" ]
It looks like that *packages.ros.org* repository provides `python3-rosinstall-generator` package which is not compatible with Ubuntu 18.04 LTS. The container creation using Dockerfile without such repository is successful: ``` FROM ubuntu:18.04 ENV DEBIAN_FRONTEND=noninteractive RUN apt-get update && apt-get install...
One way to go around this issue may be to install it using pip package manager. Since you are using python2 for ROS, just try the following: ``` sudo apt install python-pip sudo pip install -U rosdep rosinstall_generator vcstool rosinstall ``` This has worked for me. I hope this helps.
28,171,901
I have a xml-file that looks like this: ``` <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <ns1:policies xmlns:ns1="http://www.companyname.nl/exchange/policyimport" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <policy> <serialnumber>159</serialnumber> <relationnumber>159</relatio...
2015/01/27
[ "https://Stackoverflow.com/questions/28171901", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4445959/" ]
I solve the problem adding the tags DCM\_BitsAllocated and DCM\_PlanarConfiguration. This are the tags that are missed. I hope that is useful for someone.
At least you should call the function chooseRepresentation, after you have applied the data. ``` **dataset->putAndInsertUint8Array(DCM_PixelData, pSorg, sizeBuffer);** dataset->chooseRepresentation(EXS_JPEGProcess14SV1, &params); ```
22,185,500
I tried following the directions to get Yeoman Ember started from here: <https://github.com/yeoman/generator-ember#usage> ``` npm install -g generator-ember mkdir myemberapp && cd myemberapp yo ember npm install -g grunt-mocha grunt serve A welcome page should appear in your browser. ``` However, Bower errors out ...
2014/03/04
[ "https://Stackoverflow.com/questions/22185500", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3381250/" ]
Reinstall Bower. It's corrupt as it's missing a dependency.
You can try to install ansi-styles: ``` npm install -g ansi-styles ``` If you just end up having the next dependency missing there is probably something inherently wrong that needs fixed, and someone smarter than me needs to help you.
67,114,026
I'd like to limits API access from one or more domains - in other words I have a set of exposed API endpoints but I only want to respond to specific remote servers. I intend to issue tokens to the servers that I intend to respond to but I want to ensure that I'm really dealing with the right servers in case the tokens...
2021/04/15
[ "https://Stackoverflow.com/questions/67114026", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15650534/" ]
After grouping by 'FamilyID', subset the 'X', 'Y' column where the SubjectID is 4 or 5, check if `any` of the values are equal to 1 and the compound logical expression is joined with OR (`|`) operator ``` library(dplyr) df1 %>% group_by(FamilyID) %>% mutate(Z = +(any(X[SubjectID %in% 4:5] == 1)| ...
**Special thanks** to dear @akrun for his helpful suggestions: You can also use the following solution. I used data provided by dear @akrun. ``` library(dplyr) library(purrr) df1 %>% mutate(Z = pmap_dbl(list(SubjectID, X, Y), ~ if_else(..1 %in% c(4, 5) & any(c(..2, ..3) == 1), 1, 0))) %>% group_by(FamilyID) %>% ...
873
**UPDATE MARCH 24, 2016** After some further thinking, To maintain consistency I decided to go with Winkle-bot for all three images: [![Captcha, 404, and Error Winkle](https://i.stack.imgur.com/P3SfL.png)](https://i.stack.imgur.com/P3SfL.png) *Captcha, 404, and Error Winkle-bots* These will be live with the next pr...
2016/03/22
[ "https://magento.meta.stackexchange.com/questions/873", "https://magento.meta.stackexchange.com", "https://magento.meta.stackexchange.com/users/32899/" ]
I'm not sure yet if this is too cruel but you could replace "Ooops! Something bad happened" with the all too well known phrase ["There has been an error processing your request"](https://www.google.de/search?q=there+has+been+an+error+processing+your+request&source=lnms&tbm=isch&sa=X)
Here is my proposal for the 404 not found page. The idea is based on **famous misspell regarding Magento: Magneto**. Everyone here has probably made the mistake typing too fast on the keyboard. As we all know mistake typing an URL often leads to the 404 page. Thus I would like to see a **designed version of Magneto ...
873
**UPDATE MARCH 24, 2016** After some further thinking, To maintain consistency I decided to go with Winkle-bot for all three images: [![Captcha, 404, and Error Winkle](https://i.stack.imgur.com/P3SfL.png)](https://i.stack.imgur.com/P3SfL.png) *Captcha, 404, and Error Winkle-bots* These will be live with the next pr...
2016/03/22
[ "https://magento.meta.stackexchange.com/questions/873", "https://magento.meta.stackexchange.com", "https://magento.meta.stackexchange.com/users/32899/" ]
Here is my proposal for the 404 not found page. The idea is based on **famous misspell regarding Magento: Magneto**. Everyone here has probably made the mistake typing too fast on the keyboard. As we all know mistake typing an URL often leads to the 404 page. Thus I would like to see a **designed version of Magneto ...
There are a lot of meme-type things that have been done with my visage, but nothing do freakin' cool as Winkle-bot. Cheers!!
873
**UPDATE MARCH 24, 2016** After some further thinking, To maintain consistency I decided to go with Winkle-bot for all three images: [![Captcha, 404, and Error Winkle](https://i.stack.imgur.com/P3SfL.png)](https://i.stack.imgur.com/P3SfL.png) *Captcha, 404, and Error Winkle-bots* These will be live with the next pr...
2016/03/22
[ "https://magento.meta.stackexchange.com/questions/873", "https://magento.meta.stackexchange.com", "https://magento.meta.stackexchange.com/users/32899/" ]
I'm not sure yet if this is too cruel but you could replace "Ooops! Something bad happened" with the all too well known phrase ["There has been an error processing your request"](https://www.google.de/search?q=there+has+been+an+error+processing+your+request&source=lnms&tbm=isch&sa=X)
There are a lot of meme-type things that have been done with my visage, but nothing do freakin' cool as Winkle-bot. Cheers!!
27,156,353
I was trying to use Microsoft.ApplicationInsights, and I installed the same through nuget. but when I am trying to use ``` _telemetryClient.TrackException(ex, new Dictionary<string, string> { {"Id", id.ToString()} ...
2014/11/26
[ "https://Stackoverflow.com/questions/27156353", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1208503/" ]
I still haven't found any solution in configuration level. However, We can provide the Instrumentation Key while initializing the TelemetryClient object: ``` var telemetryClient = new TelemetryClient(new TelemetryConfiguration() { InstrumentationKey = "Key" ...
i'm assuming you have added the .11 or later Application Insights SDK. if so add the instrumenation key to your applicationinsights.config file after adding the Application Insights SDK to your project like this: ``` </TelemetryInitializers> <InstrumentationKey>your-guid-goes-ere</InstrumentationKey> </ApplicationInsi...
27,156,353
I was trying to use Microsoft.ApplicationInsights, and I installed the same through nuget. but when I am trying to use ``` _telemetryClient.TrackException(ex, new Dictionary<string, string> { {"Id", id.ToString()} ...
2014/11/26
[ "https://Stackoverflow.com/questions/27156353", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1208503/" ]
I still haven't found any solution in configuration level. However, We can provide the Instrumentation Key while initializing the TelemetryClient object: ``` var telemetryClient = new TelemetryClient(new TelemetryConfiguration() { InstrumentationKey = "Key" ...
Use this below code in your Configuration method. ``` Microsoft.ApplicationInsights.Extensibility.TelemetryConfiguration.Active.InstrumentationKey = key; ```
27,156,353
I was trying to use Microsoft.ApplicationInsights, and I installed the same through nuget. but when I am trying to use ``` _telemetryClient.TrackException(ex, new Dictionary<string, string> { {"Id", id.ToString()} ...
2014/11/26
[ "https://Stackoverflow.com/questions/27156353", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1208503/" ]
I still haven't found any solution in configuration level. However, We can provide the Instrumentation Key while initializing the TelemetryClient object: ``` var telemetryClient = new TelemetryClient(new TelemetryConfiguration() { InstrumentationKey = "Key" ...
In my case I just needed to add my IP to the Azure Database firewall - the `InstrumentationKey` fails before we get explanatory error about the firewall so it may be confusing.
27,156,353
I was trying to use Microsoft.ApplicationInsights, and I installed the same through nuget. but when I am trying to use ``` _telemetryClient.TrackException(ex, new Dictionary<string, string> { {"Id", id.ToString()} ...
2014/11/26
[ "https://Stackoverflow.com/questions/27156353", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1208503/" ]
Did you download nuget manually or did you get it via UI by adding AppInsights to the project? We have seen this issue when users try to add individual nugget manually. The easiest way to recover is to add full AppInsights support by right click on the project and choosing Update Application Insights - it will ask you...
i'm assuming you have added the .11 or later Application Insights SDK. if so add the instrumenation key to your applicationinsights.config file after adding the Application Insights SDK to your project like this: ``` </TelemetryInitializers> <InstrumentationKey>your-guid-goes-ere</InstrumentationKey> </ApplicationInsi...
27,156,353
I was trying to use Microsoft.ApplicationInsights, and I installed the same through nuget. but when I am trying to use ``` _telemetryClient.TrackException(ex, new Dictionary<string, string> { {"Id", id.ToString()} ...
2014/11/26
[ "https://Stackoverflow.com/questions/27156353", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1208503/" ]
i'm assuming you have added the .11 or later Application Insights SDK. if so add the instrumenation key to your applicationinsights.config file after adding the Application Insights SDK to your project like this: ``` </TelemetryInitializers> <InstrumentationKey>your-guid-goes-ere</InstrumentationKey> </ApplicationInsi...
Use this below code in your Configuration method. ``` Microsoft.ApplicationInsights.Extensibility.TelemetryConfiguration.Active.InstrumentationKey = key; ```
27,156,353
I was trying to use Microsoft.ApplicationInsights, and I installed the same through nuget. but when I am trying to use ``` _telemetryClient.TrackException(ex, new Dictionary<string, string> { {"Id", id.ToString()} ...
2014/11/26
[ "https://Stackoverflow.com/questions/27156353", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1208503/" ]
i'm assuming you have added the .11 or later Application Insights SDK. if so add the instrumenation key to your applicationinsights.config file after adding the Application Insights SDK to your project like this: ``` </TelemetryInitializers> <InstrumentationKey>your-guid-goes-ere</InstrumentationKey> </ApplicationInsi...
In my case I just needed to add my IP to the Azure Database firewall - the `InstrumentationKey` fails before we get explanatory error about the firewall so it may be confusing.
27,156,353
I was trying to use Microsoft.ApplicationInsights, and I installed the same through nuget. but when I am trying to use ``` _telemetryClient.TrackException(ex, new Dictionary<string, string> { {"Id", id.ToString()} ...
2014/11/26
[ "https://Stackoverflow.com/questions/27156353", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1208503/" ]
Did you download nuget manually or did you get it via UI by adding AppInsights to the project? We have seen this issue when users try to add individual nugget manually. The easiest way to recover is to add full AppInsights support by right click on the project and choosing Update Application Insights - it will ask you...
Use this below code in your Configuration method. ``` Microsoft.ApplicationInsights.Extensibility.TelemetryConfiguration.Active.InstrumentationKey = key; ```
27,156,353
I was trying to use Microsoft.ApplicationInsights, and I installed the same through nuget. but when I am trying to use ``` _telemetryClient.TrackException(ex, new Dictionary<string, string> { {"Id", id.ToString()} ...
2014/11/26
[ "https://Stackoverflow.com/questions/27156353", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1208503/" ]
Did you download nuget manually or did you get it via UI by adding AppInsights to the project? We have seen this issue when users try to add individual nugget manually. The easiest way to recover is to add full AppInsights support by right click on the project and choosing Update Application Insights - it will ask you...
In my case I just needed to add my IP to the Azure Database firewall - the `InstrumentationKey` fails before we get explanatory error about the firewall so it may be confusing.
70,728,515
I've been coding a program to write data into a text file and practice data processes in c, and find data from there, every data is stored as lines. There are lines, and data is stored line by line, such as: **student name** *student surname* **student phone etc.** When i take an input of "student name" it starts to ...
2022/01/16
[ "https://Stackoverflow.com/questions/70728515", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9560064/" ]
Instead of [incorrectly using `feof()`](http://stackoverflow.com/questions/5431941/why-is-while-feof-file-always-wrong) and `fscanf(filePtr,"%s", ...` to incorrectly read a *line*. Use `fgets()` to read a *line* of the file and convert to a *string*. * Test the return value of `fgets()` to see if input occurred. * Use...
The function `feof` will only tell you whether a previous input operation has already encountered end-of-file. It won't tell you whether you have now reached the end of file, so that the next input operation will fail. That function function is unable to predict whether the next input operation to `fscanf` or `fgets` w...
9,840,866
I have a table which is being dynamically populated, each row contains two textfields which can be edited. When the user click the save button, i want to read al those entered values and updated accordingly: ``` echo "<td><input value='".$row[0]."' type='hidden'>$sql1[0]</td><td>$sql1[1]</td> <td><input type='text...
2012/03/23
[ "https://Stackoverflow.com/questions/9840866", "https://Stackoverflow.com", "https://Stackoverflow.com/users/325533/" ]
Try this. ``` var values = {}; $('#order_basket input[id^="disc"]').each(function(){ values[this.id] = this.value; }); ``` Now `values` object will contain id/value pair of each of the input elements Note that I am using attribute starts with selector `^=` to find all the input elements Update based on OP's c...
You can also use class names: ``` <td><input type='text' class="field1" id='disc-".$row[0]."' value='".$row[3]."'></td> ``` You can then query this out using: ``` alert($('.field1').val()) ``` or: ``` alert($('.field1').attr('id') ``` You can check if there's more then one (because class names do not need t...
67,947,966
I am trying to get all my repositories using the Github v4 API, but I can't find any query named `repositories`. I found a similar way to do so like this: ```js export const query = gql` query repositories() { search(query: "user:userName", type: REPOSITORY, first: 50) { repositoryCount edge...
2021/06/12
[ "https://Stackoverflow.com/questions/67947966", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11148124/" ]
I think pandas is imported only on the scope of function.
You imported pandas in a function which is sent to garbage when function is over. Try importing outside the function
2,143,255
I was wondering if anyone has came up with a way to float html elements, with some content, over .swf without triggering any flash events. In my case the problem is I have flash map, and drop down menu on top of it. I simplified this into the following example: <http://f1vlad.com/etc/d.html> If you mouseover any el...
2010/01/26
[ "https://Stackoverflow.com/questions/2143255", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1689906/" ]
Have you tried adjusting the z-index of the HTML elements with CSS. Try applying this to your HTML element: z-index: 1000; Update: I have placed HTML elements over an .swf and had the area of the flash that is covered by the HTML not respond to click events. Is this essentially the same symptoms you want to correct? ...
In Firefox 3.5, your page sort of works. When I mouseout of the floating box and on to Canada it will trigger the mouseover event for Canada. However, if I mouseover the floating box again the SWF doesn't receive the mouseout event so Canada stays highlighted. I assume you want to have Canada receive the mouseout event...
2,372,297
In firefox 2 I was able to get the path using Browse - I use the path in our project to then write out files to that location. So now that browse does not get the path, does anyone know a way for a user to go to a directory and have the path returned via a web page so I could pass that along to the server for processin...
2010/03/03
[ "https://Stackoverflow.com/questions/2372297", "https://Stackoverflow.com", "https://Stackoverflow.com/users/285416/" ]
You can convert the dates to Unix timestamp. Randomly pick a timestamp between the two timestamps and convert it back to date.
Transform the dates into 3 ints: d1 = dd, m1 = mm, y1 = yyyy, same with d2, m2, y2 Then, assuming you know how to generate random numbers ( <http://www.cprogramming.com/tutorial/random.html> ), generate a random number between y1 and y2, which will act as the year. Then dd can be generated random between 1 and 28, and...
2,372,297
In firefox 2 I was able to get the path using Browse - I use the path in our project to then write out files to that location. So now that browse does not get the path, does anyone know a way for a user to go to a directory and have the path returned via a web page so I could pass that along to the server for processin...
2010/03/03
[ "https://Stackoverflow.com/questions/2372297", "https://Stackoverflow.com", "https://Stackoverflow.com/users/285416/" ]
You can convert the dates to Unix timestamp. Randomly pick a timestamp between the two timestamps and convert it back to date.
Convert the dates to fixed numbers such as a Julian value (call them J1 and J2). Generate a "random" number from 0 <= N <= J2-j1. Then convert J1+N from Julian back to a date.
2,372,297
In firefox 2 I was able to get the path using Browse - I use the path in our project to then write out files to that location. So now that browse does not get the path, does anyone know a way for a user to go to a directory and have the path returned via a web page so I could pass that along to the server for processin...
2010/03/03
[ "https://Stackoverflow.com/questions/2372297", "https://Stackoverflow.com", "https://Stackoverflow.com/users/285416/" ]
You can convert the dates to Unix timestamp. Randomly pick a timestamp between the two timestamps and convert it back to date.
Use the types and functions from the standard library time.h: <http://en.wikipedia.org/wiki/Time.h> Convert the string parts to ints, then convert these to time\_t. After calculating your random value in between, go the other way to get your result in a string.
2,372,297
In firefox 2 I was able to get the path using Browse - I use the path in our project to then write out files to that location. So now that browse does not get the path, does anyone know a way for a user to go to a directory and have the path returned via a web page so I could pass that along to the server for processin...
2010/03/03
[ "https://Stackoverflow.com/questions/2372297", "https://Stackoverflow.com", "https://Stackoverflow.com/users/285416/" ]
Convert the dates to fixed numbers such as a Julian value (call them J1 and J2). Generate a "random" number from 0 <= N <= J2-j1. Then convert J1+N from Julian back to a date.
Transform the dates into 3 ints: d1 = dd, m1 = mm, y1 = yyyy, same with d2, m2, y2 Then, assuming you know how to generate random numbers ( <http://www.cprogramming.com/tutorial/random.html> ), generate a random number between y1 and y2, which will act as the year. Then dd can be generated random between 1 and 28, and...
2,372,297
In firefox 2 I was able to get the path using Browse - I use the path in our project to then write out files to that location. So now that browse does not get the path, does anyone know a way for a user to go to a directory and have the path returned via a web page so I could pass that along to the server for processin...
2010/03/03
[ "https://Stackoverflow.com/questions/2372297", "https://Stackoverflow.com", "https://Stackoverflow.com/users/285416/" ]
Convert the dates to fixed numbers such as a Julian value (call them J1 and J2). Generate a "random" number from 0 <= N <= J2-j1. Then convert J1+N from Julian back to a date.
Use the types and functions from the standard library time.h: <http://en.wikipedia.org/wiki/Time.h> Convert the string parts to ints, then convert these to time\_t. After calculating your random value in between, go the other way to get your result in a string.
36,408,514
I need to make sure each observable is valid and also make sure all the observables are valid together. In my simplified example I have a modelNumber and stockNumber that are each required, but together they must also form a valid partNumber. My attempt gives me this error: "Uncaught Error: Cannot write a value to a k...
2016/04/04
[ "https://Stackoverflow.com/questions/36408514", "https://Stackoverflow.com", "https://Stackoverflow.com/users/251614/" ]
i have modified the code and the following code works fine. ``` ko.validation.init(); ko.validation.rules['partNumberValid'] = { validator: function (partInfo, otherVal) { return partInfo.modelNumber() +''+ partInfo.stockNumber() === "m1s1"; }, message: 'part numb...
I think the answer is you can't extend validation on Knockout Validation's validatedObservable. I think the right answer here is to create an `observable` for each thing or group of things that needs validation and then create a `validatedObservable` to validate all of those `observables`. <https://jsfiddle.net/yekr2o...
15,382,632
For practicing reasons I programmed a little Texas Holdem Game in PHP with some JQuery Animations. Every action (bet, fold, check, raise, call) is submitted via a HTML form to a PHP script. Now unfortunately the user is able to just go back to the first betting round after seeing the whole board and the computer's ca...
2013/03/13
[ "https://Stackoverflow.com/questions/15382632", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2164882/" ]
You need to invalidate the request. That means one request follows after the other. You do this by storing all requests of that user in the game. If a new request is send, it can be only added at the end. You can create the game in memory by initializing it and the pass in all events from all sides until a specific ...
Perhaps something like this will work. ``` <SCRIPT type="text/javascript"> window.history.forward(); function noBack() { window.history.forward(); } </SCRIPT> </HEAD> <BODY onload="noBack();" onpageshow="if (event.persisted) noBack();" onunload=""> ``` From [link](http://viralpatel.net/blogs/disable-back...
48,857,840
I have three rows return from a table as below: ``` select ID from service ``` Results: ``` ID -- 1 2 3 ``` How can I return output like below: ``` count | IDs -------+---------- 3 | 1,2,3 ```
2018/02/18
[ "https://Stackoverflow.com/questions/48857840", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6728546/" ]
hope this helps ``` select (select Count(*) from service)+' | '+ SELECT STUFF ( ( SELECT ',' + s.FirstName FROM Employee s ORDER BY s.FirstName FOR XML PATH('') ), 1, 1, '' ) AS Employees) ```
If you are going to be work with `stuff()` function then you will no need to `subquery` for count of ids ``` select count(1) count, stuff( (select ','+cast(id as varchar) from table for xml path('')), 1,1,'') Ids from table ```
21,059,703
I want the name of the partition with their total space, used space and free space for the Linux system using java program. I am getting correct value in case of Windows system but in Linux I am getting only one drive information: Here is what I have tried so far. ``` public class DiskSpace { public static void mai...
2014/01/11
[ "https://Stackoverflow.com/questions/21059703", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1460514/" ]
There are no drive letters on Linux. If you want to know which partitions there are, and where they are mounted, read `/proc/mounts`. When you have a mount point (2nd column in /proc/mounts), use `new File(mountpoint).getTotalSpace()` to get the total space.
Linux, Unix, and Unix-like systems have one filesystem with one root within which there may be multiple mount points at which partitions containing Unix filesystems, partial or complete, may be mounted -- non-Unix filesystems may also be mounted with the appropriate software available to handle the transformations nece...
21,059,703
I want the name of the partition with their total space, used space and free space for the Linux system using java program. I am getting correct value in case of Windows system but in Linux I am getting only one drive information: Here is what I have tried so far. ``` public class DiskSpace { public static void mai...
2014/01/11
[ "https://Stackoverflow.com/questions/21059703", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1460514/" ]
There are no drive letters on Linux. If you want to know which partitions there are, and where they are mounted, read `/proc/mounts`. When you have a mount point (2nd column in /proc/mounts), use `new File(mountpoint).getTotalSpace()` to get the total space.
This is a code snippet to display name mounted external media only. ``` String OS = System.getProperty("os.name"); if(OS.equals("Linux")) { String s = ""; Runtime rt = Runtime.getRuntime(); int n=0; Process ps = rt.exec("ls /run/media/Rancho");// Write your UserName, mine is Rancho InputStream in ...
245,645
If I remove a game on my PS4 to save space, will I always have that game, even if it is a PS+ title and can always install it again?
2015/11/28
[ "https://gaming.stackexchange.com/questions/245645", "https://gaming.stackexchange.com", "https://gaming.stackexchange.com/users/74125/" ]
You will get to keep your games. You'll notice that when you get the free PS+ titles, they're added to your account whether you download them or not. Uninstalling games will not remove them from your library, which can be viewed at the far right of the PS4 home screen. i.e. the library is tied to your PSN account, not...
Normally, you can download any game you've downloaded before as often as you want to, free of any additional charge. However, there is one exception to that rule: If the game has ever been pulled out for any reason, you won't be able to download it again until it somehow returns to the PSN. Luckily, the list of games ...
245,645
If I remove a game on my PS4 to save space, will I always have that game, even if it is a PS+ title and can always install it again?
2015/11/28
[ "https://gaming.stackexchange.com/questions/245645", "https://gaming.stackexchange.com", "https://gaming.stackexchange.com/users/74125/" ]
You will get to keep your games. You'll notice that when you get the free PS+ titles, they're added to your account whether you download them or not. Uninstalling games will not remove them from your library, which can be viewed at the far right of the PS4 home screen. i.e. the library is tied to your PSN account, not...
PlayStation Plus titles are granted a special ownership status. When you download a free PS+ title, without paying for it, you own it *as part of your PS+ status*. So, if you decide not to pay for PlayStation Plus anymore, then once it expires, you will not be allowed to play that game anymore. However, if you re-subs...
245,645
If I remove a game on my PS4 to save space, will I always have that game, even if it is a PS+ title and can always install it again?
2015/11/28
[ "https://gaming.stackexchange.com/questions/245645", "https://gaming.stackexchange.com", "https://gaming.stackexchange.com/users/74125/" ]
Normally, you can download any game you've downloaded before as often as you want to, free of any additional charge. However, there is one exception to that rule: If the game has ever been pulled out for any reason, you won't be able to download it again until it somehow returns to the PSN. Luckily, the list of games ...
PlayStation Plus titles are granted a special ownership status. When you download a free PS+ title, without paying for it, you own it *as part of your PS+ status*. So, if you decide not to pay for PlayStation Plus anymore, then once it expires, you will not be allowed to play that game anymore. However, if you re-subs...
46,780
I would like to know what are reasons of latency for a HTTP request to load HTML part of a webpage. I think about: * loading webpage with proxy * not having a good web server (apache vs nginx) * having a bad configuration of web server * having a bad internet connexion (bad ping) Any other ideas?
2013/04/01
[ "https://webmasters.stackexchange.com/questions/46780", "https://webmasters.stackexchange.com", "https://webmasters.stackexchange.com/users/20122/" ]
Here are some areas to consider in general, without going into detail: * **Physical configuration/server specs**: + RAM (the more the better) + CPU processor speed, and number of cores for multi-core applications + Drive speed and physical RAID to increase read/write speed (not software RAID used for mirrors and ...
Not having a good web server is pretty broad since you could have a good web server increasing latency for several reasons such as a peice of hardware that has defected such as a hard drive which is increasing seek time. Also outside influences could be a factor, such as routing issues on networks that you do not hav...
12,785,811
Heres the issue. I have an an ajax function that is just checking if an email that a user inputs is already used. The php script that it uses either sends back "true" or "false" strings depending on the result. When i get the response text back, or the "data" variable in the below function, and see if its == to "true...
2012/10/08
[ "https://Stackoverflow.com/questions/12785811", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1703519/" ]
For debugging, try ``` if (data.replace(/\s+/g, '') == "true") { ``` ...my money is on whitespace outside the `<?php ?>` tags. Note that if this solves the problem it should not considered the solution - the real solution is to remove the additional whitespace from the PHP script. The `<` of the opening `<?php` ta...
I know this is old but I've had the exact same problem and couldn't fix it. I am realy sure it wasn't a white-space issue but I was able to solve it in a different way. Maybe it's not the best way (I still want to know why it doesnt work in the usual way), but what I did was echo a 0 (for false) and a 1 (for true) The...
8,223,841
Say I have a collection of users and want to implement autocomplete on the usernames of those users. I looked at the mongodb docs and $regex seems to be one way to do this. Is there a better way? By better I mean more performant/better practice.
2011/11/22
[ "https://Stackoverflow.com/questions/8223841", "https://Stackoverflow.com", "https://Stackoverflow.com/users/235771/" ]
As suggested by @Thilo, you can use several ideas including prefixing. The most important thing is to have very quick request (because you want autocomplete to *feel* instaneous). So you have to use query which will use properly indexes. With regexp : use `/^prefix/` (the important thing is the ^ to specify the begin...
If you are looking for prefixes, you could use a range query (not sure about the exact syntax): ``` db.users.find({'username': { $gt : 'jhc', $lt: 'jhd' } } ) ``` And you want an index on the username field.
8,223,841
Say I have a collection of users and want to implement autocomplete on the usernames of those users. I looked at the mongodb docs and $regex seems to be one way to do this. Is there a better way? By better I mean more performant/better practice.
2011/11/22
[ "https://Stackoverflow.com/questions/8223841", "https://Stackoverflow.com", "https://Stackoverflow.com/users/235771/" ]
We do it using regex and it's fast as long as you have an index and you use /^value/ Be aware you can't use the case insensitive option with an index, so you may want to store a lower case version of your string as another field in your document and use that for the autocomplete. I've done tests with 3 million+ docum...
If you are looking for prefixes, you could use a range query (not sure about the exact syntax): ``` db.users.find({'username': { $gt : 'jhc', $lt: 'jhd' } } ) ``` And you want an index on the username field.
8,223,841
Say I have a collection of users and want to implement autocomplete on the usernames of those users. I looked at the mongodb docs and $regex seems to be one way to do this. Is there a better way? By better I mean more performant/better practice.
2011/11/22
[ "https://Stackoverflow.com/questions/8223841", "https://Stackoverflow.com", "https://Stackoverflow.com/users/235771/" ]
As suggested by @Thilo, you can use several ideas including prefixing. The most important thing is to have very quick request (because you want autocomplete to *feel* instaneous). So you have to use query which will use properly indexes. With regexp : use `/^prefix/` (the important thing is the ^ to specify the begin...
We do it using regex and it's fast as long as you have an index and you use /^value/ Be aware you can't use the case insensitive option with an index, so you may want to store a lower case version of your string as another field in your document and use that for the autocomplete. I've done tests with 3 million+ docum...
14,612,891
Struggling from this issue since 3 days. When i am tested the application in windows (WAMP), everything working fine. But when i am deployed the same in Linux, Billing continue button is not working. When i clicked on “Continue” after entering details, i am seeing in firebug <http://www.domain.com/checkout/onepage/s...
2013/01/30
[ "https://Stackoverflow.com/questions/14612891", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1223669/" ]
When clicking "continue" in the billing address step, the page sends an ajax post request to the`Mage_Checkout_OnepageController::saveBillingAction`. This function is supposed to save the form data into a quote and return a JSON object containing a property "goto\_section", i.e. "goto\_section":"shipping\_method". The ...
I faced the same problem when I was working locally. There are other shipping methods enabled which were causing this issue. I have disabled DHL, USPS, FedEx and UPS. Now working fine for me. I hope this helps.
39,736,580
The output of both `pactl list sink-inputs` and `pacmd list-sink-inputs` contains a Properties section: ``` Properties: media.name = "ALSA Playback" application.name = "ALSA plug-in [snapclient]" native-protocol.peer = "UNIX socket client" native-protocol.version = "29" application.process.id = "63...
2016/09/28
[ "https://Stackoverflow.com/questions/39736580", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6890807/" ]
Some commands also accept the unique name instead of the id, but the ones you are trying to use seem to not be able to do so.. probably because the name is not unique and there could be mulitple matches. You need to parse it yourself. This is what I came up with: ```sh pacmd list-sink-inputs | tr '\n' '\r' | perl -pe ...
Although it does parse the output and doesn't yet do any matching for the id you may be looking for, this method will provide a way, with some modifications, to get that information by sink id: ``` pactl list sink-inputs | while read -r line ; do #echo "Processing ${line}" echo $line | grep -oP 'Sink Input #\K[^$...
39,736,580
The output of both `pactl list sink-inputs` and `pacmd list-sink-inputs` contains a Properties section: ``` Properties: media.name = "ALSA Playback" application.name = "ALSA plug-in [snapclient]" native-protocol.peer = "UNIX socket client" native-protocol.version = "29" application.process.id = "63...
2016/09/28
[ "https://Stackoverflow.com/questions/39736580", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6890807/" ]
Although it does parse the output and doesn't yet do any matching for the id you may be looking for, this method will provide a way, with some modifications, to get that information by sink id: ``` pactl list sink-inputs | while read -r line ; do #echo "Processing ${line}" echo $line | grep -oP 'Sink Input #\K[^$...
Here's a short solution to OP's question: ``` $ cat pulse-get-sink-input-for-pid #!/bin/bash if [ $# -ne 1 ]; then >&2 echo Need PID; exit 1; fi export pid=$1 pactl list sink-inputs | perl -nle '/Sink Input #(\d+)/ and $si = $1; /application.process.id.*?(\d+)/ and ($1 == $ENV{pid}) and print "$si"' ```
39,736,580
The output of both `pactl list sink-inputs` and `pacmd list-sink-inputs` contains a Properties section: ``` Properties: media.name = "ALSA Playback" application.name = "ALSA plug-in [snapclient]" native-protocol.peer = "UNIX socket client" native-protocol.version = "29" application.process.id = "63...
2016/09/28
[ "https://Stackoverflow.com/questions/39736580", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6890807/" ]
Although it does parse the output and doesn't yet do any matching for the id you may be looking for, this method will provide a way, with some modifications, to get that information by sink id: ``` pactl list sink-inputs | while read -r line ; do #echo "Processing ${line}" echo $line | grep -oP 'Sink Input #\K[^$...
The very long, easy to understand, maintainable way to do it (using **application.process.binary**) *Result* ``` ffmpeg | 3 firefox-esr | 24 firefox-esr | 58 vlc | 43 ``` *Bash script* ``` str="$(pacmd list-sink-inputs)" list1=$(printf '%s' "$str" | grep 'index: ') list2=$(printf '%s' "$str" | grep 'application.p...
39,736,580
The output of both `pactl list sink-inputs` and `pacmd list-sink-inputs` contains a Properties section: ``` Properties: media.name = "ALSA Playback" application.name = "ALSA plug-in [snapclient]" native-protocol.peer = "UNIX socket client" native-protocol.version = "29" application.process.id = "63...
2016/09/28
[ "https://Stackoverflow.com/questions/39736580", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6890807/" ]
Some commands also accept the unique name instead of the id, but the ones you are trying to use seem to not be able to do so.. probably because the name is not unique and there could be mulitple matches. You need to parse it yourself. This is what I came up with: ```sh pacmd list-sink-inputs | tr '\n' '\r' | perl -pe ...
Here's a short solution to OP's question: ``` $ cat pulse-get-sink-input-for-pid #!/bin/bash if [ $# -ne 1 ]; then >&2 echo Need PID; exit 1; fi export pid=$1 pactl list sink-inputs | perl -nle '/Sink Input #(\d+)/ and $si = $1; /application.process.id.*?(\d+)/ and ($1 == $ENV{pid}) and print "$si"' ```
39,736,580
The output of both `pactl list sink-inputs` and `pacmd list-sink-inputs` contains a Properties section: ``` Properties: media.name = "ALSA Playback" application.name = "ALSA plug-in [snapclient]" native-protocol.peer = "UNIX socket client" native-protocol.version = "29" application.process.id = "63...
2016/09/28
[ "https://Stackoverflow.com/questions/39736580", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6890807/" ]
Some commands also accept the unique name instead of the id, but the ones you are trying to use seem to not be able to do so.. probably because the name is not unique and there could be mulitple matches. You need to parse it yourself. This is what I came up with: ```sh pacmd list-sink-inputs | tr '\n' '\r' | perl -pe ...
The very long, easy to understand, maintainable way to do it (using **application.process.binary**) *Result* ``` ffmpeg | 3 firefox-esr | 24 firefox-esr | 58 vlc | 43 ``` *Bash script* ``` str="$(pacmd list-sink-inputs)" list1=$(printf '%s' "$str" | grep 'index: ') list2=$(printf '%s' "$str" | grep 'application.p...
26,341,618
I've got a `DateTimeField` and like to limit it by month/year, i.e. only one entry per month. At the moment i use two extra fields (`month` / `year`) combined with `unique_together = ("month", "year")`, but there is definitly a better solution. ``` class someModel(models.Model): datetime = models.DateTimeField(un...
2014/10/13
[ "https://Stackoverflow.com/questions/26341618", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1167012/" ]
You can't really do it "natively" other than the way you're doing it now since when defining a model you're defining DB-level validation, and say MySQL wouldn't support a DATETIME field with a YEAR+MONTH unique constraint. What you can do, however, is add your own validator on the field, but this will require addition...
[Field.unique\_for\_date](https://docs.djangoproject.com/en/dev/ref/models/fields/#django.db.models.Field.unique_for_date) will make instance unique by a certain *field value*. This will limit by month: ``` from django.core.exceptions import ValidationError class SomeModel(models.Model): # Set index to field ...
413,597
Even though I've been a developer for awhile I've been lucky enough to have avoided doing much work with XML. So now I've got a project where I've got to interact with some web services, and would like to use some kind of Object-to-XML Mapping solution. The only one I'm aware of is JAXB. Is that the best to go with? ...
2009/01/05
[ "https://Stackoverflow.com/questions/413597", "https://Stackoverflow.com", "https://Stackoverflow.com/users/543/" ]
If you're calling a web-service with a WSDL, JAXB is absolutely the best option. Take a look at wsimport, and you're be up and running in 10 minutes. I don't think JAXB 2.0 will be possible on Java 1.4. You may need to use Axis instead: ``` java -cp axis-1.4.jar;commons-logging-1.1.jar;commons-discovery-0.2.jar;jaxrp...
There's [XStream](http://xstream.codehaus.org/). I seem to remember I used that ages ago, and it was fine. Can't say I have enough experience to recommend it for or against, but it's worth checking out just as an alternative.
413,597
Even though I've been a developer for awhile I've been lucky enough to have avoided doing much work with XML. So now I've got a project where I've got to interact with some web services, and would like to use some kind of Object-to-XML Mapping solution. The only one I'm aware of is JAXB. Is that the best to go with? ...
2009/01/05
[ "https://Stackoverflow.com/questions/413597", "https://Stackoverflow.com", "https://Stackoverflow.com/users/543/" ]
**JAXB is the best choice:** * [Public API included in Java SE 6](http://download.oracle.com/javase/6/docs/api/javax/xml/bind/package-summary.html) * Binding layer for JAX-WS (Web Services) * Binding layer for JAX-RS (Rest) * [Can preserve XML Infoset](http://bdoughan.blogspot.com/2010/09/jaxb-xml-infoset-preservation...
There's [XStream](http://xstream.codehaus.org/). I seem to remember I used that ages ago, and it was fine. Can't say I have enough experience to recommend it for or against, but it's worth checking out just as an alternative.
413,597
Even though I've been a developer for awhile I've been lucky enough to have avoided doing much work with XML. So now I've got a project where I've got to interact with some web services, and would like to use some kind of Object-to-XML Mapping solution. The only one I'm aware of is JAXB. Is that the best to go with? ...
2009/01/05
[ "https://Stackoverflow.com/questions/413597", "https://Stackoverflow.com", "https://Stackoverflow.com/users/543/" ]
If you're calling a web-service with a WSDL, JAXB is absolutely the best option. Take a look at wsimport, and you're be up and running in 10 minutes. I don't think JAXB 2.0 will be possible on Java 1.4. You may need to use Axis instead: ``` java -cp axis-1.4.jar;commons-logging-1.1.jar;commons-discovery-0.2.jar;jaxrp...
JIBX - known for performance JAXB2 - Ease of use Castor - Ease of use others - XMLBean, Xstream
413,597
Even though I've been a developer for awhile I've been lucky enough to have avoided doing much work with XML. So now I've got a project where I've got to interact with some web services, and would like to use some kind of Object-to-XML Mapping solution. The only one I'm aware of is JAXB. Is that the best to go with? ...
2009/01/05
[ "https://Stackoverflow.com/questions/413597", "https://Stackoverflow.com", "https://Stackoverflow.com/users/543/" ]
If you're calling a web-service with a WSDL, JAXB is absolutely the best option. Take a look at wsimport, and you're be up and running in 10 minutes. I don't think JAXB 2.0 will be possible on Java 1.4. You may need to use Axis instead: ``` java -cp axis-1.4.jar;commons-logging-1.1.jar;commons-discovery-0.2.jar;jaxrp...
**JAXB is the best choice:** * [Public API included in Java SE 6](http://download.oracle.com/javase/6/docs/api/javax/xml/bind/package-summary.html) * Binding layer for JAX-WS (Web Services) * Binding layer for JAX-RS (Rest) * [Can preserve XML Infoset](http://bdoughan.blogspot.com/2010/09/jaxb-xml-infoset-preservation...
413,597
Even though I've been a developer for awhile I've been lucky enough to have avoided doing much work with XML. So now I've got a project where I've got to interact with some web services, and would like to use some kind of Object-to-XML Mapping solution. The only one I'm aware of is JAXB. Is that the best to go with? ...
2009/01/05
[ "https://Stackoverflow.com/questions/413597", "https://Stackoverflow.com", "https://Stackoverflow.com/users/543/" ]
**JAXB is the best choice:** * [Public API included in Java SE 6](http://download.oracle.com/javase/6/docs/api/javax/xml/bind/package-summary.html) * Binding layer for JAX-WS (Web Services) * Binding layer for JAX-RS (Rest) * [Can preserve XML Infoset](http://bdoughan.blogspot.com/2010/09/jaxb-xml-infoset-preservation...
JIBX - known for performance JAXB2 - Ease of use Castor - Ease of use others - XMLBean, Xstream
29,434,734
I am trying to delete 38 lines of text after coming across a certain phrase in a .txt file in Python, while still printing the rest of the text. The code I currently have is ``` with open('text_file.txt','r') as f: lines = f.readlines() for line in lines: if "certain_phrase" in line: for num in range(38):...
2015/04/03
[ "https://Stackoverflow.com/questions/29434734", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4739392/" ]
You would need to remove from the list, you cannot `del` the line, the easiest way is to write to a temp file and copy after if you want to modify the file, if you just want to print ignoring the 38 line replace write with print: ``` with open('in.txt','r') as f,open('temp.txt','w') as temp: for line in f: ...
`del line` actually deletes the variable `line`, meaning that when you try to do that a second time, it doesn't work, because `line` isn't defined anymore. You can loop over indices to find the line, break, then delete the next 38 lines: ``` with open('text_file.txt','r') as f: lines = f.readlines() for i in range(len...
29,434,734
I am trying to delete 38 lines of text after coming across a certain phrase in a .txt file in Python, while still printing the rest of the text. The code I currently have is ``` with open('text_file.txt','r') as f: lines = f.readlines() for line in lines: if "certain_phrase" in line: for num in range(38):...
2015/04/03
[ "https://Stackoverflow.com/questions/29434734", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4739392/" ]
Instead of trying to delete lines from a file, write a new file based on the old one. The following uses `__next__()` to skip over `line`s yielded by the generator. ``` with open('text_file.txt','r') as f, open('text_file_mod.txt', 'w') as w: for line in f: w.write(line) if "certain_phrase" in line...
`del line` actually deletes the variable `line`, meaning that when you try to do that a second time, it doesn't work, because `line` isn't defined anymore. You can loop over indices to find the line, break, then delete the next 38 lines: ``` with open('text_file.txt','r') as f: lines = f.readlines() for i in range(len...
29,434,734
I am trying to delete 38 lines of text after coming across a certain phrase in a .txt file in Python, while still printing the rest of the text. The code I currently have is ``` with open('text_file.txt','r') as f: lines = f.readlines() for line in lines: if "certain_phrase" in line: for num in range(38):...
2015/04/03
[ "https://Stackoverflow.com/questions/29434734", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4739392/" ]
You would need to remove from the list, you cannot `del` the line, the easiest way is to write to a temp file and copy after if you want to modify the file, if you just want to print ignoring the 38 line replace write with print: ``` with open('in.txt','r') as f,open('temp.txt','w') as temp: for line in f: ...
``` with open('temp.txt','r') as fin: for line in fin: print(line,end="") #you want to print the phrase, right? if "certain_phrase" in line: for _ in range(38): next(line) ```
29,434,734
I am trying to delete 38 lines of text after coming across a certain phrase in a .txt file in Python, while still printing the rest of the text. The code I currently have is ``` with open('text_file.txt','r') as f: lines = f.readlines() for line in lines: if "certain_phrase" in line: for num in range(38):...
2015/04/03
[ "https://Stackoverflow.com/questions/29434734", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4739392/" ]
You would need to remove from the list, you cannot `del` the line, the easiest way is to write to a temp file and copy after if you want to modify the file, if you just want to print ignoring the 38 line replace write with print: ``` with open('in.txt','r') as f,open('temp.txt','w') as temp: for line in f: ...
Instead of trying to delete lines from a file, write a new file based on the old one. The following uses `__next__()` to skip over `line`s yielded by the generator. ``` with open('text_file.txt','r') as f, open('text_file_mod.txt', 'w') as w: for line in f: w.write(line) if "certain_phrase" in line...
29,434,734
I am trying to delete 38 lines of text after coming across a certain phrase in a .txt file in Python, while still printing the rest of the text. The code I currently have is ``` with open('text_file.txt','r') as f: lines = f.readlines() for line in lines: if "certain_phrase" in line: for num in range(38):...
2015/04/03
[ "https://Stackoverflow.com/questions/29434734", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4739392/" ]
Instead of trying to delete lines from a file, write a new file based on the old one. The following uses `__next__()` to skip over `line`s yielded by the generator. ``` with open('text_file.txt','r') as f, open('text_file_mod.txt', 'w') as w: for line in f: w.write(line) if "certain_phrase" in line...
``` with open('temp.txt','r') as fin: for line in fin: print(line,end="") #you want to print the phrase, right? if "certain_phrase" in line: for _ in range(38): next(line) ```
22,451,333
I have some test code asserting duplicate `User`s cannot be created through my `UserRepository`. User.cs: ``` public class User { public int Id { get; set; } public string AccountAlias { get; set; } public string DisplayName { get; set; } public string Email { get; set; } public bool IsActive ...
2014/03/17
[ "https://Stackoverflow.com/questions/22451333", "https://Stackoverflow.com", "https://Stackoverflow.com/users/465056/" ]
xUnit's `Assert.Throws` (at least on version 1.9.2) is not async-aware. This was fixed in version 2, which now has an [`Assert.ThrowsAsync`](http://xunit.codeplex.com/SourceControl/latest#src/xunit.assert/Asserts/ExceptionAsserts.cs) method. So, you can either upgrade to xUnit 2 or create your own method to get it wor...
This works for me: ``` Assert.Throws<AbpValidationException>(() => _personAppService.CreatePersonAsync(new CreatePersonInput { Name = null })); ``` Just don't use async/await.
22,451,333
I have some test code asserting duplicate `User`s cannot be created through my `UserRepository`. User.cs: ``` public class User { public int Id { get; set; } public string AccountAlias { get; set; } public string DisplayName { get; set; } public string Email { get; set; } public bool IsActive ...
2014/03/17
[ "https://Stackoverflow.com/questions/22451333", "https://Stackoverflow.com", "https://Stackoverflow.com/users/465056/" ]
xUnit's `Assert.Throws` (at least on version 1.9.2) is not async-aware. This was fixed in version 2, which now has an [`Assert.ThrowsAsync`](http://xunit.codeplex.com/SourceControl/latest#src/xunit.assert/Asserts/ExceptionAsserts.cs) method. So, you can either upgrade to xUnit 2 or create your own method to get it wor...
XUnit now handle Assert.ThrowAsync by default
22,451,333
I have some test code asserting duplicate `User`s cannot be created through my `UserRepository`. User.cs: ``` public class User { public int Id { get; set; } public string AccountAlias { get; set; } public string DisplayName { get; set; } public string Email { get; set; } public bool IsActive ...
2014/03/17
[ "https://Stackoverflow.com/questions/22451333", "https://Stackoverflow.com", "https://Stackoverflow.com/users/465056/" ]
XUnit now handle Assert.ThrowAsync by default
This works for me: ``` Assert.Throws<AbpValidationException>(() => _personAppService.CreatePersonAsync(new CreatePersonInput { Name = null })); ``` Just don't use async/await.
35,146
I am most familiar with 4e D&D, but might be playing in a 3.5 game starting in a couple months and I need to nail down a character. I have been drawn to the idea of a swarm druid in 4e rules and wondered if there is anything like that in 3.5? Top uses I like about the swarm are not locked into attacks, but more just t...
2014/03/19
[ "https://rpg.stackexchange.com/questions/35146", "https://rpg.stackexchange.com", "https://rpg.stackexchange.com/users/10263/" ]
Homebrew ======== This is not official material; I’m making it up. For what it’s worth, I’m fairly good at it (won several 3.5 homebrew competitions; did freelance work for Legend and Pathfinder, each a 3.5-spinoff; wrote a [“book” about it](https://rpg.stackexchange.com/a/18269/4563) as a question answer), but don’t ...
If controlling and summoning swarms is insufficient, and you want, instead, to *become* a swarm, here're some options. **Master of Flies Prestige Class** It's not a good class by any measure (e.g. uninteresting, difficult to optimize, doesn't perform level-appropriate tasks), but the prestige class master of flies ...
35,146
I am most familiar with 4e D&D, but might be playing in a 3.5 game starting in a couple months and I need to nail down a character. I have been drawn to the idea of a swarm druid in 4e rules and wondered if there is anything like that in 3.5? Top uses I like about the swarm are not locked into attacks, but more just t...
2014/03/19
[ "https://rpg.stackexchange.com/questions/35146", "https://rpg.stackexchange.com", "https://rpg.stackexchange.com/users/10263/" ]
The closest thing I know in D&D 3.5e is the [Vermin Lord](http://dndtools.eu/classes/vermin-lord/) from the Book of Vile Darkness. > > The vermin lord offers itself as a host for all manner of parasitic organisms. > > > With abilities like; Swarm Armor, Spew Vermin, and Hivemind. Otherwise you also have the [An...
Some non-druid options, just for completeness: ### Were-Murder-of-Crows The lycanthrope template has the following requirement for the animal base: > > This animal can be any predator, scavenger, or omnivore whose size is within one size category of the base creature’s size (Small, Medium, or Large for a Medium bas...
35,146
I am most familiar with 4e D&D, but might be playing in a 3.5 game starting in a couple months and I need to nail down a character. I have been drawn to the idea of a swarm druid in 4e rules and wondered if there is anything like that in 3.5? Top uses I like about the swarm are not locked into attacks, but more just t...
2014/03/19
[ "https://rpg.stackexchange.com/questions/35146", "https://rpg.stackexchange.com", "https://rpg.stackexchange.com/users/10263/" ]
The closest thing I know in D&D 3.5e is the [Vermin Lord](http://dndtools.eu/classes/vermin-lord/) from the Book of Vile Darkness. > > The vermin lord offers itself as a host for all manner of parasitic organisms. > > > With abilities like; Swarm Armor, Spew Vermin, and Hivemind. Otherwise you also have the [An...
You can also use [this ACF](https://web.archive.org/web/20161101150402/http://archive.wizards.com/default.asp?x=dnd/re/20040705a) to swap your animal companion for a vermin companion. At level 7 and higher, you can pick up a centipede or locust swarm. It's not much, but it's something. Maybe ask the DM if you can pick ...
35,146
I am most familiar with 4e D&D, but might be playing in a 3.5 game starting in a couple months and I need to nail down a character. I have been drawn to the idea of a swarm druid in 4e rules and wondered if there is anything like that in 3.5? Top uses I like about the swarm are not locked into attacks, but more just t...
2014/03/19
[ "https://rpg.stackexchange.com/questions/35146", "https://rpg.stackexchange.com", "https://rpg.stackexchange.com/users/10263/" ]
Homebrew ======== This is not official material; I’m making it up. For what it’s worth, I’m fairly good at it (won several 3.5 homebrew competitions; did freelance work for Legend and Pathfinder, each a 3.5-spinoff; wrote a [“book” about it](https://rpg.stackexchange.com/a/18269/4563) as a question answer), but don’t ...
**Yes, but not at early levels, though you can start planning for it now with the character-defining feat "Child of Winter"** There are no clear parallels to "turning into a swarm from level 1 as just this thing, y'know?" that the swarm druids can do. On the other hand, you might be able to pull off a [Skitter](http:...
35,146
I am most familiar with 4e D&D, but might be playing in a 3.5 game starting in a couple months and I need to nail down a character. I have been drawn to the idea of a swarm druid in 4e rules and wondered if there is anything like that in 3.5? Top uses I like about the swarm are not locked into attacks, but more just t...
2014/03/19
[ "https://rpg.stackexchange.com/questions/35146", "https://rpg.stackexchange.com", "https://rpg.stackexchange.com/users/10263/" ]
**Yes, but not at early levels, though you can start planning for it now with the character-defining feat "Child of Winter"** There are no clear parallels to "turning into a swarm from level 1 as just this thing, y'know?" that the swarm druids can do. On the other hand, you might be able to pull off a [Skitter](http:...
Some non-druid options, just for completeness: ### Were-Murder-of-Crows The lycanthrope template has the following requirement for the animal base: > > This animal can be any predator, scavenger, or omnivore whose size is within one size category of the base creature’s size (Small, Medium, or Large for a Medium bas...
35,146
I am most familiar with 4e D&D, but might be playing in a 3.5 game starting in a couple months and I need to nail down a character. I have been drawn to the idea of a swarm druid in 4e rules and wondered if there is anything like that in 3.5? Top uses I like about the swarm are not locked into attacks, but more just t...
2014/03/19
[ "https://rpg.stackexchange.com/questions/35146", "https://rpg.stackexchange.com", "https://rpg.stackexchange.com/users/10263/" ]
Homebrew ======== This is not official material; I’m making it up. For what it’s worth, I’m fairly good at it (won several 3.5 homebrew competitions; did freelance work for Legend and Pathfinder, each a 3.5-spinoff; wrote a [“book” about it](https://rpg.stackexchange.com/a/18269/4563) as a question answer), but don’t ...
The closest thing I know in D&D 3.5e is the [Vermin Lord](http://dndtools.eu/classes/vermin-lord/) from the Book of Vile Darkness. > > The vermin lord offers itself as a host for all manner of parasitic organisms. > > > With abilities like; Swarm Armor, Spew Vermin, and Hivemind. Otherwise you also have the [An...
35,146
I am most familiar with 4e D&D, but might be playing in a 3.5 game starting in a couple months and I need to nail down a character. I have been drawn to the idea of a swarm druid in 4e rules and wondered if there is anything like that in 3.5? Top uses I like about the swarm are not locked into attacks, but more just t...
2014/03/19
[ "https://rpg.stackexchange.com/questions/35146", "https://rpg.stackexchange.com", "https://rpg.stackexchange.com/users/10263/" ]
**Yes, but not at early levels, though you can start planning for it now with the character-defining feat "Child of Winter"** There are no clear parallels to "turning into a swarm from level 1 as just this thing, y'know?" that the swarm druids can do. On the other hand, you might be able to pull off a [Skitter](http:...
You can also use [this ACF](https://web.archive.org/web/20161101150402/http://archive.wizards.com/default.asp?x=dnd/re/20040705a) to swap your animal companion for a vermin companion. At level 7 and higher, you can pick up a centipede or locust swarm. It's not much, but it's something. Maybe ask the DM if you can pick ...
35,146
I am most familiar with 4e D&D, but might be playing in a 3.5 game starting in a couple months and I need to nail down a character. I have been drawn to the idea of a swarm druid in 4e rules and wondered if there is anything like that in 3.5? Top uses I like about the swarm are not locked into attacks, but more just t...
2014/03/19
[ "https://rpg.stackexchange.com/questions/35146", "https://rpg.stackexchange.com", "https://rpg.stackexchange.com/users/10263/" ]
Homebrew ======== This is not official material; I’m making it up. For what it’s worth, I’m fairly good at it (won several 3.5 homebrew competitions; did freelance work for Legend and Pathfinder, each a 3.5-spinoff; wrote a [“book” about it](https://rpg.stackexchange.com/a/18269/4563) as a question answer), but don’t ...
You can also use [this ACF](https://web.archive.org/web/20161101150402/http://archive.wizards.com/default.asp?x=dnd/re/20040705a) to swap your animal companion for a vermin companion. At level 7 and higher, you can pick up a centipede or locust swarm. It's not much, but it's something. Maybe ask the DM if you can pick ...
35,146
I am most familiar with 4e D&D, but might be playing in a 3.5 game starting in a couple months and I need to nail down a character. I have been drawn to the idea of a swarm druid in 4e rules and wondered if there is anything like that in 3.5? Top uses I like about the swarm are not locked into attacks, but more just t...
2014/03/19
[ "https://rpg.stackexchange.com/questions/35146", "https://rpg.stackexchange.com", "https://rpg.stackexchange.com/users/10263/" ]
**Yes, but not at early levels, though you can start planning for it now with the character-defining feat "Child of Winter"** There are no clear parallels to "turning into a swarm from level 1 as just this thing, y'know?" that the swarm druids can do. On the other hand, you might be able to pull off a [Skitter](http:...
If controlling and summoning swarms is insufficient, and you want, instead, to *become* a swarm, here're some options. **Master of Flies Prestige Class** It's not a good class by any measure (e.g. uninteresting, difficult to optimize, doesn't perform level-appropriate tasks), but the prestige class master of flies ...
35,146
I am most familiar with 4e D&D, but might be playing in a 3.5 game starting in a couple months and I need to nail down a character. I have been drawn to the idea of a swarm druid in 4e rules and wondered if there is anything like that in 3.5? Top uses I like about the swarm are not locked into attacks, but more just t...
2014/03/19
[ "https://rpg.stackexchange.com/questions/35146", "https://rpg.stackexchange.com", "https://rpg.stackexchange.com/users/10263/" ]
Homebrew ======== This is not official material; I’m making it up. For what it’s worth, I’m fairly good at it (won several 3.5 homebrew competitions; did freelance work for Legend and Pathfinder, each a 3.5-spinoff; wrote a [“book” about it](https://rpg.stackexchange.com/a/18269/4563) as a question answer), but don’t ...
Some non-druid options, just for completeness: ### Were-Murder-of-Crows The lycanthrope template has the following requirement for the animal base: > > This animal can be any predator, scavenger, or omnivore whose size is within one size category of the base creature’s size (Small, Medium, or Large for a Medium bas...
14,572,851
Is there someway to turn the row of a gridview into a hyperlink so that when a user opens it in a new tab for example, it goes to that link? Right now I am using a LinkButton and when the user opens it in a new tab, it doesn't know where to go. I figured the .aspx code would look something like: ``` <asp:Template...
2013/01/28
[ "https://Stackoverflow.com/questions/14572851", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1355120/" ]
``` <asp:TemplateField> <ItemTemplate> <asp:HyperLink ID="HyperLink1" runat="server" NavigateUrl='<%#String.Format("~/controller.aspx?routeID1={0}&routeID2={1}", Eval("routeid1"), Eval("routeid2"))%>'></asp:HyperLink> </ItemTemplate> </asp:TemplateField> ``` **routeid1 and routeid2 are...
What I did recently is modified my class to have a readonly property that constructs the A tag for me. This way I have control over what gets displayed; just text or a link. ``` <ItemTemplate> <asp:Label ID="ColumnItem_Title" runat="server" Text='<%# Bind("DownloadATag") %>'> </asp:Label> </ItemTemplate> ``` ...
14,572,851
Is there someway to turn the row of a gridview into a hyperlink so that when a user opens it in a new tab for example, it goes to that link? Right now I am using a LinkButton and when the user opens it in a new tab, it doesn't know where to go. I figured the .aspx code would look something like: ``` <asp:Template...
2013/01/28
[ "https://Stackoverflow.com/questions/14572851", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1355120/" ]
``` <asp:TemplateField> <ItemTemplate> <asp:HyperLink ID="HyperLink1" runat="server" NavigateUrl='<%#String.Format("~/controller.aspx?routeID1={0}&routeID2={1}", Eval("routeid1"), Eval("routeid2"))%>'></asp:HyperLink> </ItemTemplate> </asp:TemplateField> ``` **routeid1 and routeid2 are...
Something like: `<asp:LinkButton ID="LinkButton_Title" runat="server" target="_blank" PostBackUrl='<%# Eval(Request.QueryString["title"]) %>'` or binding them from the RowCreated event: ``` protected void GridView_OnRowCreated(Object sender, GridViewRowEventArgs e) { if(e.Row.RowType == DataControlRowType.Da...
32,830,496
Below is the PHP code to retrieve data: ``` <?php $sql = $myquery; $result = $conn->query($sql); $QueryArray = array(); if ($result->num_rows > 0) { // output data of each row while($row = $result->fetch_assoc()) { $QueryArray[] = Array($row["Column1"], $row["Column2"], $row["Column3"]); } } else {...
2015/09/28
[ "https://Stackoverflow.com/questions/32830496", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5174952/" ]
As you can see `$QueryArray` is an array of arrays ``` $QueryArray[] = Array($row["Column1"], $row["Column2"], $row["Column3"]); ``` You can access the `$queryArray` elements (array), in a foreach loop. Than use implode to print what you want. ``` <textarea style="width:100%; height:50%; resize:none; rows="5" cols=...
In your code $QueryArray is a array of array. if your field count are know, simply you can: ``` <?php $sql = $myquery; $result = $conn->query($sql); if ($result->num_rows > 0) { while($row = $result->fetch_assoc()) { $QueryArray[] = $row["Column1"]; $QueryArray[] = $row["Column2"]; $QueryArray[] ...
32,830,496
Below is the PHP code to retrieve data: ``` <?php $sql = $myquery; $result = $conn->query($sql); $QueryArray = array(); if ($result->num_rows > 0) { // output data of each row while($row = $result->fetch_assoc()) { $QueryArray[] = Array($row["Column1"], $row["Column2"], $row["Column3"]); } } else {...
2015/09/28
[ "https://Stackoverflow.com/questions/32830496", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5174952/" ]
As you can see `$QueryArray` is an array of arrays ``` $QueryArray[] = Array($row["Column1"], $row["Column2"], $row["Column3"]); ``` You can access the `$queryArray` elements (array), in a foreach loop. Than use implode to print what you want. ``` <textarea style="width:100%; height:50%; resize:none; rows="5" cols=...
This is an old question but someone might need the answer. ``` echo "<pre>"; print_r($QueryArray); echo "</pre>"; ```
5,435,758
Having: ``` @interface MyClass : NSObject { NSString *name; // retained and synthesized NSString *address; // retained and synthesized } ``` I'm creating an array: ``` NSMutableArray *myArray; // retained and synthesized ``` Filling it with several MyClass objects: ``` MyClass *kat = [MyClass new]; kat....
2011/03/25
[ "https://Stackoverflow.com/questions/5435758", "https://Stackoverflow.com", "https://Stackoverflow.com/users/475861/" ]
``` MyClass *obj = (MyClass*)[myArray objectAtIndex:5]; NSLog(@"Selected: %@", obj.address); // = null :( ``` If that code is printing `(null)`, it *cannot* be because the array is empty or `objectAtIndex:` failed. `objectAtIndex:` will throw a range exception if you try to access an index beyond the count of objects...
It's not enough to just declare myArray in an @property/@synthesize pair. You need myArray to be non-nil as well. You need to add `myArray = [[NSMutableArray alloc] init];` somewhere above your `[addObject:]`call. Additionally, since you've declared the "myArray" variable as retain, if you set another (non-nil) array...
93,510
In [this video at 7:04](https://youtu.be/okz0jI7FN9c?t=424) we see the following view of a VC-25 (an aircraft frequently known as "Air Force One"): [![Two VC-25 engines seen from the rear](https://i.stack.imgur.com/ttCEf.png)](https://i.stack.imgur.com/ttCEf.png) What are the two shiny, gold-coloured structures above...
2022/06/09
[ "https://aviation.stackexchange.com/questions/93510", "https://aviation.stackexchange.com", "https://aviation.stackexchange.com/users/16923/" ]
According to a [comment on the video from Jamie Lancaster](https://www.youtube.com/watch?v=okz0jI7FN9c&lc=Ugx8YW2LXwNhAZnB_RZ4AaABAg): > > Behind the engines under the wing are the 2 IRCM (Infrared Counter Measure) Jammers - for Air to Air or Ground to Air Missile Defense. > > > In the comments below, [GremlinWra...
[![enter image description here](https://i.stack.imgur.com/nHlw0.jpg)](https://i.stack.imgur.com/nHlw0.jpg)AN/ALQ-204 Matador <https://cryptome.org/eyeball/af1-ircm/af1-ircm.htm> It is a decendant of AN/ALQ-144 and similarly is designed to defeat first gen MANPADS
15,800,319
My app is running fine for months. Today it starts to give error on "Exceeded maximum allocated IDs" with datastore put. Is this something new with appengine quota and limitation? <http://gochild2009.appspot.com>
2013/04/04
[ "https://Stackoverflow.com/questions/15800319", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2158677/" ]
bottom-up merge sort: ``` 25, 64, 22, 46, 20, 65, 90, 66, 48, 98 -> merge groups-of-1 -> 25, 64, 22, 46, 20, 65, 66, 90, 48, 98 -> merge groups-of-2 -> 22, 25, 46, 64, 20, 65, 66, 90, 48, 98 -> merge groups-of-4 -> 20, 22, 25, 46, 64, 65, 66, 90, 48, 98 -> merge groups-of-8 -> 20, 22, 25, 46, 48, 64, 65, 66, 9...
You can find some nice pictures of MergeSort (and others) on [Wikipedia](http://en.wikipedia.org/wiki/Mergesort).
15,800,319
My app is running fine for months. Today it starts to give error on "Exceeded maximum allocated IDs" with datastore put. Is this something new with appengine quota and limitation? <http://gochild2009.appspot.com>
2013/04/04
[ "https://Stackoverflow.com/questions/15800319", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2158677/" ]
Take a look at this image found from wikipedia. Numbers are different but it's a good example of what the data would look like in each recursive call. <http://en.wikipedia.org/wiki/File:Merge_sort_algorithm_diagram.svg>
You can find some nice pictures of MergeSort (and others) on [Wikipedia](http://en.wikipedia.org/wiki/Mergesort).
56,563,952
I'm trying to build my first calculator app with android studio, I'm familiar with Java but not with UIs and XML files. I do not understand why I have margins around the buttons that I have created. I tried to set the layout\_margin to 0 but it did not work. ``` <?xml version="1.0" encoding="utf-8"?> <LinearLayout ...
2019/06/12
[ "https://Stackoverflow.com/questions/56563952", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9937744/" ]
> > The document “Main.storyboard” requires at least Xcode 11.0. This > version does not support iOS 13.0 system colors. Open this document > with at least Xcode 11.0. > > > solved open the storyboard as source code and first delete the lines: ``` <capability name = "iOS 13.0 system colors" minToolsVersion = "...
In my case I had to delete this line: ``` <capability name="collection view cell content view" minToolsVersion="11.0"/> ``` And then replace all appearances of **collectionViewCellContentView** with **view**.
30,579,616
i'm searching for something like this for days and i couldn't find anything. My knowledge of Javascript is very limited so i'm here to ask you guys to help me out. Basically i need a PHP script which read a huge log .txt file in real time (Without page refresh) which is constantly updated. But it should read only late...
2015/06/01
[ "https://Stackoverflow.com/questions/30579616", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4718346/" ]
Here is your script, tested by me. **catchlogs.php** ``` define("LOG_FILE", "test.txt"); /* function to count lines from a file */ function count_line_numbers($file){ $linecount = 0; $handle = fopen($file, "r"); while(!feof($handle)){ $line = fgets($handle); $linecount++; } fclose($ha...
The most flawless solution - use Node-Webkit and listen for `tail -f /path/to/log`.
18,623,876
This function is incorrect and won't compile: ``` checkIsZero :: (Num a) => a -> String checkIsZero a = if a == 0 then "Zero" else "Not zero" ``` This doesn't work because of the comparison between a `Num` and `0` in the expression `a == 0`. Changing `Num` to `Integral` makes this...
2013/09/04
[ "https://Stackoverflow.com/questions/18623876", "https://Stackoverflow.com", "https://Stackoverflow.com/users/446554/" ]
`Num` requires instances to implement `+`, `*`, `abs`, `signum`, and `fromInteger`. Note that `==` isn't on the list! It's instances of the `Eq` typeclass that must implement `==`. So, the `Num` constraint is not sufficient - you need an `Eq` constraint too. The following will compile. ``` checkIsZero :: (Eq a, Num a...
The reason for not requiring an `Eq` instance to define a `Num` instance is that it would rule out useful instances like ``` instance Num b => Num (a -> b) where f + g = \x -> f x + g x f - g = \x -> f x - g x f * x = \x -> f x * g x abs f = \x -> abs (f x) signum f = \x -> signum (f x)...
18,623,876
This function is incorrect and won't compile: ``` checkIsZero :: (Num a) => a -> String checkIsZero a = if a == 0 then "Zero" else "Not zero" ``` This doesn't work because of the comparison between a `Num` and `0` in the expression `a == 0`. Changing `Num` to `Integral` makes this...
2013/09/04
[ "https://Stackoverflow.com/questions/18623876", "https://Stackoverflow.com", "https://Stackoverflow.com/users/446554/" ]
`Num` requires instances to implement `+`, `*`, `abs`, `signum`, and `fromInteger`. Note that `==` isn't on the list! It's instances of the `Eq` typeclass that must implement `==`. So, the `Num` constraint is not sufficient - you need an `Eq` constraint too. The following will compile. ``` checkIsZero :: (Eq a, Num a...
If data is an instance of `Num a`, it is not a grantee , that this data is an instance of `Eq a`. `Integer` (and `Int`, `Double`) has both instances: `instance Num Integer` and `instance Eq Integer`, and program is valid `Integral` is defined as ``` class (Real a, Enum a)=> Integral a where ... class (Num a, Ord a)=...
18,623,876
This function is incorrect and won't compile: ``` checkIsZero :: (Num a) => a -> String checkIsZero a = if a == 0 then "Zero" else "Not zero" ``` This doesn't work because of the comparison between a `Num` and `0` in the expression `a == 0`. Changing `Num` to `Integral` makes this...
2013/09/04
[ "https://Stackoverflow.com/questions/18623876", "https://Stackoverflow.com", "https://Stackoverflow.com/users/446554/" ]
The reason for not requiring an `Eq` instance to define a `Num` instance is that it would rule out useful instances like ``` instance Num b => Num (a -> b) where f + g = \x -> f x + g x f - g = \x -> f x - g x f * x = \x -> f x * g x abs f = \x -> abs (f x) signum f = \x -> signum (f x)...
If data is an instance of `Num a`, it is not a grantee , that this data is an instance of `Eq a`. `Integer` (and `Int`, `Double`) has both instances: `instance Num Integer` and `instance Eq Integer`, and program is valid `Integral` is defined as ``` class (Real a, Enum a)=> Integral a where ... class (Num a, Ord a)=...
41,479,466
I have two inputs, where user types `width` and `height` of a product (let's say in mm). So min price is $250 until `width=50` and `height=20`. Then I want to increase total price by $25 every time width OR height edited by 10mm. So total should be $275 if `w=60 and h=20` (or `w=50/h=30`); $300 - when `w=60 and h=30`.....
2017/01/05
[ "https://Stackoverflow.com/questions/41479466", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4428360/" ]
Technical facts based answer: having the loop in your shell script means that you keep constantly **starting** new JVM processes. That will put a higher load on your system compared to having a loop within the Java program you are executing. In other words: you start one JVM session, it does something; it goes down;...
How about using 'watch' command if you didn't care the interval? You may type watch {your command} Then your command will refresh by 2 seconds, if you want to change the interval, you may type watch -n 5 {your command} Then the interval is 5 seconds, that's convininent if you are monitoring some output v...
27,453
We currently have a central AC unit and oil furnace. The AC is broken and the furnace is old, so we are thinking of replacing both sometime in the next year. We are considering replacing the AC with a heat pump and the oil furnace with a gas furnace in the hopes that the gas company will bring a line down our street ...
2013/05/01
[ "https://diy.stackexchange.com/questions/27453", "https://diy.stackexchange.com", "https://diy.stackexchange.com/users/12790/" ]
You don't have to worry about a heat pump being inadequate for cooling tasks, they are available in a large range of sizes. For really large buildings, they can be ganged together. 800 sf is a walk in the park for residential sized units. I don't know the specifics of what determines when the backup furnace kicks in. ...
We had a heat pump in Pennsylvania , 1 hour north of Philadelphia, used for heating and cooling. We now , after 25 years in that home we built, have gas forced air and a central AC unit. There is no comparison. The gas heat is cheaper, stays I the room, and feels warmer. I was always cold with the heat pump, even when ...
27,453
We currently have a central AC unit and oil furnace. The AC is broken and the furnace is old, so we are thinking of replacing both sometime in the next year. We are considering replacing the AC with a heat pump and the oil furnace with a gas furnace in the hopes that the gas company will bring a line down our street ...
2013/05/01
[ "https://diy.stackexchange.com/questions/27453", "https://diy.stackexchange.com", "https://diy.stackexchange.com/users/12790/" ]
You don't have to worry about a heat pump being inadequate for cooling tasks, they are available in a large range of sizes. For really large buildings, they can be ganged together. 800 sf is a walk in the park for residential sized units. I don't know the specifics of what determines when the backup furnace kicks in. ...
How well the heat pump warms the house depends on the capacity of the heat pump and how well insulated the house is. Heat pumps definitely act a lot slower than furnaces, the temperature just kind of creeps up. In fact, in my house in New Hampshire, the temperature actually gets *lower* when the heat pump comes on bec...
27,453
We currently have a central AC unit and oil furnace. The AC is broken and the furnace is old, so we are thinking of replacing both sometime in the next year. We are considering replacing the AC with a heat pump and the oil furnace with a gas furnace in the hopes that the gas company will bring a line down our street ...
2013/05/01
[ "https://diy.stackexchange.com/questions/27453", "https://diy.stackexchange.com", "https://diy.stackexchange.com/users/12790/" ]
Heat pumps are quite common in Central Oregon where summer daytime highs are often over 100°F and nights below 25°F. I have been in many a heat pump rental house in winter at below 10°F in a wide range of efficiencies from below eight to over 20 SEER. They work fine. For units with a SEER of over 14 or so, the backup ...
We had a heat pump in Pennsylvania , 1 hour north of Philadelphia, used for heating and cooling. We now , after 25 years in that home we built, have gas forced air and a central AC unit. There is no comparison. The gas heat is cheaper, stays I the room, and feels warmer. I was always cold with the heat pump, even when ...
27,453
We currently have a central AC unit and oil furnace. The AC is broken and the furnace is old, so we are thinking of replacing both sometime in the next year. We are considering replacing the AC with a heat pump and the oil furnace with a gas furnace in the hopes that the gas company will bring a line down our street ...
2013/05/01
[ "https://diy.stackexchange.com/questions/27453", "https://diy.stackexchange.com", "https://diy.stackexchange.com/users/12790/" ]
Heat pumps are quite common in Central Oregon where summer daytime highs are often over 100°F and nights below 25°F. I have been in many a heat pump rental house in winter at below 10°F in a wide range of efficiencies from below eight to over 20 SEER. They work fine. For units with a SEER of over 14 or so, the backup ...
How well the heat pump warms the house depends on the capacity of the heat pump and how well insulated the house is. Heat pumps definitely act a lot slower than furnaces, the temperature just kind of creeps up. In fact, in my house in New Hampshire, the temperature actually gets *lower* when the heat pump comes on bec...
612,722
I'm using the following groovy code to search a file for a string, an account number. The file I'm reading is about 30MB and contains 80,000-120,000 lines. Is there a more efficient way to find a record in a file that contains the given AcctNum? I'm a novice, so I don't know which area to investigate, the `toList()` or...
2009/03/04
[ "https://Stackoverflow.com/questions/612722", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
Sad to say, I don't even have Groovy installed on my current laptop - but I wouldn't expect you to have to call `toList()` at all. I'd also hope you could express the condition in a closure, but I'll have to refer to Groovy in Action to check... Having said that, do you really need it split into lines? Could you just ...
I should have explained it better, if I find a record with the AcctNum, I extract out other information on the record...so I thought I needed to split the file into multiple lines.
612,722
I'm using the following groovy code to search a file for a string, an account number. The file I'm reading is about 30MB and contains 80,000-120,000 lines. Is there a more efficient way to find a record in a file that contains the given AcctNum? I'm a novice, so I don't know which area to investigate, the `toList()` or...
2009/03/04
[ "https://Stackoverflow.com/questions/612722", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
Sad to say, I don't even have Groovy installed on my current laptop - but I wouldn't expect you to have to call `toList()` at all. I'd also hope you could express the condition in a closure, but I'll have to refer to Groovy in Action to check... Having said that, do you really need it split into lines? Could you just ...
When you say *efficient* you usually have to decide which direction you mean: whether it should run quickly, or use as few resources (memory, ...) as possible. Often both lie on opposite sites and you have to pick a trade-off. If you want to search memory-friendly I'd suggest reading the file line-by-line instead of r...
612,722
I'm using the following groovy code to search a file for a string, an account number. The file I'm reading is about 30MB and contains 80,000-120,000 lines. Is there a more efficient way to find a record in a file that contains the given AcctNum? I'm a novice, so I don't know which area to investigate, the `toList()` or...
2009/03/04
[ "https://Stackoverflow.com/questions/612722", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
Sad to say, I don't even have Groovy installed on my current laptop - but I wouldn't expect you to have to call `toList()` at all. I'd also hope you could express the condition in a closure, but I'll have to refer to Groovy in Action to check... Having said that, do you really need it split into lines? Could you just ...
if you control the format of the file you are reading, the solution is to add in an index. In fact, this is how databases are able to locate records so quickly. But for 30MB of data, i think a modern computer with a decent harddrive should do the trick, instead of over complicating the program.
612,722
I'm using the following groovy code to search a file for a string, an account number. The file I'm reading is about 30MB and contains 80,000-120,000 lines. Is there a more efficient way to find a record in a file that contains the given AcctNum? I'm a novice, so I don't know which area to investigate, the `toList()` or...
2009/03/04
[ "https://Stackoverflow.com/questions/612722", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
When you say *efficient* you usually have to decide which direction you mean: whether it should run quickly, or use as few resources (memory, ...) as possible. Often both lie on opposite sites and you have to pick a trade-off. If you want to search memory-friendly I'd suggest reading the file line-by-line instead of r...
I should have explained it better, if I find a record with the AcctNum, I extract out other information on the record...so I thought I needed to split the file into multiple lines.
612,722
I'm using the following groovy code to search a file for a string, an account number. The file I'm reading is about 30MB and contains 80,000-120,000 lines. Is there a more efficient way to find a record in a file that contains the given AcctNum? I'm a novice, so I don't know which area to investigate, the `toList()` or...
2009/03/04
[ "https://Stackoverflow.com/questions/612722", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
When you say *efficient* you usually have to decide which direction you mean: whether it should run quickly, or use as few resources (memory, ...) as possible. Often both lie on opposite sites and you have to pick a trade-off. If you want to search memory-friendly I'd suggest reading the file line-by-line instead of r...
if you control the format of the file you are reading, the solution is to add in an index. In fact, this is how databases are able to locate records so quickly. But for 30MB of data, i think a modern computer with a decent harddrive should do the trick, instead of over complicating the program.
14,466,591
I tried some stuff I found in past questions but unfortunately it hasn't helped. I think the reason may be it is deeply buried in CSS classes and I'm just inexperienced and not targeting it accurately, despite my attempts to use Chrome's inspect element to find exactly where it is. This is the code I have: ``` .multil...
2013/01/22
[ "https://Stackoverflow.com/questions/14466591", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2001526/" ]
If you are aiming for an exclusion regex according to the Schema Central parser requirement, you are almost there. The first half, excluding percent signs not followed by two hexadecimal digits is best solved using a *negative look-ahead assertion*; the second half is fine, though you can ditch the last repeat indicato...
I recently had to do this without a negative lookahead, and the following seems to work: `(%.?[^0-9A-Fa-f]|#.*#)`
7,426,844
I've been building a nested query editor in knockoutjs and added animations to it using the beforeRemove and afterAdd options on a template in foreach mode. It works just fine on the first level of nesting, but not when manipulating filters in a child filter group. Am I doing something wrong, or is this a bug in Knock...
2011/09/15
[ "https://Stackoverflow.com/questions/7426844", "https://Stackoverflow.com", "https://Stackoverflow.com/users/609641/" ]
You are running into the issue described in this [post](http://www.knockmeout.net/2011/03/are-your-templates-working-overtime.html). Basically, your inner template depends on $data.filters and ends up re-rendering the entire template whenever an item is added. So, your animation is not happening, because the entire lis...
I figured out the second part of the question myself. For the benefit of anyone who may have landed here from google: I switched the afterAdd and beforeRemove functions to be explicitly declared (and out of the markup), and then did some checks on the elem element with jQuery to figure out whether it's a filter or fi...
15,009,022
I was reading this <http://msdn.microsoft.com/en-us/library/87d83y5b(v=vs.80).aspx> but I am wondering, what is the difference between or benefit of using interfaces as opposed to simply creating a class with properties and adding it to your class via "`using MyClass.cs`?" It seems like either way you have to instantia...
2013/02/21
[ "https://Stackoverflow.com/questions/15009022", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1477388/" ]
An interface is *not* so you can use the interface's objects. It's, rather, so that you *must* **create** those objects.
Several different classes may all implement the same interface and thus share a specific set of characteristics. E.g. all types that implement the `IEnumerable` interface may be enumerated without having anything else in common. Interfaces allows less restrictive way for types to support specific features.
15,009,022
I was reading this <http://msdn.microsoft.com/en-us/library/87d83y5b(v=vs.80).aspx> but I am wondering, what is the difference between or benefit of using interfaces as opposed to simply creating a class with properties and adding it to your class via "`using MyClass.cs`?" It seems like either way you have to instantia...
2013/02/21
[ "https://Stackoverflow.com/questions/15009022", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1477388/" ]
Several different classes may all implement the same interface and thus share a specific set of characteristics. E.g. all types that implement the `IEnumerable` interface may be enumerated without having anything else in common. Interfaces allows less restrictive way for types to support specific features.
I don't see how the two are even similar. An interface defines how your code is used by clients. The using keyword (which should be followed by a namespace name rather than a file name) simply lets you use objects in that namespace without prefixing them with the entire namespace each time. A more common question is w...
15,009,022
I was reading this <http://msdn.microsoft.com/en-us/library/87d83y5b(v=vs.80).aspx> but I am wondering, what is the difference between or benefit of using interfaces as opposed to simply creating a class with properties and adding it to your class via "`using MyClass.cs`?" It seems like either way you have to instantia...
2013/02/21
[ "https://Stackoverflow.com/questions/15009022", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1477388/" ]
Several different classes may all implement the same interface and thus share a specific set of characteristics. E.g. all types that implement the `IEnumerable` interface may be enumerated without having anything else in common. Interfaces allows less restrictive way for types to support specific features.
Interface only contains the signature of your logic. It must be implemented fully in your child class. We use "using" clause when we want to include namespace which is different then the namespace of your project, but if your class or interface is in the same namespace you don't need to use "using" clause. You can in...