« first day (1019 days earlier)      last day (4155 days later) » 

00:39
Evening biatches
01:20
@PeeHaa evening motharbiatch
@Ocramius Jo! Finally somebody is awake
@PeeHaa but am going to sleep soon <_<
working on in-memory transactions in php \o/
that will be fun
@Ocramius Yeah it might be best if I hit the deck soon too
heh
@_@
 
1 hour later…
02:33
does serverside javascript threaten php?
Write a 10 page essay about it
02:44
@grantbacon loose typing is magic
@JosephPersie no ctrl-enter no ctrl-enter no ctrl-enter no ctrl-enter no ctrl-enter no ctrl-enter no ctrl-enter no ctrl-enter no ctrl-enter no
@JosephPersie I think it's a valid concern...
there are so many microframeworks that work with node package manager
although people are still interfacing cobol through webservices..
And JS Engines are improving at such a fast rate now.
I think JS is ill suited for any real large scale development... when they come out with NodeDART that might be exciting
JS is past it's prime they need to phase it out.
it was written in 7 days
but any framework can solve the issue of large scale development
you can be like java and write an annotation parser
for the sake of enterprise friendliness
03:02
I'm not arguing that JS can't be made to work with large scale projects, there is plenty of proof to the contrary. I just believe a stricter and more structured language would make it easier.
js was a miracle such that it was written in such a short time frame with emphasis on future extension
no doubt...
stricter and structured languages are stubborn to open ended solutions
I just don't like that on the client side it's the only choice...
vbscript?
Haha
03:05
that's not a choice :)
ECMAScript
ECMAScript == Javascript
&& ECMAScript actionscript && JScript
frameworks solve the syntax woes with the exception of logical operators
when you are completely unsatisfied you can exploit C++ operator overloading
in js?
Well node was powered by C++
operator overload in js? dont think so
I could've sworn node engine was C++
But after all these years I still have some unconditional love for php
03:23
@JosephPersie I feel that AS3 is actually a nicer implementation of ECMAScript for the most part
@Jasper it's typed for one :)
@Orangepill And it has classes
It even has a decent property syntax
@Jasper true.
I am not a fan of adobe or flash for that matter
flash is a steaming pile...
03:25
(as in, the accessing getter/setter functions as if they are properties, like (one of the things) you would need __get/__set for in php)
@JosephPersie flash !== AS3
I wish php would go that route of formalizing a syntax for accessors and mutators
How would you implement actionsript without native overhead?
@JosephPersie Basically, flash's relationship with AS3 is like the relationship between OS X (/iOS) and Objective C.
__get and __set suits me
Mornin
03:28
php is powered by C++ too
I find myself writing huge switch statements in __get and __set .... or just create my own accessors/ mutators
morning
@JosephPersie The problem with __get and __set is that you can't have a single function per property, and you can't have them not be based on strings either.
@JosephPersie PHP is written in C, not C++
you forgot about variable variables
i always get the two confused pardon me
cant have them not
@JosephPersie as for Node, I thought it was written in js, but (generally) run on Google's JIT compiler (which may work with C++, I don't know that bit)
@Jasper What do you mean by "and you can't have them not be based on strings either"
03:31
strong typed scholars suck at php
@JosephPersie you can edit messages
(for 2 minutes after posting them)
or any loose language for that matter
@Orangepill Basically the same thing you're saying. __get and __set must use strings for the variable name, they can't handle constant names (you can do a switch, but it's just not the same, heck not even in terms of performance)
this chat itself is probably written in js and websockets
@Jasper gotcha... I think having a formalized syntax for accessors/mutators is pretty much a must for any object oriented language that implements visibility.
@JosephPersie Probably... with erlang or something on the server side
03:35
You use constants in php but not a good idea for a dynamic variable that should be detected by magic methods
@JosephPersie not constants, constant names. Like how function bla() {} has a constant name, and something through __call does not
magic methods in php are very powerful = interpreted vs compiled
@JosephPersie yes they are very powerful, no I'm not arguing to replace them, but to supplement them, and no, it has absolutely nothing to do with interpreted vs compiled
Am tryin this in an hour
(And actually php 5 is compiled)
It is just compiled every time you run the page, unless you use an opcode cache, in which case you're using just-in-time compiling
03:39
@Mr.Alien Delving into localStorage?
and heck, 5.5 even comes with an opcode cache by default...
just in time?
its a fake compile
php !== "personal home page"
justin time????
@Orangepill Yap, I feel quiet annoyin when I type a big form and I hit the refresh button by Mistake, ita all gone, so wanna try once to cache the form fields data on the local side
@JosephPersie Yep. Whenever a file is requested, it's checked if the compiled version is newer than the non=compiled version. If it is, the compiled version is served, otherwise it's first compiled again. That's just-in-time compiling
03:42
its still technically interpreted
@JosephPersie how the heck is it a fake compile?
what even is a fake compile?
27
Q: Is PHP compiled or interpreted?

nickyIs PHP compiled or interpreted?

its like a fake operator overload in javascript
Haha
The correct answer to that question is .... yes
@JosephPersie The accepted answer is wrong. This comment describes the correct answer pretty well:
@kiranvj: I believe OP wanted to know if PHP gets compiled to the native code. Compiling it to bytecode, which is then again interpreted by Zend, is somewhere in the middle in terms of compilation cost and runtime performance. Lol, this is a rather old thread, just realized it. — Groo Dec 10 '12 at 18:16
I consider it to be semi compiled
You dont see php .class files
the interpreter decides whether or not it should be compiled
03:46
@JosephPersie that makes no sense
@JosephPersie and there's a reason for that: because it's actually more compiled than Java
Zend interpreter says "Should we re-compile this"
Hi everyone I hope you are all fine.
I have a query with 13 left join, all static tables. Thats necessary for localisation. I am wondering if that cause any performance issue. Till now, I have indexed them and implemented foreign key between main table and lookup tables.
If I was a computer science PHD you would have found youself in a mess on that argument
@JosephPersie Except it makes no sense to call that part of the code the "interpreter". After all, it doesn't interpret anything. In fact, it's the part that compiles (if aplpicable, otherwise it does nothing)
@JosephPersie If you were, we wouldn't be in this argument, since you'd agree with me...
But I'm just an undergraduate
03:50
@Mr.Alien if that gist is all there is too I I should start using it more...
@JosephPersie And what's that supposed to mean? That you're studying cs, so you must be right?
Although I do agree without 7 years of school that distinguishing interpreted and compiled is very ambiguous
seems pretty cut and try to me... and I went to two years of jr college...
because even though the zend engine "interprets" your php code it gets compiled thereafter based on modifications in the codebase
and I only remember about three week of it through the drunken haze.
03:55
@JamshidHashimi 13 joins is bad normailization
Unless you have a couple hundred tables
@JosephPersie uhm, right, feel superior all you want, but don't assume if you will
@josephPersie a lot of joins is a tell tell sign that he's approaching first normal form.
schemaless databases like mongodb solves the problem of 13 joins
@JosephPersie ّ‌It is a job portal with multi language support (for now we support 3 language and it will be more in the future). I must get for example my dropdown data from each lookup table dynamically according to language.
@JosephPersie You either really don't know what compiled and interpreted mean or you just have no idea how php works, because, well, that's just the plain wrong way around. First, there's the compiling, then there's the interpreting. It wouldn't really work in the opposite order anyway.
03:58
@Orangepill you are right. its denormailization you are after at this point
In this scenario, any better way to approach?
@JamshidHashimi What dbms are you using
@JosephPersie MySQL
Have you implemented caching?
@JamshidHashimi is the number of joins a function of the number of languages supported ? I.e. if you added another language would it require another series of joins to be added to the query?
04:02
@JosephPersie woah... you're suggesting caching without really knowing anything about his setup?
Im not suggesting anything jasper
I was merely performing something called 'requirements elicitation'
@Orangepill No, for example I have a province field in my job_posting table. I get the ID in main table and join this main table with my job_province table, which inside is ID, name_english, name_xlang, name_ylang
@JamshidHashimi have you already implemented indexing?
@JosephPersie right, right, I'm so much more convinced you know what you're talking about now that you've thrown around a fancy sales-rep term
@JamshidHashimi Do you have a relational diagram we can analyze?
04:06
@JosephPersie I didnt implement caching. I did implement indexing.
What is your domain Jamshid?
can I post my query function here? copy and paste? Is there any formatting thing?
web/phone/desktop
use caching
04:08
@JamshidHashimi Just after you paste select your code and do ctrl k
@JamshidHashimi I would like to see the query
function get_main_page_jobs($lang = "")
{
	$records = $this->db->select('
				jc.id,
				jec.company_name_'.$lang.' AS company,
				jc.position,
				jc.is_featured,
				jp.name_'.$lang.' AS province,
				jc.gender,
				jc.end_date
			')
			->from('jobs_job_posting AS jc')
			->join('jobs_employers_company AS jec','jec.id=jc.company_id','LEFT')
			->join('jobs_province AS jp','jp.id=jc.province','LEFT')
			->get();

	if($records->num_rows() > 0){
		return $records->result();
	}
}
This is my query with 2 join
I have like this 11 more
that is only 2 joins
@JamshidHashimi lol, you still know next to nothing about his system and either my eyes are playing tricks on me or you are now suggesting caching
you must have a high traffic website
04:10
yeah. High traffic. A job portal
@JosephPersie yeah, I didnt past the big query. 11 more joins are available here. just like this.
Are you using an orm or ad hoc?
@JosephPersie I am using CodeIgniter active record
Ah..
have you any knowledge of APC or memcached?
It is one step away from schemaless
@JamshidHashimi First off, you were previously talking about 13 joins, yet I only see 2. How did you get to the number 13?
@JosephPersie I know but didnit implemented. I may apply that, but I was wondering if I am doing the very best thing.
04:14
@JamshidHashimi seems sane so long as you have indexes on all of the field participating in the join. When fetching results make sure you are appending any of your where conditions to the query and not selected everything filtering in php
CI is barebones
@Jasper Do you want to paste here the 13 join query? It is a bit long but it is same as this
I find I spend more time dicking around with CI and Zend until symfony came along
@JamshidHashimi just double-checking that you were actually talking about another query and not this one
@jamshidhashimi it would also be a good Idea to index the piss out of all of your static tables... basically any field that could possibly be a member in a join or where condition.
04:16
@JamshidHashimi do you have any reasons to believe you are going to get performance problems?
@Orangepill I will apply LIMIT, for pagination support. I dont have any where conditions.
Also indexing fields used in an order by clause is a good idea
@JamshidHashimi Doesn't you job portal limit by either geography or job type? Those would be good canidates for filtration.
@Orangepill I did index the static tables specific fields(mostly ID) and also integrated the foreign key among the static tables and dynamic tables(main table)
@Jasper I just want to not face. Because it is a highly traffic website.
04:18
Do note that only one index per table is actually used by mysql :)
So it better be a good one!
@Jack really?
@Jack You mean the UNIQUE index?
@JamshidHashimi Any index.
@JamshidHashimi A wise man once said "premature optimization is the root of all evil"
@jack my love for mysql just went down a notch.
04:19
If the index is used for searching, it may not get used for sorting.
@Jack Really? by the way I am using INNODB
@Jack how do you get tags in your messages?
more-ning all. :)
@TestSubject528491 It takes years of training before you can master the
@Jack hmmm thats not good : (
04:20
[[oh :(]]
[damn]
Make sure your database tables are set up correctly, following some of the hints @Orangepill gave you, but other than that, don't go ahead and try to optimize before you know you really need it
@JamshidHashimi Depends. But typically, you only want to optimize when it's actually required.
If your table is 30 rows, I wouldn't bother.
Things start to get interesting after maybe a few thousand rows.
Carpet bombing your table with indexes is almost always a Bad Idea (tm)
@Jack is that also true for where clauses.... do I gain any benefit from adding index too multiple fields that participate in a where?
@Orangepill You mean a compound key / index?
04:22
@Jack no multiple single field keys
my relations for jobs_job_posting table.
All those fields are already indexed. @JamshidHashimi
@Jasper Feel free to try and see; the EXPLAIN mode will help you see.
@Jack yeah indexed in the jobs_job_posting table and also in their related static tables
@Jack I'll pu tit on my mental todo-list
04:27
@jack is postgres subject to the same limitations?
@Jasper Well, granted, it doesn't say so in that many words ... and it can actually use more than one index ... from experience I haven't seen that happen though :)
@Orangepill Postgres !== MySQL ... iow, I don't know :)
@Jack this is the indexes of my main table (jobs_job_posting)
@Jack But you know everything :)
@Orangepill For Postgres, please find @PeeHaa :)
04:28
@Jack Hm... so it might just be because it is (at least as estimated by mysql) best to only use a single index
@Jasper Yeah, that would be my guess as well.
@JamshidHashimi You've put an index on every field?!
@Jack I don't think he's up. It's pretty early here.
@Jack no only fields which they have foreign key relation with static tables. Actually MySQL create those indexes automatically when assigning foreign keys
@Jasper hopefully there is some sort of cardinality threshold the query planner uses before determining how to use the indexes.
@Jasper Yeah, the Dutch are mostly still sleeping :)
@Orangepill There is.
Sometimes it may even decide not to use an index.
@JamshidHashimi Yes, foreign keys have that requirement :)
04:32
if cardinality == number of records... don't use indexes that would make sense.
@Jack so till now, I am doing the correct things? :)
You mean if that column has the same value for all rows? Yeah :)
user652649
@Jasper i have a mental todo-list too... basically, i strongly hope that i will forget that i have something to do
user652649
morning all
@JamshidHashimi If your database design is sane, I would say this is probably legit :)
04:35
@Orangepill the page I linked to does include some info on how it chooses what indexes to use. It's a pretty long read though, I only scanned it myself.
@Jack what reason would you give for the delete? Answered WAY too many times??
Yup
@Jack Thank you and thanks everyone who comment and give idea.
Or rather, it doesn't introduce a new point of view on an existing problem.
04:48
@Jack is it only mods that can delete or is there a magic rep threshold that give you that ability
@Orangepill Delete votes is available for 10k+ I believe.
That also opens up the moderator tools.
Not all of the moderator tools of course ;-)
04:59
http://hasin.me/2013/07/31/introducing-nanimator-library-for-nano-animations/
Planet PHP
Introducing Nanimator Library – for Nano Animations
Hasin Hayder
1375243500
0
Q: PHP - Static variable inside function can't hold reference to singleton

Sandu Liviu CatalinI've noticed a weird behavior with singletons in PHP there's no better way to explain this but with an example. Let's say I have the following singleton class: class Singleton { protected function __construct() { // Deny direct instantion! } protected function __clone() ...

Why doesn't this work?
@Orangepill I dont think that's all, that might be a basic
I got up in the morning, thought to see something on local storage and I hit that page, and sorry for late reply, was getting ready for d office ;)
http://stackoverflow.com/questions/6129173/multiple-submit-buttons-on-a-single-form/6129273#6129273
one more to go ^^
@NullPoiиteя 1 delete vote and that question is dead, I can do that but am not doiing because that guy has +20
05:11
@vascowhite thanks
@Mr.Alien no one will lose rep
@NullPoiиteя except me :)
@NullPoiиteя nm... that's a different question
@Mr.Alien if answer/question 60days + >3 upvote ... then rep wont reverse
@NullPoiиteя not even on deletion?
@Mr.Alien AFAIK yes
05:14
I did profile my query which had 13 join and it runs on: 0.0009
Is this a good result? :)
then that's goes for delete but I will keep a watch on his rep, if it goes down, I will cast a undelete vote
oops, it took my vote but didn't deleted, seems like it needs 5 or 10
is there something that prevents static function variables inside of a static method to be treated staticly?
@Mr.Alien btw who care about rep /... :P
I me myself
@Mr.Alien i think you have enough :P
05:19
@NullPoiиteя 50K is the target now
@NullPoiиteя if you don't than make your top answer CW ;)
@Mr.Alien i dont answer ... :P instead comment
@NullPoiиteя but if it's an answer, than commenting doesn't make sense to me, that's what answer is for
@Mr.Alien again who cares about rep .... :P
because people who land up searching for google first target answers and than if nothing helps, they go for comments
@NullPoiиteя ya so make your pdo answer CW
@Mr.Alien Y U SO JEALOUS OF MINE ANSWER ? :P
05:24
@NullPoiиteя nah, am walking on your said path
as I see you are too big hearted and you don't care about rep, so I told you to consider making that answer cw ;)
lets see if you can do that
lol .. just kidding .. and yes .. sometime i think to reach 20k but .. dam i dont have much time :)
aaah see, now the puppet comes out of the box ^^^
@Mr.Alien and on the top i dont care about rep much neither i am dying to reach 20k ...
@NullPoiиteя so why don't you answer?
@NullPoiиteя you can reach 20K in 3 days from now
havent got time now a days .. too busy
and bye .. have to go now ... urgent work
05:28
@NullPoiиteя np, cya
I am happy with procedural :D
The code behaves as expected when you remove one the other or both of the &'s
I am not understanding why
Goodmorning everybody :)
mornin
05:52
this appears to be a bug in php
Seems like it :)
Whats the best way to check if a session exists ?
@Tredged isset. Are you becoming help vampire again? :D
hmm !empty session :D
@YogeshSuthar If you think so :P
06:02
I would say if (session_id()) { ... }
Thanks :)
Or you could manage your own sessions with cookies :P
@Jack so no static assignment by reference seems to be the point it's falling down.
06:03
@Jack And for $_SESSION['anything'] ?
@YogeshSuthar then yep isset! -- I imagine session_id will always return something, even if you didn't save anything
@Orangepill Believe it or not, it's documented behaviour cough cough
:D
morning guys :)
@YogeshSuthar Why? A session may be empty?
I can just say session_start() ... and so a session exists, albeit with an empty store :)
blitz question: get the first letter after the apostrophe in a string...
06:07
just as long as you have a valid session cookie (recognized server-side), even if it's empty, it'll return a session_id
btw one of the thing I suck most is...REGEXP :)
@jack you mean he uncovered a secret feature :)
@Jack Yeah empty session will return true in isset.
@gr4devel why not use strpos comma, substr, +1?
@DaveChen hey man you're right
let me try :)
btw thanks for your attention ;)
06:09
1
A: Static variable inside function can't hold reference to singleton

JackThis behaviour is documented: The Zend Engine 1, driving PHP 4, implements the static and global modifier for variables in terms of references. For example, a true global variable imported inside a function scope with the global statement actually creates a reference to the global variable. T...

Still think that's totally weird.
@jack yeah it is
@DaveChen get it, trying it :)
if(!isset($_SESSION['veri'])) {
	header("Location: home_.php");
}
home_.php what a weird name. :)
06:11
@Tredged seems legit, put an exit after too
@Tredged session_status() !== PHP_SESSION_ACTIVE
@YogeshSuthar first thought: They have multiple pages like home_one, home_two, and I broke their website xD
home_.php is the second version ... in a few years they will have home______.php :)
Its a test redirect :)
Also the funny thing is it keeps redirecting if the session exists or if it doesnt
I usually put the underscore at the beginning, ex. _index.php :D
06:13
hahaha
@Tredged do you have session_start at the beginning of the file?
Yes.
orangepill I don't get it, please explain this sh-, upvotes for you all on that question :D
@DaveChen which question?
3
A: Static variable inside function can't hold reference to singleton

JackThis behaviour is documented: The Zend Engine 1, driving PHP 4, implements the static and global modifier for variables in terms of references. For example, a true global variable imported inside a function scope with the global statement actually creates a reference to the global variable. T...

06:16
@DaveChen yeah man I slight modify what you've posted but you gave me the key concept, strpos! :)
@DaveChen thanks man ;)
Any idea why it does that @DaveChen ?
try a print_r or var_dump on session, does it have the data you expect?
@DaveChen it was a good question...
Why the hell the form is breaking? 2 files are getting attached properly
the third file always returns long base_64 string in d email
06:20
@Jack good point :D
nvm, for a split second it said (File not found.), still says it actually :o
@YogeshSuthar Yes, it's work; except the chrome that not work. what should I do? why it's so slow? — user1128331 4 mins ago
Here downloading is slow ^^^^^.
@DaveChen If logged in VERI is 1 and loggedout null
@YogeshSuthar file_size isn't needed, you just won't get the ETA :P
hi any one aware of magento?
06:29
<select name="e1" id="e1">


            <option value="Andorra">Andorra </option>
</select>
doesnt this work out to post value to database??
-__________________-
I have some magento Problems
@user2206616 Output Array ( [e1] => Andorra ) when I wrap it in <form method="post">
0
A: force to download on php

user1128331now the code on the question is work. (don't know why not work at that time) thank you for helping me

lolzzz he accepted this (own) answer.
@YogeshSuthar haha yeah, saw that answer too, but how did he accept so fast?, wasn't the minimum time 8 hours?
06:32
Lol
@DaveChen its old question.
@DaveChen i had also expected the same but its passing null value in mine
@user2206616 did you wrap the select in a form?
i am passing it through ajax
@user2206616 like jQuery's $.ajax?
06:36
yap
ohh sorry i know where i have mistaken
@user2206616 good to hear! good luck :D
thank u man
i forget to serialize select in jquery
cv is one step closer to a delv right? :P
its closed. :)

« first day (1019 days earlier)      last day (4155 days later) »