Saving code in the database.
-
I am building a small JSFiddle clone because I have no code samples that I can legally show potential employers.
I've got the code preview bit done and I even have some decent syntax highlighting thanks to the ACE project.
I need to store code in the database somehow, I was just going to have a text/varchar column for HTML, JS and CSS.
Would you think this would be sufficient or has anyone else have any better ideas?
-
NVARCHAR(MAX) that bitch :)
-
Would you think this would be sufficient or has anyone else have any better ideas?
Oracle has CLOBs, I forgot the other DBs, but they mostly have similar stuff too.
-
Yeah, NVARCHAR(MAX) is about all you can do here.
You might normalize-out the language, though, in case people want to do like JavaScript only samples, or HTML only, etc. Or have multiple JavaScripts attached to one HTML, etc.
-
Why not a document store?
-
Because I would have to learn how MongoDB and then how to hook that up to Doctrine (Yes I am using PHP). Also I want to link what external libraries (jquery, mootools etc) and maybe some CSS libraries (bootstrap etc), I dunno how to do the equivalent of a foreign key lookup in say MongoDB or even if that is the right thing to do.
-
Then use MySQL blob.
Actually, I wasn't thinking about MongoDB but more about ElasticSearch.
-
I've worked a bit with Lucene (Elastic search seems to be based on it) but mainly with Sitecore.
I am not really a "proper developer" these days, I just tend to do a good job with CSS, JS and a server side language and I can make a decent SQL database.
-
I am not really a "proper developer" these days
Is wearing pants considered a requirement still? Asking for a friend.
-
The place I am working at has a liberal dress code, basically I was told "you can wear anything you want without flashing too much flesh" ... so I guess you could get away with a dressing gown with underwear and long socks.
However the main design pattern is a VB.NET SELECT CASE statement with 100s of lines of code nested in each CASE on every control ...
-
Considering that I sometimes work from home, no pants and sexy secretary!
-
Looks like MySQL blob as it saves stuff exactly as it went in which is exactly what I want.
-
The place I am working at has a liberal dress code, basically I was told "you can wear anything you want without flashing too much flesh"
The company my wife works for recently bought a tech company with several developers. As part of onboarding, they asked about dress code. Standard response, "pretty casual, but you need to be presentable, etc". Within the first week she had to send someone from her department down to talk to them about what "presentable" means.
The first time was for a guy wearing a shirt with profanity on it. Even I thought it was ridiculous and I use "fuck" as a comma.
Second time, no shit, she had to go talk to a developer about why not wearing underwear with baggy shorts and propping his feet on the desk exposes his testicles to the office.
These are the reasons that people think developers are slobs, etc. Are people more likely to remember the developer that comes in every day wearing business casual? Or the one who exposes his balls at his desk?
-
Maybe that was why the "what we consider acceptable dress" talk was half an hour long.
-
@Intercourse said:
Even I thought it was ridiculous
The shirt or talking to him about it?
(I think you mean the shirt, but not clear).
-
The shirt. It was in poor enough taste that not even I thought it was funny.
-
And given your avatar...!
-
yes, that is saying something....
-
@Intercourse said:
Are people more likely to remember the developer that comes in every day wearing business casual? Or the one who exposes his balls at his desk?
Definitely the second. I still have flashbacks to @PJH's earlier avatars
-
Oracle has CLOBs, I forgot the other DBs, but they mostly have similar stuff too.
Postgres has TEXT.
For example, your post, and the HTML version of it, are both stored in TEXT fields.