« first day (648 days earlier)      last day (4300 days later) » 

6:00 PM
hey fellas
when i was first learning mysql i was taught to use an ENUM field type for boolean fields and just put '0','1' as the accepted values. is there any reason to not use the bool or boolean type instead?
 
I don't think ENUM is as portable as bit or int(1)
 
I usually use BIT
 
oh, because other db systems dont have enum type?
and im assuming BIT only allows 0 or 1
 
@AndyPerlitch I don't believe so.. but as I say that I can't think of any examples
12
Q: Why is ENUM better then INT

Jan HančičI just ran a "PROCEDURE ANALYSE ( )" on one of my tables. And I have this column that is of type INT and it only ever contains values from 0 to 12 (category IDs). And MySQL said that I would be better of with a ENUM('0','1','2',...,'12'). This category's are basically static and won't change in t...

 
@MikeB im pretty sure others do not. I remember reading that in a book (SQL: Antipatterns, thank you @tereško)
 
6:05 PM
92
Q: Which MySQL Datatype to use for storing boolean values?

BeatSince MySQL doesn't seem to have any 'boolean' datatype, which datatype do you 'abuse' for storing true/false information in MySQL? Especially in the context of writing and reading from/to a PHP-Script. Over time I have used and seen several approaches: tinyint, varchar fields containing the ...

 
haha guess i came to chat too soon. thanks for the links @MikeB
it seems to me that enum wins against int for speed, but probably not against BIT because there are only two values to index in BIT, correct?
 
1
Q: Alternative to lots of booleans in MySQL?

pufAmuflet's say I have a checkbox search form like this: Check all that interests you: bowling billiard sweets Can I request this data from a database instead of having to resort adding tons of booleans to a database such as this? (VenueId, IfBowling, IfBilliard, IfSweets) And maybe just have on...

@orourkek actually most of php frameworks implement ORM-Template-Adapter pattern
 
Before it spawns more bad answers please
 
@AndyPerlitch , you might read it too
 
@tereško sorry, read what?
antipatterns? one of these questions about mysql booleans?
 
6:17 PM
Hey all is there a predefined constant for forward or backslashes for file names?
like windows is backslash and linux is forward?
 
DIRECTORY_SEPARATOR
sometimes aliased to DS
 
DS :P
 
Thanks ^_^
 
@Neal , whats the point ?
php will get the file even if they are mixed up
 
Why not ^_^
I was testing something
 
6:22 PM
why not ? because it takes additional effort
 
damn @tereško you are feeling extra salty today arent you
 
has anyone ever read any web books by smashing magazine?
sale on 6 of them, but the topics all seem so... blah.
 
link?
 
@MikeB here
 
I wouldn't trust them a bit...
 
6:33 PM
they're a little more design-y, but that is one of my weak areas
I suppose there's better books that I haven't read to spend money on
 
I see it is design business, I take my statement back.
 
hello
i have one basic doubt..
Hot to get the day of the week in format like Mon or Monday from an object of DateTime class
*How
@webarto
@orourkek
 
echo date_format($dateTime, 'l'); or echo $dateTime->format('l'); (php.net/manual/en/datetime.format.php)
 
@MikeB
ok.
thanks..let me check
 
Also, there's no need to ping people
 
6:40 PM
ok..I'll never
 
Word
 
@ircmaxell I am reliably informed that the bird is the word.
 
@GordonM whats the word?
 
6:56 PM
anyone ever used bootstrap, need to come up with a way to set the active class on a link in CI.
 
@gorelative No don't!
 
7:07 PM
@Truth define stopped working
 
@PeeHaa No longer opens up links to previews.
 
@Truth is the icon still displayed?
 
@PeeHaa yes
 
@Truth And you know it doesn't onebox your own cv requests right?
 
7:09 PM
twitter needs to standardize their navigation..
 
for bootstrap
 
@Truth [delv-pls-maybe] isn't a "valid" cv request
cv-pls, cv-maybe, delv-pls and delv-maybe
 
@PeeHaa Try cv-plx than
 
Hey I just posted/And my question's crazy/Here's a link/So ?
2
 
7:13 PM
pls*
 
Just added an .htaccess Options -Indexes and modified httpd.conf with it also, the dir is still indexing, any thoughts?
 
@PeeHaa Seems to work now
 
:P
 
odd, I couldv'e sworn it didn't work :X
I'll continue monitoring :P
 
7:19 PM
k :)
 
working for me
"a master practices until he can't get it wrong, whereas an amateur practices until he gets it right." http://bit.ly/NUvfHK
 
@ircmaxell That would be a nice tile
 
for?
I would have flipped it: An amateur practices until he gets it wright, whereas a master practices until he can't get it wrong
 
Ah nice
 
7:35 PM
how to make sure that script.php is running, cron job like every minute?
 
daemon
with crons you have to worry about multiple instances of it running
 
@ircmaxell , how do you handle error state in model layer ? What actually contains it ?
 
and there is a delay
 
@MikeB can you tell me little bit more, it is just one php script that "listens" for connections...
 
@webarto Sure, libslack.org/daemon/manpages/daemon.1.html Basically you tell daemon that you want a command to run, and it takes care of making sure that it's running all the time.. even if it errors out, crashes, etc
daemon php myscript.php
 
7:48 PM
@MikeB I see, the problem is that script might crash... and sometimes I want to restart it when I update code... I see daemon can be killed easily... what I did was hackish... pokit.org/get/img/3e741c1cf9130e80c31f458b4b8a51ad.png
Thank you for helping me out.
 
Aye, that's what daemon's good for. Restarting crashed processes without the possibility of running multiple instances
 
Yeah, now I check if port is opened, if it is, kill script, start this one... :puke:
@MikeB do you want to upgrade your ZCE status to 5.3?
 
@webarto I have 5 and 5.3
 
I see, well there is no badge so I assumed...
 
Where at? I can update it :)
 
It's messed up, Zend made me create two accounts with them :\ i.imgur.com/12jfk.png
 
PHP :P
 
Thanks for reminding me.. I've been meaning to email them about it
 
debbie.o@zend.com
I was using include 'header.php'; include 'main.php'; include 'footer.php'; when you passed first exam :D @MikeB
 
haha - I was probably thinking "This public/private crap is never going to catch on!"
 
8:02 PM
@tereško Hrm, that's a vague question
 
@Mike PPP? :P ... I just reminded myself also I need to take that ZFCE test...
 
Do you know Debbie? Should I drop your name?
 
I don't think it is needed, she is a really nice lady, and in charge for certifications, you of course could, but I don't think it would matter :)
 
@webarto Let me know how the Zend Framework cert goes.. anyone else have that?
 
She sent me a code so I got it for $120, if you don't ask you don't get :P
Will do, I'm thinking it is not complicated... I do have about 2 months experience with ZF1... but will give it a try...
 
8:07 PM
@ircmaxell Do you have ZFC? I know you have ZCE
 
Only ZCE
I stay away from ZF 1.0...
 
If I ask why is it going to open a flamewar on ZF?
 
I can't stop buying domains...
 
@MikeB No, I just don't care for it
 
@ircmaxell , yeah , i know .. i think i will have to sit on this for an hour or so to figure out what i need
 
8:11 PM
sounds good.
 
It's a useless exam for a useless certification written in broken English. Where do you see Zend certified engineers growing in any way? — Azeem.Butt Dec 21 '09 at 6:15
heh @MikeB
 
Yeah I've heard all that.. doesn't bother me. I KNOW that I've learned a lot about the language just studying for the 'worthless certification'.. so I just dismiss all that
 
omg 8 hours of refactoring and i'm spent.
> I sat down with a case of bud and a bottle of jim beam and I felt sorry for me
 
@ircmaxell Good plan :)
You don't get certified on ZF1, you get committed/sectioned.
 
Order of ZF1
 
8:19 PM
wait until my blog post on Friday
 
What's the topic? PHP's 1-second runtime? :p
 
@rlemon Yuck! Jim Beam :(
 
God, Adobe can't even make an OSX preferences pane that doesn't suck like ... something that sucks a lot.
 
Yes, this is God.
 
It literally took 2 and a half seconds from clicking a radio button to the radio group actually updating.
 
8:29 PM
my laptop starts to produce smoke when I use Adobe product, especially Flash plugin...
 
@webarto And it's proprietary smoke.
 
:D
 
In fact it's DRM'd smoke that doesn't work if you don't install java and phones home every 30 minutes
 
@GordonM to be fair, neither can Apple...
 
8:37 PM
@ircmaxell :P
Was just reading your autoloader blog post. Nice work with the benchmarking.
How would using a lookup table of the deps on the autoloader affect that? I seem to recall the Zend guys pushing that a big new feature in their ZF2 autoloader.
 
It eliminates the need for file_exists and require_once replaces it with a hash table load and lookup
 
$depmap = array ("Class1" => "/path/to/Class1.php", "Class2 => "/path/to/Class2.php"); // etc

$path = isset ($depMap [$class])? $depMap [$class]: __DIR__ . '/files/' . $class . '.php';

Or something like that. Coding from the hip :)
So not really worth it unless you're working with a massive number of classes, then?
 
listening to a TGS podcast while trying to code is counter-productive
 
TGS?
 
"the game station"
 
8:43 PM
ahhh
 
I just lost :<
 
user895378
@PeeHaa lol I used to indent two spaces but saw the light a few months ago and now I'm of the righteous 4-space persuasion. I think Drupal's coding standards call for two spaces though.
 
they do
and it's horrible
 
@rdlowrey Some people just like to see the world burn
:P
 
user895378
8:47 PM
Yeah, with two-space indentations I can't separate anything visually anymore.
 
@rdlowrey TAAAABS!
 
user895378
@GordonM argggggggggggggggggggggggggg
 
:)
 
user895378
hehe
 
i went the other way from 4 spaces to 2 4 is default in bbedit
 
8:49 PM
while tabs are nice idea , it breaks down because every tool has different understanding how long a tab should be
you have 2 space , 4 spaces , 8 space .. and then there are people who think that right size should be 3 or 6 spaces
 
@roberthuttinger You went from 4 to 2???
 
@PeeHaa yeah, I am really anal about flow, so 4 just set the code too far off
 
You're nesting too deep
Code smell in my book
 
i used to use tabs , but i cannot anymore , because that retarded Torwald think that tab should be 8 spaces .. and of course thats why githab uses 8 spaces too
 
you can do everything... but you cannot indent with 2 spaces!
 
8:51 PM
i like the spaces vs tabs idea!
 
@roberthuttinger there is no vs. It's just space and that's it ;)
 
user895378
at 8 spaces ... it makes it impossible for me to read the php source code on github.
 
as i said .. retarded
it in the linux kernel code guidelines
 
4 spaces to the rescue!
:-D
my IDE translates my tabs to 4 spaces.
 
I should make a browser plugin called 4space
 
8:54 PM
it sucks that we even have to have a discussion about tabs vs spaces
 
@rdlowrey In my opinion 4 spaces is best, but 2 spaces is better than 8.
 
@LeviMorrison avg it out :-P 5 spaces
 
noone uses 5
 
if I ever got somebodies code with 5 space, I couldnt work in it until i converted the entire file to 4 space at least ;p
 
I was a witness to 5 spaces...
I think some programs on Linux default to 5...
 
8:56 PM
that's a lie
they all (which have such option) default to 8
 
could be a lie, will check it out
preg_match('#' . $this->cookie . '=([\w]+)#is', $data, $matches);
$this->connectionId = empty($matches[1])? 0: $matches[1];
should I if preg_match, or like this ^... or throw computer of out the window and myself after it...
 
user895378
@LeviMorrison Same.
 
@roberthuttinger Arrow code (lots of nesting) tends to be an indicator that something might be wrong with your code. Deep nesting often implies that you need to subdivide the problem further.
 
user895378
@LeviMorrison I'm not sure if you have a hard deadline (probably not) but I've got a few more changes to test and I should be able to create a skeleton sample app before the end of the night.
 
@rdlowrey Yeah, I'm working on the app but I don't need Artax just yet.
It's good for me to not have it, to be honest. I can't test through the UI that way.
 
9:03 PM
@tereško I like tabs because it leaves it up to the user how much you should indent and doesn't fix it in stone like spaces do. Also, less typing. :)
 
@GordonM I get a lot of one-offs, I dont like to subdivide unless the project is large, or I will be reusing the functions
 
Forces me to write unit tests.
@GordonM My IDE just expands tabs to spaces. It's not more typing :)
 
@GordonM but point taken!
 
@roberthuttinger One of the rules of thumb I apply is that a method/function should be able to fit in the screen both horizontally and vertically without scrolling. If it doesn't fit on the screen, then it's unlikely it will fit in your head either.
@LeviMorrison Yeah, most IDEs can easily reformat code and swap tabs for spaces and the like, which makes me wonder why people still like fighting over tabs vs spaces :)
 
pokit.org/get/img/a4436a67742d6d0ada4adbb0f5158745.png is this really the best way to write this :\ talkin' 'bout DRY
 
9:10 PM
@webarto Definitely not . . .
 
DRY
 
I would rather used goto :D making a function makes more sense? pokit.org/get/img/3129690e105a2d21131a38332cc9ace2.png
 
much better
 
sweet! in bbedit 'auto expand tabs' converts the tabs to spaces, Im on board the spaces fan club bandwagon now
 
9:15 PM
and I'm guessing this could be done by [403 => '403 Forbidden'] pokit.org/get/img/e7240451a27cc96021eeb8fbb6a40910.png
 
/me is not a fan
 
\t for life
 
it is just a necessity with which i have to work with
 
@webarto Yup should be an arrau
 
user895378
@GordonM Nice -- that should be required reading for everyone.
 
9:17 PM
@PeeHaa thank you for advices, can't figure out who is doing it wrong...
 
@rdlowrey Indeed. Everyone knows "If it's hard to test then there's something wrong with the code". I think we need to add "If writing it in a way that's easy to test is hard then there's something wrong with the design"
3
 
 Run your tests often.
 Don’t let them get stale.
 Rejoice when they pass.
 Rejoice when they fail.
6
 
@ircmaxell, @rdlowrey, @PeeHaa : does it make sense to have a separate domain object which handles the error state and has own mapper ( which most likely maps to session ) or do you think that it is better for each domain object to hold own error-state and have a session mapper which can map error-state from all the domain objects ?
keep in mind that some error-states might require a storage in DB too
( i have been drawing crappy pictures an half an hour already , trying to figure out the most appropriate way to handle this )
 
user895378
@tereško What sort of error states are you talking about? Like an application-wide state that you can query at any time to determine if something is wrong?
 
@webarto exit looks ugly.
 
9:23 PM
@rdlowrey like failure of validation in domain object
or mapper beind unable to save the information
 
@LeviMorrison not sure I need one, or return, removed...
 
i could just write as i always do, but it causes the model layer to become messed up
i assume that you don't have a ready answer for this, @rdlowrey
 
user895378
@tereško no I was trying to think about the different options.
 
why do i always end up with such lame problems
 
user895378
I haven't had to deal with any sort of form submission states in a while and I was trying to consider what the drawbacks might be to adding an additional domain object just for the error state.
 
9:29 PM
Wow, approximity.com/ruby/Comparison_rb_st_m_java.html makes C++ sound pretty dreadful.
 
i think i should just give up this whole OOP fad and get back to the happy spaghetti code style
 
user895378
lol.
 
@rdlowrey , another thing you might want to consider : is it done in code from application of framework namespace
 
time when only thing mattered was to make something work :P
 
now i can go back to circling my room with notepad in had
 
user895378
9:31 PM
I don't think I would create a separate domain object. Off the top of my head I think I'd pass information to the view when an error is caught somewhere in the model layer. That's generally a more specific problem than I would want a framework to solve, personally. It's a very fine-grained situation that might be difficult to abstract out to the framework level.
 
user895378
@tereško But I can't say for sure without sitting down for a long time and doing what you're doing (pacing trying to decide the best solution). And even then I'd probably end up refactoring it over and over.
 
Normally how I approach it is do very basic validation in my domain objects (update them through setters, return a failure result or throw an exception if the input data is invalid) and have more sophisticated input validation in front of the object (Some fort of object whose sole job it is to check that some input data is valid against some list of constraints).
 
here is the thing , usually the view does not get the error directly
it detects that error happened and makes usually performs a redirect
 
As I see it, the domain object's only responsibility is to not let itself get into an invalid state, and to bitch about it if you try to force it into one. If something needs more nuanced validation/error detection then that's a different area of responsibility
 
in most cases the only GET request error is 404 , the rest need a redirect
 
user895378
9:36 PM
If you're going to do a redirect I'm not sure how else to handle it than to with a separate domain entity. And now I've successfully gone in a circle. I don't like it, but I can't point out a specific problem with it.
 
@GordonM well .. you get two major types of errors in model layer : domain logic errors and write errors
one caused triggered by domain object , other by a mapper
 
user895378
If you want to maintain the state across requests then I think you could do worse than a mapper with its own entity.
 
@tereško Sounds about right, yeah.
The cross-cutting concerns are always fun :P
 
user895378
I have this partition in my mind where I quarantine all questions about stateful HTTP because I mostly deal with stateless APIs.
 
@GordonM , this just means that it has to be deal with at the service level of things ( at least by my naming-system-structure-thing )
@rdlowrey , well .. then how do you handle a user registration
especially the errors that happen while doing it
because this is a clear case where you can have both logic an write errors , and it is a POST( or maybe PUT ) request
 
user895378
9:41 PM
@tereško right now it's a closed registration system with customers who pay negotiated fees. Soon I'll be opening up to free/public service tiers and I'll have to start thinking about it.
 
lol , that's not what i wanted to hear ..
 
@tereško Well without specifics of the problem it's hard to say what to do (and obviously still hard in your case, even with the specifics). But I do find it helpful to try thought experiements like "If something fails in object X, does object Y need to know about it? What about object Z? Does the user need a detailed stack trace and a variable dump, or would just a "Sorry, I can't do that" kind of response do?"
 
@GordonM , here is a specific problem : user registration
we all have done it (usually in an ugly way )
 
user895378
I mean, I've done registrations and other such nastiness with raw access to $_SESSION in the past. I just haven't fully addressed problems like that in the full light of OOP.
 
Yeah, stuff like that makes the spaghetti seem quite tasty.
 
9:45 PM
yeah .. a developer with 10 year experience would have made ~100 user registrations .. so why do we suck at it ?
 
Because we tend to be results-driven?
"If a user fills out the form and can register then that's good enough"
 
and this is why we redo it every time
 
That clueless manager who's breathing down your neck demanding it all be done yesterday and whose eyes glaze over when you use words like "unit test" doesn't help matters either. He's even more results-focused and he has the power to make you redundant.
 
user895378
lol @ "I'll rewrite this next time" ... if only we didn't have to "just make it work" from time to time because the bills don't pay themselves :)
 
well , i have a bit more freedom for this project , which is why i think it is a nice time to invest in this problem
sadly i had hoped that someone else had done it already and could spread the wisdom like candy
 
9:48 PM
Time to do it properly has become such a rare luxury.
 
@GordonM , which is why i have begun to use word "invest" , when describing such endeavors
 
Very wise
I'm thinking some kind of structure along the lines of User > Validation object > Domain object > Storage object. LoD would dictate that the validation object knows only about the user's data and how to forward data to the domain object. The domain object doesn't need to know where the data comes from, just so long as it's valid and will do whatever transformations are needed on it. It only needs to know about the storage object when the data is persisted. Ditto for the storage object
The question is what happens at each layer in the event of an error? For the validation object that's easy. Send a message back to the user saying "What's the dilly-o? Give me some proper data, man! " But what about the domain and the storage layers?
 
you seem t be using different terms
 
I probably am, but it's getting late and concentration's starting to slip.
If an error occurs in the domain object then that's something the programmer needs to know, so the details should be logged there. The user should also be told something went wrong but they don't need to know the gory details. But you can't just send a message back through the validation object because that's not what the validation object is for. Does that mean the domain object needs a direct link to the user too?
 
@GordonM I'd just throw an exception that is caught higher up the call chain . . .
Maybe I'm a terrible human being for doing that, but it seems to be the best approach I can think of.
 
10:01 PM
@LeviMorrison Probably the only sane response, actually, in spite of my personal aversion towards overusing exceptions.
 
@LeviMorrison , you might want to scroll up to the beginning of the topic : chat.stackoverflow.com/transcript/message/4673838#4673838
anyway , i think i will have to go with "separate domain object for errors" structure
 
I'm starting to lean towards having some kind of separate class for handling errors. But the problem with that approach is that you then have a class that might need to know about all the kinds of errors that can occur and then you've got a god class.
Okay... How about all the classes talk to each other normally under normal circumstances, and throw various classes of exceptions when things they can't respond to in other ways happen. Then have a set of error handling classes that have the job of catching and handling the exceptions in question. a logger class that stores them to disc, a mailer class that sends an email alert to whoever needs to know in a hurry, etc.
Or maybe I'm just overthinking this.
 
yes , you are .. you obscured the original issue by adding more inconsequential stuff
while that is a nice strategy, when in a meeting with clients or management people, it does not work on developers
 
any one wanna help me out?
0
Q: Identifying (non exact) duplicates from a MySQL database

PetahIs there any tools for identifying, and merging non exact duplicates in MySQL tables? I have a large data set with many duplicates like: 1348, Auto Motors, 12 Long Road, etc 48264, Auto Mtors, 12 Log Road, etc 82743, Ato Motoers, 12 Lng Road, etc 83821, Auto Motors, 13 Long Road, etc 92743,...

 
10:20 PM
SOUNDEX?
 
user895378
@tereško I just pondered your question while walking the dog. I now really like your idea to create a domain entity and mapping it to whatever backend persistence you need. I think you had it right originally and I just needed some time to fully digest your question. Something like RegistrationSubmission with the accompanying mapper would make short work of it.
 
later.
 
user895378
adios
 
user895378
@tereško A dedicated domain object would make it easy to persist the error status of a stateful submission as well as allow you to store the submitted values to do things like repopulate the form fields with the originally submitted values so the user doesn't have to re-enter it.
 
10:36 PM
now that would be a bad thing
the previous values should be handled by the domain object which did the validation
 
user895378
I'm only suggesting that the entity could be used to hand information off to the view, not that it would do any processing of that information.
 
because it would cause a different behavior for different forms , you would end up choosing from where to get data depending on whether the error state was triggered or not (or even what triggered the error state)
@rdlowrey yeah , something like that was my conclusion too
36 mins ago, by tereško
anyway , i think i will have to go with "separate domain object for errors" structure
 
user895378
Oh I see what you're saying. I guess I didn't think all the way through that. In any case, I think you've hit on the right solution.
 
I should have known better than to search for "interfaces in codeigniter ~success"
 
user895378
@orourkek lol
 
10:49 PM
ehh .. love this band .. cannot understand most of the lyrics , but they always put a huge grin on my face
hadn't heard them for almost a year
 
Are there any good resources (excuse the pun) on web-centric naming conventions, specifically nouns? e.g. component vs. resource vs. utility vs. etc
not the best examples, but still
 
Yeah .. IRC
then naming thing is highly contextual
 
I figured as much, but I still find myself wondering "is this really a 'component', or is there a better word?"
 
which "this" you are talking about
 
doesn't matter; I'm never 100% confident in my naming (of interfaces and abstract classes, especially)
 

« first day (648 days earlier)      last day (4300 days later) »