database layout: compound key with a column that is automatically incremented and reset when the value of the foreign key changes

I am trying to implement a ticket system, the generated numbers would be sequential.

4000, 4001, 4002, 4003

My idea was to have a table related to the current draw, and the ticket_no column is not an auto increment column that is reset when the foreign key changes.

Composite keys are raf_id and ticket_no since the ticket does not have to exist several times in the same draw

it's possible?

|------------|-----------|---------|
| raf_id     | ticket_no | user_id |
|------------|-----------|---------|
| 1          | 4000      | 1       |
| 1          | 4001      | 1       |
| 1          | 4002      | 2       |
| 1          | 4003      | 3       |
| 2          | 4000      | 4       |
| 2          | 4001      | 4       |
| 2          | 4002      | 5       |
| 2          | 4003      | 1       |
|------------|-----------|---------|

Financial calculator (emulator) that gives a negative result in compound interest

I am studying brokerage. And I am using this emulator to study.

https://epxx.co/ctb/hp12c.html

I am getting negative results when doing compound interest calculations.

I am doing it this way:

 1: 10000
 2: I press enter
 3: I press PV
 4: enter "3" and press "i" key
 5 enter "4" and press "n" key
 6 I press FV

I am doing something wrong?

Sharepoint Enterprise: compound appearance error

When I try to change the composite look of the site collection, I get this error:

The background image could not be saved in the folder:
_catalogs / theme / Themed / 9577847E. Unexpected error. System.UnauthorizedAccessException: access denied. to
Microsoft.SharePoint.Utilities.SPUtility.HandleAccessDenied (Exception
ex) in Microsoft.SharePoint.Library.SPRequest.PutFile (String
bstrUrl, String bstrWebRelativeUrl, Object punkFile, Int64 cbFile,
Object punkSPFileMgr, Object punkFFM, SPFileSaveParams sfsp,
SPFileInfo and pFileProps, UInt32 and pdwVirusCheckStatus, String &
pVirusCheckMessage, String & pEtagReturn, Byte & piLevel, Int32 &
pbIgnoredReqProps)

I checked the folders at: _catalogs/theme/Themed/ and it's empty
What do I have to do to get the correct permissions?
to solve this problem.

sql server: foreign key reference table with compound primary key when i only need 1 column association

Let's say we have 2 tables in the SQL Server database:

CREATE TABLE VersionedData (
    Id INT PRIMARY KEY,
    Version INT PRIMARY KEY
)

Y:

CREATE TABLE PointingTable (
    Id INT PRIMARY KEY,
    RefId INT NOT NULL

    CONSTRAINT (FK_Pnt_Ver) FOREIGN KEY (RefId)
      REFERENCES VersionedData (Id)
)

My idea of ​​this relationship is when joining these 2 particular tables I only care about the latest version of the VersionedData table (meaning I will ALWAYS match the maximum version for the specific ID value, giving me exactly 1 row that I need).

Of course, the code above causes an error that I must reference both PK columns of PointingTable. I could add the Version column for PointingTable, however I would get stuck on that specific version even when a newer one is inserted for VersionedTable.

I'm struggling to figure out how to redesign this relationship, I've thought of a calculated column for PointingTable that would use the scalar function to get the maximum version, but I think that would be overkill, there must be a better way.

Theming: Extract email addresses of compound field type using Twig Computer

I am using a custom compound field type to collect multiple data from a user. This type of custom compound field contains a field that collects the email addresses entered.

What I'm trying to do is use a calculated Twig field to extract the email addresses entered within the custom compound field type and use an email handler to send a confirmation email to all those email addresses, without However, I am having real trouble trying to reference a field within a compound field type. I have used multiple pieces of twig code, but all it seems to be able to reference is the values ​​of all the fields in the custom compound and not a specific field.

I'm really new to twig, so I still don't understand all the capabilities, but does anyone know how to reference a field value inside a compound field type, using twig?

Thanks in advance.

postgresql: how do you pass a compound array to a plpgsql function?

I'm having trouble figuring out how to render an array of a compound type in SQL to invoke a PL / pgSQL function. I have tried several different syntax variants, but the psql shell does not accept any of them. What am I doing wrong here?

Types

CREATE TYPE jobs_v0.insertable_program AS (
       handle text,
       zip bytea
);

Tables

CREATE TABLE jobs_v0.jobs (
       id bigserial PRIMARY KEY NOT NULL,
       manifest_cid text NOT NULL,
       created_at timestamp NOT NULL DEFAULT now()
);

CREATE TABLE jobs_v0.programs (
       id bigserial PRIMARY KEY NOT NULL,
       job bigserial REFERENCES jobs_v0.jobs(id) NOT NULL,
       handle text NOT NULL,
       package bytea NOT NULL
);

Function

CREATE OR REPLACE FUNCTION jobs_v0.insert_job(
       manifest_cid text,
       programs jobs_v0.insertable_program()
) RETURNS void AS
$$
DECLARE
       job_id jobs_v0.jobs.id%TYPE;
       program jobs_v0.insertable_program;
       inserted_programs jobs_v0.programs();
BEGIN
       -- Insert job
       INSERT INTO jobs_v0.jobs(manifest_cid) VALUES (manifest_cid)
       RETURNING id INTO job_id;

       -- Insert programs
       INSERT INTO jobs_v0.programs(job, handle, package)
       SELECT job_id, * FROM unnest(programs)
       RETURNING * INTO inserted_programs;
END;
$$ LANGUAGE plpgsql;

Function call in psql:

-- Query
select jobs_v0.insert_job(
       'QmTXzATwNfgGVukV1fX2T6xw9f6LAYRVWpsdXyRWzUR2H9',
       array(row('main', '0xdeadbeef'))::jobs_v0.insertable_program(),
);

-- Output
-- ERROR:  malformed array literal: "39"
-- DETAIL:  Array value must start with "{" or dimension information.

nt.number theory – Compounds in physics: from a storyboard of simple examples to ask about the relevance of compound integers in physics

In this publication I add some examples related to compound integers, perhaps some of these may be considered partly unrelated to physics for some person, and after asking about the relevance or importance of compound integers in physics. To know what happens to integers and physics, I have read the conversation notes (1). I also know other good YouTube videos (see the comment).

We consider integers greater than or equal to $ 1 $.

Example 0 One can think of prime numbers as a strip of unit paper squares that cannot be arranged in a pretty rectangle $ c = a times b $, where $ a> $ 1 Y $ b> 1 $ are integers This example It seems Of course it is not related to physics. For example the integer $ c = $ 8 or $ c = $ 9 They can be organized in beautiful rectangles. The importance, density and open problems related to prime numbers are known. In particular I mean (2).

Example 1. For the design of the Arecibo message, a rectangle was considered as a format $ a times b $, for those specific integer values $ a> $ 1 Y $ b> 1 $ which refers to Wikipedia Message from Arecibo. Therefore, physicists or people who designed this format did not choose a first $ p $let's say like a rectangle $ p times 1 $, as a format / frame for that message. Here I emphasize that the interesting thing is that to transmit certain information a format was chosen.

Example 2 For example, on YouTube you can search and see examples of how to make a hologram in your home, using different materials and some devices, say a phone or TV that projects a certain amount of photos / files in order to create the hologram. My belief (I think it's obvious) is that each of these identical photos / files is a rectangle $ a times b $ with $ a> $ 1 Y $ b> 1 $, a compound integer.

Question. I would like to know if compound integers have any relevance or importance in physics. What are the problems or those scenarios that exemplify and motivate that compound numbers are important in the theories that explain our physical world? Thank you.

In this post, I ask from an informative point of view, and as a soft question. If there are examples, and you know it from the literature, refer it, do not hesitate to answer this question as a reference request, and try to find and read it in the literature.

References

(1) David Tong, Physics and the integers, University of Cambridge, Trinity Maths Society (2010).

(2) Barry Mazur and William A. Stein, Prime numbers and the Riemann hypothesis, Cambridge University Press (2016).

array – compound char C[] literal vs literal string?

I just want to know the difference between:

puts((char()){'H', 'e', 'l', 'l', 'o', 0});

and that:

puts("Hello");

Is there a difference? All I know is the strings unix command you will find

"hello"

but no

(char()){'H', 'e', 'l', 'l', 'o', 0}

Why?
What other differences are there? Anything behind the scenes that string literals do that initialized array strings don't do?

web forms: how do I format the presentation and presentation format of a date and time field in a custom compound?

In a Drupal 8 web form, I have a date and time entry that works well and I can format it in the settings. When I create a custom compound with a date and time, I don't have the same formatting options as before. For example, I cannot choose a presentation or submission format for the date.

You could create a module to hook the shipment and modify it that way or, presumably, you could do it in sending email with tokens. (I haven't tried it yet). However, that would only affect the presentation and not the screen.

How do I format the presentation and presentation format of a date and time field in a custom compound?

java – Calculate compound interest

My job for now is to teach an apprentice to program. I told him to solve the following task, given by a book (I try to translate it):

Write a program for the calculation of compound interest. The user must enter the amount of money, the years and the interest rate. The program should look like this:

Money in Euro: 100
Annual percentage rate: 6
Term in years: 4
Money after 1 years: 106.0
Money after 2 years: 112.36
Money after 3 years: 119.1016
Money after 4 years: 126.247696

Important note

He has not yet learned anything about OOP, exception handling or use of objects and methods. Now learn to design simple algorithms. But you have received a hint on how to use the scanner class to get user input.

I want to show you my own example solution, so I can learn. I want to ask if my sample solution is fine to show it to a beginner. Is it well written or have I ignored good practices?

// use "int variable = scanner.nextInt()" for getting int values
// use "double variable = scanner.nextDouble()" for getting double values

import java.util.Scanner;

public class Main {
    private static Scanner scanner = new Scanner(System.in);

    public static void main(String args()) {
        // write your solution here:    
        double money;
        int years;
        double rate;

        System.out.print("Money in Euro: ");
        money = scanner.nextDouble();
        System.out.print("Annual percentage rate: ");
        rate = scanner.nextDouble();
        System.out.print("Term in years: ");
        years = scanner.nextInt();

        for (int i = 1; i <= years; i++) {
            money += money * (rate / 100);
            System.out.println("Money after " + i + ". years: " + money);
        }
    }
}