parsing .properties file in Python

Say you have, e.g.: $ cat my.props first: primo second: secondo third: terzo i.e. would be a .config format except that it’s missing a leading section name. Then, it easy to fake the section header: import ConfigParser class FakeSecHead(object): def __init__(self, fp): self.fp = fp self.sechead = ‘[asection]\n’ def readline(self): if self.sechead: try: return self.sechead … Read more

Designing an EAV database correctly for historical data

An EAV ‘database’ [sic] is literally mathematically straightforwardly an undocumented description in triples of a database and its metadata, with no functionality to tablulate relationships, or query relationships, or query metadata, or type check, or maintain integrity, or optimize, or transact atomically, or control concurrency. Software engineering principles dictate that sound EAV database [sic] use … Read more

Entity Attribute Value Database vs. strict Relational Model Ecommerce

There’s a few general pros and cons I can think of, there are situations where one is better than the other: Option 1, EAV Model: Pro: less time to design and develop a simple application Pro: new entities easy to add (might even be added by users?) Pro: “generic” interface components Con: complex code required … Read more

PHP – File to Associative Array with 1 key and two values attached

Try this // file path $file=”orderdata.txt”; // REMEMBER TO MENTION THE CORRECT FILE WITH EXTENSION // open the file and get the resource handle with errors suppressed $handle = @fopen($file,’r’); // DONT USE @ while at development since it will suppress errors // array to hold our values $params = array(); if($handle) { // if … Read more

How to remove [ ] and ” from Python output [duplicate]

Try str.join(): the_dict = { “pres”: [“the President right now is”, “Joe Biden”], “FSUNick”: [“the seminoles”, “unconquerd”], “class”: [“introcution to Python”] } while True: print(“we have these keys”) print(“\n”.join(the_dict.keys())) print(“enter zz to end program or the word you want a listing for”) choice = input(“enter the string you want typed out”) if choice == “zz”: … Read more