« first day (1769 days earlier)      last day (3404 days later) » 

13:00
Also @Maurize the $default argument is not used anywhere
because php didn't get it right ;)
@sherif please do have a look at my updated code
http://stackoverflow.com/q/32095942/4791856
@Sjon nobody was inclusive of those working on PHP
13:00
@Sherif agreed
user3119231
@DaveRandom same as $import. will use it later, maybe
It was an XNOR
badumpshhh
pretty interesting behaviour 3v4l.org/I5P33
@Sherif I hope that helps you to understand my query
user3119231
@DaveRandom ahhh man. Nearly finished. It just paste it in the first cell
13:02
@HardikSisodia You still don't show where in your code you get variables like $id, $size, or $color
user3119231
and does not replace the header
user3119231
@SergeyTelshevsky That's not interesting. That's just context switching.
@tereško in your opinion, I need to a new column on vote table ? and store two user id {who gives a vote, who is voting for?} because I need to give +5 rep to who is voting for
are you voting for the user of the post/comment?
because if you are voting for a post, then it should contain the postID
13:04
@Sherif why did it change in context of a method but not change outside of it?
@tereško your mean is I should find (who is vote for) from postID/coomentID ?
Guys, I tried that, but I don't seem to get any output. Any idea why?
stop
@Sajad , what are those votes for?
@tereško every user can give a vote to each comment and each post
the point is, I need to give some rep to owner of post or owner of comment
@tereško how should I detect the owner ?
Guys, it doesn't show me any output, any idea why?
@Maurize Are you sure ; is the correct delimiter?
good mornin'
@HassanAlthaf The function receives an argument, you didn't pass one
You should get an error about calling a function with the wrong number of args
Turn error reporting on
13:13
@DaveRandom I have but it doesn't.
@DaveRandom Ha! YOu just got bitten
@SergeyTelshevsky I think you're not grasping what context switching is, exactly. When you call a function/method, PHP copies the symbol table (the thing that it uses to look up what variable holds what value), and builds a new stack frame. Which means that the two things are now completely unrelated. When you return from a function or method, PHP copies everything back as it tears down the stackframe. So you're still back square 1 as they say.
@Orangepill morning
@DaveRandom how do I pass an argument to a function which is passed to another function?
Nevermind, got it.
Guys i have set up a cronjob in cpanel but it is throwing 500 internal error do any one have any idea on that.
13:14
@HassanAlthaf You haven't and it does 3v4l.org/gfFQZ
user3119231
@DaveRandom print_r($orders) = Array ( [0] => Design Type > Design_Type [1] => Device Type > Part_Type [2] => Date Created > Date )
user3119231
for example
@DaveRandom I don't know, MAMP is weird. I switched it on, but it doesn't show me any errors. Would you be able to help me out?
@Sherif These are the forms I've created from where I get the value for size and color

size form:

<form action="" method="POST" id="masterform">
<table border="1" cellspacing="0">
<tr>
<th colspan="4">
Sizes
</th>
</tr>
<tr>
<td>
<label for="2.2">2.2</label>
</td>
<td>
<input class="roomselect" type="radio" id="2.2" name="size" value="twopointtwo" <?php echo $two_two; ?>>
</td>
<td>
<label for="2.4">2.4</label>
</td>
<td>
<input class="roomselect" type="radio" id="2.4" name="size" value="twopointfour" <?php echo $two_four; ?>>
@HardikSisodia Please don't paste more than 3 lines of code in here. Use a codepad/pastebin
13:15
@HassanAlthaf ini_set('display_errors', 1); error_reporting(~0);
@Sherif yes, CoW, but how does that relate to changing the object state inside itself and maintaining it's state outside
when does it happen exactly
@SergeyTelshevsky No, Copy On Write is a totally different concept.
@Sherif Sure will remember from next time ;)
@Maurize Yeh I mean in the file, you are using ; as the CSV delimiter, excel doesn't seem to understand that. Open the original and new files in a text editor (not excel) and compare the formats
13:17
@HardikSisodia Sorry, I don't feel like reading a hundred lines of code in an active chat room.
/me smokes
@Sherif can you provide any reference so I could find more about it?
Besides I'm asking you for the code that initialized those variables. Not the form you used to get them.
user924016
@HassanAlthaf the cv link was just a friday prank that never got removed
13:17
@DaveRandom Nvm, I found an option in the MAMP settings to do it on.
@RonniSkansing I see.
@SergeyTelshevsky Context switching just means that when you go from one function to another things like variable names now have new meaning to that function. That's the point of a function. It creates state isolation. But because objects in PHP are abstracted into a container type it makes it possible to reference the same object from different contexts.
user3119231
1:1 .csv opened in notepad++
@Sherif but that would mean that a method that's changing a property would change it only inside the context of the object and not outside, but that's not true
@SergeyTelshevsky No, that's the "container" abstraction that's wrapping objects in PHP.
That's what makes it possible to change the object's state from different contexts as I just pointed out.
This is what set PHP 5 apart from PHP 4 in OOP
13:21
@Sajad you join owner thought post's or comment's ID
That you didn't have to litter your code with references in every function signature.
The fact that you use a reference in your example and that reference points to $this is what actually breaks this behavior somewhat. PHP sees its a ref type and so it doesn't attempt to break it.
@tereško suppose, you put a comment, and I give a vote up to your comment, Now, my website want to give you +5 rep, how should detect you ?
Unfortunately, it doesn't actually try to enforce that you not write to $this period, just that it doesn't happen within object context.
Which means you cheated PHP
:)
@Sherif I don't understand.. why does this work then: 3v4l.org/LoYWa
What don't you understand?
13:26
@Sajad well, when you click on the "upvote", you perform three queries: add an entry in the CommentUpvotes table containing the commentID, userID (who voted), vote and timestamp. Then you find the owner of that comment. And then you update add +5 to owner current amount of points.
"Then you find the owner of that comment" how do that ?
@SergeyTelshevsky When you call $y->f() all you're doing is saying $y = new stdClass inside of the context of the function moo(), however, once moo() returns then that context is lost and PHP knows that $y is still an instance of Y. Nothing has changed. But when you did $d->g($d) all you really did was say $d = $d->g() where $d->g() returns new stdClass
Get it?
The fact that you are using references there didn't really change much externally, except for the fact that you're breaking refcount every time internally.
It's the implicit assignment that's happening that you're not seeing
@sajad hopefully you are storing who wrote the comment... when you are rendering the comment leave yourself some means to match it back to the comment record which should contain reference the user who wrote it
@SergeyTelshevsky In other words, you didn't really assign anything to $this, because as long as some function of $this is still the caller of some higher stack frame, there is a reference to it, so PHP will never lose it from memory.
@Sajad you shoul have tables: Posts, Comments, Users, Votes, PostComments, PostVotes and CommentVotes.
4 primary tables and 3 pivot-ish tables
13:36
what are PostComments and PostVotes ?
Votes is the same with PostVotes
in Posts table you should only store the total votes for that post
I know
what is different between Votes and PostVotes
?
@Maurize Can't see anything, can you just use pastie or gist?
actually, I take it back. PostComments and Votes is not a necessary tables
also PostComments, right ?
13:39
can you export a diagram of your DB?
user3119231
@DaveRandom sensity data but there are only ";" sometimes there are blank spaces between -> "; ; ; ;"
Hello. :)
@Maurize Need to see input and output, really...
@tereško I can, but it is not useful for you, the name of column are not english
user3119231
@DaveRandom got teamviewer?
13:40
Not on this machine, can you just paste it?
@tereško can I say the structure of my tables here ?
user3119231
@DaveRandom 1 sec.
can you?
user3119231
@DaveRandom terminal.bm-designs.de/index.php?id=6 tell me when you have copy and pasted it. will delete it then.
@tereško yes, I just say the related column name, (and ignore comment and comment vote table, because If I understand for post and vote, I can implement it for comment and vote_comment tables)
user:
id | reputation

posts:
id | user_id

vote:
id | post_id | user_id
I want when userA put a post, and userB give to his post a voteup, Then the reputatuin of userA be updat
13:43
well, then code it
@tereško jsfiddle.net/x00hLkfs see anything wrong with the syntax?
@Sajad lol easy
@Maurize OK so that is before it's been run through that function or after?
@sajad It's simple PHP code dude.
@HassanAlthaf not easy !
@tereško your mean is my querys ?
13:44
@Sajad Wanna see how easy it is? I'll write you a skeleton and you'll know.. lol
user3119231
@DaveRandom it is the original .csv from company.
@Sherif thanks for the explanation, I'll fiddle a bit with it to understand it completely
user3119231
@DaveRandom exported from teamcenter or sap I think.
@Sajad that's it. I am confused again. What is the problem that you are trying to solve. When I try to explain something to you, you tell me that you already have it. And immediately you ask about something, what should be required for the previous thing to work.
Please, can you form a coherent thought?
@Sajad

<?php
    // When a user upvotes, get the users ID.
    $userID = get it from some magic way;
    $postID = get it from some magic way;

    $posterID = find it from who created the post with an id of $postID;

    // update PosterID reputation

    // insert the reputation thing in the database

?>
13:46
This is fucking frustrating.
@tereško maybe you are right
@tereško I just want to detect the owner of post !
@Sajad Easy.
@HassanAlthaf I'm reading your skeleton , wait
@Sajad based on WHAT?
@Sajad SELECT user_id FROM posts WHERE id='post id';
13:48
@tereško em, when I give a vote up to your post, my website will insert a row in the vote table, but your Id is not exist in vote table
now how can I find your id for giving you +5 rep
I am facing a strange issue. I am authenticating a user by binding his password against LDAP. If i hardcode the password in the code, I am able to authenticate. But if send the same password via html form to php script, I am not able to authenticate. This scenario occurs only for Password containing special characters like "Œ". For ASCII password, Its working fine.
@Sajad It is easy dude, just find the id of the person who created the post? Each post has its own id in the database.. and based on that you can do it.
user3119231
@DaveRandom I think it is a ";" thing :D
@HassanAlthaf your mean is I create a new query for detecting the owner of post ?
13:50
@sajad you just need to sum the vote value after joining the three tables
@HassanAlthaf em, I think it is not optimized !
Why do you want a super complex query? just do some multiple simple queries.. :L
@Sajad Optimized my ass, it will barely take like 0.01sec more.. :L
@Maurize OK, and what does the file look like after you've run it through the function?
@HassanAlthaf :)))
@Sajad you probably don't want to store the rep on the user... you just want to sum up the related votes
13:51
btw, Excel is often not a good tool for inspecting CSVs, it may simply be that Excel is doing something weird
@Orangepill I think you don't know what I want
@Sajad What he is saying is right.
@Orangepill old discuss :-) ! I love trigger
:P
user3119231
@DaveRandom it is not the fputcsv. It's the $columnHeaders. print_r gives:
user3119231
Array ( [0] => [1] => Home [2] => [3] => [4] => Canada Approval (CSA) [5] => [6] => [7] => [8] => CE Approval [9] => [10] => [11] => [12] => Checked-Out By [13] => [14] => [15] => [16] =>  ...
user3119231
13:52
So system will do empty cells.
@Sajad he says, to not have a reputation field in the users table. He says to fetch all the data from upvotes table and then add them up and show.
im off i need to code my site.
@HassanAlthaf I know what he said, But I want to update reputation column via trigger
@Sajad lel figure it out yourself, i cbf to help ya anymore
All you do is reject our ideas..
If that is what you intended at the first place, why did you even bother asking the question here? :L
@HassanAlthaf ok, never mind, sorry
@sajad keep working on it ... you will see why we are saying you don't want nor need the trigger here.
13:58
Oh god this HTML is getting up my nerves.
@Orangepill look, using of 3left join plus 1 sum() is slow !
Good morning
user3119231
@DaveRandom $columnHeaders = fgetcsv($fp, ';', '"'); & fputcsv($tmpFp, $columnHeaders, ';', ';');
user3119231
try this.
@sajad if its slow its because your keys are off... what you mean is "you think with three tables and an aggregate the query will be slow"
@ircmaxell o/
the problem is my resource (512MB / 1 cpu), and I think about when the number of my rows be +2 milions
also, when I can do that via trigger, why should not do that ? trigger is really faster
@sajad think to the next step... what are you going to do when a post is deleted
@Orangepill I created a trigger AFTER DELETE
@ircmaxell mornin
Can anyone help with pdo_informix issue : chat.stackoverflow.com/rooms/87474/…
14:04
@sajad you are trying to move application logic into the databases... that should rarely (if ever) be done
@Orangepill yes, debugging is hard, but the performance is faster
I am facing a strange issue. I am authenticating a user by binding his password against LDAP. If i hardcode the password in the code, I am able to authenticate. But if send the same password via html form to php script, I am not able to authenticate. This scenario occurs only for Password containing special characters like "Œ". For ASCII password, Its working fine.
Could anyone answer this
Whoa deja vu.
A glitch happens when they change something. Was it exactly the same question?
8
Q: $_POST will convert from utf-8 to ä ö ü etc

lungovI am new here, so I apologize if I am doing anything wrong. I have a form which submits user input onto another page. User is expected to type ä, ö, é, etc... I have placed all of the following in the document: <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> header('Content-...

@sajad you think... if speed is the concern there are better techniques like caching ... you shouldn't throw the integrity of your data under the bus for the sake of performance.
Or any of the other hundred questions on the subject...
14:09
@Orangepill emm, I don't know, maybe you are right
@sajad I've been doing this a while... and I'm sure pretty much everyone else here will tell you the same thing.
@Orangepill please take a loot to the comment of this
user3119231
is there a mysql php function which only imports columns out of a .csv which are in database?
user3119231
mysql_php_intersect_columns_csv doesn't exist. Closest matches:
14:23
@sajad yeah... I stand by my opinion caching results shouldn't be done in the database
@Maurize I would recommend not using any of the CSV functions in PHP. Look for a library on packagist that helps do what you need.
user3119231
@Danack So I have a .csv and need to import it to database if any columns matches the database columns
Good for you?
user3119231
It is good. And I won't (means never ever) include a library for this.
user3119231
Easy to understand?
14:25
@danack why the hate for the native functions .. lack of ability to force quoting on numeric columns?
lol danack, that answer :P
@Maurize "And I won't (means never ever) include a library for this." Then you're quite dumb.....this is exactly the thing that using a bugtested library for is a good idea.
@Orangepill There are some bugs in the CSV functions that ship with PHP. I tried to fix them.....a fun time was not had.
user3119231
I'm dumb? You're website is trash: basereality.com
@Orangepill ok :-)
@byedit Yep, they’re all just variants on the same thing. MVC-style makes a lot of sense and is clean which is why it’s been around so long
14:27
@Maurize yeah - I need to update that. Been spending all my time contributing to community by maintaining imagick and making a tutorial for 200 functions - phpimagick.com
No no, he's quite right. I am a website.
user3119231
Yeah, my mistake.
/me pokes head in
A significant reason to use OSS is that it's continually critiqued and updated (hopefully). Hence why using an external lib that already exists (read: wheel invention) can be a good thing
Sorry, I did not want to get involved :P (but failed miserably)
@Orangepill can you help me about this :
when userA gives a upvote to the post (wroted by userB), I want to run this:
update user set reputatuin=reputation+5 where id = {how get the id od userB}
14:30
someone posted a thing on twitter earlier ..
@sajad can't help you because I disagree with it on a philosophical level
Don't reinvent the what again? I am sure happy I don't have to fit giant boulders to my car or bike. http://t.co/DBk07MHeCx
lol
there's also some truth in that ... we need some people that are brave enough to reinvent wheels if we are to move forward at all ...
@Orangepill :-) but I think you can solve my problem: how get the id od userB , I think I need to a JOIN
14:33
Telling a programmer there's already a library to do X is like telling a songwriter there's already a song about love
@Danack All the songs about love have been done now. Hence why today's music is all about popularity, sex, being 'cool' and free
@Sajad the difference is I don't see a problem with not updating the user record. The problems get introduced when you do... so by not helping you i am helping you
@Orangepill what a great sentence: so by not helping you i am helping you
you are welcome
arghhhhh
Again forgot a | at the start of a line in bison
14:39
@Danack that's you that maintains Imagick... I thought it was the other Dan Ackroyd :)
@Orangepill People on twitter sometimes think I'm the film star...
I saw the Autism tweet :)
Hello guys, what am I doing wrong? $article_date_date = DateTime::createFromFormat("d. M Y H:i T", "09. Aug 2015 19:30 CEST"); echo $article_date_date->format('Y-m-d H:i T');
@Mr.T What are you trying to do? 3v4l.org/4Lolg
lol
14:54
I would like to get a DateTime object from the string "09. Aug 2015 19:30 CEST".
@Mr.T But.. you do get a DateTime object. 3v4l.org/CW1B1
So all is done correctly?
hmm my code stops at "echo $article_date_date->format('Y-m-d H:i T');" always...

« first day (1769 days earlier)      last day (3404 days later) »