« first day (483 days earlier)      last day (4450 days later) » 

12:01 AM
quick question guys: any way to automatically increment an integer column which its row is returned in a query?
in sql, i mean
 
@LondonBoy Howdy, how are you doing?
 
JMR can you be more clear please
@CharlesSprayberry hey Charles nice to see you online, im alright and you?
 
@JMRboosties You mean if Column A gets queried we increment some counter signifying "Column A was queried"
 
@CharlesSprayberry well i was thinking more like if row A was queried then increment a counter column in that row
 
@LondonBoy I'm doing great :)
 
12:03 AM
so if you do 100 queries and Row A is given ten times, column_count would have a value of 10
obviously you can do this in php using a 2nd statement, just trying to do it more efficiently
 
@CharlesSprayberry nice to hear :) have you got the new job?
 
@LondonBoy I just got back from apartment hunting with my fiancee. The company wants me to start on 2/27...just depends on if I can get into a place that soon.
 
@CharlesSprayberry good luck and i hope you will get it soon
 
@LondonBoy Thanks :)
 
@CharlesSprayberry Im doing a little script where people can guess scorers of the week in soccer and if they get all 4 correct choices they win, what would be the best way of implementing this :)?
 
12:09 AM
Sup peops
 
hi Anfurny
 
@LondonBoy Define your problem, write down what you want your users to do, define the data you want to store, write unit tests, write code.
I'm sure you could throw in there some stuff like "writing down what you want to do with the data and what you want users to do with the data"
 
For what it's worth, my advice: Ditch the project and just dl porn instead @LondonBoy
 
But, really until I have written it down or typed it I refuse to do anything. I've done that before and it winds up leading to crap. First thing I do is start writing. Chances are I've flubbed something in my thinking and the writing will reveal the flaw
 
i got the data in the db and can retrieve how many correct scorers they got
 
12:13 AM
@CharlesSprayberry any insight?
 
@JMRboosties No, I'm sorry. Admittedly I would probably just do a second query. I don't think I saw anything relevant on Google, but I also don't think I looked too hard ;)
@LondonBoy Well, if you can get the data out then it's just a matter of checking whether or not they guessed right :)
 
@CharlesSprayberry yea ive looked on google and come up empty handed as well
a 2nd query is by no means bad, i was just wondering if there was a more succinct way of doing it
 
@JMRboosties If you checked Google and SO then post a question. Maybe there's some special way of doing it that a more advanced SQL user can answer
 
yea perhaps i will
 
12:56 AM
@CharlesSprayberry good night charles
 
@LondonBoy See ya :)
 
 
1 hour later…
2:21 AM
posted on February 11, 2012 by Chance Garcia

PHPStorm's File template settings are very versatile. They allow you to not only make a file template, but also allow you to parse out redundant elements (such as licensing) in the template by allowing an includes section. In your File Template, any undefined variable automatically elicits a prompt from PHPStorm. PHPStorm allows you access to the includes section via the #parse directive. If y

 
3:37 AM
anyone here?
 
does beginTransaction() followed by an execuite() actually update the database?
 
@epaps No, you would need to check for errors and then either rollBack() or commit() as appropriate
@user1079641 What's up? If you need help just ask :)
 
@CharlesSprayberry i'm trying to implement rollBack() and commit() as a solution to this problem: stackoverflow.com/questions/9222244/…
 
@epaps Hrmm...have you tried the info provided in the answer about the transaction locks?
 
@CharlesSprayberry No, not yet, but I'm using PDO so I figured rollBack() and commit() might be easier
 
3:48 AM
@epaps Ugh, trying to manage internal locking of the database through PHP? Sounds like a nightmare.
 
@CharlesSprayberry Do you think my problem can be solved using rollBack() and commit()?
 
@epaps Well, I mean you're using transactions right? That's pretty much all you can do, either rollBack() or commit() :)
 
@CharlesSprayberry How can I check to see if the system is overbooked and then rollBack()?
@CharlesSprayberry If the database isn't being updated? I can't see if there are now 5 spots taken because the database isn't updated until commit()
 
4:13 AM
I have an index.php and then a head.php
index.php imports head.php using "include"
head.php uses "include" to import style.css
 
@epaps Not entirely sure, sorry.
 
problem is
for some reason, the style.css file is being printed out
$path = $_SERVER['DOCUMENT_ROOT'];
$path .= "/res/style/main.css";
include ($path);
that is the include code
can anyone please help me?
?
never mind
i changed /res/style/main.css to res/style/main.css and it worked :)
 
 
2 hours later…
6:54 AM
why do you name your files *.class.php
 
hello everybody
i am an android developer but i want to communicate with php server using webservices please see my question here stackoverflow.com/questions/8970213/…
and please help me with how to create webserive in php to return Json array,jsonobject to android application
 
 
1 hour later…
8:39 AM
Good mornin'
 
9:05 AM
how to include the files in zend framework ? I have function file now i want to include this file inside my edit.phtml page what i can do ?
 
9:27 AM
@Donut mornin
 
9:39 AM
@NikiC Do you know the ans
?
@Gordon any idea ?
 
@John No idea, I don't know ZF ;)
 
ok
@Gordon You there ?
 
Hello
In MVC you want to have the logic that belongs to a particular domain in the Model right? The Controller should only be routing actions from the view to the model and update the view again when the model is changed?
 
 
1 hour later…
11:12 AM
this is going to be awesome: ironsky.net
 
hey @Gordon
 
@NikiC hey
 
got a question about how to best implement something
say I want to store some info about function return values and parameters
one part of that info is the typehint
my Initial thought was to have an empty interface Typehint and also empty classes Typehint\Integer, Typehint\String etc, as well as a Typehint\Object (which actually has some methods). But that doesn't sound reasonable
 
not sure i understand the question
 
hum
I'll just ask the other way around: How would you store typehint infos of params?
Simply using strings like 'int', 'array' or 'PDOStatement'?
 
11:21 AM
store where?
 
in some object
 
i still dont get the question :( can you give an example?
 
heh :(
Say you have a class Parameter with constructor(typehint, isByRef). isByRef is a boolean, clearly. But what is typehint?
 
aaah
hmmm
string sounds reasonable
 
it does?
 
11:25 AM
you could infer it from the value passed to it but it doesnt work for mixed type
like new Parameter($theValue, $byRef) and then do gettype($theValue)
 
@Gordon I don't have concrete values. Think of it more as reflection ;)
 
String does sound reasonable for my particular case. But in the general case there for example wouldn't be a distinction between "int" (integer type) and "int" ("int" class ^^)
 
@NikiC hmm, is that an issue? I mean, we dont have working scalar typehints anyway
 
@Gordon No, it's not an issue for me, only theoretic ^^ Nobody would typehint against an "int" class, so one can safely assume that it is an int type
 
11:31 AM
and in case of the newly introduced scalar typehints i'd argue that any code you write should follow the language, so int would mean scalar, not class
you could of course come up with something like a TypeHint class
 
@Gordon but how would it look like?
 
class TypeHint
{
    protected $name;
    protected $isScalar;
}
and maybe isCallable
 
That's what I tried to explain above, that one could have a Typehint interface and several empty Typehint_Integer, Typehint_String ... classes, but they would all be empty, which doesn't sound right
 
that would be tagging interfaces
 
@Gordon And isInt, isString, isArray, isResource ...
 
11:33 AM
its not completely broken imo
alternative would be abstract TypeHint and then have TypeHint_Int extends TypeHint
 
is it better to use an abstract class there?
 
i really dont know
you would trade the tagging interface for empty subtypes
__construct(TypeHint $typeHint, $byRef, $defautlValue)
new Parameter(new TypeHint_Int, false, 1)
 
sam
any one can plz give me like for sample zend framework application
 
yeah, that would look cleanest to me
still having empty Typehint_xyz classes fells kinda wrong ^^
 
@NikiC given that typehints hint at types, you could probably also just pass Type instances
so not have TypeHint classes but create just Type classes
 
11:39 AM
not that it would change much
 
yeah, just brainstorming
 
hum hum hum
I think I'll go with the empty classes
 
Hello all!
 
Only need to solve the Type\Array problem now ...
 
1
Q: Zend Tutorial for newcomers

khushwantIs there any good tutorial for zend except the official zend tutorial at http://framework.zend.com/manual/en/. The zend official tutorial is very scattered and not very much helpful for newcomers.

 
11:40 AM
I probably will have to use Type\_Array or something like that ^^
 
Did anyone setup XDebug with PhpStorm on remote server?
 
nope
 
@NikiC what would you pass for No Hint or Mixed?
 
@Gordon Type\Mixed maybe?
heh, everything feels to bad :(
 
and Type\Null or None
will this be for static reflection or runtime?
 
11:43 AM
I probably should just stop trying doing strange OO things and just hack together some dirty app ^^
@Gordon The data is coming from the docs, so static ;)
 
@NikiC i'd say just start with strings. looks like the simplest thing that could possibly work. can improve later
 
@Gordon Hm, I'm thinking about getting rid of all that altogether. And instead just read in the data from sqlite directly, without converting it into an object graph first.
 
@NikiC cant tell since i have no idea what you are really doing there
 
@Gordon me neither, I think ^^
 
12:39 PM
class InvokablePDO extends PDO {
    public function __invoke($query) {
        $stmt = $this->prepare($query);
        $stmt->execute(array_slice(func_get_args(), 1));
        return $stmt;
    }
}
How evil is that?
$db('SELECT foo FROM bar WHERE x = ? and y = ?', $x, $y) ^^
 
Looks nice.
 
Nice trick
 
1:11 PM
@NikiC it should have a hint that it accepts variadic number of arguments
 
@Donut and ALL : do you know any how to make realtime chat in php ?
 
Yes thankyou :)
 
@Donut using XMPP
 
@dhams you dont. use nodejs or python instead
 
@Gordon well i read somewhere using xmpp in php for realtime chat
 
1:15 PM
@dhams and now you read that you should use nodejs or python instead ;)
 
Or some native language
 
@Donut yah ... m using java for this but for server backend i need to handle xmpp for it
@Donut in java i found so many server for real time chat ..but i dont have java server to deplyoee my project
 
@dhams the problem with php for long running processes is that it will start to leak memory. i dont know how severe it is for the library you linked, but that is the general problem with php for anything real time.
 
@Gordon ?
the only problem imho is that it'll block a process and you'll run out of processes
 
@Gordon: Aside from the fact it's socket routines were not designed for server implementations
 
1:19 PM
@Gordon @Donut i'll worder if i get to know how facbook made a real time chat ..they are use xmpp server or else ?
@Gordon @Donut facebook is in a php isn't it ?
 
@dhams they probably have design documents for that online.
@dhams facebook is polyglott
 
@Gordon i dont want real time chat in website ..i just want open source server which is suppot xmpp
 
@Gordon I thought it was some Erlang job
 
@Leigh they use various languages.
@dhams well, try that google lib.
 
@Gordon google lib ?
@NikiC dose xmmp work on php server ?
 
1:23 PM
@dhams xmpphp. the one you linked
 
@Gordon yes but m looking for opensource php server which support it
 
@NikiC i dont have a linkable for that. its just what ive been told the recent years over and over again. happy to be proven wrong. would open up new frontiers for php.
 
@Gordon I see no reason why it should leak memory ^^
 
@dhams try some of these: xmpp.org/xmpp-software/servers
@NikiC mainly because the purpose of php is short lived requests where memory is freed after the request anyway and a lot of the internals dont care for proper memory handling
 
1:35 PM
@Gordon PHP has few leaks, and those only in crazy circumstances.
Just try a debug build and see whether you get leak messages
On any "normal" code you won't get any
 
13
Q: Is it wise to use PHP for a daemon?

AbsI wish to create a background process and I have been told these are usually written in C or something of that sort. I have recently found out PHP can be used to create a daemon and I was hoping to get some advice if I should make use of PHP in this way. Here are my requirements for a daemon. ...

 
elegant way to get a nan in php?
 
@NikiC investigate and write a blog post about it please
 
@Gordon I don't see anything to investigate
 
@NikiC var_dump(NAN);
@NikiC well, given that there is a lot of people saying PHP is not well suited for long running processess, someone should clear up that myth if its not an issue anymore
 
1:43 PM
@Gordon Uh...
And I was thinking about 0.0/0.0 ^^
 
:)
 
and you don't by accident also know the name of the function which generates random floats?
ah, already got it
is there also some float max const?
there doesn't seem to be a PHP_FLOAT_MAX ^^
 
@NikiC nope. no idea
 
@Gordon list(, $largestDouble) = unpack('d', pack('C*', 255, 255, 255, 255, 255, 255, 239, 127)); is what I came up with
I'll ask a question on SO in case there is a simpler solution
but thinking about it: The above method assumes a double anyways, so I can just as well use the plain value ...
/me thinking too complicated again
 
Sup
 
@Gordon funny that it uses eval() as a non-fucntion as an example ...
hiho @edo!
 
whats up
 
Hi @edorian
 
heh, I kinda have the feeling that php doesn't generate random random number ... ^^
 
2:32 PM
well it's not getting better than mt_rand when doing just math
ircmaxells crypto lib has other random sources
 
3:11 PM
lol, there honestly is a leak() function in PHP
(i.e. in debug builds) ^^
wonder what its useful for ^^
 
3:35 PM
@NikiC judging by the name its for leaking something.
 
@Gordon Yes, it is. I mean I don't know why you would want to leak memory ^^
 
Afternoon
do any of you know how to remove the . and .. from this ` if ($dh = opendir($dir)) {
while (($file = readdir($dh)) !== false) {
echo '<li><a href="uploads/';
echo $file ;
echo '">';
echo $file ;
echo '</a></li>';
}`
did that make sense?
 
3:52 PM
@FrankAstin there is "isDot($dir)"; but all in all I'd suggest now using DirectoryIterator or glob and avoiding opendir
 
could you link me to an example of how I'd use DirectoryIterator
 
php.net/DirectoryIterator
__construct
 
@edorian thanks bro
 
4:37 PM
any idea why this is loading portfolio.php instead of index.php with portfolio as a variable ` RewriteRule ^portfolio/([\w-]+)?$ index.php?portfolio=$1 `
 
@FrankAstin That rule won't do that. Probably another rule responsible for that. Try ^/portfolio instead.
 
@Oldskool no joy , doesn't load anything now
 
@FrankAstin So you now have: RewriteRule ^/portfolio/([\w-]+)?$ index.php?portfolio=$1 loading nothing?
 
@Oldskool yep
 
@FrankAstin Odd, do you have RewriteLog enabled? If yes, what does it say? If no, try that for further debugging :)
 
4:51 PM
@Oldskool no can do , server doesn't allow it . I've got another rule : RewriteRule ^([\w-]+)$ index.php?query=$1 (which works fine) . Could that be conflicting with it?
 
Well, yes.. portfolio also matches [\w-]+
 
@Oldskool thought it might , how can I get them working together?
 
@FrankAstin Try putting your portfolio rule above that and put [L] behind it, to tell Apache that's the Last rule it should parse on match.
 
@Oldskool can you clarifie where you want the [L]
`Options +FollowSymlinks
RewriteCond %{SCRIPT_FILENAME} !-d
RewriteCond %{SCRIPT_FILENAME} !-f

RewriteRule ^/portfolio/([\w-]+)$ index.php?portfolio=$1


RewriteRule ^([\w-]+)$ index.php?query=$1 [L]`
 
hello all
 
5:04 PM
@FrankAstin Almost right, the [L] should go after the ?portfolio=$1 bit.
And hello PeeHaa
 
@Oldskool Still nothing....
 
And with your original ^portfolio rule? (So with the leading /)
 
yep as above
hang on I've got a local LAMP , I'll see if I can get the log running on there
 
5:23 PM
@Oldskool having probs with the local , but interestingly if I remove the other rule it still doesn't work
 
@FrankAstin So, any luck with the local RewriteLog?
 
@Oldskool nah , apache won't pass the vaible to my php script on the local server
 
Dan
mh, might it be the $ at the end?
what are you passing in?
 
@Dan mydomain/portfolio/ (thisbit)
 
Dan
nothing after /portfolio/ ?
 
5:36 PM
@Dan yep , just a simple string eg blah
 
Dan
so actually mydomain/portfolio/something
 
@Dan yep
 
 
2 hours later…
7:18 PM
@Oldskool I has log
 
any other peeps skilled with mod_rewrite
 
@FrankAstin I know a little. What's the question?
 
0
Q: Trying to get index.php to load under HTML5 head bar without interputing music playback while user browse site?

Rileywhat tag do i need to use to have joomla index.php load below my that header. http://www.gmoneyglove.com/html5 ... i almost figure it out .. Been trying this for ever .. i am almost there.. : as you can see the player on top .. if you hit the arrow forward key it plays .. and you can navigate ...

 
@PeeHaa I've been trying to get this to work with little sucess RewriteRule ^/portfolio/([\w-]+)$ index.php?portfolio=$1
 
7:26 PM
What is the url you are using?
 
@FrankAstin Are you sure your webserver doesn't add a trailing slash?
 
Try using ^/portfolio/([\w-]+)/?$ index.php?portfolio=$1
 
^^ what @Donut said
kinda
the dollar sign isn't correctly placed i think
 
Fixed
 
:-) you're fast
 
7:28 PM
Doin' it too fast
 
:P
 
@Donut nah no joy , wanna see the log?
 
Show it.
Still, what url are you using? In webbrowser
 
mydomain.com/portfolio/derp
 
And what's the problem?
 
7:34 PM
`109.149.192.97 - - [11/Feb/2012:19:34:00 +0000] [mydomain.com/sid#823b4b0][rid#8479898/initial] (3) [perdir /var/www/html/] strip per-dir prefix: /var/www/html/portfolio -> portfolio
109.149.192.97 - - [11/Feb/2012:19:34:00 +0000] [mydomain.com/sid#823b4b0][rid#8479898/initial] (3) [perdir /var/www/html/] applying pattern '^' to uri 'portfolio'
109.149.192.97 - - [11/Feb/2012:19:34:00 +0000] [mydomain.com/sid#823b4b0][rid#8479898/initial] (4) [perdir /var/www/html/] RewriteCond: input='off' pattern='!=on' => matched
@Donut i get a 404 instead of index.php?portfolio=blah
 
What about ^/?portfolio/(.*)/?$ index.php?portfolio=$1 ? (updated)
 
@Donut nothing
@Donut interesting , it loads portfolio.php
can you check get variables with chromes js console?
this is weird , it's remapped all of my linked script files (jquery ect) back to portfolio.php
 
8:15 PM
@Donut I will launch my website somewhere the coming week. Thanks again for testing
 
"developer tell that he will launch own website in a week" .. it means that it could happen this month
 
9:06 PM
@PeeHaa :)
 
 
1 hour later…

« first day (483 days earlier)      last day (4450 days later) »