« first day (569 days earlier)      last day (4394 days later) » 

12:13 AM
Hello, is anyone here?
 
12:32 AM
@rdlowrey :-D
 
user895378
1:02 AM
@ircmaxell I still kind of like the idea of a PHP Node.js equivalent ... even though non-PHPers would scream bloody murder :)
 
3:21 AM
@rdlowrey Have you seen this? github.com/JosephMoniz/node.php ... I have seen another event-oriented framework for PHP too.
 
 
2 hours later…
5:16 AM
Actually, this is pretty sad: phpsadness.com/sad/11 I wonder if there is a configuration to disable it.
 
5:57 AM
@Paul Wastage of resources and time.. Truly sad.
 
 
1 hour later…
Can someone tell me how I can have an else statement for isset w.r.t to this answer?
 
7:19 AM
@geekpanth3r First you need an if statement. That answer doesn't have one, so I don't know what you are asking.
 
oh... okay.
 
if (! isset ( $loop_first ) and the_post_thumbnail()) {
    // do something
}
else {
    // do something else
}
@geekpanth3r Possibly something like that.
 
@Paul thanks, I got this...
<?php if ( ! isset ( $var ) ) { ?>
<?php the_post_thumbnail( 'thumbnail' ); ?>
<?php } else { ?>
<?php the_post_thumbnail( 'medium' ); ?>
<?php } ?>

or

<?php if ( ! isset ( $var ) ) {
the_post_thumbnail( 'thumbnail' );
} else {
the_post_thumbnail( 'medium' );
} ?>
This is for WordPress, so it's a bit different from your code
 
@geekpanth3r ouch, definitely the second. The less open and close tags the better IMO.
 
7:25 AM
@Paul okay, thanks.
 
morning everyone
 
anyone know how to get which url to send to while using Google's API, say Google Tasks
 
morning tereško
 
7:57 AM
ehh .. monday .. now back to that stupid $data['allowedActions'] = $this->getAllowedActions($data['order'], $data['actionList']); redirect issue again
 
Hi all
just a small question....
I am facing the issue of multiple mysql connections in my php ajax application...
 
@dskanth whats the issue?
 
Basically what i am trying to do is: i am calling a php script every 4 seconds, that uses mysql to fetch content from database..
 
ok and?
 
@dskanth , does the response changes ever time ?
 
8:02 AM
it mostly does
I had a app it fetches every 2second from mysql
 
@All Hi
 
@SoroushAtarod @tereško yes, the response changes almost every time...
This is the db file that i am including in the page, that is called every 4 seconds
<?php
mysql_connect("localhost:3306","user","password");
mysql_select_db("database");
?>
 
that is not how we connect to mysql in php5 =P
 
@dskanth u can use ajax, setInterval
 
Please stop writing new code with the ancient mysql_* functions. They are no longer maintained and community has begun the deprecation process . Instead you should learn about prepared statements and use either PDO or MySQLi. If you care to learn, here is a quite good PDO-related tutorial.
9
 
8:04 AM
@SoroushAtarod i am already using ajax...
 
@dskanth so whats the problem? the memory usage ?
 
@dskanth , if it is "almost every time" then first step would be to implement a file-based cache
 
any one have idea about the CodeIgniter @dskanth @tereško @SoroushAtarod
 
@SoroushAtarod Yes, the problem is with the database usage
 
@857628 nah
 
8:04 AM
@857628 , it is horrible and should be avoided
@dskanth, you need to implement some sort of caching
 
@dskanth i used same thing what ur saying keeping calling the mysql every 2second
 
@dskanth Also, read: gist.github.com/2362466
 
its fine
 
you are DDoS;ing your db server
 
but the memory usage increases
 
8:05 AM
the database is getting busy
 
check into memchache -.-
 
@SoroushAtarod @tereško ok
 
@SoroushAtarod , you are assuming that that call-per-2-seconds is made by single user
@SoroushAtarod thats stupiud
 
mmm true
@tereško memcache is the solution right?
 
it is a solution if you have a claster of servers
 
8:06 AM
@tereško no.. many users will make calls to database every 4 sec
 
so what if you have only one server
 
@dskanth , what is the approximate rate of duplicate responses ?
will most of users get the same repsonse ?
 
Currently i cant use memcache... what is the best way to use php and mysql with ajax, such that i can use the existing database connection for all requests
 
@tereško if multiple users request data from database through ajax what would you do to increase the performance?
 
@tereško 50% duplicate responses
@SoroushAtarod I am planning to use Node.js and socket.io for performance... if the no. of users increase.. then no need of any ajax .. if needed, i will store the messages in a file
 
8:09 AM
@dskanth , in that situation i would create a "response file" on change in database , and let ajax calls read the content of that file
 
bonjour @all
 
basically , you form a response on each write to the database, instead of each read
 
@dskanth i had the exact same issue
which u have now
@tereško so doesnt that involves every second writing to a file
?
 
you could put the "content of response" in APC instead , but yeah
though , in what sort of system you change DB data each second ?!
 
@tereško @SoroushAtarod Cant i create a mysql connection once, and reuse it for all ajax requests ?
 
8:12 AM
no
 
@dskanth yes u can
@tereško I have a multiplayer online game , there are 6users each move the make it inserts into db
 
This is the barebones code that i have in my "db.php" file, that i include in another file, which i am calling every 4 seconds...

mysql_connect("localhost:3306","user","password");
mysql_select_db("database");
 
and even if you could , you would encounter problems with queuing
 
that means maybe in one second ajax should fetch data from mysql
 
@dskanth , in what sort of system you change DB data each second ?!
 
8:14 AM
it is my localhost now.... that i am testing..
 
@dskanth i finished a multiplayer chess game
@dskanth i faced the same issue which you have. it keeps a huge load on server
@dskanth I think the ideal solution would be to use node.js
to let server inform the client. rather than the client requesting the server
@dskanth check comet implementation . it does have a slight increase in performance
 
@SoroushAtarod For timebeing, Can i create a mysql connection identifier, and use it for all the queries ?
 
@dskanth not sure what you mean. but yea
 
@SoroushAtarod , wrong again
@SoroushAtarod , and wrong
 
@tereško each user will have unique connection right?
 
@SoroushAtarod , you are doing it all wrong
why the hell are you stuck on making a connection for each request of information ?!?
especially if information does not change for each request
 
@tereško information changes all the time
every second information changes
 
store the response when you change the information
 
where will I store in a file?
 
what ?
 
8:20 AM
Well, i will try to optimise my application, to use the existing mysql connection, for all requests.. probably a persistent connection ?
 
@tereško what do you mean store ?where should I store ?
 
in apc or in file
 
apc do you have a good tutorial that I could learn?
@tereško if there are three game rooms. and each room 2users. who play chess
how would you inform other player about the movements?
 
@SoroushAtarod there is this fantastic new thing , called "google" .. try it out
 
8:21 AM
through sockets or database?
@tereško did checkedi t
 
@dskanth , a single persistent connection would cause even more problems .. you would have to implement pooling
 
@tereško you mean long pooling comet?
 
which , in php's share-nothing architecture would be a horrid thing to do
no , i mean database connection pooling , like in java applications
as in "pool of connections"
 
@tereško what language is the best for networking ? I mean rich database connection?
python ?
 
pole:
pool:
 
8:25 AM
lool
 
actually, the first is a pole
 
@SoroushAtarod , when you are talking about long-polling , it is poking a server to check if response is done yet
 
@tereško true
 
@Paul , yeah .. my bad
 
poll is also a term for an animal with no horns.
 
8:26 AM
@tereško i think allowing the server inform the client about a change is more ideal
 
websockets are still in state of early adaptation , and using socket through flash is pain
@Paul , as you might be aware , english is my 4th language .. i tend to make mistakes
 
sam
hi i am new in PHP
 
Yes, I'll forgive you for that.
 
sam
:)
 
ohoh, its the third Sam....
 
8:30 AM
just what we needed
 
sam
actually i am C++ programmert
you can show me some references to learn it fast & easy
 
hey all ... i just wanted to know.. which book is good for php 5 and myqsl
 
www.google.com
 
@sam php.net/manual/en/index.php Seriously, the manual is an awesome resource.
 
sam
8:32 AM
i have some problem about binding PHP and Oracle
 
using PDO ? @sam
 
sam
ok @sam
 
so node.js is the most used for networking application
 
sam
there are some advice's witch no one works fine :(
 
@SoroushAtarod , wrong
 
sam
8:38 AM
?
 
@sam , ya know "does not work" is not a valid error message .. what exactly is the problem ?
 
sam
i installed oci8 on ubuntu then i wrote this line for connection oci_connect('system', '123123', '172.20.12.222/TEMP_LOG');
there are no return :(
 
what's in the oci_error(); ?
 
sam
no , that function doesn't return error message . in fact i wrote echo"hi" after that line .it never come to next line and it never show "hi"
 
what's in webserver's logs ?
you might have misconfigurated php
 
sam
i think i have problem by installing OCI8 , the code is correct
@Eugene it is wrong
 
@tereško then which is recommended for network application? mashable.com/2011/03/10/node-js
it says node
as far I read everywhere say node
 
@SoroushAtarod Node.js along with socket.io is the best
 
@dskanth Agree
 
@SoroushAtarod Using node improves the speed of the application... and also it can handle a ton of user requests at the same time, not like Apache
 
8:57 AM
@SoroushAtarod , maybe you should stop reading the "hype blogs"
@sam "cv-pls" stands for "close vote please" .. it's something that 3k+ reputation users can do
 
hi guys! has anybody done some work with moodle? I have a very simple question maybe you could help me with...
 
@tereško Hope that Node is better at handling multiple users, than Apache
 
@ircmaxell I've noticed, that you are Zend Certified Engineer. I have a question regarding Zend. I'm developing an app, where I need routing. Preferably similar to what ZF offers. But in this app I can't use Zend. Now the question is. Is it possible to write and acomplish routing based on documentation ZF offers on that topic?
 
@dskanth , i use lighttpd and nginx as servers , so i dont give a flying f*ck about limitations of apache ..
 
@tereško AFAIK, Lighttpd is better than Apache in handling multiple user connections
 
@Trufa are you there?
 
@SoroushAtarod yep :)
 
@Trufa i did develop university blackboard system
didnt use moodle
moodle interface aint easy
 
Nope it's not! The block navigation bar (the vertical one on the side) is driving me nuts
Even I if hide all the blocks, the space for the block still shows
 
mmmm
have you tried developing the system from scratch
 
9:12 AM
I could hard code it but it doesnt seem such a good idea
and, no can't do it from scratch, it is not my website
 
@Trufa if you do it from scratch you have 100% control overit
oh alright
 
9:35 AM
.. which you can only do if you have time and resources
@Trufa did you inspect the html part ?
most likely there is a margin on the rest of content to make room for the panel ( or the whole thing is a table .. which in case of moodle is also a possibility)
 
I actually did, and removing manually modyfing the html/css it would be easy to accomplish what I want!
@tereško you are actually right about the table :)
but the problem is, in some other parts I would need that part of the table, so hiding it with it's css class is not really a possibility
I'm starting to very quickly hate moodle
 
Hey guys - probably prette basic question, but I'm trying to work around a limitation in MySQL for my login system. Currently I'm generating a random salt for every user created and hashed with sha1 together with the password. In MySQL I can do something like ... WHERE SHA1(CONCAT(salt, 'input password'))...and it works like a charm. But if I want to use SHA-256 I need an updated version of MySQL (and not many servers has this) which means I need to use PHP's hash function.
 
But this can't be used with MySQL in the same way. So basically, what I'm asking is would it be considered unsafe to just use a static salt for all the passwords within my application?
 
@Gordon hi!
@Gordon I noticed, that are also Zend Certified Engineer ( like @ircmaxell ). Maybe you could answer my question while @ircmaxell is away?
 
9:45 AM
@Repox , you should leave the hashing on the PHP side of thing , try using crypy()
 
@tereško I'll take a look at it. Thanks.
 
what questions will be asked for a php developer position?
 
@hakre probably, but I dont get why s/he's not getting how to do it given that s/he managed to create the tree in the first place.
@Eugene just because I'm a ZCE doesnt qualify me more than the others but feel free to ask. I'm somewhat short on time though, so I might not respond immediately
 
10:01 AM
@Gordon okey. I can wait. Not to repeat myself I'll just add a link to question. chat.stackoverflow.com/transcript/message/3598422#3598422
 
@Gordon good point ^^
 
@Eugene oh, you are confusing ZFCE with ZCE ;) @ircmaxell and I are Zend Certified not Zend Framework Certified
 
@Gordon emmm. Now I'm really confused.
 
Zend has multitude of projects
 
@Eugene Zend Certified Engineer (ZCE) is about PHP. Zend Framework Certified Engineer (ZFCE) is about Zend Framework. It's two different certifications with totally different exams and scope.
 
10:08 AM
@Gordon ou. I see. So no experience with ZF?
 
@Eugene I have some experience with ZF1
 
@Gordon any regarding routing?
 
@Eugene regarding your question: I dont understand what you mean by "Is it possible to write and acomplish routing based on documentation ZF offers on that topic?"
also, i dont understand why you cannot use ZF's router in that application. ZF is a component framework and you dont have to use the full stack to incorporate it into your application. I dont know how tightly the ZF router is coupled to the Zend MVC component though.
Even if you cannot use the router standalone, routing isnt complicated. all you need to do is map some URLs somewhere.
This could be as simple as having an array with urls as the key and the destination as the value
 
@Gordon what I mean is, that they have documentation framework.zend.com/manual/en/zend.controller.html where router is a part of it. If I will find, that explanation in documentation is enough for me, then in your opinion is it possible to write my own controller and all of it components ( also router ) or until I don't have a stable understaning of it, then I will not be able to acomplish that?
 
@Eugene why dont you just look at the source code instead of the documents?
also, a controller is dirt easy to write as well. All it needs is a method to handle the incoming request. that's the only responsibility a controller has.
 
10:17 AM
@Gordon well, I'm making a somewhat of a framework ( I know, that most of you here hate that word ) and the topic of this task is to make it myself. At least such important components.
So as I understand in your opinion it is quite doable?
 
class MyController implements RequestHandler
{
    public function handleRequest(Request $request)
    {
        // do something with Request
    }
}
that's all a Controller needs
could add Response if you wanted
@Eugene yes, but you dont need ZF docs for that.
 
What do I need then? Some other articles?
Because I also need to describe most important components a bit.
For the task.
 
@Eugene If you are interested in ZF's specific implementation of Controllers and Routers, look at their source code. But if you are just interested in the general concepts, just google the terms.
 
@Gordon Okey. Thank you @Gordon
 
10:24 AM
Awesome.
 
got an interview in an hour
tension :S
can someone ask me questions in php?
 
what does explode do? XD
 
extracts certain values from a string
right?
 
@SoroushAtarod what for? just be yourself and dont pretend to know things you dont know.
 
It explodes it by some given boundary string.
 
10:28 AM
so im wrong
 
@SoroushAtarod breaks it into an array based on a delimiter, yes, wrong.
 
@SoroushAtarod BINGO
 
one more question
last time i had an interview, the programer asked me how would u extract a value from a string
and i replied explode, no wonder i got rejected
 
write a for loop to print the numbers from 1 to 10 in english, except for those that contain the letter 'e'
 
i came to know i can use preg_match
 
10:32 AM
@SoroushAtarod you can pretty much use explode for that purpose, but you got at least a couple of alternatives.
 
can u ask me another question?
 
@SoroushAtarod Write a program that prints the numbers from 1 to 100. But for multiples of three print “Fizz” instead of the number and for the multiples of five print “Buzz”. For numbers which are multiples of both three and five print “FizzBuzz”
 
its with a for loop and condition if($i % 3 )==0){echo fizz
@Gordon if($i % %==0) echo fizzBzz
 
They might also ask about knowledge of XML. So I would ask you to build a simple xml document, that needs to consist of Simple root tag and at least three child nodes. You can also through attrbibutes somewhere.
Pretty easy
 
never worked with xml, the position is junior server php developer
i did develop a multiplayer chess game
 
10:38 AM
@SoroushAtarod What does the static keyword do?
 
static means one memory location
it points to a fix memory location
 
@SoroushAtarod when and why you might need to use it?
 
an example would be i have a counter
i set it as static counter = 0;
and i have a for loop and it increases the counter
mmmm
dont know
but i remember i used it in an iphone app
the variable was being set to 0, then when i set it to static
it didnt set to 0
 
@SoroushAtarod Could you give a more complete (especially syntactically correct) example of how to use static? I'm not sure which of the two "static" uses you are talking about right now
 
@SoroushAtarod if you'd answer that in an interview Im pretty sure you'd not get hired because its not a program like it was asked for.
 
10:42 AM
if i want to check user logged in , i have a variable static isLoggedin= true
 
I'd point out that it was for classwide properties or methods. That it wasn't attributable to an instance of the class (and that it was a bad idea for OO code where you are wanting to deal with objects).
 
db pattern question: if you have a large questionnaire and you want to start storing each datum as a single entry instead of updating a row of user-data, how do you deal with the different data types. do you create a table for each datatype and let the app manage the selection of the right table? or is it a case where denormalization is the better choice?
 
@Paul I think @SoroushAtarod is talking about static variables in functions (not in classes). But I'm not sure.
 
@Gordon so where should I use static?
@NikiC yes im talking about static variables in function
@NikiC so where will you use static variables can u give me an example
simple one
 
oh, i see. I don't see static variables very often.
 
10:45 AM
i used it once
i forgot
 
@SoroushAtarod Hm, I rarely ever use function-static variables. Last time I used it it was to count how many times a tick function was called and throw an exception if it's too many times.
 
but im sure it was bez the variable was getting initialized to 0
and i made it static
it wasnt getting change to 0
 
But really, static variables have quite little use. Normally it's better to use a class with a property :)
 
can u ask me one more question?
 
@SoroushAtarod What are some of benefits of OOP?
 
10:48 AM
re-using of code, flexibilty, easy code management. get things done faster with fewer lines of code
btw wats the use of interface
i mean its a class which has functions which does nothing
 
@soroush if you managed to write a multplayer chess game you shouldnt have any problems with questions
 
so whats the use of it?
it wasnt efficient. I didnt use sockets
i used ajax calling every 2sec to the server
it works
but not efficient
 
@markustharkun , sounds like what you ned to look into is table inheritance
 
@SoroushAtarod i would say the benefits of OOP were data hiding, encapsulation, composition and polymorphism.
 
@Paul composition is like having a class book, and class bookLoan
where bookLoan is composition of book
bez if we delete book, the books in bookloan will be deleted
am I right on composition
 
10:54 AM
no
 
we class car
and class engine
if we delete class car, class engine gets deleted
bez engine belongs to car
 
@markustharkun , that would be Chapter 3 in PoEAA book , the section about "Structural mapping patterns"
 
You can't really delete classes. Or do you mean objects?
 
objects
 
@tereško thanks for the hint, will look into that and read the chapter!
 
10:56 AM
... seems like he thinks that class and object are interchangeable
 
@SoroushAtarod The good thing isn't that they get deleted though. Its that One object can use the other objects that it is composed of.
 
@markustharkun , there was alos a chapter on this problem in "SQL Antipatterns" book
might be worth looking into
 
If we were going to model a car, it would make sense to say that an engine is part-of a car. Within composition, the lifetime of the part (Engine) is managed by the whole (Car), in other words, when Car is destroyed, Engine is destroyed along with it.
 
@SoroushAtarod , but it is wrong
objects you inject into others MUST have longer lifetime then the containment
 
class Car
{
    protected $engine;
    protected $brakes;

    // The car can use the engine and the brakes.
    public function screechWheels() {
        $this->engine->rev();
        $this->brakes->apply();
    }
}
Thanks @tereško
 
11:00 AM
omg
how to extract a certain character from a string
strpos right?
i get the position of it
 
@SoroushAtarod $theString[$offset] will give the character in the $theString at the given $offset
 
@Gordon if i want to delete all colons in a string
i can use explode right
explode(':',$theString)
 
@SoroushAtarod why dont you just use str_replace then
 
@Gordon why not explode?
 
11:03 AM
@SoroushAtarod because explode splits a string into parts. thats different to replacing characters
 
mmm
doesnt str_replace , replaces a string
so how will it help in delete the colons in the string?
you mean str_replace(':'," ",$theString); @Gordon
 
@SoroushAtarod yes
 
did you try reading the documentation , @SoroushAtarod ?
 
yes @tereško
@tereško documentations are not good as the tips from an experience programmer
 
@Gordon , actually that wasn't what you meant .. he is replaceing semicolons colons with spaces there
 
11:09 AM
@tereško hm? looks like a colon on my screen.
 
so @Gordon if you want to delete all the colons from a string you would use str_replace
right?
 
3 mins ago, by Gordon
@SoroushAtarod yes
 
@tereško Hi, I heard that mysql is getting depreciated. Any particular reason why?
 
@ShyamK depreciated != deprecated
 
11:15 AM
@ShyamK not MySQL itself , just the php extension for mysql which provides the mysql_* functions as API
 
reason is that nobody wants to maintain it anymore .. the API itself hasn't aged well , and it's not supporting mysql5.1+ features
 
posted on May 07, 2012 by Kore Nordmann

This years FrOSCon - one of the most awesome open source software conferences - is right ahead and we are organizing a PHP ubconference gain this year. Read more for details.

 
@Gordon Sorry, my bad.
@Gordon @tereško Oh okay. Thanks
 
11:25 AM
oha, 18./19. August 2012 will be PHPUnconf HH and next weekend is Froscon 2012 already
 
Say anyone here knows python...not serious python programming but I have a doubt relating to it and the python chat is down..I'm the only one there. :(
 
@ShyamK , why not just use dedicated IRC channel on FreeNode server ?
 
@tereško IRC chat? Never used it..well thanks for the heads up
 
@tereško Why thank you :D
@tereško Damn. Need a manual to use that site. Got one?
 
11:36 AM
what exactly you do not know how to do ?
python channel should be #python or ##python
to join a different channel after you have connected to the server you type in /join #channel_name
 
@tereško Guess its coz I've never used IRC before
@tereško Cannot send to channel: #python-unregistered.

Thats the message that I'm getting. :(
 
well .. then i gues you need to register
try typing in /help register .. or /register help
 
@tereško nope. Nothings happening man.
@tereško Still nothing.
@tere
@tereško This totally suxx
 
register with NickServ
/msg NickServ HELP
 
@tereško Thanks that worked. I've registered with them. But I still get the error message.
Cannot send to channel: #python-unregistered.
 
11:47 AM
itll email you an auth code
that you have to /msg as well
 
did that too..
how do i post a simple message there?
does it have to include /msg?
 
after you register you shouldn't need /msg
/msg is just to communicate with NickServ
 
then what the hell is wrong with this stupid thing? Aaargh!!!
 
perhaps the channel only allows people with voice to speak or try leaving the channel and /join again
 
Gr8. Bummed out chat. Why cant it be as simple as this one?
 

« first day (569 days earlier)      last day (4394 days later) »