record

Hibernate Many-to-Many, duplicates same record

落花浮王杯 提交于 2019-12-02 07:05:19
I tried Hibernate Mapping Many-to-Many using Annotations with the example given in vaannila. http://www.vaannila.com/hibernate/hibernate-example/hibernate-mapping-many-to-many-using-annotations-1.html Set<Course> courses = new HashSet<Course>(); courses.add(new Course("Maths")); courses.add(new Course("Computer Science")); Student student1 = new Student("Eswar", courses); Student student2 = new Student("Joe", courses); session.save(student1); session.save(student2); This thing works fine. But if I try to add another Course later, to a existing student like, Set<Course> courses = new HashSet

Audio record in R

一个人想着一个人 提交于 2019-12-02 07:03:14
I am playing with some audio and sound packages in R for Windows (mine is Win7 x64). There is a problem when I tried to record from microphone using record() {audio} : it could record only once then cannot record some more until restart the whole console once sound is recorded, it could be save but cannot play() file recorded from above cannot be read by audio, but tuneR due to 'incomplete wave file' and the following "filename" does not work filename=paste0('abcd','.wav') save.wave(x,filename) until type directly to the command like, this makes hard to write a record script/function save.wave

Postgres Function End Loop and return Error

℡╲_俬逩灬. 提交于 2019-12-02 03:11:48
I have tried to create this function but the system is returning a "LOOP error" and I don't know how to return 3 variables at the same time. I've tried hard to figure this out but I didn't find an answer anywhere. CREATE OR REPLACE FUNCTION conta_relatos(fator_normativo integer, fator_determinativo integer) RETURNS integer AS $BODY$ DECLARE vinculos_encontrados RECORD; rel_pri INT; rel_sec INT; rel_ref INT; no_item INT; tipo_relato TEXT; BEGIN rel_pri := 0; rel_sec := 0; rel_ref := 0; FOR vinculos_encontrados IN SELECT * FROM "Vinculos" WHERE ("Vinculos"."Fator_Normativo" = Fator_Normativo AND

Adding to an existing value in Erlang

最后都变了- 提交于 2019-12-02 03:02:08
I am attempting to create a function that stores a number into a record and then adds value X to that number every time the function runs. Value: 5 Run Function (Add One): 1 Value should be: 6 Run Function (Add One): 1 value should be 7 I tried to use a record: -record(adder,{value :: integer()}). ---function Number = random:uniform(6), L=#added{value = Number + #added.value}. This does not work as it resets the value every time. Any suggestions? Take a look at this code: -module(test). -export([add/1]). -record(adder, {value=6}). add(X) -> #adder{value = X + #adder.value}. If you compile this

pyaudio-OSError: [Errno -9999] Unanticipated host error

大城市里の小女人 提交于 2019-12-01 22:30:57
问题 I just want to run a simple python audio code: import pyaudio import wave import sys CHUNK = 1024 wf = wave.open("4.wav", 'rb') # instantiate PyAudio (1) p = pyaudio.PyAudio() # open stream (2) stream = p.open(format=p.get_format_from_width(wf.getsampwidth()), channels=wf.getnchannels(), rate=wf.getframerate(), output=True) but I got the following error: Traceback (most recent call last): File "rec2.py", line 17, in <module> output=True) File "C:\Users\Surena\Anaconda3\lib\site-packages

Android: Two instances of Media recorder at same time

余生长醉 提交于 2019-12-01 17:06:36
Can i run two instances of Android MediaRecorder class at the same time? For example public MediaRecorder mrec1 ; public MediaRecorder mrec2 ; mrec1.setCamera(mCamera); mrec1.setPreviewDisplay(surfaceHolder.getSurface()); mrec1.setVideoSource(MediaRecorder.VideoSource.CAMERA) . . . . mrec2.setAudioSource(MediaRecorder.AudioSource.MIC); mrec2.setOutputFormat(MediaRecorder.OutputFormat.THREE_GPP); mrec2.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB); . . . . mrec1.prepare(); mrec2.prepare(); mrec1.start(); mrec2.start(); I get this error when second start() is called i just want to know is

How to define a Type A in Type B and Type B in Type A?

巧了我就是萌 提交于 2019-12-01 16:45:10
I have two types. One Type A and one Type B. The Problem Type A contains Type B and Type B contains Type A. Such a thing like this won't work: type typeA = record test1 : typeB; end; type typeB = record test2 : typeA; end; Edit: Thats not my design. I converting C Header files (to access a DLL) that include such constructs to delphi. Edit2: "C++ structs are another name for classes AFAIR. And there must have been pointers, not values themselves. – Arioch 'The 1 min ago" Yes you are right that was a Pointer to a Type: There I definied: test1 : ^typeB; Will that work instead? test1 : Pointer;

F#: Error when trying to copy and update record through interface

我怕爱的太早我们不能终老 提交于 2019-12-01 06:11:06
I am trying to make a function that turns any flat seq<IHierarchy> into a hierarchy. Essentially, anything that has a parentID and a seq of children should be able to be made into a hierarchy. Instead of making Hierarchy a base class with parentID and children properties [we can't as records are sealed classes] I was wondering if it was possible to make it an IHierarchy with two abstract fields that we implement for each class (parentID and children). I attached the code below including a makeHierarchy function that tries to turn a flat seq<IHierarchy> into a hierarchy structure of

F#: Error when trying to copy and update record through interface

我的未来我决定 提交于 2019-12-01 04:51:47
问题 I am trying to make a function that turns any flat seq<IHierarchy> into a hierarchy. Essentially, anything that has a parentID and a seq of children should be able to be made into a hierarchy. Instead of making Hierarchy a base class with parentID and children properties [we can't as records are sealed classes] I was wondering if it was possible to make it an IHierarchy with two abstract fields that we implement for each class (parentID and children). I attached the code below including a

Record syntax default value for accessor

好久不见. 提交于 2019-12-01 03:51:59
As I was writing up an answer just now, I ran across an interesting problem: data Gender = Male | Female deriving (Eq, Show) data Age = Baby | Child | PreTeen | Adult deriving (Eq, Show, Ord) data Clothing = Pants Gender Age | Shirt Gender Age | Skirt Age -- assumed to be Female deriving (Show, Eq) Suppose I wish to write the final data type with record syntax: data Clothing = Pants {gender :: Gender, age :: Age} | Shirt {gender :: Gender, age :: Age} | Skirt {age :: Age} deriving (Show, Eq) The problem is, I want gender $ Skirt foo to always evaluate to Female (regardless of foo , which is an