FAQ Database Discussion Community

Does FileDescriptor.sync() work for all file data or just file data originating within the callers JVM

Will this ensure that all data is synced on the local machine or just data originating within the currently operation JVM? FileOutputStream s = new FileOutputStream(filename) s.getFD().sync() FileInputStream fis = new FileInputStream(null); fis.getFD().sync(); Context: we have many programs (other software) that write to a file that we share. We all...

Flush cout manually only

As far as I know streaming std::endl into std::cout will flush it. I get that that behavior makes sense for most applications. My problem is that I have some output that uses multiple std::endl's and therefore flushes the output. This is really bad for the performance of my program and...

Add values before Doctrine Flush

I would like to add values before flushing. My others values are from a Form which is mapped with my Entity, so when i try to use setData(), my fields stay at "null". Code : public function updateAction(Request $request, $id) { $em = $this->getDoctrine()->getManager(); $entity = $em->getRepository('BlogBlogBundle:Blog')->find($id); if (!$entity) {...

Guarantee disk cache was flushed with fsync

I understand that fsync system call moves dirty data from kernel buffer cache (page cache) to HDD. Does it guarantee that hard disk moved said data from its internal cache to platter?

Is processor cache flushed during context switch in multicore?

Recently, I discussed why there is a volatile mark at seq in Java Actors demo @volatile private var seq = 0L private def nextSeq: Long = { val next = seq seq += 1 next } One answer was that threads can be migrated and variables lost (other cores will...

PHP pthreads, in pool tasks, ob_flush and flush cause crash

$p = new Pool(10); for ($i = 0; i<1000; i++){ $tasks[i] = new workerThread($i); } foreach ($tasks as $task) { $p->submit($task); } // shutdown will wait for current queue to be completed $p->shutdown(); // garbage collection check / read results $p->collect(function($checkingTask){ return ($checkingTask->isGarbage); }); class workerThread extends Collectable {...

When NOT to use EntityManager.flush()?

For synchronization and to retrieve the DB-generated ID's I feel coerced to call EntityManager.flush() at several places. Performance implications aside, are there reasons not to call flush()? In other words, is there any observable difference for the caller of my (DAO, ...) method if it does/doesn't flush()? My scenario is...

Cannot cin.ignore till EOF?

I wanted to ignore all characters in cin to flush cin in this answer: How to get rid of bad input one word at a time instead of one line at a time? But I found that the program seemed to hang awaiting input if I wrote: cin.ignore(std::numeric_limits<std::streamsize>::max()); It propperly...

Should I BIO_flush() after BIO_read()-ing?

So I implement a base64 decoder and while encoding (BIO_write() on BIO_f_base64) you should BIO_flush() as they say in documentation. However, they don't mention anything regarding BIO_read() (decoding). Should I flush after BIO_read() and if not what are the consequences if I do?

Restarting a Clip object - flush() method

The Javadoc for DataLine.flush() states Flushes queued data from the line. The flushed data is discarded. In some cases, not all queued data can be discarded. For example, a mixer can flush data from the buffer for a specific input line, but any unplayed data already in the output buffer...

How to reconcile gzip compression and the flushing of the header of index.php

I have a pretty big index.php file(about 500kB) in which lots of logic and database query are present(and the index.php which goes to the client is about 200kB). What I'd like to do is first of all compress the file using gzip, which I do by simply adding SendOutputFilter in...

How to determine the discriminator column value from within an entity with ZF2 and Doctrine

I would like to use Doctrine’s preflush features to automatically set the value of form elements based on the values of other elements. The preflush statements in my ZF2 entity might look like this: /** * set eventEndDate = eventStartDate for single-day events on pre flush. * * @ORM\PreFlush *...

How to make HttpResponse.Flush() async?

How to implement an asynchrone call to the HttpResponse.Flush() method using .net 4.0 & VS2013 ? I tried delegate: var caller = new AsyncFlush(context.Response.Flush); var result1 = caller.BeginInvoke(null, null); caller.EndInvoke(result1); then task: Task.Factory.StartNew(() => context.Response.Flush()).Start(); and finally thread: new Thread(new ThreadStart(() => context.Response.Flush()).Start(); But each case seem freeze my internet...

How to clear the contents read by cin

After typing an integer and pressing ENTER,the newline is getting stored. So when i do a char c = cin.get() , the previously entered newline is being assigned to variable c.The following loop gets skipped because of this..How to clear the contents of cin? Or how to avoid reading the...

Reading sentences as string inputs from users

I have been trying to implement a simple code which takes a sentence as an input from the user, stores it in a string and displays it back. Here are the issues: 1. When T = 1, the program exits immediately. 2. When T>1, the loop runs for only T-1...

.Net BinaryWriter automatically flushes stream when checking stream Position

Has anyone else seen this or know how to turn this off? I have code which periodically checks the Position of a stream in a BinaryWriter. Every invocation of the BinaryWriter.BaseStream.Position method results in that stream's Flush method being invoked. I tried using a BinaryWriter and a StreamWriter, and only...

How to force flushing in Grails GORM

I have a service that distributes tasks to operators. Inside a method I distribute many tasks in time inside a loop. I want to flush the task, the operator, and a DistributionLog. If I just had one domain to save I think I could do something like Operator.withTransaction{ //...some code...

Typo on wikipedia input/output examples

I am reading the following example from wikipedia. #include <iostream> int main() { std::cout << "Hello, world!\n"; return 0; } The article reads then as: This program would output "Hello, world!" followed by a newline and standard output stream buffer flush. I do not believe this is correct, since a...

Why hbase memstore size and flushed data size are not equal?

I was monitoring hbase (0.94.18) data storing and found that memstore size and size of flushed stored data are not the same. When memstore data size grows up to 128 Mb it is flushed to HFile. But store file size diff on disk is 36.8 Mb. Compaction is turned off....