record

Compiler can't tell which record type with duplicate fields should be the function parameter type

杀马特。学长 韩版系。学妹 提交于 2019-12-11 11:56:19
问题 My program has a few record types with the same field names (each record type means something different). The compiler insists function parameters matching this record shape must be of the last type declared, even though I'm declaring record instances with unambiguous field names, and always passing a consistent type into each function. What is the appropriate way to deal with this? I know I could put a type annotation on the functions, but I feel like if I'm doing things the Right Way, I

Error recording voice at16000 khz 16bit mono little endian wav file in android device [duplicate]

狂风中的少年 提交于 2019-12-11 11:51:52
问题 This question already exists : Closed 7 years ago . Possible Duplicate: how to convert or record .wav file in 16khz 16bit mono little-endian? I want to implement audio recording from an android device at 16000 khz 16bit mono little endian wav file. I had implemented the logic in android like this. I'm using one class name as extaudiorecorder. public class ExtAudioRecorder { private final static int[] sampleRates = {44100, 22050, 11025, 16000}; public static ExtAudioRecorder getInstanse

plpgsql function: Return rows from a view created from random table

邮差的信 提交于 2019-12-11 10:44:02
问题 I want to create a function that returns rows from a view created from a unknown table(s): CREATE OR REPLACE FUNCTION tt_query(text, timestamp without time zone) RETURNS SETOF record AS $$ DECLARE orig_name ALIAS FOR $1; data_tt ALIAS FOR $2; BEGIN [...] EXECUTE 'create OR REPLACE TEMP view temp as select * from ' ||orig_name ||' where trigger_changed >' ||quote_literal(data_tt) ||' ORDER BY trigger_changed DESC'; [...]--other work on view temp --NOW I WANT RETURN THE ROW OF view temp END; $$

Pascal: Get field from LPSYSTEMTIME record

人走茶凉 提交于 2019-12-11 10:30:12
问题 I'm using the Win32 api to get date and time of a file. I have a LPSYSTEMTIME structure, and I'm trying to print its wYear variable. I've got a function (GetFileDate): function GetFileDate : LPSYSTEMTIME var CheckFile: Long; FileTime: LPFILETIME; FileTimeReturn: LPFILETIME; SystemTimeReturn: LPSYSTEMTIME; begin CheckFile := CreateFile(PChar('main.pas'), GENERIC_READ, FILE_SHARE_READ, NIL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0); GetFileTime(CheckFile, FileTime, NIL, NIL);

Why is named association required for a one-element record aggregate?

蓝咒 提交于 2019-12-11 07:15:30
问题 When an aggregate contains only one element, as below, positional notation results in a compilation error and we have to use named notation only. Why? type singleton is record v : integer; end record; v1 : singleton := (0); results in the compiler message check.adb:6:23: positional aggregate cannot have one component check.adb:6:23: write instead "V => ..." gnatmake: “check.adb" compilation error whereas this is OK: v2 : singleton := (v => 0); 回答1: Parentheses round an expression are

AppleScript how to find pattern and set it to a record or list?

别来无恙 提交于 2019-12-11 06:55:05
问题 In AppleScript I know how to do a typical find with something like: tell application "BBEdit" activate open find window find "memberFunction\\(\\)" searching in text 1 of text document "theFile" options {search mode:grep, wrap around:true} with selecting match end tell and I can do a multi file search find: tell application "BBEdit" activate find "memberFunction\\(\\)" searching in {file "path:to:project.bbprojectd:"} options {search mode:grep, showing results:true} end tell but I'd like to

MS Access: Enter a specific text in a form using command button from another form

江枫思渺然 提交于 2019-12-11 06:29:26
问题 I would like to ask for your help on the following issue in MS Access. I had created a form "CustomerListF", filled with command buttons for each client. For each button, I had created the following code: Private Sub cmd_outlets_ABC_Click() DoCmd.OpenForm "OrderFormF" Forms!OrderFormF!Outlets = "ABC" End Sub The button would then open another form "OrderFormF" and enter "ABC" in the textbox named "Outlets". However, I realized the second line of code (Forms!OrderFormF!Outlets = "ABC") would

Postgres Create View With Record Type Function

十年热恋 提交于 2019-12-11 06:19:39
问题 I have this complex query with a user defined function conta_relatos() running very well as a select statement. But it doesn't work when I try to create a view with the same instructions. Postgres is telling me that the column "conta_relatos" has pseudo-type record. This function, conta_relatos() returns a record type variable. Addition by Editor: The return type is a well known composite type as defined in the preceding question: Postgres Function End Loop and return Error Below is the query

Ada record representation

徘徊边缘 提交于 2019-12-11 06:17:37
问题 I have a record type as follows: type Rec_T is record a : Bit_12_T; b : Bit_4_T; end record; where Bit_12_T is mod 2**12 and Bit_4_T is mod 2**4 . To tell the compiler the precise alignment of this record, I use the the for use record statement. However, I want to split the a field bewteen the bytes, so I try to do it as follows: for Rec_T use record a at 0 range 0 .. 7; -- The 1st byte a at 1 range 0 .. 3; -- The 2nd byte b at 1 range 4 .. 7; end record; Clearly, this is not the way to do it

Returning different types of arrays from a lambda expression in F#

做~自己de王妃 提交于 2019-12-11 05:14:34
问题 i have a List of records type Item = { Color : string; Size : int} let itemList = [{Color="Red"; Size=1}; {Color="Green"; Size=2}; {Color="Blue"; Size=3};] I am looking to get turn my list of records into an array of values like [|"Red";"Green";"Blue"|] or [|1;2;3|] I can sorta get there like this type ItemType = | Color of string | Size of int type ItemEnum = | C | S let GetProp x y = match x with | C -> List.toArray y |> Array.map(fun x -> ItemType.Color(x.Color)) | S -> List.toArray y |>