record

Are there “Records” in C#?

霸气de小男生 提交于 2019-12-10 16:29:08
问题 I'm looking to store some customer data in memory, and I figure the best way to do that would be to use an array of records. I'm not sure if that's what its called in C#, but basically I would be able to call Customer(i).Name and have the customers name returned as a string. In turing, its done like this: type customers : record ID : string Name, Address, Phone, Cell, Email : string //Etc... end record I've searched, but I can't seem to find an equivalent for C#. Could someone point me in the

SML function on record list

最后都变了- 提交于 2019-12-10 16:21:36
问题 I'm trying to declare a function that takes a list of records inside a tuple as an argument but the syntax is not as intuitive as I would have liked. Here's what I'm trying to do: type Player = {id:int, privateStack:int list}; fun foo(({id, x::xs}:Player)::players, ...) = (* wrong syntax *) (* do something *) 回答1: Pattern matching requires binding record fields to some values so you have to use explicit record syntax. Therefore, fun foo(({id = id, privateStack = x::xs})::players, ...) = (* do

Ocaml - Accessing components in an array of records

ⅰ亾dé卋堺 提交于 2019-12-10 15:07:31
问题 I have a array of record type tt - originally with more components ;-) - and like to change its values within a for loop: type tt={mutable x: int};; let f0={x= -1};; let max=10;; let ff=Array.create max f0;; for i=0 to max-1 do ff.(i).x <- i;done;; Nevertheless, all fields of ff have the value 9 instead of having values from 0 to 9. Is ff.(i).x correct? I also tried for i=0 to max-1 do f0.x <- i;ff.(i) <- f0;done;; but with the same result... (I'm using OCaml version 4.00.1) What is wrong? I

Record selectors in Haskell's Type Classes

痞子三分冷 提交于 2019-12-10 14:47:10
问题 I want to implement a Type Class with few default methods, but I'm getting an error, that I cannot use record selectors inside type classes definitions. The following code basically creates type class which defines add function, which should add an element to the repr record of some data type . Here is the code: import qualified Data.Graph.Inductive as DG class Graph gr a b where empty :: DG.Gr a b empty = DG.empty repr :: gr -> DG.Gr a b -- following function declaration does NOT work: add :

Are there any useful abstractions for Haskell's record syntax?

醉酒当歌 提交于 2019-12-10 13:40:07
问题 To try and simplify this problem I have defined these arrow functions: splitA :: (Arrow arr) => arr a b -> arr a (b,a) splitA ar = ar &&& (arr (\a -> id a)) recordArrow :: (Arrow arr) => (d -> r) -> (d -> r -> d) -> (r -> r) -> arr d d recordArrow g s f = splitA (arr g >>^ f) >>^ \(r,d) -> s d r Which then let's me do something like this: unarrow :: ((->) b c) -> (b -> c) -- unneeded as pointed out to me in the comments unarrow g = g data Testdata = Testdata { record1::Int,record2::Int

Record video and over the video show time and date over the video

荒凉一梦 提交于 2019-12-10 12:33:23
问题 Hi does anybody knows how to record video in android and for example above the recording screen at the bottom show current time and date 回答1: Here is code that record video in surface view and store in sdcard and for date and time by This package com.po; import java.io.IOException; import android.app.Activity; import android.content.Intent; import android.content.pm.ActivityInfo; import android.media.CamcorderProfile; import android.media.MediaRecorder; import android.os.Bundle; import

Skip weekends Business day tasks NetSuite

梦想的初衷 提交于 2019-12-10 12:09:06
问题 Using NetSuite, I am trying to automate the creation of monthly tasks. These tasks will fall on the last day of the month, a day before, and 1,2,3,4,5 days after the last day of the month. But, the tasks can't be due on a weekend, only business days. So if the day falls on a sat or sun the dates have to move up. How can I use my custom record to calculate the next months task dates skipping weekends? Here is a screenshot of the record - see that 10/4 and 10/5 fall on saturday and sunday, how

C# how to record general audio from output device ( speaker ) with NAudio API

拟墨画扇 提交于 2019-12-10 11:46:55
问题 I'm trying to record the Speaker Output to detect volume and BPM from any playing music with C# and NAudio API. The problem is, i don't know how to do that :/ i have a sample code from http://opensebj.blogspot.de/2009/04/naudio-tutorial-5-recording-audio.html where they record simple input with less code... waveInStream = new WaveIn(44100,2); what does the "44100, 2" means ? does that targets the device to record from ??? how can i target speaker output ? does anyone can help me out ? or even

how can i record audio file as .m4a format?

梦想与她 提交于 2019-12-10 10:28:08
问题 how can i record audio file as .m4a format. i am using the code below: public void startRecording() throws IOException { recorder = new MediaRecorder(); path = "/sdcard/pithysongs_" + System.currentTimeMillis() + ".m4a"; String state = android.os.Environment.getExternalStorageState(); if (!state.equals(android.os.Environment.MEDIA_MOUNTED)) { throw new IOException("SD Card is not mounted. It is " + state + "."); } recorder.setAudioSource(MediaRecorder.AudioSource.MIC); recorder

Return record option as null when calling from C#

别说谁变了你拦得住时间么 提交于 2019-12-10 09:33:16
问题 Is it ever possible to return record option value from F# to C# as null value? I want to encapsulate some logic in F# assembly, and hide as much as I can behind facade being "more natural to C#". Here's some synthetic example: type Data = { DataField1: int; DataField2: string } And code to return to C# would look like this: type SomeFacade() = let data = Some { DataField1 = 1; DataField2 = "hello" } member x.GetData() = if Option.isSome data then Option.get data else null But it is not