on-the-fly

Read XML file while it is being written (in Python)

一曲冷凌霜 提交于 2019-12-02 08:19:05
I have to monitor an XML file being written by a tool running all the day. But the XML file is properly completed and closed only at the end of the day. Same constraints as XML stream processing: Parse an incomplete XML file on-the-fly and trigger actions Keep track of the last position within the file to avoid processing it again from the beginning On answer of Need to read XML files as a stream using BeautifulSoup in Python , slezica suggests xml.sax , xml.etree.ElementTree and cElementTree . But no success with my attempts to use xml.etree.ElementTree and cElementTree . There are also xml

windows file copy internals (on the fly encryption)

浪子不回头ぞ 提交于 2019-12-02 04:23:23
问题 I have to write an on-the-fly encryptor for Windows to encrypt all copied files, To implement this I need some detail about how windows FileCopy works. So I need a description such as the following: the CreateFile is called, creates a destination file and then reads from source file and then writes to the destination file using WriteFile ... Note that I cannot use any (File system) filter driver; I've to use a user-mode hook. 来源: https://stackoverflow.com/questions/24220382/windows-file-copy

Operator as and generic classes

浪子不回头ぞ 提交于 2019-12-01 02:41:05
I'm writing .NET On-the-Fly compiler for CLR scripting and want execution method make generic acceptable: object Execute() { return type.InvokeMember(..); } T Execute<T>() { return Execute() as T; /* doesn't work: The type parameter 'T' cannot be used with the 'as' operator because it does not have a class type constraint nor a 'class' constraint */ // also neither typeof(T) not T.GetType(), so on are possible return (T) Execute(); // ok } But I think operator as will be very useful: if result type isn't T method will return null , instead of an exception! Is it possible to do? You need to add

encrypting and/or decrypting large files (AES) on a memory and storage constrained system, with “catastrophe recovery”

梦想的初衷 提交于 2019-11-30 14:22:32
问题 I have a fairly generic question, so please pardon if it is a bit vague. So, let's a assume a file of 1GB, that needs to be encrypted and later decrypted on a given system. Problem is that the system has less than 512 mb of free memory and about 1.5 GB storage space (give or take), so, with the file "onboard" we have about ~500 MB of "hard drive scratch space" and less than 512 mb RAM to "play with". The system is not unlikely to experience an "unscheduled power down" at any moment during

Gson - Setting object reference on-the-fly using InstanceCreator

馋奶兔 提交于 2019-11-29 08:13:46
I'm stuck in a problem where I need to set reference of my object being parsed to its child objects during deserialization using Gson and InstanceCreator . To depict the problem, following is the simple representation of classes' structure. public class Workshift { private final transient Context context; private final Visit visit; public Workshift(Context context) { this.context = context; this.visit = new Visit(this); } } public class Visit { private final transient Workshift workshift; public Visit(Workshift ws) { this.workshift = ws; } } With this structure, I am able to set Context in

Defining a class while a Java application is running

有些话、适合烂在心里 提交于 2019-11-28 20:35:22
In Java, is it possible to create a class definition on the fly while an application is running, and then create an object of that class? For example, a running application would read in a text file that contains a list of class members to include in the new class. The application would then define a class definition based on the list of members, and then insantiate it. Yes its possible to do so in theory your class file is byte code which is at the end a byte array! you can then use the method defineClass(String, byte[], int, int) to get a Class instance that can be used to instantiate

Gson - Setting object reference on-the-fly using InstanceCreator

笑着哭i 提交于 2019-11-28 01:49:30
问题 I'm stuck in a problem where I need to set reference of my object being parsed to its child objects during deserialization using Gson and InstanceCreator . To depict the problem, following is the simple representation of classes' structure. public class Workshift { private final transient Context context; private final Visit visit; public Workshift(Context context) { this.context = context; this.visit = new Visit(this); } } public class Visit { private final transient Workshift workshift;

How to build Twisted servers which are able to do hot code swap in Python?

廉价感情. 提交于 2019-11-27 18:56:18
问题 I've developed a set of audio streaming server, all of them are using Twisted, and they are in Python, of course. They work, but a problem keeps troubling me, when I found some bugs there in the running server, or I want add something into the server, I need to stop them and start. Unlike HTTP servers, it's okay to restart them whenever, but not okay with audio streaming servers. Once I restart my streaming server, it means my users will encounter a disconnection. I did try to setup a manhole