« first day (1008 days earlier)      last day (4166 days later) » 

09:06
@crypticツ about commenting …
/**
* Get the question type
*
* @access   public
* @param    object  $resultRow
* @return   string
*/
public function getQuestionType(stdClass $resultRow) {
everything but @return string is redundant and unneeded here. only put stuff into the DocBlock that is not already obvious from the method signature
so phpDoc will still document it correctly then?
@crypticツ no one cares about phpDoc :)
@Gordon wait whaa?
I'm following PSR and I think it's suppose to be phpdoc commented
the problem with docblocks is that they usually get out of sync with the code quickly. write your code as expressive as possible to make it self documenting. put into the docblocks what you cannot reasonably express in code. See c2.com/cgi/wiki?SelfDocumentingCode
@crypticツ well, maybe. but PSR is a FIG standard. It makes sense for a framework vendor to provide ample documentation because a lot of people wont look at the code but only the API docs. I doubt anyone of us will ever generate API docs for the backlog.
also, you don't need all the @method annotations up there: github.com/PHP-Chat/CVBacklogUI/blob/master/backlog.php
use the @method and @property annotation when you have magic methods. See stackoverflow.com/questions/3814733/…
I like how I use to do it, no comment at all. but you cant share code then =oP
09:15
@crypticツ depends on your audience
/**
* Sets data source for current instance
*
* @access   public
* @param    string  $dataSource
* @param    string  $cacheDir
*/
public function __construct($dataSource, $cacheDir, Array $expirationTimes) {
> Sets data source for current instance
I didn't know what to put =oP
your short desc is much better than the usual "Creates a new instance"
but it's a ctor. so everyone knows what it does
@crypticツ nah, you're doing fine. I am just giving tips here.
Should I make a seperate class for Question types? Like a Question object? So where I have all my methods to see what type of question it is and all?
I've piled up a quite a few right now working on the type detection to fix the bugs there are
09:24
@crypticツ do they have different behavior?
getCloseReasonName(string $closeReason)
getCloseReasonAcronymn(string $closeReason)
getQuestionType(stdClass $question)
isDeleteQuestion(stdClass $question)
isReopenQuestion(stdClass $question)
isAutoDeleteQuestion(stdClass $question)
isCloseQuestion(stdClass $question)
isReviewQuestion(stdClass $question)
like all those, should they be put into a Question class?
@crypticツ probably. basically all these methods work on data inside stdClass and you usually put the methods on the objects that have the most data to fulffill the method
how would I create the object in the Backlog object? Should I extend it or create a new instance inside it?
@crypticツ for pragmatic reasons and since you dont have UnitTests I'd say create them inside the Backlog object for now.
/**
* Updates the data cache file with most current question data
*
* @access   public
*/
public function fetchQuestionData() {
fetchQuestionData is not what the method is doing
rather, it does what the short desc says. it doesnt fetch anything. I'd expect a fetch to return something. But the method is not a Query but a Command and doesn't return anything
so it should be updateCacheWithQuestionData()
k renamed
09:38
@crypticツ if you are unsure about what should be an object, consider your application domain. A Backlog has a Collection of Questions. So these three (Backlog, QuestionCollection and QuestionItem) should likely be objects. One point of OOP is really to capture your mental model of something in code and make it manipupalatable.
so the above methods would be in QuestionItem and the API requests should be in QuestionCollection?
@crypticツ the methods would be in QuestionItem. yes. The Api Request wouldn't be in QuestionCollection. A QuestionCollection is just a bag of QuestionItems. It's like an array, just that it has some methods to find and extract the QuestionItems.
although you could put the api methods on it. Then it just wouldn't be a collection anymore but more like a Repository. But repository is complicated so either don't have a QuestionCollection at all and stick with the array or have one but keep the API stuff where it is now.
Ah, I see where the confusion came from. I said Backlog is a when I should have said has a. fixed.
@crypticツ but take one step at a time. like i said yesterday, it's a learning project.
ok moved the methods to QuestionItem, now how and where would it go in the Backlog class?
@crypticツ close to where you fetch them
@Gordon ive added a new PHP question that does not related to MVC :)
09:47
@David okay
@Gordon oh, right now I am using those methods in the table loop when outputting the result set
public function getQuestionData() {
    $this->questionsData = $this->questionDataCache->read();
    // here??
}
@Gordon
@crypticツ hmm, yes. That would have been my initial thought too, but given that the QuestionItems don't have any real business logic but basically just control how you render the table I wonder if we need QuestionItems at all. Maybe it should be something like QuestionItemViewHelper or something.
but put it there first. we can still learn if its wrong later
0
Q: Session wrapper class. Set multi dimensional array

DavidI have a wrapper class for my $_SESSION array because I like to work with objects and it sort of prevents me from getting lazy and calling the super global from places I should not. It used to be ok to have a simple: public function get($name); public function set($name, $value); public functio...

@crypticツ btw, the method is misnamed. It's not getting anything. It's setting questionsData. It's a Command. Not a Query.
so setQuestionsData?
10:01
@crypticツ it's somewhat weird to have a setter without an argument, but in any case better than get. as a rule of thumb. If you don't return anything, it's a set. If you do return it's a get.
@Gordon how would I put it there? Earlier being in the same class I just did $backlog->getQuestionType($resultRow->close_reason))
@crypticツ $this->questionDataCache->read(); returns an array of stdClass objects, right?
@Gordon json_decode yep
@crypticツ do you want the objects to be created each time you call setQuestionData or do you want them to be cached?
cached
oh wait, setQuestionsData is only called once
so don't matter.
10:06
@crypticツ if you wanted to have them cached you'd have to create the instances right after the api call.
$this->questionsData = $this->questionDataCache->read();
$this->QuestionsItem = new QuestionsItem();
wrong?
@crypticツ how would you iterate that? :)
then do: $backlog->QuestionsItem->getQuestionType($resultRow->close_reason)) ?
iterate?
@crypticツ iterate is the fancy term for foreach'ing
why does it have to iterate? I'm confused
10:10
in your UI you do foreach ($backlog->questionData as $questionRow)
and you want your $questionRow to be a QuestionItem now
but then it won't contain the entries, no?
$this->questionsData = array_map(
    function($questionData) {
       return new QuestionItem($questionData);
   },
   $this->questionDataCache->read()
);
or do it less fancy with a good old foreach …
user652649
morning
10:14
foreach ($this->questionDataCache->read() as $questionData) {
    $this->questionsData[] = new QuestionItem($questionData);
}
I like the array_map approach but I'm getting parse error with it
@Wesツ morning
@crypticツ your host does have PHP 5.3+?
@Gordon running PHP 5.5
@crypticツ wow
there is a semicolon missing after the array_map. maybe that's it?
Parse error: syntax error, unexpected '}' in backlog.php on line 131
10:16
and after the return
fixed
oh weird I guess it didn't save. I did put both of those
ok I lost all the data. I'm guessing I need to do something in the constructor for QuestionsItem?
@crypticツ yes obviously :)
what does the QuestionItem class look like right now?
class QuestionItem
{
    public function __construct() {

    }
no wonder it doesn't work! =oD
try to put in magic() into the constructor. See if it helps ;)
your current goal is to move the methods you mentioned earlier to that method
so what do you need to do?
10:26
hint: think about what isReopenQuestion() should have as a method body
hint: we passed $questionData to the ctor in the array_map
public function isReopenQuestion(stdClass $question) {
    return (isset($question->closed_date)
        && 0 < $question->reopen_vote_count);
}
so should I do the whole array_map thing for all the needed methods?
@crypticツ why would you pass in the $question on a method on the $question?
the aim is to change from $backlog->isReopenQuestion($question) to $question->isReopenQuestion()
public function getQuestionType(stdClass $question) {
    if ($this->isDeleteQuestion($question)) {
        $type = 'delv';
    } else if ($this->isReopenQuestion($question)) {
        $type = 'ro';
    } else if ($this->isAutoDeleteQuestion($question)) {
        $type = 'adelv';
    } else if ($this->isCloseQuestion($question)) {
        $type = 'cv';
    } else if ($this->isReviewQuestion($question)) {
        $type = 'rv';
    } else {
        $type = 'none';
    }
    return $type;
}
that is the method that will be actually called during the loop
I just separated out each question check into it's own method so make it easier to modify and change as SO changes things
yes, but now you got the QuestionItem. And all the $this->is* will be $queston->is*
you want to move the methods onto the QuestionItem
Hello Everyone
@Gordon:- hie
10:35
@crypticツ clear or more hints?
@aliasgarvanak hello
@Gordon I'm so confused. So right now those methods are already in QuestionItem aka $question->
@crypticツ I can't see what you have right now :)
you said your questionItem class is just an empty class atm
with no methods and no data
no, it has those methods in it, just the consturctor is empty
and no data
@crypticツ ok, so we passed $questionData to the ctor
now we need to change the code in the ctor to make that data available to our methods
in other words, properties
class QuestionItem
{
    public function __construct(stdClass $questionData) {
        // do somethign with $questionData so the methods can operate on it
    }
public function isReopenQuestion() {
    return (isset($this->closed_date)
        && 0 < $this->reopen_vote_count);
}
$this->questionData = $questionData?
10:41
@crypticツ either that. then you'd have a thin wrapper around the data but your methods would need to call $this->questionData->closed_date then. Valid approach and less work. Or - more work - create all the properties for the data in the stdClass
I'd go with the thin wrapper. it's good enough
@crypticツ clear or moar eggshplanashion?
@Gordon I got it, the data passed, just now redoing the method calls in the loop
@crypticツ cool. can you put in your own words, why we did that? :) And yes, I know I am an evil person asking you to do that.
@crypticツ ok, the point was that when you do OOP you want to end up with cohesive objects that contain the data and the logic to manipulate that data. these objects should be focused on doing one thing, kinda like in "you only had one job".
oh, ok I get it now
10:56
Consider these dialogs:

Backlog: Hey QuestionItem, are you are Reopen Question?
QuestionItem: yes, I am.

-> QuestionItem answering questions about itself.

versus

Backlog: Get over here QuestionItem. Lay down I'm gonna probe you now to find out whether you are a ReopenQuestion

-> Backlog answering questions about QuestionItem
So the Backlog class is already like that since it already contains the data and the logic to fetch the API info?
@Gordon: i have an issue in ie7 of JSON
in IE not only in IE7
@aliasgarvanak cant help with that. sorry.
@crypticツ The second dialog is what you had before. The first dialog is what you got now
@Gordon: ok
@Gordon how would I do that?
11:03
@crypticツ putting all the properties? manually. tedious. not worth the effort imo.
is there a way to loop through it?
@crypticツ you could loop over the stdClass instance, check whether a property of the same name as in the stdClass instance exists and if so, set it. else set a sane default
@crypticツ more or less
Anyone interested in killing bugs? stackoverflow.com/questions/17761585/…
@crypticツ but like I said, not worth the effort right now. focus on getting the method moving done
public function __construct(stdClass $questionData) {
    array_map(
        function($property) {
            if (!property_exists('QuestionItem', $property)) {
                $this->{$property} = $questionData->{$property};
            }
        },
        get_object_vars($questionData)
    );
}
something like that?
not tested =oP
11:15
@crypticツ something like this. yes. but keep in mind that you have to write all the properties into the QuestionItem, e.g. private $closeTime, private $whatever and so on to use that.
really $this->questionData = $questionData is fine
the only benefit of declaring and mapping the properties explicitly is that you can decouple your own implementation from what the SE.API returns. You can evolve your own application more independently then. But you don't have that need right now.
public function __construct(stdClass $questionData) {
    array_map(
        function($property) use ($questionData) {
            if (!property_exists('QuestionItem', $property)) {
                $this->{$property} = $questionData->{$property};
            }
        },
        array_keys(get_object_vars($questionData))
    );
}
thats what I used
@crypticツ Not nice code, imho
I wouldn't use array_map for this
@NikiC foreach?
array_map is if you want to make use of the return array
@crypticツ yup :)
foreach (array_keys(get_object_vars($questionData)) as $property) {
    if (property_exists('QuestionItem', $property)) continue;
    $this->$property = $questionData->$property;
}
a lot nicer to read imho :)
@crypticツ it's not what the code should do though. You want to assign the data from the stdClass IF there is a property of the same name in QuestionItem. Right now you are only setting the data if the property does NOT exist
11:27
@Gordon yeah, I also wondered why it has that ! in there
@Gordon I thought that's what I wanted to do. Checking for existing properties so I wont overwrite them?
@NikiC is it generally faster to use foreach (array_keys($array) as $var) than foreach ($array as $var => $not_important)?
@bwoebi my guess would be that the latter is faster
actually, I'm fairly certain that the latter is faster ^^
Me too, just asked because I've seen the first so often…
@crypticツ you want the equivalent of
class QuestionItem
{
    private $title;
    private $closeDate;
    // more properties …

    public function __construct(stdClass $questionData)
    {
        $this->title = $questionData->title;
        $this->closeDate = $questionData->closeDate;
        // more assigning
    }

}
11:29
@Gordon which is what the code is doing right now. If I do var_dump($this) at the end of the constructor it will correctly show those properties are now properties of $this
@crypticツ yes, but they are public. you assigned on the fly. you didnt declare them in your QuestionItem.
@Gordon oooh
Guys, can anyone explain what means "supports jquery" when used in a feature list of server-side framework?
and you can't change it to private inside the constuctor, right?
@crypticツ nope. at least not without killing kittens
@crypticツ and you dont want them public because then everyone can access the data when the only one to access that data directly should be the QuestionItem. It guards that data. Access to it should happen through methods. You dont want everyone touching the poor QuestionItem. We are not the TSA.
11:37
ok switched back to old method. Ok I just got one more method to finish then going to commit it all. If I can figure that out as well >.<
@crypticツ like I said, the benefit of declaring the properties is really just to be able to evolve the code independently from the SE.API. Well, and a developer can more easily see what properties exist at all. But technically, he should be fine with just using the methods you offer. It's more important than knowing the properties.
what's with the stars?
@Gordon not me, cancel them?
yeah, they seem a bit random
@Gordon aww
@zerkms it likely means that the framework has ways to render HTML and jQuery. Kinda like ZF supports Dojo.
@salathe I suspected it was you -.-
@salathe whos going to believe that now? ;)
@Gordon Hopefully everyone... *grin*
@salathe ok. I do. You avatar looks so trustworthy.
mornig\
morning
11:59
@PeeHaa morning :)
@DaveRandom Please do NOT shout right now... :(
@RokoC.Buljan hiya
Grasping recently on some concept... Arguments in favor to FlatFile vs. DB ... Anyone?
@RokoC.Buljan Depends on what you are trying to do.
If it's relational data store it in a relational database
Honest opinions please, do you think this question was rightfully closed? stackoverflow.com/q/17745114/871050
12:08
@PeeHaa (don't smile, I read lot of times that it's surpr. fast to use FF) so I have a med proj with lots of users. Thought about creating a good OOP connectors to do the job and store all ID-related activity to FF
What if FF?
(sorry) Flat File Database
before making my hands dirty thought better ask for soem thoughts - or might also be you have some good experience wit hFFdb
@RokoC.Buljan hey
@PeeHaa hello
Define "ID-related activity"
@aliasgarvanak yoy
12:11
To me it sounds like relations
hola @aliasgarvanak
@RokoC.Buljan i need ur help dude
@PeeHaa hola
@PeeHaa so everything would have an ID (users, places etc...) and I was thinking about making the website relevant content correlations getting this ID and asking the server to search into Files for content etc
@aliasgarvanak shoot!
@salathe lol
12:13
@RokoC.Buljan JSON is not working in IE..:(
So what to do for this ?
@MadaraUchiha Not sure whether it should have been closed. But saying storing it as JSON is an option is just plain stupid
@PeeHaa Where were you when I asked that question?
I know but the web page would be quite for young people, so hopefully in 1014 I might not care
@PeeHaa What do you suggest then?
@MadaraUchiha Probably drunk :)
I think I would:
12:15
@MadaraUchiha you mean my Q ? :)
@RokoC.Buljan No, mine.
8 mins ago, by Madara Uchiha
Honest opinions please, do you think this question was rightfully closed? http://stackoverflow.com/q/17745114/871050
@MadaraUchiha lemme see
Can any one help how to work JSON in IE?
@aliasgarvanak Sounds like a job for the JavaScript room.
Have a table with all possible plane models, have a table with the possible fields foreign key is plane, have a table with reports with foreign key plane, and have a table with foreign keys: report, fielded, data
The last table (report items) will be multiple rows for a single report
Same goes for fields table
12:18
@PeeHaa So basically, AEV, yes?
@RokoC.Buljan Really you should use a relational database
9
Q: Clickable desktop notifications for chat

user161944I like the desktop notification functionality, but it is rather inconvenient to have the notification popping up on my screen and not being able to click it (to go to the chat). Can we have GMail-like notifications for chat, in which the chat window will focus upon clicking it?

I really want this.
@PeeHaa I was "afraid" to hear that
What does aev mean? :P Sorry I really had a couple too many yesterday
@RokoC.Buljan Why? What so bad about databases?
@PeeHaa nothing bad, it's just I find FFdb more friendly
12:21
:|
specially in the means of (when the time comes) for a future dev to get easily all the needed mess and re-create a more professional str. DB
Switching to Ubutnu
BRB
;) kidding I liked the idea of having a super fast DB and fun to look at all the files
JSONs etc
@PeeHaa - but as you said perfectly I was afraid about the relations. Using FF I would hardly manage to read only part of the file...
nada... opening my mySQL cheatsheet ;)
12:27
:-)
wb
Going to grab something to eat and start doing some work so I can finally have a day off tomorrow :(
@PeeHaa you should have a PP "Donate Here" button next to your avat (for being so much time here on SO helping) ;) (hmm, good Meta proposal :D )
@RokoC.Buljan I'm still waiting for the day to convert my rep to hard cash :)
@PeeHaa njeh njeh :D :D bon apetit! see ya
Holy shit 15 mails
Valid concern @PeeHaa, on the same note, the CVBacklog itself isn't licensed as well.
Good point @Gordon ^
Morning @hakre
12:47
I'm running as CGI and I've come across this weird parse issue that looks like it causes PHP to crash.
Does anyone want to test it out? =oP
Am willing, but kinda busy atm :( @crypticツ
@PeeHaa people these days, too busy to crash their PHP =oP
:D
If nobody has tried it for you I will pick it up tonight
@MadaraUchiha /cc @PeeHaa MIT
@RokoC.Buljan was proposed many times before. was shot down each time out of fear to change why people are here. People should answer out of altruistic motives. a monetary incentive doesnt help with that.
@Gordon well, I respect that, SO it's still a nice place to loose some valuable time and should stay like that, otherwise would be a financial crowd of money-hungry fellas ;) After all anyone can paste a link-to in it's profile I suppose. If someone is really interested about it's savior... :D
13:01
@RokoC.Buljan that's why I have a link to my Amazon wishlist in my profile
*#$%&/( I forgot to do the same, I've seen that a long time ago under your profile!
@RokoC.Buljan Not that I have ever gotten anything in my 3+ years here …
@Gordon not one book???
What you think about storing sensitive user informations inside each user's avatar?
@RokoC.Buljan That is what gravatars are :)
@RokoC.Buljan not a single gift. that's fine with me though. I had one guy who gifted me a game from my Steam Wishlist. But I rejected that because he was much poorer than me and it didn't feel right.
@RokoC.Buljan to what purpose?
13:05
@Gordon ...cause we can? :)
@RokoC.Buljan sure. go ahead.
@Gordon you're unbelievably a nice and good person, I need another coffe after reading that (tears prevention)
@PeeHaa is there something about gravatars that I don't know? (in the means of steganography)
@RokoC.Buljan It's an md5 hash of your emailaddress
@PeeHaa I kow that but I was thinking about storing sensitive informations inside a user avatar like email, personal data etc crypt and compress randomly into an image (it's avatar)
@RokoC.Buljan thanks. But really … who would not do that? I mean, I make a good living out of writing code. Likely more than most people asking the questions here make, so I don't expect them to put their day wage on a book that costs a fraction of what I earn per hour.
13:13
just like terrorists do HAHAHAAH but for use in a proj
@Gordon you're right, after all learning should be free-for-all, teaching it's a nice thing to do and it's a noble act.
@Gordon I have already flagged it, but if you have time could you please burninate this user: stackoverflow.com/users/2602209/others-first
It's a spam whore
@PeeHaa done. thanks
Gracias
13:33
Atlast got the guru badge, muhahahaha
@Mr.Alien congress ... :)
@PeeHaa do you remember which migrated question it was?
the question was migrated over and back, but the API shows it has a lock status still, might be another API bug.
Hello again everyone
Any idea why this wont work?
<?php
require_once('A_file.php');
require ('connection_file.php');

if(isset($_GET['XXX'])) {
$ID = (int)$_GET['XXX'];
mysql_query("UPDATE `TableName` SET `Homes`=7");
}
?>
Sorry, I don't know if there's anything like CtrlK for posting in chat
and I know mysql_ is obsolete
13:51
@crypticツ I'm going over the code in CVBacklogUI
It.s just that I'm not ready to move up as I still have trouble with this type of thing and Im currently following a tutorial
@MadaraUchiha you might want to wait on that a bit. Got a ton of changes to commit in about an hr
In phpDocumentor, @method is used to detonate a magic method (method which isn't actually defined)
thats one of them =oP
Oh, goody, I'll wait then.
13:52
@MadaraUchiha good mornings @all
@hakre Nice to see your name in italics.
My true query is more complex but I can't even get "UPDATE TableName SET Homes=7" to run
@MadaraUchiha oh, I never noticed that
however if I run it in PHP MyAdmin's SQL tab it works
Um Hello??
@crypticツ It was pinned for the last day or so.
@StuartKaufman There is CTRL+K in chat
Some
Example
13:53
@MadaraUchiha no, talking about room owners names being italizied
Also, how does it not "work"?
@crypticツ Oh, that was implemented since forever :D
Would it be good to go back and correct this @MadaraUchiha or don't worry about it for this time?
@StuartKaufman No need
Not even sure if it is possible to edit
Sweet
@StuartKaufman Up arrow, but it only works for a very short while after you post the message.
13:56
Cld you guys kindly help me with my baffling problem?
I know Im connecting to the DB because I can echo $ID even after require
so that makes me sure it's connected
and a similar query runs on another page but the one with this code is killing me
Hi frineds
i used seo urlin htaccess but it not working for me
Anyone care to bail me out on this one?
0
Q: Seo URL using .htaccess not working

DhamuMy site URL: http://stackcomplete.com/category.php?id=28 i used seo URl in .htaccess RewriteEngine On Options +FollowSymLinks RewriteRule ^category-([0-9]+)\.php$ category.php?id=$1 but no changes,i i done wrong?? my full .htaccess RewriteEngine On RewriteBase / RewriteCond %{HTTP_HOST} ...


« first day (1008 days earlier)      last day (4166 days later) »