Is there a memory efficient and fast way to load big JSON files?

There was a duplicate to this question that had a better answer. See https://stackoverflow.com/a/10382359/1623645, which suggests ijson. Update: I tried it out, and ijson is to JSON what SAX is to XML. For instance, you can do this: import ijson for prefix, the_type, value in ijson.parse(open(json_file_name)): print prefix, the_type, value where prefix is a dot-separated … Read more

How can I import a large (14 GB) MySQL dump file into a new MySQL database?

I’ve searched around, and only this solution helped me: mysql -u root -p set global net_buffer_length=1000000; –Set network buffer length to a large byte number set global max_allowed_packet=1000000000; –Set maximum allowed packet size to a large byte number SET foreign_key_checks = 0; –Disable foreign key checking to avoid delays,errors and unwanted behaviour source file.sql –Import … Read more

HTML5 – How to stream large .mp4 files?

Ensure that the moov (metadata) is before the mdat (audio/video data). This is also called “fast start” or “web optimized”. For example, Handbrake has a “Web Optimized” checkbox, and ffmpeg and avconv have the output option -movflags faststart. Ensure that your web server is reporting the correct Content-Type (video/mp4). Ensure that your web server is … Read more

Reading large text files with streams in C#

You can improve read speed by using a BufferedStream, like this: using (FileStream fs = File.Open(path, FileMode.Open, FileAccess.Read, FileShare.ReadWrite)) using (BufferedStream bs = new BufferedStream(fs)) using (StreamReader sr = new StreamReader(bs)) { string line; while ((line = sr.ReadLine()) != null) { } } March 2013 UPDATE I recently wrote code for reading and processing (searching … Read more

Working with huge files in VIM

I had a 12GB file to edit today. The vim LargeFile plugin did not work for me. It still used up all my memory and then printed an error message :-(. I could not use hexedit for either, as it cannot insert anything, just overwrite. Here is an alternative approach: You split the file, edit … Read more

How to find the largest file in a directory and its subdirectories?

Quote from this link- If you want to find and print the top 10 largest files names (not directories) in a particular directory and its sub directories $ find . -type f -printf ‘%s %p\n’|sort -nr|head To restrict the search to the present directory use “-maxdepth 1” with find. $ find . -maxdepth 1 -printf … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)