首页 \ 问答 \ 将System.out.println或stdout数据捕获到摆动备忘录(巨大数据)(Capturing System.out.println or stdout data to a swing memo (Huge Data))

将System.out.println或stdout数据捕获到摆动备忘录(巨大数据)(Capturing System.out.println or stdout data to a swing memo (Huge Data))

嗨我需要显示在备忘录而不是使用System.out.println结果,但不可能将标准输出放在列表中例如,并在摆动备忘录中显示此列表的内容后,因为我需要显示每一行的结果是实时还是显示。

我认为这些东西像System.out.println的观察者那样工作,当控制台中打印了一些数据或信息时,我希望能够捕获它并显示在备忘录中。

为了更好的理解,我在unix服务器中远程执行一些命令,并在标准输出中检索这些命令的结果,并计算一些时间和度量值,当然我需要这样做来模拟远程应用程序的行为。

该解决方案可以用于在备忘录中显示清单中每一行或每个项目的完整时间。

而秋千备忘录可以处理大于500kb或大于1MB的大字符串?

因为打印在我ID中的sdtout中的整个结果非常巨大。

谢谢


Hi I need to show the result in a memo instead using System.out.println, but isn't possible to put the stdout in a list for example and after display the contents of this list in swing memo because I need to display every line of the result in real time or when it is showed.

I'm think in something that works like an observer of System.out.println and when some data or information have been printed in the console I want to be able to capture it and display in a memo.

For a better comprehension, I execute some commands remotely in an unix server and retrieve the results of these commands in the stdout and compute some time and metrics with them, and definitely I need to do in this way to simulate the behavior of an remote application.

The solution could be a way to show every line or every item in the list in the memo in the exactly time that it is produced.

And the swing memo can deal with big strings, more than 500kb or more than 1MB?

Because the entire result printed in the sdtout in my ID is really huge.

Thx


原文:https://stackoverflow.com/questions/6316272
更新时间:2023-08-22 09:08

最满意答案

SessionMiddleware的第三行调用一个特定的会话引擎 ,它决定了要使用哪个SessionStore。

如果您进入contrib / sessions / backends / base.py,您将看到以下代码:

class SessionBase(object):

    ...

    def __getitem__(self, key):
        return self._session[key]

    def _get_session(self, no_load=False):
        """
        Lazily loads session from storage (unless "no_load" is True, when only
        an empty dict is stored) and stores it in the current instance.
        """
        self.accessed = True
        try:
            return self._session_cache
        except AttributeError:
            if self._session_key is None or no_load:
                self._session_cache = {}
            else:
                self._session_cache = self.load()
        return self._session_cache

    _session = property(_get_session)

它所做的是创建一个会话代理对象,中间件已附加到该请求。 它不会从数据库加载会话对象,直到您说出:

x = request.session['key']

此时, __getitem__(self, key) self._session __getitem__(self, key)试图解引用self._session ,它(作为属性)反过来返回此事务的会话字典的缓存副本,或者如果没有可用的缓存,则从存储中获取它使用load()方法。 load()方法由特定的子引擎实现:数据库,文件,缓存,缓存+数据库等。

SessionStore是一个完整会话的轻量级代理; 当您需要读取或写入与会话ID cookie中编码的密钥关联的会话对象的数据时,它只会变成一个完整的会话,触及数据库。


The third line of SessionMiddleware invokes a specific session engine, which dictates which SessionStore to use.

If you go down into contrib/sessions/backends/base.py, you'll see the following code:

class SessionBase(object):

    ...

    def __getitem__(self, key):
        return self._session[key]

    def _get_session(self, no_load=False):
        """
        Lazily loads session from storage (unless "no_load" is True, when only
        an empty dict is stored) and stores it in the current instance.
        """
        self.accessed = True
        try:
            return self._session_cache
        except AttributeError:
            if self._session_key is None or no_load:
                self._session_cache = {}
            else:
                self._session_cache = self.load()
        return self._session_cache

    _session = property(_get_session)

What this does is create a session proxy object, which the middleware has attached to the request. It does not load the session object from the database until you say:

x = request.session['key']

At which point, the __getitem__(self, key) attempts to dereference self._session, which (being a property) in turn returns a cached copy of the session dictionary for this transaction, or if no cache is available, fetches it from the store using the load() method. The load() method is implemented by specific child engines: database, file, cache, cache + db, etc.

SessionStore is a lightweight proxy for a full session; it only becomes a full session, hitting the database, when you need to read or write data to the session object associated with the key encoded in the session id cookie.

相关问答

更多

相关文章

更多

最新问答

更多
  • 获取MVC 4使用的DisplayMode后缀(Get the DisplayMode Suffix being used by MVC 4)
  • 如何通过引用返回对象?(How is returning an object by reference possible?)
  • 矩阵如何存储在内存中?(How are matrices stored in memory?)
  • 每个请求的Java新会话?(Java New Session For Each Request?)
  • css:浮动div中重叠的标题h1(css: overlapping headlines h1 in floated divs)
  • 无论图像如何,Caffe预测同一类(Caffe predicts same class regardless of image)
  • xcode语法颜色编码解释?(xcode syntax color coding explained?)
  • 在Access 2010 Runtime中使用Office 2000校对工具(Use Office 2000 proofing tools in Access 2010 Runtime)
  • 从单独的Web主机将图像传输到服务器上(Getting images onto server from separate web host)
  • 从旧版本复制文件并保留它们(旧/新版本)(Copy a file from old revision and keep both of them (old / new revision))
  • 西安哪有PLC可控制编程的培训
  • 在Entity Framework中选择基类(Select base class in Entity Framework)
  • 在Android中出现错误“数据集和渲染器应该不为null,并且应该具有相同数量的系列”(Error “Dataset and renderer should be not null and should have the same number of series” in Android)
  • 电脑二级VF有什么用
  • Datamapper Ruby如何添加Hook方法(Datamapper Ruby How to add Hook Method)
  • 金华英语角.
  • 手机软件如何制作
  • 用于Android webview中图像保存的上下文菜单(Context Menu for Image Saving in an Android webview)
  • 注意:未定义的偏移量:PHP(Notice: Undefined offset: PHP)
  • 如何读R中的大数据集[复制](How to read large dataset in R [duplicate])
  • Unity 5 Heighmap与地形宽度/地形长度的分辨率关系?(Unity 5 Heighmap Resolution relationship to terrain width / terrain length?)
  • 如何通知PipedOutputStream线程写入最后一个字节的PipedInputStream线程?(How to notify PipedInputStream thread that PipedOutputStream thread has written last byte?)
  • python的访问器方法有哪些
  • DeviceNetworkInformation:哪个是哪个?(DeviceNetworkInformation: Which is which?)
  • 在Ruby中对组合进行排序(Sorting a combination in Ruby)
  • 网站开发的流程?
  • 使用Zend Framework 2中的JOIN sql检索数据(Retrieve data using JOIN sql in Zend Framework 2)
  • 条带格式类型格式模式编号无法正常工作(Stripes format type format pattern number not working properly)
  • 透明度错误IE11(Transparency bug IE11)
  • linux的基本操作命令。。。