## Indexing only for most recent entries

Consider the following table:

``|-----------------------------------------------------| | raffle                                              | |----|---------|----------|-----|---------------------| | id | shuffle |  user_id | ... |           notify_at | |----|---------|----------|-----|---------------------| | 1  | 4D6G8Z1 |      542 | ... | 2019-12-01 14:00:00 | | 2  | 64G264D |        6 | ... | 2019-12-28 14:00:00 | | 3  | 4IPF93D |       58 | ... | 2020-01-01 14:00:00 | | 4  | D25LF03 |       58 | ... | 2020-01-14 14:00:00 | | 5  | G04LDWE |      684 | ... | 2020-03-02 13:00:00 | ``

In this table, most requests are not done to the `id` column, but to the `user_id` and `created_at`, which is a 64-bit timestamp (no 2038 Bug):

``SELECT * FROM [raffle] WHERE [user_id] = ? and [created_at] = ? ``

The table grows by the minute, but that is not the problem, but rather, the records for the `notify_at` in the current month are most accessed than the rest. In 10.000.000 records, an index of the `user_id` and `notify_at` sums 160MB, which only 1% of these are heavily accessed.

Is there a way to optimize an index (or any other strategy) to make retrieval of the records for the current month snapier?

## Is there a risk associated with to many entries in your SAN list?

Is there any risk associated with having lots of websites in your SAN list? For instance:

Or is this common among website hosts, and possibly safe?

## Entries in suspect_pages but checkdb shows no error

I am using Microsoft SQL Server 2016 (SP2-GDR) (KB4505220) – 13.0.5101.9 (X64) Jun 15 2019 23:15:58 Copyright (c) Microsoft Corporation Standard Edition (64-bit) on Windows Server 2012 R2 Standard 6.3 (Build 9600: )

Yesterday, I got two entries in “suspect_pages” for the same database. One of event type 1 and one of type 2

1 = An 823 error that causes a suspect page (such as a disk error) or an 824 error other than a bad checksum or a torn page (such as a bad page ID).

``database_id file_id page_id eventtype   error_count last_update_date 8           1       1482057 1           1           2019-11-14 14:40 8           1       1482057 2           1           2019-11-14 14:40 ``

I found the object related and they both point to the same table on the database.

`DBCC TRACEON (3604); DBCC PAGE (8, 1, 14823057, 0); DBCC TRACEOFF (3604);`

I had a valid backup of before the corruption and couldn’t afford a down time so I took a backup of the corrupted database, restored my backup on a new name. I dropped the corrupted table and then recreated it from the valid backup.

Today, I restored the corrupted database backup that I took yesterday on a test server and when I run a full checkdb, it detects no corruption.

DBCC CheckDB() WITH No_INFOMSGS, ALL_ERRORMSGS

How is it possible that the backup I took from a corrupted database (according to suspect_pages) doesn’t have any problems? Can those entries in suspect_pages be a false positive?

Database Compatibility Level is 130 (SQL 2016) Our SQL Server is running on Windows Server 2012.

## How come there are two King of Diamonds entries for the Curse of Strahd tarokka card readings?

In Curse of Strahd, p. 15, it shows two entries for “Broken One (King of Diamonds)”, one after the other (I’m not using spoiler tags because they only work without line breaks, and that makes the below look like a mess):

A. Broken One (King of Diamonds) Your greatest ally will be a wizard. His mind is broken, but his spells are strong.

This card refers to the Mad Mage of Mount Baratok (see chapter 2, area M).

B. Broken One (King of Diamonds) I see a man of faith whose sanity hangs by a thread. He has lost someone close to him.

This card refers to Donavich, the priest in the village of Barovia (see chapter 3, area ES). He will not accompany the characters until his son, Doru, is dead and buried.

Is there errata for this? Or have I missed something?

Actually, I’ve just noticed that there are other duplicate entries, so maybe I’ve missed the point. Am I supposed to pick whichever one I, as DM, think would be more interesting? I’d still appreciate some clarification on this, despite the fact that I might be missing the point.

## Iterate cartesian product (cross product) of sorted lists of positive numbers in order of decreasing product of entries (MVCE of a stub included)

Suppose I have several sorted lists of positive numbers, like so for example:

``double[] a1 = new double[]{0.70, 0.20, 0.10}; double[] a2 = new double[]{0.80, 0.10, 0.05, 0.05}; double[] a3 = new double[]{0.60, 0.15, 0.14, 0.10, 0.01}; ``

I want to iterate Cartesian product of these arrays in the order of decreasing product of entries, like so:

``0000: Combo[product=3.36e-01, vals=[0.70, 0.80, 0.60], indexes=[0, 0, 0]] 0001: Combo[product=9.60e-02, vals=[0.20, 0.80, 0.60], indexes=[1, 0, 0]] 0002: Combo[product=8.40e-02, vals=[0.70, 0.80, 0.15], indexes=[0, 0, 1]] 0003: Combo[product=7.84e-02, vals=[0.70, 0.80, 0.14], indexes=[0, 0, 2]] 0004: Combo[product=5.60e-02, vals=[0.70, 0.80, 0.10], indexes=[0, 0, 3]] 0005: Combo[product=4.80e-02, vals=[0.10, 0.80, 0.60], indexes=[2, 0, 0]] ... ``

E.g. in the example above the first entry is obvious (as arrays are sorted) and it is a combination of the first values: `[0.70, 0.80, 0.60]` with product `0.70*0.80*0.60 = 3.36e-01` and corresponding value indexes in arrays `a1, a2, a3` are `[0, 0, 0]`. Now the second entry is less obvious, should we change `0.70` to `0.20`? Or `0.60` to `0.15`? Or `0.80` to `0.10`? The second should be `[0.20, 0.80, 0.60]`with product `9.60e-02`, indexes `[1, 0, 0]`.

Here is a program in java to generate/print them: https://repl.it/repls/FilthyGreatRotation (all the logic is in `printWholeCartesianProduct()` method)
This program generates them in lexicographic order and then sorts the whole set by product.

Question: Is there an easy way to actually generate the combos in correct order in the first place?

The reason for this: I don’t have the lists in the first place, only iterators over some sorted collections of numbers. Possibly veeery long, length not known ahead of time, but it is known that the numbers in each iterator are sorted.

MVCE to play with (same as in https://repl.it link above):

``import java.text.DecimalFormat; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.StringJoiner; import java.util.function.Consumer; import java.util.stream.Collectors;  public class Main {      public static void main(String[] args) {         List<List<Double>> data = createData();         printWholeCartesianProduct(data);     }      public static List<List<Double>> createData() {         double[] a1 = new double[]{0.70, 0.20, 0.10};         double[] a2 = new double[]{0.80, 0.10, 0.05, 0.05};         double[] a3 = new double[]{0.60, 0.15, 0.14, 0.10, 0.01};         return createData(a1, a2, a3);     }      public static void  printWholeCartesianProduct(List<List<Double>> data) {         final DecimalFormat df = new DecimalFormat("0.00");          // print input data         String matrix = data.stream()             .map(l -> l.stream().map(df::format).collect(Collectors.joining(", ")))             .map(row -> "[" + row + "]")             .collect(Collectors.joining("\n"));         System.out.println("Input data:\n" + matrix);          // collect combos as they are generated         final List<Combo> combos = new ArrayList<>();         Consumer<int[]> callback = indexes -> {             double[] v = new double[indexes.length];             double prod = 1;             for (int i = 0; i < indexes.length; i++) {                 List<Double> col = data.get(i);                 int index = indexes[i];                 v[i] = col.get(index);                 prod *= v[i];             }             combos.add(new Combo(prod, v, indexes.clone()));         };          // generate combos         int[] c = new int[data.size()];         int ptr = c.length - 1;         while (ptr >= 0) {             callback.accept(c);             c[ptr]++; // increment             if (c[ptr] == data.get(ptr).size()) { // carry                 do {                     ptr--;                 } while(ptr >= 0 && c[ptr] == data.get(ptr).size() - 1);                 if (ptr < 0) {                     break;                 }                 c[ptr]++;                 // zero out                 while (++ptr <= c.length - 1) {                     c[ptr] = 0;                 }                 ptr = c.length - 1;             }         }          // cheating - sort after generation and print result         combos.sort((o1, o2) -> Double.compare(o2.product, o1.product));         StringBuilder sb = new StringBuilder();         double totalP = 0;         for (int i = 0; i < combos.size(); i++) {             sb.append(String.format("%04d: ", i)).append(combos.get(i)).append("\n");             totalP += combos.get(i).product;         }         System.out.printf("Cartesian product in descending product (total p=%.3e):\n%s", totalP, sb.toString());     }      public static List<Double> asList(double[] a) {         return Arrays.stream(a).boxed().collect(Collectors.toList());     }      public static List<List<Double>> createData(double[]... arrays) {         final List<List<Double>> vals = new ArrayList<>();         Arrays.stream(arrays).forEachOrdered(a -> vals.add(asList(a)));         return vals;     }      static class Combo {         final double product;         final double[] vals;         final int[] indexes;          Combo(double product, double[] vals, int[] indexes) {             this.product = product;             this.vals = vals;             this.indexes = indexes;         }          @Override         public String toString() {             return new StringJoiner(", ", Combo.class.getSimpleName() + "[", "]")                 .add("product=" + String.format("%.2e", product))                 .add("vals=[" + Arrays.stream(vals).boxed().map(v -> String.format("%.2f", v)).collect(                     Collectors.joining(", ")) + "]")                 .add("indexes=" + Arrays.toString(indexes))                 .toString();         }     } } $$```$$ ``

## Timesheet Entries UX

How to distinguish new time entries

I have a timesheet that looks like this:

Which works well. the customers can see all their time entries on one screen and works well reading the times across the week at a glance.

However the issue comes when a user has to enter their timesheets and can be working on up to 5 different assignments, that need to be added via the ‘Add in time’ drop down.

User story:

As a user i fill out my timesheet at the end of the week, and it totals to 34.5 hours

Then 2 days later i need to go back in the add additional time for another assignment that i worked on which i forgot about. So the weeks total hours is now 42 hours.

34.5 hours – Assignment 1

7.5 hours – Assigment 2

However i do not know which project the total time has been allocated to.

What is the best way to distinguish this new information that has been added

• New time added from different assignments
• How to tell at a glance which time has been allocated to what assignment

Hope this is clear..

## List all entries in the current directory whose names contain only uppercase letters

In one of my lab questions I was asked to list all entries(both files and folders) in the current directory whose names contain only uppercase letters using piping and grep command. Folders must have a forward slash displayed. Initially, my solution looked like this:

``ls -p | grep -e "^[[:upper:]]*\/?\$  " ``

I thought that I can protect the ‘/’ sign with the backward slash(as in `echo \*` vs `echo *`). However, it doesn’t work as intended. One of my friends suggested the following solution:

``ls -p | grep -e '^[[:upper:]]*/\?\$  ' ``

I have no idea why the backward slash is used like this. What is even more weird,for me, that it actually produces the right result. I was wondering if someone could explain where the mistake in my solution is and why the second version actually works.

## update entry with a different form entries in gravity forms

i need to update a gravity form student information entries. my problem is that i registered student in two different forms. now i want to update the student information and i can’t. i’m using this guide.

forms structures:

• form 1: regular registration.
• form 2: registration in middle of the course.
• form 3: this is the forms that is on /edit-student/.

form 3 is populated with the entry data set as default values to each field:

``\$  edit_form["fields"][1]["defaultValue"] = \$  cvalue["21"];  ``

but the entries are not being updated and i feels like it’s really bed code (im a new programmer. this is my code:

`` add_action("gform_pre_submission_15", "edit_form_pre_submission_handler"); function edit_form_pre_submission_handler(\$  form) {     // //Get original entry id     \$  r = 5;     \$  a = 12;     \$  form_5 = GFAPI::get_entries(\$  r);     \$  form_12 = GFAPI::get_entries(\$  a);      \$  student_id = \$  form["fields"][9]["defaultValue"];     if (is_array(\$  student_id))         \$  marged_entries = array_merge(\$  form_5, \$  form_12);     if (is_array(\$  form)) {         if (is_array(\$  entry)) {             foreach (\$  marged_entries as  \$  entry) {                 if (\$  entry["post_id"] == \$  student_id) {                     \$  entry_id = \$  entry['id'];                     \$  editentry = GFAPI::get_entry(\$  entry_id);                     // save values                     \$  editentry["21"] = \$  _POST["input_11"];                     //  parent Last name                     \$  editentry["20"] = \$  _POST["input_13"];                     //  student first name                     \$  editentry["26"] = \$  _POST["input_14"];                     //  student Last name                     \$  editentry["25"] = \$  _POST["input_15"];                     // email and post title                     \$  editentry["22"] = \$  _POST["input_6"];                     // Address                     \$  editentry["23"] = \$  _POST["input_8"];                     //  Student Age                      \$  editentry["27"] = \$  _POST["input_10"];                     //  Student Phone                      \$  editentry["24"] = \$  _POST["input_5"];                     //   update entry                     \$  updateit = GFAPI::update_entry(\$  editentry);                     // die();                     if (is_wp_error(\$  updateit)) {                         echo "Error.";                     } else {                         //success                         echo 'student updated';                     }                 }             }         }     } }  ``

question: 1) is there a better way to update GF entries with entries from another form? 2) way when i remove the comment from die() the site get stoke? i cant stom form 3 from getting submitted with out this function. 3) way the form is not getting updated?. on its on all of the values are working.

## workflow – remove duplicate entries

i have 3 list. Input list, reference table list and transfer. list. I want to remove all related entries in reference table if a certain product is chosen

example reference table product a – category 1 product a – category 2 product b – category 1

so if i go to the input list and added product a – category 1 in the list, what i would like to do is remove all “product a’ from the reference table and copy to transfer list, then delete them from reference table. I tried creating a workflow but only the current list is deleted from. the reference table.

## Do directory submition upto 1000 entries for \$5

I will improve link quality of your website by HIGH PR Directory Submission. Great Gig from Smart SEO done only with MANUAL work.Best Gig for new sites!In this Gig I will submit your site to Directory sites, which are the best SEO to drive traffic in your website! Features and Effects from this gig:Faster Indexing, Higher Link Popularity, More Pages Indexed Better Rankings, Effective Keyword Targeting, Higher Page Rank, Brand Building ,More Customers Drive premium quality traffic, Increased Visibility ,Good for new sites,Manual work ,As a proof of submission i will give you screenshot when i submit your website on directory.Please First Order me…..Thank you.

by: akhilmurali212
Created: —
Category: Directory Submission
Viewed: 287