« first day (646 days earlier)      last day (4306 days later) » 

9:00 PM
Ok, but according to your arguments, it makes it more flexible to switch
 
if customer wants a specific RDBMS , it might be a warning sign
 
@tereško Customers are customers. Some don't want to run 2 RDBMSes because you developed your app to use a different one from the one they use.
@ircmaxell If you wanted to, I'm sure it would be a lot less work to hand PDO a different DSN and rewrite a few queries than it would be to build a new class to your data storage abstraction interface, test it, and then rewrite the queries as well.
 
eih, but now you've duplicated all your code...
 
OK, I think we're going in circles here... if you didn't use PDO wouldn't you just have even more code to duplicate?
 
And don't be so sure about that. Have you written tuned applications for a specific RDBMS?
even how you structure your schema will usually change
so to say "rewrite a few queries" usually is far from the truth
 
9:05 PM
i just had to attempt to explain rage faces to a group of 40+ year old people
 
Okay, maybe that was an exaggeration. But "rewrite queries" still seems like less work to me than "Build additional DB interface class, then rewrite queries".
 
27 year old chick in there too
yeah thats my job
 
Did you try to explain by example? i.e. yourself?
 
haha no
 
@GordonM if you need to build a db interface class to your data mapper (that isn't stupid simple), you're likely doing something else wrong and over-abstracting your code anyway...
 
9:05 PM
all that it result in was me looking like a dumbass
 
@ircmaxell Somewhere in the code, at some point, there's got to be code that uses some method to interface with the database, be it in a datamapper or (God forbid) directly in the business objects it's got to be there somewhere. I'd rather it was all done through a uniform interface. But that's just me.
 
@GordonM I have no issues with different classes using different dependencies...
 
I dunno, "Bad defaults" seems a slightly weak argument to me for doing work you don't have to. Surely setting sane values for PDO is still going to be less effort :)
 
I'll write a blog post one of these days about it
 
Look forward to it.
I'm all for being proved wrong if I can be a better coder for it.
 
9:21 PM
Go go gadget eval(): stackoverflow.com/a/11620609/508666 :)
 
Ow! My soul!
I'm glad you prefaced that with a remark about how you should never do that!
 
Yeah I think I've mentioned it a couple of times ;)
 
I did get that impression
 
@PeeHaa expression on face while posting
 
:)
 
9:26 PM
Wow, I think that video might have crossed the camp event horizon.
Need to man it up a bit, I think.
 
http://stackoverflow.com/questions/9181160/pdo-mysql-prepared-statements-not-escaping-characters
So that's why prepared querys does not escape '#' ?
if cannot escape it, theres no way to insert # into db?
 
how would one store a php array in a mysql database? I won't need to query the array, but I will need to read from it and update it
 
@LoganBesecker Sounds like you need a separate table
 
serialize?
 
I'll need to do this for each user on a web application. I asked if it was common/viable to have a separate table for each user here: stackoverflow.com/questions/11496683/… and they said not to do that..
 
9:37 PM
@webarto NO!
Having to work with a database full of serialized data is a nightmare.
 
yes I know, but what are the options?
 
@LoganBesecker If you need to read it and update it then you need to query it :)
Table with a column for each key in the array is pretty much teh standard way isn't it?
 
@webarto would I store the string in a varchar, blob, or text? also, the array is going to be quite large, possibly in the hundreds of thousands.
@GordonM I don't know.. I'm still getting my feet wet haha
 
ask yourself if that is the only way ;)
 
I'm learning as I'm going. I'm a computer science student but have only been instructed on c++ so web dev is new to me
 
9:41 PM
I'm going to replace it, end. Thanks anyway for sugestions/tries to help me out
 
If it's an array with a relatively small number of distinct keys that represent different things then you probably want a table with a column for each key. If it's a big array of uniform data then you probably want a table with a row for each key. If it's something else tehn you might need to rethink your design and/or storage strategy.
@webarto The amount of stuff I've seen in out database that looks like that... did I mention I'm in the market for a new job?
 
@GordonM what is your salary requirement?
 
Same or better than my current one and a clause in my contract that says I'm entitled to punch any coders that serialize data into the database in the face.
 
One way I was thinking of making it work was to have a row for each key(each key representing a single user) and having around 10,000 columns which would each hold a single element of an array. Is something like that common/viable?
ahaha
 
@GordonM I do agree, but... is it better to update one column with relatively small amount of data, or update 10 columns?
 
9:45 PM
@LoganBesecker Wow, how much data are you storing on your users!
 
well, I need to track a certain action that they perform. I originally planned to store all data, but I think the most recent 10,000 would work.
 
shish
 
@webarto You can't search on individual key values if you serialize data, not without using REGEXP or the like, you can't construct meaningful indexes on the data, you can't validate that the data you put into the database is the correct type because your serialized column always has to be VARCHAR or TEXT, you can't change an individual value (you have to pull the entire column unserialize it, change the item of interest, reserialize it and store it back)...
 
user895378
@LeviMorrison Just got back into town ... on the computer for a few minutes. Going to hit the gym in a bit though then be back for serious catch-up coding later this evening
 
9:48 PM
there's just far too much pain introduced by doing it for it to ever be worth it
 
user895378
@LoganBesecker When you said 10,000 columns, did you really mean 10,000 columns?
 
user895378
I hope not.
 
user895378
If you think you need 10,000 columns ... you're doing it wrong.
 
yes... I was wondering if that would be viable
 
@LoganBesecker I'm really not sure what you're trying to accomplish, so I'm just guessing (an activity log?), but it really sounds like you're not thinking your database design out properly. An RDBMS isn't just a fancy filesystem, it's designed to model how items of data are related to each other.
 
9:49 PM
haha
 
The clue's in teh name. Relational Database Management System ;)
 
user895378
@LoganBesecker What @GordonM just said is correct. What exactly are you trying to model?
 
It sounds like if you're doing what I think you're doing then you need 2 tables. One for users, and one for user activity. The first table will store general user info (a unique ID, name, email address, etc), the second one will store an ID column, a timestamp column and an activity column.
 
user895378
^ what he said.
 
Every time the user with the ID 8 does something, add a row to the activity table.
 
9:50 PM
been thinking here (i know ,i should better stick to things i am good at , right) .. ins't routing mechanism actually part of domain logic ?
 
Of course that's all based on a pure guess at what I think you're trying to achieve...
 
@GordonM I know, it is just that Zend_Auth is using serialized array in data column, and it is PITA to change or look for anything... when I once proposed change, I was told "but Zend does it like that, it must be right..."
 
user1320842
whilst we're on the subject on databases, how do i do a "from table1, table2 where table1.id=table2.id" but still show table1 if it doesn't have a table2.id?
 
@webarto
@JohnDoe LEFT JOIN
 
@JohnDoe learn to use joins
 
user1320842
9:52 PM
ok, thanks
 
user895378
@tereško I've gone back and forth on where it fits exactly, but I think if you're talking about HTTP applications it makes sense to have a standardized routing mechanism that doesn't vary from project to project
 
@rdlowrey , i was thinking of this in context of View instances .. you see , View needs a router , because you are require to generate URLs
 
@GordonM @rdlowrey I'm trying to rank things based on users' comparisons to other similar things. ie: if you have 3 items: 'A', 'B', and 'C' and a user says 'A' > 'C' and that 'B' > 'A', then 'B' > 'A' > 'C'. But with a whole lot more that just three items.
 
if routing was already part of model layer , then i cold just add a service an be done with it
 
user895378
@tereško I was thinking of it in similar terms since our MVC discussion the other day.
 
9:54 PM
so I'll need to keep track of a huge amount of data to beable to connect all items in the database
 
but now i have to inject two separate instances in the view's constructor
 
Sorry dude, but I'm not doing your entity relationship modelling for you. Especially not on such a vague spec :)
 
haha, I was just wondering how I should store arrays in a mysql table
 
@LoganBesecker , you put them in separate table , get this books SQL Antipatterns .. your issue is covered in first chapter
 
I can't tell you what you should do, that's up to you. All I can tell you is that you shouldn't store it as a serialized string. The pain it will cause you is simply not going to be worth it.
And I promise you, it will cause you agony in a few months time. Huge datasets + no structure = disaster waiting to happen.
You might also want to look for a book called SQL antipatterns.
 
9:58 PM
@tereško wouldn't I then need a seperate tabel for each item? or would I use the key as the columns then use the rows to store the elements of the array, then when I fill up the max size of a row(holding the keys) I would create another table and use JOINs?
 
Jaywalking. Avoiding an intersection!
 
user895378
@tereško I'm approaching it from an event-broadcast perspective. Instead of using a routing mechanism to determine the view, I'm using routing to determine the appropriate controller. From there the controller and model objects broadcast events. View classes are registered as listeners for any events they're interested in (and models as well).
 
hey there
 
user895378
@tereško I don't have specifics totally worked out, but I should in the next few days -- at which point I'll want feedback from people ...
 
The advice in the SQL antipatterns book is mostly good. Some of it is questionable, but if you're an SQL newbie then it's extremely valueable.
 
10:00 PM
is there any option to create a temporary css file using php ? Using tempnam or tmpfile i can create a php file
but how do i create a css file ? Any help would be great
 
@GordonM , which parts were "questionable" ?
 
@GordonM thanks, I'll check it out :)
 
@tereško Well in the second chapter one of the soluctions he advocates is (by the author's own admission) a variant of the jaywalking antipattern from the first chapter. Also his assertion that storing files in the filesystem and not as blobs struck me as questionable.
 
> From there the controller and model objects broadcast events. View classes are registered as listeners for any events they're interested in (and models as well).
@rdlowrey , sounds a bit strange
especially in context of web
 
user1320842
is it safe to use multipart/form-data if you're not using $_FILES?
 
user895378
10:03 PM
@tereško I know it sounds strange :)
 
and that was not what i mean by "views need the routing mechanism"
 
user1320842
@itamar $tempFile = tempnam("/tmp", "css"); $target = fopen($tempFile, "w"); etc
 
also , i much prefer the Model2 approach over the original MVC concept
 
user1320842
it creates a temp file then fopen can save into that temp file...
 
@JohnDoe , the second parameter sets the file's prefix, not the suffix
 
user1320842
10:05 PM
i know
 
so the "css" setting will assure the file would be a .css file ?
 
user895378
@tereško I generally prefer Model2 as well. I'm experimenting with both with the event support.
 
user1320842
all it means is that the css tmp files will be labelled as css, it has no effect on it whatsoever ^_^
 
so there won't be any problem using this file as a css file ?
 
user1320842
no problems
 
10:07 PM
ok , thanks ! : )
 
@GordonM are your views on json_encode the same as yours on serialize?
 
user1320842
json is awsome, don't insult it >.>
 
@LoganBesecker Yes. The problem is the concept, not the implementation. Doesn't matter if it's serialized PHP vars, or JSON, or XML, it breaks fundamental good design practices for SQL databases.
 
@JohnDoe the original question was about storing strings in a database. He didn't like when people serialize them because then you can't query them
 
(Well some databases have rich XML capabilities, but that's beside the point)
 
10:09 PM
hmm, ok. I guess I'll keep thinking about another solution
 
user1320842
ah, i serialize them ... i hate doing it but sometimes it's required unless i restructure the database rather than using lots of columns :O
 
@LoganBesecker I'd strongly recommend trying to model the problem you're trying to solve before designing a schema. Don't just start slapping a database and code together without a plan, and if you're not sure what it is you're modelling how are you going to model it properly?
 
The whole damned View thing is confusing me
 
yeah, I'm new to databases so I'm probably going about it wrong haha.
 
@LoganBesecker , then maybe you should start by learning some basic SQL
you won't be able to copypaste examples for everything
 
10:13 PM
Sorry dude but I'm going to have to go with @tereško on this one. Aren't views meant to be basically dumb, capable of only echoing out the data assigned to them in the appropriate format?
 
I'm curious though, is there a reason that there isn't an array datatype in SQL? if there was, it seems like it would be easy enough to query
 
@GordonM Not in the least...
There's always display logic associated with rendering content
 
31 secs ago, by GordonM
Sorry dude but I'm going to have to go with @tereško on this one. Aren't views meant to be basically dumb, capable of only echoing out the data assigned to them in the appropriate format?
lolwut ?!?
 
@ircmaxell Well yeah, foreaches and the like. But Routing logic, in a view?
 
No, not routing logic
 
10:14 PM
@GordonM , please stop , i almost drowned in my tea
 
but pagination? View. Sorting? View. Fetching data to display? Possibly View (depending on your exact circumstances)
There's definitely room in a View for non-trivial code. But the key is that it should all be presentation logic.
 
@tereško I was working with mysql a few months back(not copy pasting, I knew how to write queries) but I haven't taken any database classes yet or read any books on it other than how to form simple queries
 
then you should pick one up , preferable something that deals exclusively with MySQL
 
@LoganBesecker SQL is an implementation of Relational algebra (well not strictly so, but close enough for most purposes). One of the first rules of relational algerbera is that items in each row (I forget the relational name for them. Tuple?) must be atomic, as in it can represent one thing and only one thing.
@ircmaxell Sorting? Shouldn't the back-end hand the data to the view in the order it ought to appear?
 
@GordonM the model will likely perform the sort, but the view should have the logic around what and how to sort
 
10:20 PM
yeah, I was refered to amazon.com/gp/product/1890774561/ref=oh_details_o00_s00_i01 and it's set to arrive on the 25th. It seems to be more focused on how to structure queries which for starting out would be nice. Can anyone recommend a book for modeling a (my)SQL database?
 
@ircmaxell Okay, maybe dumb was the wrong choice of word.
 
yeah, I get what you're trying to say
 
But they definitely shouldn't need to worry about routing :)
 
that's fair
 
@ircmaxell so if you paginate something, you pull out all entries, and pass them all to the view for paginating?
 
10:22 PM
@orourkek not usually
 
@ircmaxell , the issue that i was bothering rdlowrey with was , whether routing mechanism should be part of the model layer .. the thinking is that the generation of pretty links happens in the presentation layer. And the routing exhibits a lot of aspects commonly associated with model. In some application you even have routing directly dependent on data from database (url that are based on page titles , not ids )
 
@tereško That's an interesting one...
let me think on that for a sec...
 
I just finished writing another paginator (not in the view), and was curious
 
take a day (i have been trying to wrap my head around this for a week or so)
 
Well, my first instinct is that routing would be outside the MVC triad, meaning that it should be routed before it even gets to the controller, since routing would need to happen before a controller was entered
 
10:23 PM
At the risk of putting words in @ircmaxell's mouth I think he means the view needs to be aware that the data might not be the complete dataset, though it probably shouldn't need to be worrying about how to cut the data passed to it to the requested subset
 
But that doesn't solve the generation of pretty link issues...
Then again, generating links isn't a view concern, since it would be tied to the application as a whole (it's not a presentation layer responsibility)
 
what are pretty links?
 
So, if routing falls outside the triad
then generating links also falls outside the triad
But if you do that, the cross-cutting concern will cause issues...
So, what I would do, is make routing a component of the model
make it a service provider
 
@LoganBesecker They're the links that don't have trouble getting a date for the prom
 
@GordonM my take has been to force the view to not care about how much data is passed to it, such that even the pagination details are passed in
 
10:25 PM
and round and round we go ..
 
ahaha
 
The view can access the service, the front-controller (outside the triad) can access it, the model can access it
So there's my answer: It belongs as a service inside of the model, seperate from the rest of the business objects it would route...
 
@LoganBesecker http://example.com/blog/2012-07-23/this-is-a-somewhat-pretty-link
 
user895378
@ircmaxell That summary makes me happy. That's what I've settled on, though I wasn't able to express it quite so concisely.
 
@ircmaxell seems reasonable
 
10:28 PM
@ircmaxell I tend to find it helpful to think in terms of models, services and utilities. Models collectively being the domain you're modelling, services provide useful functionality that requires access to some external resource and utilities do the same except without external dependencies. So a data mapper would be a service (it talks to a data source) and a password generator would be a utility (they usually don't need to talk to anything)
 
someone should forbid him to drink , while online
 
Ok, I'm off. Later
 
Have fun
 
hmm .. the old Believe album from Disturbed is quite good for late-night developing
 
too loud for late-night :{
 
10:45 PM
got ground floor corner apartment with thick walls
hmm .. damn ... I am starting to get a feeling that one of my factories is turning into as Service Locator
and not in a good way
 
11:17 PM
Question for you guys: With a user database, I have a "merge duplicate user" tool. Currently, that tool will reassign any relational data owned by user A to user B, then delete the user A row from the database. I have seen a different approach where the row is left intact, but a field in that row indicates if the "master" record is that row itself or a different one. In that case, a merge would leave all the relational data intact and simply change that one field in user A's row
Which do YOU prefer?
 
I don't know if that was intended as a reply to me, but thanks for the new desktop background :p
 
@Chris , IMHO, if you intend to have such a merging functionality , you would have to separate the user accounts details from the user details
 
both situations seems legit, only thing is, with option 2, unmerge is probably possible... question is, do you need (want) that... I usually write "this action cannot be undone etc"... and go for option 1...
 
That's what I have now, the "OH NOES!" warning with a destructive merge
 
11:22 PM
basically each UserAccounts entry can have multiple UserDetails
ad for wallpapers : this where to look for them : http://browse.deviantart.com/customization/wallpaper/
 
dA is a cool company to work for
 
@tereško Oh I know all about DA... I've posted some even: browse.deviantart.com/…
 
it's written in PHP
 
Disclaimer: I am not an artist, and the tool was MS Paint
 
11:25 PM
it is noice
 
in any case , @Chris , merging of two accounts should not be a complicated task and you should no be required to update all the user's content
 
@tereško That... is interesting. Funny, we're denormalizing tables lately to speed up queries, so it would be an interesting debate at the next meeting to suggest more fragmentation/normalization
 
@Chris , usually, instead of speeding up queries , you should look into caching solutions
 
when I was little I used to "fill" areas with pencil, I didn't know that CTRL + T wiil bring up Toolbox with bucket tool, I sometimes spent half of day painting area with pencil... it was fun. All I do now is code in PHP and have no life. PHP ruined my life.
 
there are cases where denormalization is the pragmatic way to go ( like counting votes or comments ) but it is in very special cases
 
11:29 PM
@tereško So right now, it's transactions, tickets, membership, etc, etc, lots of relational data. The merge tool currently changes the user_id field on all that from user A's ID to user B's ID. It isn't exactly heavy lifting, and I can delete the user A tuple for a squeaky clean table. The proposal is to instead add a masterUserId field to the user's table, which would usually be self-referencing -- the merge would simply change that field.
 
here is a question for you
 
The denormalization stuff is mainly happening surrounding tags -- there's a boatload of tags on items and the progressive search crap can't cope with high-frequency refreshes
 
when you ask tereško a question all you get is a question you can't answer
 
Caching... oh do we need to look in to caching
 
@Chris , if you are so fixated on the performance , why don't you have already a separate table for user account data ( password hash, email ) and user details ( name , address , stuff ) ?
 
11:31 PM
Everything in this project is so highly oriented toward high-performance INSERTING, unfortunately 90% of the work is SELECTING
 
CREATE TABLE stuff
MySQL?
 
@tereško Not my design, I rarely get to work on things that I designed from the ground anymore
Aye, mysql
 
so you are stuck in the garbage detail: "this does not work, fix it .. yesterday" .. you open code and it is all globals , error suppression and spaghetti
 
Yeah, basically
I haven't worked for a startup in like 2 years
I miss those crazy cats
And their huge bank accounts
@tereško well, most of that kind of stuff is gone (globals, spaghetti), but you know the score -- try talking penny-pinching non-profits into spending xxx dollars on code optimization. The response is unvaried as it is disappointing -- "You want us to spend $5,000 to make our system... do exactly what it does now?"
 
but faster :)
 
11:35 PM
On their spyware laden Windows XP computers with IE as the browser of preference? They wouldn't notice the improvement :p
Oh were it only 2007 again
 
you are not in enviable situation :P
 
I've been doing this for... oh God it's been 4 years now
 
@Chris , you are positioning it the wrong way: what you actually want to do is improvement in the infrastructure , so that it would become possible to add functional improvements (faster or at all) and to cut down future maintenance costs
 
if they don't see that after you presentation, I think you should leave... and they will call you back...
(don't try this with girls)
 
but on the other hands ... i think we will soon get to the point were several regulars in this channel will start a development company
 
11:38 PM
There is a committee that meets to hear the recommendations of a committee that meets to hear a report from the guy that I meet with, that's how the project cycle starts. It's like a game of telephone... with drunks.
 
quick simple question
is there any thing also to put on or un-comment form php.ini to display all possible errors.
other than `error_reporting = E_ALL`
 
@tereško Heh, if you can cover the crap 35k I'm making a year right now, I'd give up a kidney just to review code documentation at said company.
 
error_reporting = ∞
 
@Chris , this is why you should present your proposal as powerpoint slides .. the next guy up the ladder will be lazy and reuse them
 
Heh, that's not a bad idea
 
11:41 PM
@Chris how much is not crap salary then?
 
@webarto really.. :P
 
@Chris , i always have been interested in ways to hack the organizational pyramid =P
 
Umm, if I could get back to 65k, where I was in 2007, I'd be happy. I don't even want to make much more than that, seriously. I hate the bleep out of money. I just want to make student loan payments again, it would be... novel.
(I live in Michigan, that ought to explain much)
 
@Chris that is sirius money when you live in 2nd-3rd world country, but not for USA...
 
lol
 
11:43 PM
Again... Michigan. We're 2nd world-ish
 
here a well paid developer gets $18k per year .. but usually it is somethin like 12k
 
I am perfectly content with that, though. I like dirt roads and corn fields
 
here you can get $10k max
 
@tereško Cost of living would, in comparison, also be lower
Typical rent in my area is around 800 a month for a 2-3 bedroom place or a modest mortgage
 
depends how you define living, if that is surviving, then you can do that with $500 easy...
 
11:45 PM
@Chris , that's the same here
 
I have 2 kids, a wife, 2 dogs, and I enjoy eating 3 meals a day. I don't really look for much more than that, 35k is basically enough to keep us clothed, fed, and housed.
 
I pay $500 for apartment in center of Belgrade (Serbia)
@Chris you win
 
Win wat?
 
yeah .. you are at that point where you got a baggage and cannot change anything
 
what breed are the dogs? :)
 
11:48 PM
the dumb and useless breed
 
@webarto - If I was hunting for an old Serbian band, like 80's era, and I only know for sure the singer's first name, do you have any idea where I could start? I do know they were fairly popular.
 
name?
 
@webarto A Basset Hound and a German Shorthair Pointer
@webarto The singer's name is Mario.
 
nice, I have Parson Jack Russell Terrier, and he is smarter then some people that come in this chatroom...
any song perhaps? mario isn't serbian name, more likely croatian...
but same s*
(back in the '80s)
 
@webarto your dog breed look like TIN-TIN's snowy
 
11:51 PM
No. I knew the guy from work, and he showed me a magazine cover that he and his band were on. He was definitely Serbian. He and the rest of the band were there when "the war" broke out, the rest of the band died fighting and only Mario made it.
I've lost track of the guy, and I want to try and find him again in this crazy world... he was a good mate, and we lost touch when I moved out of state. The language barrier... I couldn't pronounce (and now cannot remember) his last name.
I think I taught him like 60-75% of the English he knew at the time of our parting, but I still couldn't say his damn last name.
 
hmm ... i actually might be able to seen start commiting stuff to that damned framework repository
 
@Chris Knezović?
@tereško if you have nothing better to do :P
 
well ... i have a project , in which i am testing the concept
the idea is to extrac the framework later , document it and put on github
basically , this means that i am getting paid for making a framework which i wanted to make anyway
 

« first day (646 days earlier)      last day (4306 days later) »