Is there a way to overcome the 2GB limit of files in VBA ? Before trying to use multiple files controlling them by my own code, I would like to ask for any hints on the topic.
Try using the file system object model (FSO) instead. Specifically, the OpenTextStream method of the File object. I cannot find anything that explicitly says that it can go over 2GB, but lot of places imply it. If you use the ReadLine method of TextStream and all of the lines are under 2GB, it should work.
On the other hand, VBA does have some memory limitations also, so you want to make sure to stream this: don't try to keep all of the lines in memory at once, just one or two at a time.
Related
I think I did some stupid thing by creating random data using some command dd if=/dev/urandom of=20GB.bin bs=1GB count=16 iflag=fullblock
in huge size. Actually I was testing the behaviors of something when disk is full.
However Now I wish to delete this. I deleted the dev/urandom folder hoping it will do something, but it seems nothing was deleted without making any difference.
I see some commands online like wipe and shred, However now my dev/urandom folder is deleted, so what exactly should I do now ?
Any kind of help will be great.
you saved the random numbers to 20GB.bin thus you can do rm 20GB.bin to remove it. /dev/urandom is a special file bound to a tool and does not save random files, but just creates them on the fly. Some other tools might depend on /dev/urandom so deleting this device file might let them crash.
I have a pretty big corpus of texts that I use to make a few million Doc-objects.
I am somewhat familiar with the usage of DocBin(), but it looks like it loads all the Docs to memory before dumping it to file. Seems a bit risky and crash-prone. Ideally I want to be able to continue where it stopped should a crash or unexpected exit occur.
I came up with two options:
Write every doc as a single file with Doc.to_disk.
After the first x iterations I write the docbin to file, then every x iteration after that I load the docbin-file, merge it with the ones in memory, then write that new DocBin to file again.
Anything I've missed here? What are the up- and downsides to these methods? Any other suggestions?
Recently, I've been trying to write to a .PAK file while it is being used by another process in ring 0. This has been a problem for quite a while and i haven't had much success. I am able to use any programming language necessary to accomplish this, but C#/VB.net is preferred. I originally wanted to use a find and replace system when editing, but I will just choose and offset to write to and such instead.
No, I can't just terminate the process then edit; the process must be running. Yes, I obviously know the process with the file handle attached.
No, I can't just run as admin because the process is established in ring 0/the kernel.
I've tried multiple methods including setting the process speed temporarily to 0 to edit then revert, and changing the FileShare and other parameters, none with any success.
One approach which I have been told a lot and which I have no experience in is creating a "Kernel Driver". I'm not sure how to go about this and I cant find much info online so if you think that's is the best method please inform me on how to get started. Any help is appreciated!
Always create a temporary file (a copy of your original file). If you need to process a file within your codes, create a temp file, use the temp file and process that file. So if you need another process, there will be no problem.
I know this is kind of a weird question, but how do you...allocate physical memory? I know using New will make a new object but it's not allocating what I'm looking for. Here's kind of what I'm looking for: http://www.soft.tahionic.com/download-memalloc/index.html
That program allocates memory in the way I want to. How would I go about allocating around...say 500 MB? Or will VB.NET not allow this because of it's memory management? I tried googling about memorystreams and unmanagedmemorystreams but I'm not sure how to start. I also tried making large arrays but that seems kind of...unprofessional. I've only been using VB.NET for a year or so. Can someone help me get started? By the way, I just joined. Nice to meet you all!
You can allocate and free a specified block of unmanaged memory like this:
Dim handle As IntPtr = Marshal.AllocHGlobal(size)
Marshal.FreeHGlobal(handle)
See the MSDN for more info. You could alternatively use the Marshal.AllocCoTaskMem method and free it with Marshal.FreeCoTaskMem.
utilize the windows api functions such as HeapAlloc using pinvoke
I am reading a file datafile at the launch of my application.This is just self learning drill.
On apple developers website under the heading Minimize File Access at Launch Time
it says
If you must read a file at launch time, do so only once.
So my question is that is there a standard or preferred way of doing this. At the moment I have an instance varible NSArray and I populate that in - (void)viewDidUnloadand never garbage collect it. Is that good enough ? or Should I be making use of application Object (I am not even sure if it is logical to say this.).
There is no standard way to optimize. But there are some guidelines.
One basic idea of optimization is to do less. E.g. as the advice you cited where the data of a file may be needed at multiple points in your code, it is better to read it from disk once and then distribute a data pointer within your program.
If the file is big enough to cause a stutter when you start your application, i.e. it takes more than 20ms to read and parse the file, you should consider reading the file in a background thread/task and adding a ‘loading…’-state to display to the user.