record

Recursive records in F#

血红的双手。 提交于 2019-12-01 03:35:58
问题 A friend and I are reading up on F# and are messing around with records at the moment. We have made the following record for representing a person: type Person = {name: string; father: Person; mother: Person;} F# Interactive accepts it, and in some way, the type makes sense, except we can't see how to use it. When we try to declare a person, we have to declare the parents at the point of declaration, and in turn declare their parents and so on. Is there any way to actually use this type? And

R RecordLinkage Identity

元气小坏坏 提交于 2019-12-01 03:35:32
问题 I am working with RecordLinkage Library in R. I have a data frame with id, name, phone, mail My code looks like this: ids = data$id pairs = compare.dedup(data, identity=ids, blockfld=as.list(2,3,4)) The problem is that my ids are not the same in my result output so if I had this data: id Name Phone Mail 233 Nathali 2222 nathali@dd.com 435 Nathali 2222 553 Jean 3444 jean@dd.com In my result output I will have something like id1 id2 1 2 Instead of id1 id2 233 435 I want to know if there is a

Function to return a Haskell record with a modified field

我们两清 提交于 2019-12-01 02:57:38
Given : data MyRecord a = MyRecord{list :: [a], other_fields :: Char, …} I am trying to write a function which puts a new a on list and returns a new MyRecord : pushOntoList :: a -> MyRecord -> MyRecord Question : Is there a way to write pushOntoList is such a way that it does not depend on what is in the rest of the record, but simply gives it back unmodified? Another way to ask this is can you write pushOntoList without seeing the rest of the MyRecord definition? Yes, very easily using the record accessor/label syntax: b = a { list = 'x' : list a } as in the function: pushOntoList c a = a {

How to stop the capturing mediastream that is started by chrome.tabCapture API in chrome

ε祈祈猫儿з 提交于 2019-12-01 00:26:54
I am developing a chrome extension and I use chrome.tabCapture API to capture the stream from a tab of the chrome browser and to record the stream using MediaStreamRecorder.js . I could stop the recording of the stream using mediaRecorder.stop() but that chrome.tabCapture API doesn't end. It continously sends the stream. I need to stop the chrome.tabCapture API running for the particular tab. Try : stream.getVideoTracks()[0].stop(); To improve video quality, specify videoConstraints : chrome.tabCapture.capture({ videoConstraints: { mandatory: { maxWidth: 4000, maxHeight: 4000} }},

requestRecordPermission does nothing

一曲冷凌霜 提交于 2019-11-30 22:41:47
问题 Since the update of iOS 7 there has been some changes with recording applications. I have an app that used to work with iOS 5 and 6, but when I tried to run it on iOS 7 - recording didn't respond. I checked the internet and saw there's a new method that needs to be called. I tried to place this code in viewDidAppear: if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 7) { if([[AVAudioSession sharedInstance] respondsToSelector:@selector(requestRecordPermission:)]) { [[AVAudioSession

Record sound in Android and read Amplitude

你离开我真会死。 提交于 2019-11-30 21:58:53
I'm trying to make an app that records sound for a second and then reads the maximum amplitude from the recorded sound. This is what I have so far but my app crashes and I can't figure out why. This is my second activity, which I'm calling from my first after I press a "Record" button. The app crashes on my emulator and on my phone. package radu.soundSampler; import java.io.IOException; import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.widget.TextView; import android.media.MediaRecorder; public class DisplayMessageActivity extends Activity {

Record and play simultaneously on iOS (Phonegap build)

社会主义新天地 提交于 2019-11-30 21:33:23
I'm developing iOS and Android application using Phonegap Build version 3.3.0. Main focus of application is audio recording with another audio / music playing in the background. For both instances i'm using phonegap media api with correct audio files for recording (iOs - *.wav / Android - *.amr ) and playing (iOs and Android - *.mp3). Example: var audioRec = new Media(audioRecSrc, onSuccess, onError); audioRec.startRecord(); var audioPlay = new Media(audioPlaySrc, onSuccess, onError); audioPlay.play(); Example works on Android without any problem. Sound is recorded and music played normally.

How to adjust microphone volume in android?

五迷三道 提交于 2019-11-30 20:56:50
I want to recorder the sound, but the mic (microphone) input sound is too loud, and I want to adjust the mic volume, would someone help me? The following is the main code: private int audioSource = MediaRecorder.AudioSource.MIC; private static int sampleRateInHz = 8000; private static int channelConfig = AudioFormat.CHANNEL_CONFIGURATION_MONO; private static int audioFormat = AudioFormat.ENCODING_PCM_16BIT; audioRecord = new AudioRecord(audioSource, sampleRateInHz,channelConfig, audioFormat, bufferSizeInBytes); audioManager.setSpeakerphoneOn(false); When the microphone is open, it used the

Nothing but “packed” records — should I fix it?

纵饮孤独 提交于 2019-11-30 20:46:09
While reviewing some code in our legacy Delphi 7 program, I noticed that everywhere there is a record it is marked with packed . This of course means that the record is stored byte-for-byte and not aligned to be faster for the CPU to access. The packing seems to have been done blindly as an attempt to outsmart the compiler or something -- basically valuing a few bytes of memory instead of faster access An example record: TFooTypeRec = packed record RID : Integer; Description : String; CalcInTotalIncome : Boolean; RequireAddress : Boolean; end; Should I fix this and make every record normal or

how to record audio as mp3 file by using AvAudiorecorder

霸气de小男生 提交于 2019-11-30 20:43:45
how to record audio as mp3 file by using AvAudiorecorder.i m using following code for recorder setting recordSetting1 = [NSDictionary dictionaryWithObjectsAndKeys: [NSNumber numberWithInt:AVAudioQualityMin],AVEncoderAudioQualityKey, [NSNumber numberWithInt:16], AVEncoderBitRateKey, [NSNumber numberWithInt: 2], AVNumberOfChannelsKey, [NSNumber numberWithFloat:44100.0], AVSampleRateKey,nil]; Add [NSNumber numberWithInt:kAudioFormatMPEGLayer3] forKey:AVFormatIDKey However it's impossible to encode mp3 format at IPhone because of royalty. Whilst you can play MP3 files using AVAudioPlayer , you can