« first day (445 days earlier)      last day (4500 days later) » 

5:00 PM
@CharlesSprayberry ^5
 
I couldn't help it! I knew even as I typed it that I should just hit delete. But, alas...the power of the pun was too strong.
 
@CharlesSprayberry it was worth while...
 
Definitely!
 
Nice shirt!
 
5:01 PM
umm, no auto conversion love for me? :/
 
@JohnP ah, you were the one suggesting la noire when it was 75% off
 
Got some #mongodb schwag from @thilinag ! Thanks man! And the tshirt fits! @mongodb http://t.co/jHJRuBo2
 
@edorian why oh why doesn't it work for me?!
 
@JohnP No pretty printing for twitpics :)
 
@Gordon haha, yeah that was me. You didn't connect it till now? >.<
 
5:02 PM
/photo/1
 
ah, the pic links don't work
 
Or the chat just likes me better than you!
 
yes, living in tropical islands isn't all it's made out to be
we're also far removed from the usual schwag shipping routes
 
@JohnP nah, unless people have the same name as they have in chat i fail to connect them
 
5:04 PM
@ircmaxell You should post the article on reddit btw
 
yeah, probably doesn't help that I have one name for steam, another for SO and another for twitter :D
 
A quote relating to Mongo swag: "Here have a Mongo cup" - "Can I have two please? I need to reliably store coffee"
 
@JohnP it helps being unconnected, which can be desirable, too
 
lol
 
5:05 PM
@everyone: Good day to you all. I'd like to ask about your ideas, suggestions, opinions on user input validation for database storage.
Note: I'm using prepared statements with PDO
My initial thoughts on validation once the form is posted are:
1. use htmlspecialchars with ENT_QUOTES and UTF-8
2. use other business-logic validation checks (on formats, perhaps) where applicable
Is that good enough?
For the MySQL collations, what should i use? There are several utf8 collations like utf8_bin and utf8_general_ci.
 
@ircmaxell Huh, why isn't it shown in the listing?
 
rofl
 
@Nonym you don't need to use htmlspecialchars to validate. Use that when outputting
 
@Nonym Why use htmlspecialchars before you store it in the database?
 
you got me
 
5:06 PM
I wonder what happens if they attach it black side up :D
 
@Nonym Why do you tell us that you use htmlspecialchars when you ask about storing things in the database? :)
@Nonym I'm mainly asking because I'm afraid you might say you encode it before you store it
 
@NikiC cache perhaps?
 
@ircmaxell No probably spam queue. Happend to me once before they made me an approved submitter. You should ping one of the mods about that ;)
 
@JohnP, @CharlesSprayberry : Oh, right! I should only be concerned about using htmlspecialchars/htmlentities when outputing. slaps forehead
 
@NikiC I've submitted before successfully
 
5:09 PM
@ircmaxell Not sure whether this makes a difference
 
@edorian : Sorry, my head's not working.. I shouldn't be using htmlspecialchars/htmlentities before storing in the database, after all..
I should be worried about that during output time
 
@Nonym Mine nether, I didn't see you already got answers :)
 
@NikiC How can you tell if a link you submitted is in this spam queue?
 
fair enough
 
So sorry, guys.. My head's not in a right state.. so for validation.. addslashes should do.. since prepared statements help prevent sql injection already.. But am I missing anything else?
 
5:11 PM
@CharlesSprayberry It not showing up on the "new" page is a good sign :)
 
I mean, for database insertion.. Am I not lacking anything else?
 
@NikiC Fair enough. Anything special you need to do to be an approved submitter?
 
Nope. it seems fine. A collation for storing UTF-8 .. dunno :)
 
@Nonym you don't need addslashes. you'll be fine if you're using prepared statements
 
@Nonym The fact that you're using prepared statements is a big plus
@Nonym Although I'd be sure to set the charset in your dsn
 
5:12 PM
@NikiC pinged
 
@Nonym depending on the type of input, you might want to whitelist the data. So allow only a-z0-9 or something like striptags. And use PHP filters
 
@CharlesSprayberry Dunno, don't think so.
 
@edorian : Yeah, that's what I'm worried about now.. I was here in chat yesterday and got some posts from hakre that I should allow, for the most part.. valid characters.. and he pointed me in the direction of utf8 for encoding or collation.. so now i'm worried that i might not do it right..
 
@NikiC Finally, how do I ping a moderator? Sorry, I'm a reddit newb
 
@JohnP : Right again! Gosh, I'm stranger than normal today..
@CharlesSprayberry : I'm sorry.. How do I go about that?
 
5:14 PM
But if you allow "everything" than you are still save with PDO if you then properly escape the output when putting it in html
 
@CharlesSprayberry Don't know either ^^ I pinged frozenfire on efnet because I already knew him before but I don't know whether there is some official way ;)
 
I sent it through message a moderator on the right bar
 
@Nonym $dsn = 'mysql:dbname=testdb;host=127.0.0.1;charset=utf8' IIRC. One of the smarters guys will correct me if I'm wrong
@Nonym Of course filling in the appropriate values for your server
 
@JohnP : What does "whitelist the data" mean? I would use a filter for a-zA-Z0-9-_ for usernames and passwords and emails.. but it seemed that I should allow everything else (where applicable) for first names, last names, etc.. since I could get users from other countries using other languages.. Is this right?
 
@CharlesSprayberry Yeah, that's it. You need the charset as part of the DSN and to use 5.3.6+
 
5:17 PM
@ircmaxell And set PDO::ATTR_EMULATE_PREPARES to false? :P
 
@edorian : so I maintain using PDO, and then use htmlentities with ENT_QUOTES and utf-8 when outputting, is that right? I mean, htmlentities would suffice?
 
@Nonym depends on your usecase. For example, for an email I'd usually expect a very limited character set.
 
@CharlesSprayberry Yes
 
or something like a credit card number
 
@Nonym No, don't use htmlentities
 
5:18 PM
@Nonym You got it right the first time with specialchars, And yes: They do
 
does anyone know anything about non latin char email addresses? I haven't seen any, I'm assuming they allow it in the RFC?
 
hey
how do i check if a class is extending another class?
 
'lo
 
@Neal huh?
 
5:20 PM
instanceof?
look for extends in the class definition?
 
@JohnP yes, but i do not want to declare a new one until i know it exists
 
@CharlesSprayberry : Thank you.. so I should add ;charset=utf8 in my dsn.. !
 
So far i have this:
if(class_exists($model_name)){
    /**
     * @var AppModel $model_name
     */
    $this->$model_name = new $model_name();
}
else {
    //default model (no database chosen)
    $this->$model_name = new AppModel();
}
 
@Nonym are you using PHP 5.3.6 or newer?
 
How do i add on into that if statement that the model extends AppModel?
 
5:21 PM
@JohnP : I see.. so if I work with filter_var for email.. it should be acceptable for the general public, even for foreign languages?
 
@Nonym And $Pdo->setAttribute(PDO::ATTR_EMULATE_PREPARES, false) and upgrade to PHP 5.3.6+
 
@Neal if(class_exists($model_name) && is_subclass_of($model_name, 'AppModel')){
 
@Nonym yes, the filters use the RFC as the reference IIRC
 
@JohnP : ah, and for a credit card number, i'd probably follow the bank standards like what's acceptable for a mastercard, etc..
 
 $model_name instanceOf AppModel
 
5:22 PM
@edorian strings work with instanceof?
 
@ircmaxell That will work before i do new?
 
@Nonym yeah, you'd only want the numbers and strip out anything else
 
@ircmaxell There is no "string" in there is there?
 
@ircmaxell > Although instanceof is usually used with a literal classname, it can also be used with another object or a string variable
 
Hey, quick question, if I want to port an app from CentOS 5.7 to CentOS 6 I shouldn't have any incompatibility problems right? Any bugs/incompatibilities I should be aware of?
 
5:23 PM
@edorian $model_name is a string classname
 
For a LAMP stack
 
Oh that. yeah it does
 
@salathe ah fair
 
Unless your PHP app depends on something specific to that environment, no
 
But it doesn't check if it implements an interface does it?
 
5:23 PM
@ircmaxell : If I'm only accepting plain text for my input fields like names and descriptions, I still can't use htmlentities? I was thinking of using it to prevent any other tags.. Or is that something I shouldn't worry about if I use htmlspecialchars?
 
@ircmaxell thanks ^_^
 
@edorian @ircmaxell : Okay.. it seems I should stick with specialchars..
 
@Nonym specialchars will prevent all tags. Entities does something else
 
@ircmaxell : Yes, I'm working with PHP 5.3.6.. Is there something I should take note of?
 
@NikiC it's on the listing now
@Nonym the charset parameter to the DSN is only available as of 5.3.6. so just wanted to be sure :-D
 
5:26 PM
@ircmaxell good
 
Ok, going to go grab some lunch
 
enjoy
I'm off as well, g'night all
 
@ircmaxell will read the article later :)
 
I'm off too. Time to go home
 
@CharlesSprayberry : Okay, I'll look into the EMULATE PREPARES further..
@ircmaxell, @edorian : Thank you guys
@JohnP @CharlesSprayberry : Thank you as well
@CharlesSprayberry : I tried reading from the PHP site, but I'm afraid I don't quite understand why I should turn ATTR_EMULATE_PREPARES to false..
 
5:33 PM
@Eugene re
 
@Nonym Because for certain MySQL drivers PDO doesn't use native prepared statements but emulates one in code.
@Nonym Think of it is as a safety check to make sure your statements are being prepared by the database.
 
@hakre ?
 
jow back
 
@CharlesSprayberry : So it should be that the the driver should always try to use prepared statements that we set that attribute to false? (I'm asking to see if i understand what you mean by setting it as a safety check to make sure the database always tries to prepare the statement I'm using with PDO) (sorry for the trouble)
 
@Nonym Well, we want the statements to be prepared by MySQL and not by PDO. This explicitly states that we want this to happen.
 
5:39 PM
@CharlesSprayberry : AH! That's easier for me to understand! slaps forehead Thank you!
 
@Nonym Thank you. I like the opportunity to work on my wording :P
 
@CharlesSprayberry : no, i'm sorry, i didn't mean to make it look that way.. it's just that i didn't really understand that both pdo and mysql can prepare the statements.. in such that there are two entities that do that.. sorry
 
@NikiC I know, it's a bit long for your tastes
 
@CharlesSprayberry : just one other thing.. for the dsn, I should add ;charset=utf8 .. but what about when i create my tables.. i see many collations from utf8_bin to utf8_general_ci.. what should i use?
 
In a tree, I'm playing around between a null parent, or a NullObject instance for the root parent. My get_root() function will still need to test for a $this->_parent instanceof NullObject though, so it seems like the effect is negated (at least here)
Thoughts anyone?
 
5:41 PM
@Nonym Sure, PDO is just a library to query a database. You could replace MySQL with PostgreSql or something else of your choice
 
@Nonym PDO can emulate it, if MySQL doesn't support it. But it does, so why not use it
 
@Nonym That's a very good question and one that I've wondered myself.
 
@Nonym that's the connection charset only, not the database charset.
 
50 secs ago, by ircmaxell
@Nonym PDO can emulate it, if MySQL doesn't support it. But it does, so why not use it
 
@CharlesSprayberry, @ircmaxell : So in practice, it's best to let the database prepare it(first priority), and then PDO if it can't(second priority) ? It's slowly... starting to make sense!
 
5:43 PM
@ircmaxell I mean for the charset. but, I think @hakre answered
 
@hakre : Thank you for your help last time.. I was wondering what collation i should use for my table columns... so i got the connection charset down.. what about the database charset?
 
@ircmaxell "simple punkish drum style that Nirvana played": It's Grunge officially.
 
@Nonym utf8_general_ci unless you need either case sensitivity or something else
@Gordon Yes, I know. But I wanted to get across the comparison to Black Flag...
 
@ircmaxell : Thank you for the link.. I'll go through all items in it..
 
5:47 PM
@Nonym just some background on why it emulates by default
 
@ircmaxell Black Flag is Hard Core ;) which of course is a subgenre of punk.
> Grunge (sometimes referred to as the Seattle sound) is a subgenre of alternative rock that emerged during the mid-1980s in the American state of Washington, particularly in the Seattle area. Inspired by hardcore punk, heavy metal, and indie rock,
 
@Gordon musically they are very similar (in terms of riffs and melodic complexity
 
@ircmaxell hmm, i'd disagree to that.
not that its overly important :)
 
Are you disagreeing that both have a fairly simple and similar song structure (not that it means the styles are similar, I'm just talking about the musical technicality)
 
@ircmaxell : so utf8_general_ci it is.. since at the moment.. i don't have any idea yet why i would need case sensitivity for names, descriptions, notes.. and i hope i won't need it..
 
5:51 PM
hey all, has anyone ever gotten this before: /etc/httpd/conf/httpd.conf: Cannot load /etc/httpd/modules/mod_proxy.so into server: /etc/httpd/modules/mod_proxy.so: cannot open shared object file: No such file or directory
 
@ircmaxell i'd say nirvana is more complex. they are both raw and dirty, but nirvana doesnt sound like black flag. but im mainly saying that they are different genres, similar, but differnt, so "punkish" for nirvana is officially not correct
 
@ircmaxell , @hakre , @CharlesSprayberry : Thank you guys again..
 
@Nonym most don't
@Gordon Not saying it sounds like. More as if you looked at the music in bar notation, and didn't know what you were looking at, they would look very similar (whereas something from rush would look decidedly more complex)
 
alright..
My takeaway from this chat:
1. Continue to use PDO's prepared statements, using PHP 5.3.6
2. Add `;charset=utf8` to connection DSN
3. setAttribute(PDO::ATTR_EMULATE_PREPARES, false)
4. Database collation: utf8_general_ci
5. No need for addslashes during insertion
6. Use htmlspecialchars (not htmlentities) when displaying data that should be plain text (no scripts/code)
 
That list makes sense.
 
5:56 PM
hello :-)
 
"The Complexity of Songs" was an article published by Donald Knuth, an example of an in-joke in computer science, namely, in computational complexity theory. The article capitalizes on the tendency of popular songs to evolve from long and content-rich ballads to highly repetitive texts with little or no meaningful content. Article summary Knuth writes, with a grain of truth, that "our ancient ancestors invented the concept of refrain" to reduce the space complexity of songs, which becomes crucial when a large number of songs is to be committed to one's memory. Knuth's Lemma 1 states that i...
:)
 
@Gordon lol
 
according to documentatoin, "mod_proxy's already built as a module in the default CentOS 4 Apache"
Im using centos 5
not sure why it says cannot find it
 
@ircmaxell change "punkish" to balladesque ;)
 
@Gordon nah, I like it that way. I wanted to draw the connection to Black Flag and to Rush (although neither are direct connections, there's a similarity to both)
 
5:59 PM
@ircmaxell Fans from either camp will likely flail you for that ;)
 
I am a fan of all of them, so flail me all you want :-P
It's a gross overgenerialization to make the point...
ROTFL
Finally, the progress during the 20th century—stimulated by the fact that "the advent of modern drugs has led to demands for still less memory"—leads to the ultimate improvement: Arbitrarily long songs with space complexity O(1), e.g. for a song to be defined by the recurrence relation[2]

Vk = 'That's the way,' U 'I like it,' U, for all k > 0
U = 'uh huh, uh huh'
 
@ircmaxell That is absolutely hilarious
 
I like this one better:
> When the Mayflower voyagers first descended on these shores, the native Americans, proud of their achievement in the theory of information storage and retrieval, at first welcomed the strangers with the complete silence. This was meant to convey their peak achievement in the complexity of songs, namely the demonstration that a limit as low as c=0 is indeed obtainable.
 
@ircmaxell It is, but I read it anyways and it was good as always ;) Only thing that I didn't get is how the logger sample relates to the rest of the article ;)
 
@NikiC The hidden point that it takes far more code to pull off, since you need a file class which abstracts away the file operations...
 
6:07 PM
@KamilTomšík hey! didn't see you in a while here :)
@ircmaxell I thought so, but it wasn't entirely obvious, especially as $this->file could also be a pre made SplFileObject not a custom class ;) [okay, just checked, splfileobject doesn't have ->append(), so forget about what I just said ^^]
 
@NikiC Well, there is no append method there, so no it couldn't :-P (I explicitly avoided using SPLFileObject, since to me that's on the same abstraction level as fopen. I wanted to show multiple layers)
:-D
 
@ircmaxell never used it to be honest ^^
 
The only file related function I usually get to use is fgc ^^
@Gordon done
 
@ircmaxell i am creating the model part of my mvc
its getting interesting
 
6:12 PM
@Neal You are making nice progress :)
 
@NikiC hehe i hope so, the problem is i have to wean off my modelless code lol
 
@NikiC thanks
 
@NikiC :-D
 
@ircmaxell I am trying to remove all associations to mysql in the controllers
 
Hum, I think I should start coding some site again. I haven't worked on anything "real" for half a year I think...
 
6:18 PM
OMG the answers …
 
:-P
 
Yep, though so, last commit to a real site happened on 13. July :( => nearly half a year
 
Anyone have a good example of a simple Model for an MVC? right now im using the example from here: anantgarg.com/2009/03/13/… (modified for mysqli)
 
Is there any special convention to indicate in a docblock that a parameter is taken by reference? I mean, the signature speaks for itself, but is there any supplemental convention?
 
@Neal The "Model" is a collection of multiple layers. It's not a class.
 
6:26 PM
@Gordon yes, thank you.
do you have a better way?
 
@Neal why yes, make it a collection of multiple layers. Domain Model Layer, Persistence Layer. Cannot be bothered right now to explain it again in details. Did it too often already. Sorry.
 
@Neal My thoughts on the subject: "Model makes use of a variety of objects related to data persistence, validation, and whatever else your app needs to provide the appropriate data. Ultimately the Model should be able to exist entirely independent of the View and Controller."
 
@CharlesSprayberry well it needs knowledge of the view/controller, no?
 
@Neal In my opinion, no. I should be able to stick whatever View and Controller I choose to your Model and your app work.
 
@CharlesSprayberry can u explain a bit more?
 
6:31 PM
@Neal Well, my view on "MVC" is a tad...unorthodox. I wrote a blog post about it that talks more to the subject: cspray.github.com/2012/01/03/…
 
@CharlesSprayberry well have you seen what I have so far?
they were all telling me to add a model part
Right now all i have is the V and the C
 
@Neal Honestly no. I've tried implementing my own custom-baked Model before. Honestly, before I saw any code I'd want to see the plan/strategy you have for how your Model works. I think the problem is too complex to jump right to code before writing down some kind of plan
 
@CharlesSprayberry this is my modeless code: github.com/maniator/SmallFry
I am now adding a model part
 
@NikiC Hey. Wanted to ask you, have you ever worked with Doctrine?
 
6:51 PM
@Eugene nope, never used an ORM
I like SQL too much for that ;)
 
@NikiC you haven't lived! Try DQL!
 
@NikiC As I recall, Doctrine doesn't restrict the use of normal sql
 
@salathe Serious or Sarcasm?
 
@NikiC It just extends it in own unique way.
 
@NikiC I'll leave that without an answer. :)
 
6:53 PM
@salathe Okay, defaulting to sarcasm then, as my heuristics on you tell me :)
 
heh, yes my default mode is set to sarcasm.
 
Hoping sarcasm :|
 
-4
Q: How do I get the next weekday after a specific date in PHP?

Pota OnasysHow do I get the next weekday after a specific date using PHP? For example, if the date is 01/05/11, I want to get the next weekday which is 01/06/11. Also how do I get the next Monday, Tuesday, Wednesday after a specific date? For example, if the date is 01/05/11, the next Monday is 01/10/11 ...

 
@salathe thy4cv
 
I regularly think we must be Doing It Wrong™ for people to ask this question over and over again.
I refuse to believe people are so reluctant to take the time to search for the answer themselves that asking the question becomes the easy option.
 
6:57 PM
@salathe In that case you are just plain foolish ;)
 
@NikiC No denying that.
Closing the question and pointing to duplicates doesn't help with the problem at all.
 
yep
 
ahoy
 
Hi @ircmaxell
 
@Donut lol Robik. new name?
 
7:06 PM
Sup there @robik
 
@Neal I have this name for almost a month.
 
@Donut hehe guess ive just not been paying attn. all ur other accounts still say Robik lol
 
@salathe I still believe that it is just easier to SO as a code generator that produces working code than to look at a solution, understand it and adapt it
 
This one is still missing 2x delete: stackoverflow.com/questions/8731601/…
 
Thanks to people answering clear dups this is not going to change
 
7:09 PM
@Neal I wish I could change it back. I have to wait 9 days :(
 
@Donut hehe goto one of ur other accounts and push the account from there
its a good hack ^_^
 
Good idea.
 
@hakre +1
 
@Neal Work'd! :D
 
@hakre I so need 20k...
@Donut No, please, we want to keep our donut :)
 
> Reading the ZF2 "quick start" guide made me throw up in my mouth.
 
@ircmaxell lol
 
:-D
 
I wouldn't attribute that to the size of the framework but to the way they do configuration but well :)
 
@NikiC Then go ahead, change your name :)
 
7:19 PM
@Robik No. I'm not the donut type of person ;)
 
Well, the thing is, I've eaten last donut about 6 months ago, so neither am I. I just like 'donut' word :-P
 
7:36 PM
0
A: PHP OOP: Create a new class?

GordonIf you think about your student_courses and courses tables in terms of objects, you will notice that the student_courses are the really interesting and individual objects for the student. They are what you want to have your Student object connect to. What you have in Courses now is just the non-c...

does that make sense?
 
Can anyone remind me what was the diff. between Doctrine 1.2 and Doctrine 2.x?
 
7:40 PM
 
@Eugene they are different versions?
 
Active Record and Data Mapper?
 
@ircmaxell Yee. Probably that too. :)
 
if not, that would be quite awkward
 
@hakre Right. I think, that this was it.
@hakre Ty.
 
7:44 PM
Shouldn't be used VS currently best PHP ORM solution out there
 
@edorian Well it is better then Propel and on that my knowledge probably ends. Propel and Doctrine.
 
@Gordon Mostly. Not sure why you'd introduce courseDescription object to be honest
 
@ircmaxell Though admittedly I must say that some comment on the logger example in the article would have been nice ;)
 
@edorian because these parts dont change for a course and I dont want properties for them on the Course instance. It's a variation of the ItemDescriptor Pattern.
 
7:49 PM
@NikiC sure
 
@ircmaxell But yes, don't feed the troll :P
 
sigh...
 
Oh and "Just because you don't understand, doesn't make it wrong..." definitely is a bad idea
I know, you are right, but he'll be offended by it and argue further
 
@Gordon reading
 
And it doesn't fit your nice-guy imagine ;)
 
7:51 PM
@edorian its in the middle of the right column on page 2
 
@NikiC :-D
 
@ircmaxell Don't have you have anything worthwhile to do?
 
@edorian yes, yes I do
 
And yes: I'm aware of the irony in that statement :)
@Gordon Can you make your point again using more colours please?
 
@edorian more colors? As in Coad's color coding? Oo
 
7:54 PM
@NikiC burned my votes for today now.
 
@Gordon Ok.. yes.. maaaybe
I can easily see taking those properties out for objects of which multiple copies exist
 
@edorian thats the point
 
So If you say to me that this course is usually given 2:n times than I'd do it like that
But to be honest I just didn't think of that.. for me a course only existed once
 
@edorian eih, many students many courses
 
7:58 PM
(as next years course would have a different description)
But all right then. Then I know how to call those objects that I build two weeks ago :)
 
@edorian in the OPs scenario students have to pay for a course, hence that part is variable and individual to a Student. you and i could take the same course. its description would be the same, but it would still be individual for each of us on the instance level.
 
"Item Descriptor" sounds a lot clearer than "The stuff that is the same for all the stuff of the same type"
@Gordon Argumentation using business knowleague is so mean/great :)

But if those course would be held once It wouldn't matter to me as all students would have be connected to the same "course" object.
 
@edorian unfortunately there is also a Type Object pattern which is supposedly an alias, so I'm not entirely sure if Item Descriptor is right
 
> Intent: Decouple instances from their classes so that those classes can be implemented as instances of a class.
Yo dawg?
 
8:04 PM
@edorian its funky. i like it.
 
HUH?
decouple instances from their classes? anonymous objects?
 
@edorian i didnt get that statement?!
 
Note to self: Note the arrow
@Gordon If a course is only given once It can hold it's own description for all I care for even if 20 students have that object in their "visited courses"
@ircmaxell The text seems a lot more readable than the intro
 
@edorian thats actually the same as having Courses and CourseDescription. You still separate the static from the dynamic, e.g. VisitedCourse has all the changing data. And can link to the single Course of yours.
 
fair
 
8:11 PM
But I don't see the point of having a "BlogPost" that doesn't own its description f.e. - And If courses are unique entities thats kinda the same for me
@Charles Welcome back
 
@edorian You are about to unwelcome me.
I have discovered another MySQLism that has ruined my day.
Search for "Furthermore"
I thought I knew all of the things that MySQL did silently incorrectly.
 
@edorian because there isnt multiple BlogPost with the same description
 
yes
 
Today, I have learned that as a result of this and blind trust that it was working correctly, I have 6-7 tables in my dev and production databases that have no fkeys.
 
LOL
 
8:13 PM
@Gordon And all I'm trying to say is that if you don't have courses that can be taken multiple times then: yes thats my point. If that's a requirenment your approach is good.
 
In computer programming blind faith (also known as blind programming or blind coding) is a situation whereby a programmer develops a solution or fixes a computer bug and deploys it without ever testing his creation. The programmer in this situation has blind faith in his own abilities. Another form of blind faith is when a programmer calls a subroutine without checking the result. E.g.: A programmer calls a subroutine to save user-data on the hard disk without checking whether the operation was successful or not. In this case the programmer has blind faith in the subroutine always perf...
 
@Gordon I am somehow both surprised and unsurprised that there's a wikipedia article for this situation.
 
Heisenbug is a whimsical computer programming jargon term for a software bug that seems to disappear when one attempts to study it. The term is a pun on the name of Werner Heisenberg, the physicist who is commonly associated to the observer effect of quantum mechanics; which states that the act of observing a system inevitably alters its state. Other similar terms, such as bohrbug, mandelbug, and schrödinbug have been occasionally been proposed for other kinds of unusual software bugs, usually in jest; however (unlike Heisenbug) they are not widely known or used. Examples Heisenbugs occur...
 
@Charles MySql doesn't follow a SQL standard? Hmm. Now thats now and unsuspected :)
 
At least we can take solace in three facts: 1) nobody's using the feature because people are idiots, 2) they were there only so we could ensure sanity, not because we're trying to block insanity, and 3) the rest of the hundred or so tables in the database don't have fkeys anyway, so we're already screwed.
@edorian A real shocker.
 
8:16 PM
Foreign keys in mysql. What is this. 2017?
It's not called "Oracle starter edition" because its feature complete :)
 
@edorian then upvote it :P
 
On a more serious note: I didn't know that :) then again I don't work much with mysql outside of work and we don't have InnoDb tables for the most part
 
Well, all it does is enforce our decision of using postgres for the new projects.
We can use fkeys and check clauses and all sorts of normal, modern goodies ... and they actually work!
 
Next thing you are going to say is triggers, procedures and transaction :P
 
Ooook
 
8:21 PM
Using relational database like they are supposed to be used.. what a novel approach to web development ;)
 
Here is what I have now for a Model SELECT:
function select($options){
    $select_query = "SELECT * FROM %s %s %s";
    $where_section = array();
    $order_section = array();
    extract($options);
    if(isset($conditions) && is_array($conditions)){
        $where_section = $conditions;
    }
    if(isset($orderby) && is_array($orderby)){
        $order_section = $orderby;
    }
    $where = "";
    $order = "";
    if(count($where_section) > 0){
        $where .= "WHERE ". implode(" AND ", $where_section);
    }
    if(count($order_section) > 0){
How can I expand that?
well obviously remove the extract with something better?
 
@edorian Gods forbid we might actually find a purpose for stored procs...
 
@Charles See! Thats how db interaction is supposed to look like. Just mash together a string and throw it against the db somehow someway and see if it works
 
@Neal Why are you writing your own SQL builder when there are dozens out there that do the job just as well?
 
@Charles Can you send me a good small example?
 
8:24 PM
@edorian Heh. Actually, we are indeed struggling to find a purpose for stored procedures. Every time we think of one, we sit down and think it through a bit more and discover we're already doing the checks in our business logic. We aren't dealing with a complex or interesting enough data set, I think.
@Neal No, because building SQL is non-trivial and all of the best examples are very, very not-small.
 
I'd rather say "better" (or well.. not pointless sql builders) .. but then again I don't see the point in having slq-string-concatinators anyways so I shouldn't be asked on that subject
 
The more and more you work at building an SQL builder, the more and more edge cases you find, and the more and more complex it becomes.
 
@Charles well ok. could u send me a good example? (not small, but relatively understandable?)
 
@Neal I found the SQL builder that Zend Framework uses to be ... palatable.
 
@Charles I realize that
@Charles All i need is select where order by
basically
 
8:26 PM
@Charles You are "keeping the database scalable" :)
 
@edorian There we go, I like that.
 
Looking at the MySql 5.6 docs for some stuff just shows me that I didn't do all that much db work last year
And since we put in 64gigs of ram in the machine and fixed all the ulimit issues half a year ago I didn't do much performance wise ether.. except making it use up the memory we gave it and tuning it a little
 
Bob Martin sounds drunk in some of that interview... :-D
 
Robert Martin or someone else
 
8:35 PM
All right. Just wanted to make sure as people usually say "unclebob" or "Robert C. Martin"
 
I almost wrote Uncle, but eih
 
Well if you'd make money of of talking to people like that troll on reddit for +10 years :)
 
yeah, this is true
 
Even so I didn't have that thought
 
that was an interesting interview
 

« first day (445 days earlier)      last day (4500 days later) »