Saving file to disk while I getting for TIdTCPServer / TIDTCPClient [closed] - delphi

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I want to go receiving a file via TIdTCPClient and receiving data that will be saved on disk, such as Skype. In Skype you send a file, the other person accepts and select somewhere to save the file begins to be transferred and the data that have been received will now be saved to disk, so the file is not in RAM. Does anyone know how to do this?

It's a little hard to work out precisely what the question is. But I think the issue is that you don't want to download the entire file to memory, and then write to disk.
I suspect that you are currently using TMemoryStream to receive the data. Doing so compels you to receive the entire file to memory. Avoid that quite simply by using TFileStream instead. Put the data to a file rather than memory.

Related

Convert Array of Floats to Wav File Swift [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 2 years ago.
Improve this question
I want to convert an array of floats (one dimension) to an audio file -- then I want to send this audio file to a server with a put request, thus I need to convert it to Data.
How could I do this?? I have seen stack overflow posts about how to convert an array of floats to a wav file like this: Write array of floats to a wav audio file in swift
But I dont want to store anything, just convert it to a wav file, convert that to Data and send that to my db with a Put request. How can I do this? Thanks so much for your help!!
I recommend creating a temporary AVAudioFile to send to the server, and delete it when all data has been sent. This will prevent having to recreate the file in case the connection is dropped or has some other problem. It is also a high-level API that's easy to use.
If you want to avoid writing to a file, it can be done but will be much lower-level. You can create an AudioFileID with custom Data-based callbacks using AudioFileInitializeWithCallbacks, wrap that with ExtAudioFileWrapAudioFileID, and then write the floats using ExtAudioFileWrite after setting the client data format.

How to write at last index of file in write mode in iOS [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this question
I want to write data in file at the end of every call. How can I do this in iOS? Below are the steps.
If "filename" doesn't exist create a new file
And write NSData or Data content in the file.
Next time when thread complete the work it will again call same method to write in file but if file exist it will open to write from last index in file.
I don't want to store or cache data in memory to write simultaneously.
You should take a look at the documentation of Filehandle.
Create a file handle, then seekToEndOfFile() before using write(_ data: Data).

When offline, how to manage data? IOS [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this question
I would like to know what are the best practices regarding, Modeling data when no network connection available, if the app you are building is cloud computing based, but still you want to be able to have basic functionality and I guess some persistent data?
PD: I am kind of new to IOS development
UserDefaults is okay for small bits of data that don't change often, but as it has to rewrite the entire user defaults dataset to a file each time a change it made, it is not robust enough for anything of volume or with frequent changes. For that you would want CoreData or a third party open source solution like Realm.io.
You can try to using the 'cache' where you store temporary data.
One way to achieve this is NSUserDefaults where you set a variable (let's say users profile photo) and when the user opens his app again, the image will be loaded even if there is no internet connection since its cached. Hope this helps!

Caching Images while using Parse [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I'm creating a social media app.
I want to know a way to cache a users profile picture once downloaded from the Parse network and then each time the app is loaded check if an updated picture has been found and load that one, then cache that one.
I have no idea how to approach this, does anyone have any ideas?
There are plenty of third-party libraries for caching you can find on Github, or you can simply use NSUserDefaults or CoreData to save the pictures(or really anything) to disk. To check if a picture was modified, you can give the picture an identifier, compare it with the response from the server, and re-save the picture, or do whatever is needed.

Copy on write and fork()? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 9 years ago.
Improve this question
In a system with paged memory, where Copy On Write technique is used, a process creates a new process with fork() call.
Right after creation, the new process tries to write something in the memory. Which error will the CPU generate - page fault or something else?
As far as i know, when copy on write is used, that means that common data is not copied, but when we use fork(), when a new process tries to write in a certain page, that pages stops being shared, and the process created with fork gets a copy of the page so it can write in it.
So, i'm a little confused will the processor generate an error at all?
Page faults are generated by the processor the first time a copy-on-write page is written to, but the fault is handled by the kernel (just like faults on pages that are swapped out or zero-filled). It isn't passed on to userspace.

Resources