« first day (639 days earlier)      last day (4295 days later) » 

6:00 PM
@cHao great answer on @Neal Q
 
thanks :)
 
@dyelawn The output buffer doesn't abnormally effect variables set before, during, or after output buffering
 
@Bracketworks What would be the best way to separate each organization's data? I can just add a field to each table with whatever organization that row belongs to. But is that the best way?
 
I'm starting to hate you...
 
@MikeB so what's the point of calling ob_end_clean()?
 
6:01 PM
@hanleyhansen an Organization table, and each record elsewhere that belongs to a given Organization references it by ID.
 
@MikeB Well, the good news is that JavaScript is taking over as the first language people learn. In some ways, this is GOOD for PHP.
 
@dyelawn I don't understand your question. ob_end_clean() erases the buffer and trashes its contents. What does that have to do with a variable?
 
@Bracketworks I would also have to make a multiple column index for each record with the organization id.
 
@Bracketworks I told him that already...
 
@Bracketworks Beacause org1 and org 2 can both have a bob, right?
 
6:02 PM
@dyelawn it dumps output to the browser
 
@hanleyhansen My company has a strict 1 Bob per department rule
 
@MikeB What about Alice?
 
@MikeB this is cross company so joke no good.
 
atleast 1 Alice per department
 
i want to do some stuff with variables, but i don't want those variables to ever be visible/output. E.g. I want to calculate a rating for something, but i don't want to reveal the data or methods used in the calculation
 
6:03 PM
hi
 
@qaisjp hi hi
 
JOKE NO GOOD
 
Do you know a good way to design a user log database?
 
[Alice] + --- 1 [Department] 1 --- 1 [Bob]
 
@dyelawn Why would you methods of calculation be revealed?
 
6:04 PM
Poor Bob.
 
@webarto Why you sucking me dude? Hop off.
 
@dyelawn erm... output is what you echo/print...
wat
 
@webarto thanks. my vocab isn't good, very new. I meant output like a verb, like to output
i'll be sure to keep the terminology correct in the future
 
@hanleyhansen Hrm, is there any reason for data separation? Meaning, security reasons (are you managing sensitive user data), or performance reasons (each site will have terabytes of data), or management reasons (sites will get customizations that will require db level changes)
 
@dyelawn if you paste script, you can probably get detailed help, basically, what you don't echo/print will not be "visible" and affected by ob_*
 
6:06 PM
@ircmaxell security reasons. I don't want my security to be limited to a where clause.
 
@hanleyhansen Hammer out a prototype with whatever means and resources you have at your disposal. It'll be messy. Once you're done, and you can shove input in one end and output dribbles from the other, take it apart and perform an analysis of the approach. Read, learn, and revise. Simultaneously, ask specific questions on SO through this endeavour, instead of copping a free think-tank session in chat.
 
@hanleyhansen but that is where most "security" in DBs are....
 
this is just getting better and better...
 
@Bracketworks LOL
 
@hanleyhansen can you elaborate?
 
6:07 PM
@ircmaxell Data leaks in a SaaS setup
 
@MikeB my understanding is (please feel free to correct/revise) that output buffers are used to prevent data you don't want being transferred to the browser.
 
yes, but what data
 
@dyelawn Kinda, that's one use of it but not the strict definition
There's tons of stuff you can do with output buffering.. the majority of them are wrong/bad :(
 
@ircmaxell Each congregation will have their users sensitive data. If i put everything in the same db when i query it won't i be doing "select * from speeches where congregation=256" for example. so the only security is the fact that i am just filtering by using the where clause. idk if that's how it's done. that's my question. or is that unsafe?
 
6:09 PM
@dyelawn output buffer, well, is a buffer that collects all echo/print data before outputting it to the browser, that way, it can be gzipped to save bandwidth and increase speed... but you can see output after the script has executed... otherwise, output can be updated while the script is working... I'm no good at explanation, so google it...
 
@hanleyhansen define sensitive data
 
so say i'm doing some sort of authentication using two keys. i want to flush_clean so that the keys are never transferred to the browser. but inside that buffer, i might also like to set some variables that will be used in another part of the script
 
@hanleyhansen You are creating something that exists already --> shulcloud.com
 
end_clean*
 
@ircmaxell addresses, id numbers etc
@Neal i'm not. my application is tailored to theocratic ministry schools. not at all the same. it's religion specific.
 
6:11 PM
@dyelawn Why are you outputting keys?
 
@hanleyhansen: please be specific. I've asked what sensitive data. id numbers can mean many things...
 
i'm not
 
@dyelawn I'm still not understanding. At some point you're printing secure information, then collecting it in the buffer and throwing it away?
 
@hanleyhansen lol but I am sure you can work with them to make a version to suit your needs. no need to recreate the wheel :-)
 
@dyelawn once again, that buffer is only from echo/print... variables etc are in memory... and they cannot be accessed from outside...
 
6:12 PM
@ircmaxell publisher id number, pioneer id number. stuff that isn't supposed to be shared.
 
even variables in a buffer are stored in memory?
 
$string1 = "foo";
ob_start();
echo $string1;
$string2 = ob_get_clean();
 
Variables don't go in buffer
 
Setting strings, the easy way.
 
@Bracketworks Hehe that is how the view part of my MVC works
 
6:13 PM
@dyelawn everything is in memory... buffer is only for output...
hi, I need help
 
@webarto yes?
 
@Neal Oh boy. Lemme guess, you wrap an eval() in there somewhere ;)
 
@Neal i'm also doing it for the learning experience.
 
@hanleyhansen so far I haven't seen anything that isn't considered public. Therefore, keep it in a single database...
 
@webarto Don't we all?
 
6:13 PM
oh. so that's why it's output buffering
 
@Bracketworks nope ^_^
 
@Neal @Bracketworks @NikiC @ircmaxell @MikeB can you help me?
 
no
 
@webarto i think i understand now
 
@webarto Sure fella. What seems to be the mishap?
 
6:14 PM
I'm having this problem...
 
@webarto No... You've never said what your problem is
 
@webarto Lots of people do. What makes yours special?
 
I'm building a social network...
 
@webarto Yeah, I have that one a lot too
 
6:15 PM
its called bookface
 
@webarto as did I ^_^ it was really crappy: blipit.net/new
 
brilliant!
 
@webarto Does it doo facebook?
 
and this NodeJS AJAX jQuery thing that I got
mysql_query is not working
it works on local server, I'm using Window7 and WAMP, for my social network
 
@webarto I usually use WAMP with Ubuntu... I wonder what your issue is....
 
6:18 PM
@Event_Horizon I hate it when people say "I'll facebook you."; facebook, you see, is not a verb. The action conjured up in my head every time I hear that, is of one person mashing a dictionary into another's face.
 
@Bracketworks yeah, I also picture this
 
@Bracketworks I like googling though ;) And by extrapolation to facebook someone is also okay
 
@NikiC I'll science you to death.
 
$res = mysql_query('SELECT * FROM users');
while($row = mysql_fetch_array($res))
{
    $last_user = $row;
}
print_r($last_user);
I use this to get last user, but it's not working
 
@webarto Did you try codeigniter?
 
6:20 PM
and I use this to select last 500
 
"Try googling my name so you can facebook me later"
 
SELECT DISTINCT users.id, users.membership, (((acos(sin((35.7589*pi()/180)) * sin((users.latitude*pi()/180))+cos((35.7589*pi()/180)) * cos((users.latitude*pi()/180)) * cos(((-78.7798- users.longitude)*pi()/180))))*180/pi())*60*1.1515) as distance
FROM users
INNER JOIN laston ON users.id = laston.user_id INNER JOIN z_9 AS s9 ON users.id = s9.user_id INNER JOIN z_12 AS s12 ON users.id = s12.user_id INNER JOIN z_13 AS s13 ON users.id = s13.user_id INNER JOIN z_14 AS s14 ON users.id = s14.user_id INNER JOIN z_15 AS s15 ON users.id = s15.user_id INNER JOIN z_16 AS s16 ON users.id = s16.user_id I
2
 
It can do MySQL too
@webarto I think your pi is broken
 
I got this query from the company I worked in, it ran only 2 days...
 
@webarto Is that for real??
 
6:22 PM
is that a polar distance calculation?
 
guy got fired, and beaten...
 
Fanicified:
SELECT DISTINCT
    `users`.`id`,
    `users`.`membership`,
    (((acos(sin((35.7589*pi()/180))*sin((`users`.`latitude`*pi()/180))+cos((35.7589*pi()/180))*cos((`users`.`latitude`*pi()/180))*cos(((-78.7798-`users`.`longitude`)*pi()/180))))*180/pi())*60*1.1515) as `distance`
FROM
    `users`
        INNER JOIN
    `laston` ON `users`.`id` = `laston`.`user_id`
        INNER JOIN
    `z_9` AS `s9` ON `users`.`id` = `s9`.`user_id`
        INNER JOIN
    `z_12` AS `s12` ON `users`.`id` = `s12`.`user_id`
 
@webarto looks solid
 
^_^
 
anyways, I solved my problem... hope it helps:
$res = mysql_query('SELECT * FROM users');
while($row = mysql_fetch_array($res))
{
    $rows[] = $row;
}
$num = mysql_num_rows($res);

print_r($rows[$num]);
 
6:24 PM
@webarto PFFFFT
1
A: cakephp case insensitive login

NealJust use strtolower php function before saving it (or checking against it).

My answer of the day
Sorry this one is better:
0
A: PHP OOP - using an object inside other classes

NealPass it into the controller: class Item { function __constructor(SoapClient &$s){ $this->soap = $s; } // item properties function addItem($itemName) { $this->soap->addItem($itemName); //service returns true or false } }

Ummmm Singletons are uuuugly. — Neal 9 secs ago
 
pastebin.com/0haKQEEL can you help me with this query
 
@webarto wtd is that??
 
@webarto what in zeus's name is that?
 
@Event_Horizon wizn?
That doesnt flow of the tongue as easily
 
@Neal only because you aren't use to it
 
6:28 PM
@webarto i'd like to help:
 
all from company I worked in... (I'm kind of ashamed now)
 
Does anyone have a leftover vserver I could use?
 
@NikiC A what?
 
pastebin.com/N6myYRQb < this one is also great
why do you do that? diddn't we agree you will add column "state" in the area codes table ?
- not in area_codes table
- why not ?
- I think this kind of table should be mobile
- what is "mobile" ?
- flexible
- and you want it "flexible", whatever it means?
- yes
 
if you run a curl to a cgi script, do the variables in the script still get stored in browser memory?
 
6:30 PM
I'm not sure what this is called so I don't know how to search for it, but does anyone know how or can help me get started with this... Take for example, a support ticket system, where someone can send an email to support@mail.com. the server takes that email and inserts the message and "from" into a database, etc.
How do you go from email to script?
 
@dyelawn not in the browsers, in servers...
@stevether me to the rescue
 
and the memory you were talking about before in the output buffer was also server?
 
@Neal hm?
 
@stevether you need something listening for incoming messages
e.g. postfix, etc
 
@dyelawn yes man, it's all on server, you don't need to worry
 
6:32 PM
3 mins ago, by Neal
@NikiC A what?
 
so for a human to gain access, they'd have to gain access to the server
 
@stevether one option is to download messages from IMAP/POP3 account which is support@mail.com ... second one is to "pipe" email to you kind of $this->stdin = stream_get_contents(fopen("php://stdin", "r"));
 
I guess this is called email piping?
 
as long as you have a halfway decent mail server running, the functionality is probably already there
 
yes, and then you parse email (from,message,subject)... ticket id is in subject usually... @stevether
 
6:36 PM
Cool, I'll do some googling. Thanks
 
I'm sirius now
I get random connection timeouts on Win7, I don't think it is Apache in matter, but rather Windows, because it doesn't happen when I access from Linux, whatever that means...
local network, over dlink router, supermarket grade one...
serverfault?
I am sirius
 
-1
Q: Trying to get value from $this-> through another variable value in codeigniter

Daniel Runnakko LöfgrenAlright,so I'm trying to get the value from $this->lang->line('test'); I got another variable called $try, which contains the value $this->lang->line('test');. I can successfully make it print out the name $this->lang->line('test');, but I can't get it to print out the value o...

da fuq?
 
that is OOP
even Rasmus is not using eval()
 
better yet...
i have a scary request from a client
 
6:52 PM
don't let me guess
 
they want to be able to copy/paste sql statements into a textbox in an admin area and be able to create their own reports.
developed a reporting site, and i made some canned reports for them.
they want to take the statement thats generated from their internal program and put it on this site i made for them. so they can create a report for their client.
HELLLOOOOOO injection
 
just add, you are executing at your own responsibility... and that would be a little tricky...
 
nah not tricky
easiest way is to store the statements in a table somewhere
 
anyone know where i can get a list of htaccess wild cards
 
6:56 PM
yeah did you try those links
or are you just happy to have a use for that
 
lol i use that all the time, even in my corporate job :)
infact i have a big sign above my cube taht says "Google Headquarters" with an arrow pointing down to my cube.
is what you're looking for @ert3
 
no
([a-zA-Z0-9_-]+)
any number an letter
 
those arent wildcards
those are regex exp's
 
AH
 
facepalm
 
6:59 PM
thats what i needed then
 
i use this site-> gskinner.com/RegExr
because regex > me
i am convinced there is an easier way to do stuff than with regex.
i am also convinced that they stem from satan himself.
 
Yeah see im trying to lock down my Get variables and the tutorial i used to figure out htaccess refers to them as wild cards, then again i found myself haveing to redo allot of the crap in the tutorial
 
yes, learn how regex works. It's not hard at all
complex queries can be difficult, but the basic premise is easy...
 
we wouldn't have jobs if complex coding wasn't hard
 
@ircmaxell x2.. i still have to scratch my head at them sometimes. So i usually opt to ginore them lol
 
7:02 PM
34 page views short of 60k on my "PHP Sucks" article
 
nice :)
fuq ya, getting that for the gf
 
SplObserver doesn't really work well for creating an event-driven system. It requires an SplSubject, but in an event system the subject doesn't pass itself to the observer, it passes the event.
 
@NikiC: this ajf guy is getting on my nerves...
 
0
Q: HTTP (random?) connection timeout with Windows 7

webartoI am experiencing (almost) random connection timeouts, with Apache on Windows7, to the extent that I'm afraid to hit F5... I cannot explain when it occurs, because I was unable to find pattern. Computer that is giving me the troubles is the one that Mario wants to smack. Here is the fun part, ...

 
7:19 PM
@ircmaxell yeah a bit
he's too active
still I appreciate what he's doing
 
define: ajf
 
holy load time batman
 
@NikiC which is why I haven't said anything...
 
stars.js
 
7:22 PM
@ircmaxell He still has to grow up a bit :)
 
It's really odd to think that the two of you are only separated by a year...
which makes what you do / how you do it a lot more impressive
 
NikiC knows ajf?
 
@gorelative Good choice :D
 
AJF is a top-poster. Why has he not been yelled at for this?
 
you're welcome @MikeB
 
7:33 PM
speaking of head screatchers here is one, so i setup paging for my blog and I have the get variable page set the multiplier for the limit start for each page , IE (LIMIT :start, :numerator )
pages iterate by multiplying 4* page number with the 0th page pre defigned, for some reason page 2 however shows sets present from 0 where as page 3 does not (as it shouldn't) any ideas?

Page 2 = 2 * 4 -> (limit 8,4)
never mind i figured it out
 
user895378
@LeviMorrison I agree with this statement about the SplObserver ... the observer pattern is useful if you have a small number of specific relationships, but it doesn't scale out to the system level if you need a lot of pluggable functionality.
 
generic statement is generic...
Observer has its uses...
 
@gorelative Who's ajf?
 
@ircmaxell I think he meant that he thinks SplObserver is useful in a small number of specific relationships, not the pattern in general.
 
it's useless anyway
 
7:46 PM
Doctor Who Lets Talk about it
 
user895378
The observer pattern is helpful if you have maybe one object in your system that any other objects care about ...
 
// I think this is a better observer subject interface:
interface SplSubject {

    /**
     * @abstract
     * @param callable $handler
     * @return void
     */
    function register(callable $handler);

    /**
     * @abstract
     * @param callable $handler
     * @return void
     */
    function unregister(callable $handler);

    /**
     * @abstract
     * @return void
     */
    function notify();

}
While I think that is better, I think that it might be better without notify at all.
 
eih, basically the same pattern
 
user895378
^ I prefer that because you aren't restricted to hard-coded interface types.
 
@ircmaxell But it cuts out the SplObserver, which requires SplSubject to be passed.
 
7:49 PM
@LeviMorrison This is the exact reason why I hate doc comments to much
your actual interface is:
 
@NikiC I actually can't have callable type-hint. On PHP 5.3. I just added it before posting here.
 
interface SplSubject {
    function register(callable $handler);
    function unregister(callable $handler);
    function notify();
}
doccomments make simple stuff look so ... big
 
The actual piece in my codebase is this:
interface Notifier {

    /**
     * @abstract
     * @param callable $handler
     * @return void
     */
    function register($handler);

    /**
     * @abstract
     * @param callable $handler
     * @return void
     */
    function unregister($handler);

    /**
     * @abstract
     * @return void
     */
    function notify();

}
In which case the docblocks are helpful.
 
@LeviMorrison yeah, but that's a trivial change. You could create CallbackObserver
 
@LeviMorrison ^^ But I'd remove @abstract :)
 
user895378
7:51 PM
I hate @abstract :)
 
@NikiC Was auto-generated by PhpStorm. Meh.
 
@LeviMorrison Yeah I know
 
user895378
@abstract == IDE vomit
 
One can probably disable it ^^
@rdlowrey The Indian guy :D
 
user895378
@NikiC yup :)
 
7:52 PM
He was so hilarious ^^
 
class CallbackObserver implements SplObserver {
    protected $callback;
    public function __construct(Callable $callback) {
        $this->callback = $callback;
    }
    public function update(SplSubject $subject) {
        $cb = $this->callback;
        $cb($subject);
    }
}
 
@ircmaxell I've been looking at this for a while. I don't see how this is any better than SplObserver?
 
it is SplObserver
 
I don't see the point of it.
 
@ert3 Love Doctor Who ^_^
 
7:57 PM
you wanted to use generic callbacks, that lets you
 
@Neal well they brought back the tenth doctor for some animated serials
 
@ert3 I am the admin/creator of the Doctor Who Google+ page ^_^
 
@ert3 Haha you found me ^_^
 
guide to tardis indards
deserves a place in internet histroy
 
man, wordpress sure knows how to ruin a perfectly good day
 
@orourkek hmmm?
 
@Neal our WP install just went belly-up for some reason
though it could be mysql...
 
is there anybody here who like to talk about some php logc?
ie is always annoying
by the way i'm a businessman, programming is my hobby
 
8:20 PM
@LearnerExpress I am a person.
 
I had my doubts
 
@ircmaxell Callable lets me use generic callbacks. I don't want to pass SplSubject because if the subject is notifying an observer about an event (not a change in the subject) then it's a broken API. That was the whole point of NOT using SplSubject.
And SplObserver.
 
huh?
 
This signature is undesirable abstract public void update ( SplSubject $subject ));
On SplObserver.
 
Well, you can observe multiple subjects, so it includes the one that sent the message
it's not necessarially undeseriable
 
8:29 PM
But in an evented system, we don't care so much as WHO raised the event as WHAT teh event is.
 
that's not the use-case for an observer
 
@ircmaxell I beg to differ.
 
The original purpose of an observer is to notify a listener that the parent changed. Not what changed, not how it changed, just that it changed
 
bam
 
I hate it whenever I use an SPL data structure.
It reminds me of the others.
SplObjectStorage . . . I'm not going to rehash why you suck, but you do.
 
8:38 PM
SplObjectStorage is handy for some needs...
 
Well, it's API is foobar.
It's a Map (dictionary, whatever), but they didn't give you a Set because you can use SplObjectStorage, but just use keys.
 
@ircmaxell I had actually found a legitimate use for using SplObjectStorage. But its API does suck big time.
 
@Neal whoo the mets won
awesome but i think your simulator might be broken
 
yeah, part of me would love to see a few first-class data structures in 6...
 
We're all dreamers, aren't we?
 
8:43 PM
yes
 
@ert3 lol it is random
 
have to share:
 
@ircmaxell The ability to create a hash for scalar values would be nice. You can put your brain to work there . . .
good hash*
 
what's the advantage over an associative array?
 
@ircmaxell There isn't. I had actually thought of that back when I started working on new data structures, but I forgot.
Problem solved.
 
8:54 PM
:-P
 
does anyone have experiences with multiple target sass or compass watches
 
compass watches? like watches with a compass on the dial?
 
We use compass but I just have a separate tab that is always running compass watch :p
 
nope. sry, very misunderstandable sentence... it's about sass (Syntactically Awesome StyleSheets)
what I would like to do is have one 'watch' instance watch several scss targets and recompile if ANY of them change
I'm almost sure it's not possible at the moment
 
Is there a can_be_used_as_array_key function?
 
9:01 PM
@LeviMorrison php.net/is_scalar
 
@ircmaxell Thanks.
 
Woot, 10 page views away from tieing my best month ever...
just 16 days into the current one...
and there we are
 
9:26 PM
answer to my own question: any additional watch targets can be watched by adding add_import_path "paths" to the config.rb file
 
9:37 PM
I just wrote my first version of HashSet that works for both scalars and objects.
It's yucky.
<?php

namespace Spl;

use Iterator,
    Traversable;

class HashSet implements Iterator, Set {

    protected $objects = array();

    protected $scalars = array();

    /**
     * @return void
     */
    function clear() {
        $this->objects = array();
        $this->scalars = array();
    }

    /**
     * @param $object
     * @return bool
     * @throws InvalidTypeException when $object is not the correct type.
     */
    function contains($object) {
        return array_key_exists($this->hash($object), $this->objects)
The choice to represent it with two arrays is bad, methinks.
Better to adapt the hash function.
What I was thinking, I don't know.
 
yeah
rather adjust the hash functions to work for scalars too
also, the code won't work with array keys :D
 
or object keys...
 
@ircmaxell It does work with object keys.
 
Oh, you're not implementing ArrayAccess
nevermind
 
Well, theoretically should
I haven't run it
And I'm not going to.
 
9:41 PM
:-P
 
@LeviMorrison That's the only safe way :D
 
And it's the only sane way
then again, we're not sane...
 
    protected function hash($item) {
        if (is_object($item)) {
            return 'o_' . spl_object_hash($item);
        } else if(is_scalar($item)) {
            return "s_$item";
        }

        throw new InvalidTypeException('HashSet only works with scalars and objects');
    }
Any problems you guys see with that implementation?
I'm sure it can be optimized, but that's not what I mean.
 
what about arrays?
or resources?
 
yeah, we want to be able to write $hash[[]] = [[]]; after all :D
 
9:45 PM
@ircmaxell Resources can be dealt with, sure.
I'm not sure how to generate a hash for an array.
I mean, a good hash.
 
md5(serialize(array))
 
I think for arrays the only sane way would be a serialize...
 
There's a saying in IT: either you're new, or you're nuts. And you're definitely not new...
 
lol...
 
@ircmaxell You think MD5 is a good choice?
My worry about supporting arrays is that it's currently the only thing could have collisions.
Well, resources might not be unique either.
I'm not sure exactly how those are implemented.
But scalars and objects will be guaranteed to be unique.
(Excepting the difference between 1 and '1')
I guess I can just use buckets on an array and then use == to compare to find the exact array.
But then I'd be back to multiple arrays to represent the object.
PHP wasn't meant for implementing this stuff :)
 
9:53 PM
Sounds like you're having fun @LeviMorrison
 
Anyone good with Web services?
nusaop?
0
Q: Why do I get Error Response not of type text/xml: text/html?

SirBTI am new to using SOAP to communicate with Web Services, I recently wrote a client in php to communicate with a Web Service but get this error message back: "Error Response not of type text/xml: text/html" Is there something wrong with the format I send away? Please find the request below: R...

 

« first day (639 days earlier)      last day (4295 days later) »