human-readable

I Need a Human Readable, Yet Parse-able Document Format

…衆ロ難τιáo~ 提交于 2019-12-03 11:17:36
问题 I'm working on one of those projects where there are a million better ways to accomplish what I need but I have no choice and I have to do it this way. Here it is: There is a web form, when the user fills it out and hits a submit a human readable text file is created using the form data. It looks like this: field_1: value for field one field_2: value for field two more data for field two (field two has a newline in it!) field3: some more data My problem is this: I need to parse this text file

I Need a Human Readable, Yet Parse-able Document Format

旧时模样 提交于 2019-12-03 01:41:46
I'm working on one of those projects where there are a million better ways to accomplish what I need but I have no choice and I have to do it this way. Here it is: There is a web form, when the user fills it out and hits a submit a human readable text file is created using the form data. It looks like this: field_1: value for field one field_2: value for field two more data for field two (field two has a newline in it!) field3: some more data My problem is this: I need to parse this text file back into the web form so that the user can edit it. How could I, in a foolproof way, accomplish this?

Finding human-readable files on unix

旧城冷巷雨未停 提交于 2019-12-03 00:32:42
I'd like to find human-readable files on my linux machine without a file extension constraint. Those files should be of human sensing files like text, configuration, html, source-code etc. files. Could you suggest a way to filter and locate. find and file are your friends here: find /dir/to/search -type f -exec sh -c 'file -b {} | grep text &>/dev/null' \; -print this will find any files ( NOTE: it will not find symlinks directories sockets etc only regular files ) in /dir/to/search and run sh -c 'file -b {} | grep text &>/dev/null' \; which looks at the type of file and looks for text in the

objective-c NSFilePosixPermissions to human readable NSString

 ̄綄美尐妖づ 提交于 2019-12-01 04:36:35
is there a way to get human readable string (@"drwxr-xr-x" for example) from an NSFilePosixPermissions integer ? The file system permissions attribute is simply an unsigned long value. The code below could obviously be made more efficient but it shows [more or less] what needs to be done to get the string you want: // The indices of the items in the permsArray correspond to the POSIX // permissions. Essentially each bit of the POSIX permissions represents // a read, write, or execute bit. NSArray *permsArray = [NSArray arrayWithObjects:@"---", @"--x", @"-w-", @"-wx", @"r--", @"r-x", @"rw-", @

How to use HTTP status code symbols in RSpec?

烈酒焚心 提交于 2019-11-30 05:52:14
I use HTTP status code symbols in code in a controller such as: render json: { auth_token: user.authentication_token, user: user }, status: :created or render json: { errors: ["Missing parameter."] }, success: false, status: :unprocessable_entity In the code of my request spec I also would like to use the symbols: post user_session_path, email: @user.email, password: @user.password expect(last_response.status).to eq(201) ... expect(last_response.status).to eq(422) However each test where I use the symbols instead of integers fails: Failure/Error: expect(last_response.status).to eq(:created)

bytes to human readable, and back. without data loss

狂风中的少年 提交于 2019-11-29 18:37:36
问题 I need to convert strings which contain the memory usage in bytes, like: 1048576 (which is 1M) into exactly that, a human-readable version, and visa-versa. Note : I looked here already: Reusable library to get human readable version of file size? And here (even though it isn't python): How to convert human readable memory size into bytes? Nothing so far helped me, so I looked elsewhere. I have found something that does this for me here: http://code.google.com/p/pyftpdlib/source/browse/trunk

How to use HTTP status code symbols in RSpec?

蹲街弑〆低调 提交于 2019-11-29 06:14:03
问题 I use HTTP status code symbols in code in a controller such as: render json: { auth_token: user.authentication_token, user: user }, status: :created or render json: { errors: ["Missing parameter."] }, success: false, status: :unprocessable_entity In the code of my request spec I also would like to use the symbols: post user_session_path, email: @user.email, password: @user.password expect(last_response.status).to eq(201) ... expect(last_response.status).to eq(422) However each test where I

Code-Golf: Friendly Number Abbreviator

冷暖自知 提交于 2019-11-28 19:58:41
问题 Based on this question: Is there a way to round numbers into a friendly format? THE CHALLENGE - UPDATED! (removed hundreds abbreviation from spec) The shortest code by character count that will abbreviate an integer (no decimals). Code should include the full program. Relevant range is from 0 - 9,223,372,036,854,775,807 (the upper limit for signed 64 bit integer). The number of decimal places for abbreviation will be positive. You will not need to calculate the following: 920535 abbreviated

Make big and small numbers human-readable [duplicate]

前提是你 提交于 2019-11-28 09:42:20
This question already has an answer here: Formatting Large Numbers with .NET 5 answers I would like to print my very small numbers in C# in a human friendly way, such as: 30µ for 3E-5 or 456.789n for 0.000000456789 . I know of the Humanize_number () function from BSD in C, but only compatible with bit ints, not floats and doubles. Is there the equivalent in C# that supports those? Also, it should keep a certain amount of precision when displaying numbers, like: 0.003596 should be displayed as 3.596µ , not 3.6µ (or worse, 4µ ). The possible answer here: Formatting Large Numbers with .NET but

htop output to human readable file

扶醉桌前 提交于 2019-11-28 08:11:10
I've tried piping htop to a text file (e.g. htop > text.txt ) but it gives me text garbled by formatting strings (see below). Is there a way to get nicer, human readable output? ^[7^[[?47h^[[1;30r^[[m^[[4l^[[?1h^[=^[[m^[[?1000h^[[m^[[m^[[H^[[2J^[[1B ^[[36m1 ^[[m^[[1m[^[[m^[[32m||||||||||^[[31m||||||||||^[[30m^[[1m \ 22.2%^[[m]^[[m ^[[36mTasks: ^[[1m159^[[m^[[36m total, ^[[32m^[[1m5^[[m^[[36m running^[[3;3H2 ^[[m^[[1m[^[[30m \ 0.0%^[[m]^[[m ^[[36mLoad average: ^[[30m^[[1m1.11 ^[[m^[[m1.28 ^[[1m1.31 ^[[4;3H^[[m^[[36m3 ^[[m^[[1m[^[[m^[[32m||||||||||^[[30m^[[1m \ 11.1%^[[m]^[[m ^[[36mUptime: ^[