flush

Java: Hibernate does not see changes in DataBase

核能气质少年 提交于 2019-11-30 20:05:05
I have two different applications that share the same database. The problem is that when I have an application change something in the database, the other does not update. I tried to make a session.flush() but it didn't work. The only way is to close the entire session and recreate it, but of course, that takes too long. Short answer: issue a session.refresh(obj) every time you want to display some object. It will force Hibernate to go to the database. Another solution is to use a StatelessSession , which won't cache anything (not even 1st level cache), forcing your applications to go the

Flushing Perl STDIN buffer

本秂侑毒 提交于 2019-11-30 18:29:56
Is there any way to clear the STDIN buffer in Perl? A part of my program has lengthy output (enough time for someone to enter a few characters) and after that output I ask for input, but if characters were entered during the output, they are "tacked on" to whatever is entered at the input part. Here is an example of my problem: for(my $n = 0; $n < 70000; $n++){ print $n . "\n"; } chomp(my $input = <STDIN>); print $input . "\n"; The output would include any characters entered during the output from that for loop. How could I either disable STDIN or flush the STDIN buffer (or any other way to

Empty or “flush” a file descriptor without read()?

孤街浪徒 提交于 2019-11-30 18:00:45
(Note: This is not a question of how to flush a write() . This is the other end of it, so to speak.) Is it possible to empty a file descriptor that has data to be read in it without having to read() it? You might not be interested in the data, and reading it all would therefore waste space and cycles you might have better uses for. If it is not possible in POSIX, do any operating systems have any non-portable ways to do this? UPDATE: Please note that I'm talking about file descriptors , not streams. Streams have fclean available, which flushes the write buffer, and returns the read buffer back

PHP Error: ob_flush() [ref.outcontrol]: failed to flush buffer. No buffer to flush

蓝咒 提交于 2019-11-30 17:47:54
Could someone please save these 2 files and run them and tell me why I get the error " ob_flush() [ref.outcontrol]: failed to flush buffer. No buffer to flush". I tried googling around and it says that I have to use ob_start(); but when I do then it doesn't print out line by line, but rather returns the whole object from the FOR loop when it has completed. I'm kinda new to PHP so I'm not sure where else to look.. test_process.php // This script will write numbers from 1 to 100 into file // And sends continuously info to user $fp = fopen( '/tmp/output.txt', 'w') or die('Failed to open'); set

Flushing Perl STDIN buffer

耗尽温柔 提交于 2019-11-30 16:52:43
问题 Is there any way to clear the STDIN buffer in Perl? A part of my program has lengthy output (enough time for someone to enter a few characters) and after that output I ask for input, but if characters were entered during the output, they are "tacked on" to whatever is entered at the input part. Here is an example of my problem: for(my $n = 0; $n < 70000; $n++){ print $n . "\n"; } chomp(my $input = <STDIN>); print $input . "\n"; The output would include any characters entered during the output

NHibernate 3.0: TransactionScope and Auto-Flushing

╄→гoц情女王★ 提交于 2019-11-30 15:34:24
问题 In NHibernate 3.0, FlushMode.Auto does not work when running under an ambient transaction only (that is, without starting an NHibernate transaction). Should it? using (TransactionScope scope = new TransactionScope()) { ISession session = sessionFactory.OpenSession(); MappedEntity entity = new MappedEntity() { Name = "Entity", Value = 20 }; session.Save(entity); entity.Value = 30; session.SaveOrUpdate(entity); // This returns one entity, when it should return none var list = session.

How do I use the unofficial Android Market API?

一曲冷凌霜 提交于 2019-11-30 13:00:00
I'm trying the sample code from here . But my app is crashing. I added logging and found out that it's crashing at session.flush(); so I removed that line and it doesn't crash anymore. But it doesn't reach the onResult callback. package com.mytest.app; import com.gc.android.market.api.MarketSession; import com.gc.android.market.api.MarketSession.Callback; import com.gc.android.market.api.model.Market.AppsRequest; import com.gc.android.market.api.model.Market.AppsResponse; import com.gc.android.market.api.model.Market.ResponseContext; import android.app.Activity; import android.os.Bundle;

The consequences and pros/cons of flushing the stream in c++

回眸只為那壹抹淺笑 提交于 2019-11-30 11:09:04
I have recently read an article which stated that using \n is preferable to using std::endl because endl also flushes the stream. But when I looked for a bit more information on the topic I found a site which stated: If you are in a situation where you have to avoid buffering, you can use std::endl instead of ‘\n’ Now here comes my question: In which situation is it preferable not to write to the buffer? Because I only saw advantages of that technique. Isn't it also safer to write to the buffer? Because it is smaller than a hard drive it will get overwritten faster than data that is stored on

Does PHP flush work with jQuerys ajax?

旧街凉风 提交于 2019-11-30 09:33:04
问题 I have created a page in which I use the PHP function flush(), to output data to the browser the second the data is echoed. I'm also calling this page using jQuery's ajax function. It works, but jQuery doesn't output anything until the entire page has executed, which kind of removes the functionality of flush(). How can I fix this? My ajax call looks like this: jQuery.ajax({ type: "get", url: url, data: postdata, success: function(retval) { jQuery('#retdiv").html(retval); } }) 回答1: Here you

c++ std::ofstream flush() but not close()

ぐ巨炮叔叔 提交于 2019-11-30 08:40:06
I'm on MacOSX. In the logger part of my application, I'm dumping data to a file. suppose I have a globally declared std::ofstream outFile("log"); and in my logging code I have: outFile << "......." ; outFile.flush(); Now, suppose my code crashes after the flush() happens; Is the stuff written to outFile before the flush() guaranteed to be written to disk (note that I don't call a close() ). Thanks! From the C++ runtime's point of view, it should have been written to disk. From an OS perspective it might still linger in a buffer, but that's only going to be an issue if your whole machine