record

Delphi: Record constructor vs factory function

萝らか妹 提交于 2019-12-03 10:12:22
So what will be the preferred way of initializing records? With a 'factory function': TMyRecord = record valueX: integer; valueY: integer; end; function MyRecord(const AValueX, AValueY: integer): TMyRecord; begin result.valueX := AValueX; result.valueY := AValueY; end; var myrec: TMyRecord; begin myrec := MyRecord(1, 2); end; or a constructor: TMyRecord = record valueX: integer; valueY: integer; constructor Create(const AValueX, AValueY: integer); end; constructor TMyRecord.Create(const AValueX, AValueY: integer); begin self.valueX := AValueX; self.valueY := AValueY; end; var myrec: TMyRecord;

Does erlang implement record copy-and-modify in any clever way?

守給你的承諾、 提交于 2019-12-03 08:29:16
given: -record(foo, {a, b, c}). I do something like this: Thing = #foo{a={1,2}, b={3,4}, c={5,6}}, Thing1 = Thing#foo{a={7,8}}. From a semantic view, Thing and Thing1 are unique entities. However, from a language implementation standpoint, making a full copy of Thing to generate Thing1 would be intensely wasteful. For example, if the record were a megabyte in size and I made a thousand "copies," each modifying a couple of bytes, I've just burned a gigabyte. If the internal structure kept track of a representation of the parent structure and each derivative marked up that parent in a way that

When to use a Discriminate Union vs Record Type in F#

淺唱寂寞╮ 提交于 2019-12-03 07:43:45
问题 I am trying to get the basics of F# clear before moving on to complex examples. The material I'm learning has introduced both Discriminate Unions and Record types. I have reviewed the material for both, but it is still unclear to me why we would use one over the other. Most of the toy examples I have created seem to be implementable in both. Records seem to be very close to what I think of as an object in C#, but I am trying to avoid relying on mapping to c# as a way to understand F# So...

Delphi - Invoke Record method per name

我的未来我决定 提交于 2019-12-03 07:25:46
I wrote a scriptlanguage for my applications and my goal is to make it possible to publish any type from delphi in the script. I use rtti to automatize this task. For any instance type like classes I use the following code to find and call a method from script. var Info : TRttiType; Meth : TRttiMethod; Param : TArray<TValue>; Result : TValue; AnyClass : TClass; begin ... Info := RttiContext.GetType(AnyClass); Meth := Info.GetMethod('AMethod'); Setlength(Param, 1); Param[0] := TValue.From<Integer>(11); Result := Meth.Invoke(ClassInstance, Param); ... end; But with a record this code doesn't

How to record voice in a browser?

淺唱寂寞╮ 提交于 2019-12-03 07:19:36
I need users to record their voice on a browser and then automatically upload the resulting mp3 to a webserver. I am thinking the user presses a big fat start record/stop record button to do this. This would then save a file on the users hard disk. Then it would be efficiently compressed and automatically ftp'd up to a website. Is it possible to do this using ActiveX or perhaps Java? Or are there libraries available that help? The application is for users who can install software if need be so it will be possible to install exe's or whatever. Any suggestions are most appreciated. The ideal

ios - Pause video recording

拜拜、爱过 提交于 2019-12-03 07:03:47
I'm try to create application where user can record video from camera. One of the feature of this application must be a pause file recording. For example: User start record after pressing "Start" button. After some time user press "Pause" button and video recording paused. Then user press "Resume" button and video continue recording in the same file. Can any body help me? Thank you. WBR Maxim Set up an AVCaptureSession and a AVAssetWriter then you can switch the recording on an off with the boolean "isRecording". BOOL isRecording; -(void)captureOutput:(AVCaptureOutput *)captureOutput

PostgreSQL v9.X have real “array of record”?

江枫思渺然 提交于 2019-12-03 06:31:29
This query works fine, WITH test AS ( SELECT array_agg(t) as x FROM ( SELECT 1111 as id, 'aaaaa' as cc ) AS t ) SELECT x[1] FROM test; but, can I access the recod elements? I try SELECT x[1].id ; SELECT x[1][1] ; ... nothing works. PS: with Google we see only OLD solutions... The context here is v9.X, no news about "array of record"? I try also select x[1] from (select array[row(1,2)] as x) as t; no solution to access only item 1 or only item 2. A clue that I was unable to follow: postgresql.1045698.n5.nabble.com solve the problem using a CREATE TYPE ... Ok, but I need "all in a query"

Haskell record pattern matching

牧云@^-^@ 提交于 2019-12-03 04:46:39
问题 I'm looking for a way to simplify function patterns when the actual data is not required: data X = A | B String | C Int Int String myfn :: X -> Int myfn A = 50 myfn (B _) = 200 myfn (C _ _ _) = 500 Is there a way to make a simpler pattern for matching C, just discarding the values? hsdev adds a hint "Hint: use record patterns", but Google did not help me there. 回答1: You can use record patterns like this: data X = A | B {name :: String} | C {x::Int, y::Int, name::String} myfn :: X -> Int myfn

Voice Recording/Saving in Delphi

不羁岁月 提交于 2019-12-03 04:01:55
Is there a component or code that allows the following: Record a spoken word (or words) and save it/them to a file that can be played back. The file must be able to be played back on XP, Vista and Windows 7. The file can be either stand alone or saved to a datasource. [Using Delphi 7 for creating apps on XP and using Absolute Database.] The functions in MMSystem.pas let you do this using Windows API. You can either use high-level functions such as the MCI functions and PlaySound , or low-level functions such as waveInOpen , waveInPrepareHeader , waveInProc etc. If you want high control, you

How to record screen and save as gif animation? [closed]

半世苍凉 提交于 2019-12-03 03:41:41
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 7 years ago . Is there such a software? 回答1: Try this (Size -857 KB) (trial version - only 25 frames ) 回答2: Try this free tool (unlimited frames) called Cropper. Set the output as Animated Gif. http://cropper.codeplex.com/ Update: In the notification area right click the cropper icon, go to Output > Animated Gif 来源: https:/