Jump to content

Proper Format

BestPCBuilder2017

So I'm using colons for logging a bunch of information and I was wondering if this format would be acceptable. I want to make sure I'm using colons correctly. 

 

email: example

password: example 

username: example 

creation date: example 

 

Is it proper/acceptable to list in this fashion or is there a more proper route that should be taken? 

 

 

Link to comment
Share on other sites

Link to post
Share on other sites

afaik there isn't an ISO standard for that so basically use whatever floats your boat.

If you want my attention, quote meh! D: or just stick an @samcool55 in your post :3

Spying on everyone to fight against terrorism is like shooting a mosquito with a cannon

Link to comment
Share on other sites

Link to post
Share on other sites

If you work in a team just make sure everyone uses the same formatting.

PC: Case: Cooler Master CM690 II - PSU: Cooler Master G650M - RAM: Transcend 4x 8Gb DDR3 1333Mhz - MoBo: Gigabyte Z87x-D3H - CPU: i5 4670K @ 4.5Ghz - GPU: MSI GTX1060 ARMOR OC - Hard disks: 4x 500Gb Seagate enterprise in RAID 0 - SSD: Crucial M4 128Gb

Phone: Samsung Galaxy S6

Link to comment
Share on other sites

Link to post
Share on other sites

This might be a long shot, but it's worth a try 

@ARikozuM

Would you happen to know the proper format? 

 

 

Link to comment
Share on other sites

Link to post
Share on other sites

For something that only you would use it would be acceptable.

 

It suffers however from the fact that it's hard to improve upon or extend.. what happens for example when you want to introduce an address that has multiple lines or something else? do you have to use ":" right after the keyword or it's ok if there's multiple spaces or other special characters that may look like space?

 

My advice would be to look at something like JSON which allows you to easily parse data back into your application, and also export it easily.. the format is very simple :

http://www.json.org/

 

It's literally those two-three pages of documentation.

 

 

Link to comment
Share on other sites

Link to post
Share on other sites

3 hours ago, mariushm said:

For something that only you would use it would be acceptable.

 

It suffers however from the fact that it's hard to improve upon or extend.. what happens for example when you want to introduce an address that has multiple lines or something else? do you have to use ":" right after the keyword or it's ok if there's multiple spaces or other special characters that may look like space?

 

My advice would be to look at something like JSON which allows you to easily parse data back into your application, and also export it easily.. the format is very simple :

http://www.json.org/

 

It's literally those two-three pages of documentation.

By the looks of it, it seems like for programming there should be two spaces. Once before and one afterwards. I'm not sure if that would be same for the standard English language though. 

 

 

Link to comment
Share on other sites

Link to post
Share on other sites

Whatever is used to read the file, should not care about those spaces if the file can be edited by a human person.

The human person may use tab instead of  space (so editor may enter the tab character or may enter 2-4 spaces depending on editor), or the user may not enter spaces at all.. your parser should be able to ignore "whitespace" (spaces, tabs, enter in places where they are no appropriate etc)

JSON does that.. your file would look something like this

 

"entry" : [ "username" : "example" , "password" : example , "creationdate" : "example" , email : "example" ]

 

this defines an array called "entry" with the values between the brackets

 

If the files are not meant to be edited by humans another simple format would be benconding, which is used to create .torrent files for example .. the format is super simple: https://en.wikipedia.org/wiki/Bencode

 

Your single record would be encoded sort of like this

 

d8:username7:example8:password7example12:creationdate7:example5:email7:examplee

 

d = start a dictionary   ( holds an even number of records  key , value

  8:  (8 characters = "username")

  7: (7 characters = "example") 

  [...]

  5: 5 characters "email"

  7: 7 characters = "example"

e = end of dictionary

 

Link to comment
Share on other sites

Link to post
Share on other sites

7 hours ago, NCIX Lampy said:

I want to make sure I'm using colons correctly. 

You can use colons however you want to use colons, there's no global law or mandate governing or otherwise restricting their use...

6 hours ago, NCIX Lampy said:

By the looks of it, it seems like for programming there should be two spaces. Once before and one afterwards.

There's no specific global edict defining or restricting their use in the context of programming either - it is entirely open to interpretation by whatever language implementation has chosen to include their use.

6 hours ago, NCIX Lampy said:

I'm not sure if that would be same for the standard English language though. 

Specifically in the context of the English language then it is thus: Example.

7 hours ago, NCIX Lampy said:

Is it proper/acceptable to list in this fashion or is there a more proper route that should be taken? 

In relation to what exactly?

7 hours ago, NCIX Lampy said:

I'm using colons for logging a bunch of information and I was wondering if this format would be acceptable.

It's up to you, you are in control of the implementation detail of your logging... Do as you please but balance this against ease of use/readability i.e. use your common sense.

6 hours ago, mariushm said:

Whatever is used to read the file, should not care about those spaces if the file can be edited by a human person.

To be completely blunt, OP has not mentioned that the file is to be deserialized/parsed at any point - this is your assumption. You are correct in your points, for the most part, but one should first be pragmatic before adding unnecessary complexity to convolute things.

 

Ask the question first, is the log going to be serilized/deserialized? I'd hazard not because a log is generally not going to be a data storage medium, data storage is a distinctly different concern. Log parsing/interpretation possibly but we should deal with this as and when no?

 

At the most a formal key value data structure/relationship may be considered but again, it's probably over complicating things.

The single biggest problem in communication is the illusion that it has taken place.

Link to comment
Share on other sites

Link to post
Share on other sites

4 hours ago, Nuluvius said:

-snip

Thanks, the link had a pretty good example. 

Image.png.6d136a09a038bc284dc06b552c380c7d.png

 

 

Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×