range

How to use the NOW() function as upper bound of a range?

无人久伴 提交于 2019-12-11 12:39:39
问题 I have a table with a column of type tstzrange in a Postgres 10.6 database. I need to insert / update rows with a defined lower bound but the value of the current time for the upper bound of the range, so NOW() as upper value. Have tried things like: UPDATE table_name SET date_range = ['2018-03-23 00:00:00-05', now()) WHERE id = 3; Is there a way to use a built-in function or a subquery maybe? 回答1: Use a range constructor . The manual: Each range type has a constructor function with the same

Microsoft Excel: Conditional Formatting of Dates (Within Certain Ranges)

喜夏-厌秋 提交于 2019-12-11 12:37:13
问题 Trying to do conditional formatting in excel and it seems a little tricky for my data. I have 654 dates. 654 rows/entries. I need to use three colors: Green - Make the cells green that are within 10 MONTHS OF TODAY'S DATE Yellow - Make the cells yellow that are within 10 TO 12 MONTHS OF TODAY'S DATE RED - Make the cells red that more than 12 MONTHS away from today's date OR do not have any data in the cell I know this isn't correct but I feel like I'm on the right track: red=($G$428:$G$655<

How to filter in execute query by Date range value?

旧城冷巷雨未停 提交于 2019-12-11 12:13:21
问题 I have to made a Query in executeQuery , and I have to filter by date field, my code is : public void executeQuery() { utcDateTime dateUTC, datenullUTC; query q = new Query(); QueryBuildRange qbr; QueryBuildDataSource qbds ; QueryRun queryRun; dateUTC = DateTimeUtil::newDateTime(_dateValue, 0, DateTimeUtil::getCompanyTimeZone()); qbds = q.addDataSource(tableNum(MCRCustCategory) ); qbds.addRange(fieldNum(MCRCustCategory, ValidTo)).value(strFmt ("> %1", dateUTC) ); queryRun = new QueryRun (q);

Matlab: Dividing chunks of data randomly into equal sized sets

 ̄綄美尐妖づ 提交于 2019-12-11 12:08:53
问题 I have a large dataset that I need to divide randomly into 5 almost equal sized sets for cross validation. I have happily used _crossvalind_ to divide into sets before, however this time I need to divide chunks of data into these groups at a time. Let's say my data looks like this: data = [1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18]; Then I want to divide them randomly into 5 groups in chunks of 2, e.g. like this g1 = [3 4], [11 12] g2 = [9 10] g3 = [1 2], [15 16] g4 = [7 8], [17 18] g5 =

Generate random Double between -x and x [duplicate]

风格不统一 提交于 2019-12-11 11:56:08
问题 This question already has answers here : Closed 7 years ago . Possible Duplicate: Generating random number in a range with Java double x = //Random number between -0.5 and 0.5 Possible Outputs: -0.23 0.01 0.26 -0.4 How do I generate a double between the range of (example) -0.5 and 0.5 ? 回答1: This should do it Math.random() - 0.5 Math.random will generate betweeen 0 and 1 . If you want between -0.5 and +0.5 then you can just -0.5 from this result. See the API docs One thing that this will not

Full-range random number in Python

余生长醉 提交于 2019-12-11 11:42:14
问题 I'm generating a series of random floats using this line: random.random()*(maxval-minval) + minval I'm using it to add variable noise to a given variable, and the amount of noise added depends on a series of factors. In some cases, the noise should be so high that in practice the original value is lost, and I have a completely random value. In this context, the code works works with finite values, but if I use "inf" it returns NaN. Is there a workaround to allow a continuos random range that

Android Time Range Seek Bar

筅森魡賤 提交于 2019-12-11 11:05:43
问题 I want to allow the user of my app to trim a specific part from a video. And i'm looking for a solution that can help me make a time selection slider with two thumbs(Max and Min time). This is a sample of what i want to achieve . I know that there is already some librarys that can help: android-range-seek-bar Material Range Bar But they work only with floats and integers. My question is how can i make it work with time values ? 回答1: Basically you can represent time with a numeric type! With

Mail range with formatting through vba in excel

不想你离开。 提交于 2019-12-11 11:04:26
问题 there are lot`s of articles in the web, how to pass excel range in the outlook mail. So i am using the following code: Set OutApp = GetObject(, "Outlook.Application") If OutApp Is Nothing Then Set OutApp = CreateObject("Outlook.Application") Set OutMail = OutApp.CreateItem(0) Set rng = Sheets("Report").Range("A3:F" & ThisWorkbook.Worksheets("Report").UsedRange.Rows.Count) With OutMail .HTMLBody = RangetoHTML(rng) .Display End With In my range i have table of hyperlinks. And i want them to be

vlookup and return entire cell including formatting from non active workbook

偶尔善良 提交于 2019-12-11 10:16:19
问题 I'm looking to vlookup a value from a tableArray on a different workbook and return the value and entire cells content. This SO answer is nearly what I'm looking for. If I amend this links copyFormatting routine ( Private Sub copyFormatting(destCell As Range, srcCell As Range) ) to copy the cell and paste all instead of formatting the cells font: srcCell.Copy destCell.PasteSpecial xlPasteAll Then the code works as is when the return value is within the same workbook. Any ideas how I can get

Run-time error '1004': Method 'FormulaR1C1' of object 'Range' failed

牧云@^-^@ 提交于 2019-12-11 10:09:22
问题 I am trying to create a simple macro which basically is adding a new colum, naming it, pasting the formula and filling down. The error I get is as in the subject: Run-time error '1004': Method 'FormulaR1C1' of object 'Range' failed Here is the formula: =IF(OR($G2=DATA!$L$3;G2=DATA!$L$4;$G2=DATA!$L$5;$G2=DATA!$L$6;$G2=DATA!$L$7;$G2=DATA!$L$8;$G2=DATA!$L$9;$G2=DATA!$L$10);DATA!$L$2; IF(OR($G2=DATA!$M$3;G2=DATA!$M$4;$G2=DATA!$M$5;$G2=DATA!$M$6;$G2=DATA!$M$7;$G2=DATA!$M$8;$G2=DATA!$M$9;$G2=DATA!