« first day (1319 days earlier)      last day (3644 days later) » 

8:00 PM
the guy who wrote that made 5 abstractions on top of eachother
he's a "genius"
of course the mapping gets a bit more complicated if you have a few tables joined caue the mapping uses 2-3 tableModels instead of only tableModelA
but that's not something that bad
 
@DanLugg Sounds like something that could be on the soundtrack to doom game.
 
@zigi are you aware, that model is not an abstraction of a table ?
 
yes
completely
that's how the company calls the table abstractions...
because they are using Zend 1.0 which has no ORM
What is intended as a "model" here is just a sample class holding the db table column names and the db table name"
it's more or less a static class if you want to call it that way
apparently some people are still in the stone age
The genius who wrote it also had inside those two loops an additional for loop that traverses every time all whole mapping array to gather the parsingMethods
well, guys, thanks for the links
I will just revise everything written so far
and just make more sensible Abstract Class
have you guys seen this framework called PhalconPHP
 
8:16 PM
Yeah.
 
Yup.
 
and?
Have you used it?
 
Oct 9 '13 at 23:24, by rdlowrey
@tereško That's my point. If you're going to compile something it better be blazing fast as a result. phalconphp isn't remotely fast enough to justify the myriad drawbacks that come with using something like that.
 
Could someone direct me in the correct direction. I want to have a year, say 2003, that when a user clicks on it it filters the entire table (via mysql query) to just show 2003. I'm currently using filter=year&filtervalue=2003 and using $_GET[] and switch() to parse the filter but not sure how to prevent any SQL injections or malicious escaping on filtervalue.
 
use prepared statements.
 
8:20 PM
hehe..
//Handle the request
$application = new \Phalcon\Mvc\Application($di);
 
@Fabien So do a prepared statement for each possible combination?
 
@Travis Read a little more on prepared statements and you'll get your answer.
 
@Fabien Thanks. I'm using MySQLi
 
np
 
8:36 PM
Phalcon got some pretty serious bugs open..
 
@zigi you can probably thread that code to improve it's performance if the bottleneck is really where you think it is ...
@RonniSkansing not even a little bit surprised ...
 
Joe, thread it how? for each row?
 
hi guys !
 
@zigi think so, but that doesn't mean thread per row
 
@RonniSkansing internet makes me sad
 
8:51 PM
I dunno who phalcon is aimed at ... the only people that can take it to production, wouldn't ...
 
@tereško =] imaging in 30 years + high blood pressure
 
*sigh* NetBeans formatting is starting to suck has sucked for awhile, and it's starting to piss me off.
 
so Joe, what do you propose, every 5 rows
 
no !! how many cores you have isn't dependent on the number of rows you are dealing with, if you want code to scale then think in terms of the number of cores you have rather than the amount of data ... so from this perspective, if you have 8 physical cores, then you should probably have 8 threads processing X rows ... then it doesn't matter how many rows you have your CPU will do it as fast as physics (and your skill set) will allow ...
start there probably ...
 
@Joe you mean logical cores I assume…
 
8:58 PM
yeah, sorry, logical cores ...
 
yeah I was kind of wondering
yeah our server has 12 logical I think
 
then start with 12 ... of course, you can sometimes see a gain with more threads than cores ... but it wouldn't be a good starting place or good advice ...
or start with a maximum of 12 ...
few threads as possible ... all the time ...
 
ok I have worked with threads in JAva I have to see how I will do it here
 
any idea why php.net save my ip into the cookie?
 
you already know how it works then more or less ...
 
9:01 PM
@RonniSkansing to let you ask questions :x
 
so @JoeWatkins does that mean that if I have 12 threads and the DB returns N rows I should make 12 threads and give each N/12 rows
 
yes
 
ok
 
or
use the pool ... and make row == task ...
 
9:05 PM
Or just use GO, and let it do the math for you
 
yeah, good point, I wouldn't have used php in the first place
but I already got this
on my hands
there are at least 50K lines
 
@zigi yeah this was already said @ircmaxell
 
I know, I am telling the irc guy
 
:-)
 
ok, quite helpful
Thnak you Joe!
 
9:06 PM
@zigi well, there's nothing saying that you can't use multiple technologies
 
what math are you doing ? is it simple math ?? I have a way to give you native instructions for moderately simple maths in php since about 48 hours ago ... (cool, but probably not a solution)
actually it doesn't have to be simple ...
 
I've been ignoring php-internals for the past few weeks... what happened to phpng that required a freaking front page news article about it?
 
just that particular part, offload to another "lang"
 
joe what kind of maths are you talking about?
 
@JoeWatkins :-)
 
9:08 PM
@zigi math ... github.com/krakjoe/jit/blob/master/fib.php that kinda thing ...
@Charles it's not something that happened on internals
it's something happening everywhere else ...
 
@JoeWatkins Ah, drama leak, gotcha.
 
interesting
 
@JoeWatkins put that on your blog thing, but not on the front page
 
wow the class speed up sounds like a great thing
 
@bwoebi you missed relevant conversations ...
 
9:11 PM
@JoeWatkins I'm reading the backlog in irc just as of now.
bjori: to pilot the blog, use the frontpage I see.
 
so Joe, how fast does the fib run with your C functions
 
I don't want it on frontpage either, I wanted a place for it and have to do it there, only twice ...
@zigi it's fast as native ... it is native ...
 
Bruno is a fuck.
 
eloquent as usual Dejan :D
 
@JoeWatkins well, native could optimize and store temporary results…
Does jit that too?
 
9:14 PM
honestly don't know
 
@webarto sometimes he's decent.
 
I get it, he needs that attitude to provoke comments/visits.
 
but it solidifes that sitepoint in general sucks
 
Saving peoples IP's in their cookie is okay?
 
@RonniSkansing why not? everyone who could intercept your cookies will also be able to get your IP.
 
9:16 PM
Because is it sensitive information
 
yeah why not, you broadcast it all the time ... it's public information isnt it ?
no it's not ...
 
The cookie is pretty easy to steal
 
@RonniSkansing how is an IP sensitive info?
 
an ip is not sensitive, it cannot be ...
 
@RonniSkansing just as easy to steal the IP...
@RonniSkansing the IP address is in every IP header you send around…
 
9:17 PM
Sure but that is between me and the server
(and everything in between)
 
and the cookie isn't?
 
@RonniSkansing if I were to find out your IP address what could I do with it to steal information from you specifically or the server
 
everyone who has access to your files has to know your IP (and if it is physical access he can look it up himself)
 
Other than try to hack into your system
 
/me is out ... nite
 
9:22 PM
hah cool
gist: Function to detect number of CPUs in PHP, 2011-10-28 03:53:23Z
<?php

/**
 * Copyright © 2011 Erin Millard
 */

/**
 * Returns the number of available CPU cores
 * 
 *  Should work for Linux, Windows, Mac & BSD
 * 
 * @return integer 
 */
function num_cpus()
{
  $numCpus = 1;

  if (is_file('/proc/cpuinfo'))
  {
    $cpuinfo = file_get_contents('/proc/cpuinfo');
    preg_match_all('/^processor/m', $cpuinfo, $matches);

    $numCpus = count($matches[0]);
  }
  else if ('WIN' == strtoupper(substr(PHP_OS, 0, 3)))
  {
    $process = @popen('wmic cpu get NumberOfCores', 'rb');

    if (false !== $process)
    {
      fgets($process);
      $numCpus = intval(fgets($process));

      pclose($process);
    }
  }
  else
  {
    $process = @popen('sysctl -a', 'rb');

    if (false !== $process)
    {
      $output = stream_get_contents($process);

      preg_match('/hw.ncpu: (\d+)/', $output, $matches);
      if ($matches)
      {
        $numCpus = intval($matches[1][0]);
      }

      pclose($process);
    }
  }
  
  return $numCpus;
}

echo num_cpus().PHP_EOL;
 
g'night @Joe
 
ehm.. You guys are usually right. But really, I do consider the IP private some degree. But I guess you would have no problem having your IP flashed up on a page after you visited it?
 
WTF
 
it discloses information
 
@RonniSkansing it is no different than having your address listed in a phone book
 
9:23 PM
@Pitchinnate Actully strike that, I do not see that comparison
If it was like that, then I would expect people not to give out my number or write it to places where people could look at it
 
@RonniSkansing if someone wanted to hack your computer and they were a competent hacker they could get your IP regardless
@RonniSkansing all it is an address to your computer
 
lol I am not talking about anything near that
 
@RonniSkansing "encrypt" it, but it makes no sense... httponly cookies, right?
 
yes hash it!
And yea.. lol
http cookie
 
@RonniSkansing IP addresses are in no way private, and neither are they particularly reliably useful by the time you get all the way up to the application layer
 
9:26 PM
Other than hacking what else can you do with an IP?
It is just an address to a machine
 
@DaveRandom sure I can agree they are not private. But would you share your work ip, home ip with anyone?
Its not about the machine, its about the person using the machine
 
on a complete tangent, probably the bit of technobollocks that annoys me most about 24 is that whenever they give out an IP address it always at least one "octet" that is >255
 
@DaveRandom lol
@DaveRandom can you enhance that?
 
@RonniSkansing I would, but I'm a competent(ish) network engineer, so I'm a) aware of how useless it is and b) confident in how useless it is because I'm happy my network is secure
 
Well anyways I bow and thanks for all the input
 
9:29 PM
@JoeWatkins, do you think it is a good idea to keep a counter and increase it when creating an active thread and when the thread finishes it's processing work to decrease the counter, so I have a way of knowing when exactly all processes are finished processing, otherwise I have no idea which of the threads has finished last since they go simultaneously.
 
Bob the average user would probably be less happy about it, though
 
@DaveRandom agree, however I don't know that the average user even knows what an IP address even is
 
@Pitchinnate I'm not sure, I might need to join the servers together with a macro override first
 
Well now I know how it feels to be a "wordpress developer" trying to hide the source code =] I find the whole networking quite hard
 
9:31 PM
@DaveRandom sounds good, maybe you can hack into someones server using a 2048bit worm
@RonniSkansing I know it seems abstract but in reality an IP address is no different than a house or apartment address
 
@Pitchinnate True. But they don't know what cookies are either, and we still ask the user if we can use them as if it's some kind of deadly security risk - even though those that are a true security risk wouldn't ask you first
 
@Pitchinnate I do know the basics though.. thanks [=
 
@Pitchinnate Let me just open up a socket
^ that one seriously pisses me off as well
 
@DaveRandom true, there a lot of news stories throw out catch words like cookies and spyware
so people think all cookies are bad
 
@DaveRandom That is standard in US tv shows - not to give out valid addresses or telephone numbers, which is why most telephone numbers on tv start with 555.
 
9:35 PM
@DaveRandom in reality it the shows would consist of "hold on let me turn it off and on again it is acting weird"
 
Also, this is a far worse thing:
 
@Danack So use some reserved private subnets then. Or multicast, ffs
 
fist through monitor warning
 
That thumbnail does not do that girl any favours
Also youtube no worky for me :-(
 
@Danack lol that is awesome i wonder if they sell tandem keyboards
 
9:38 PM
@DaveRandom Basically, two people are 'hacking' on one keyboard, by both of them typing at once.
 
just for fighting against incoming attacks
 
@Fabien My last week
:)
 
It's like saying you guys don't mind if your email address was scrapped from the internetz and put on several spam dictionaries
 
@DaveRandom hmm? what are you replying to?
 
@JoeWatkins, sorry for pinging once more, but I just wanted to say that you have some really awesome projects out there, I didn't know you created the Pool, but it looks great, I will recommend it. Additionally, the phpdbg looks great, I will give it a try
 
9:43 PM
I wasn't aware you were average
 
@DaveRandom well, I'm Bob… that's why I'm wondering…
 
@bwoebi No I just meant "the average internet user", like some people refer to "Jimmy the junior developer", meaning "idiot"
 
oh, okay
@DaveRandom Next time, you use "Anthony the average internet user" :-D
 
@bwoebi How's Alice doing?
 
@DanLugg meh, that's crypto context… Okay, just realizing that they were talking about security…
 
9:57 PM
@bwoebi I'll go with "Dejan the average user" I think
@bwoebi Actually that didn't even occur to me
 
^^
 
btw, that Eve character sounds like a bitch. She always seems to be out to ruin Alice and Bob's respective days
 
I tought her name was Trudy (from Intruder)
 
Mallory pops up sometimes as well
 
wasn't that Archer's mom?
 
10:01 PM
Bit of a noob question... I have a function that calls on a query in the url using $_GET. On occasions the page does not load with a query and I would like to add it in manually, what is the best way of doing this? Is there any easy way to add the query in using php or is there a better way of doing it?
 
$_GET['param'] = $value'
 
@zigi I don't know, I can't see anyone other than Lucille Bluth, they're basically the same character portrayed by the same actress
 
haha yeah
same thing with Bob from Bob's burgers and Archer
 
never seen it. worthwhile?
 
@zigi Well that makes sense... Thanks for your help.
 
10:02 PM
(bob's burgers, that is)
 
ah well, it's kind of boring but it has it good moments
depends on your type of humor
 
@joshhunt in general I would question whether your design is correct. You shouldn't pretend values were passed, but rather have default values for optional args...
I realise the difference is subtle, but there is a difference and is does matter
Certainly the superglobals should always be treated as read only, apart from $_SESSION if you really must use that
@zigi dl'ing S1 now, will give it a few eps chance
Although not for a while, the list is already pretty long
 
@DaveRandom I completely agree with you. Unfortunately I am modifying someone else's code otherwise I would start from scratch and build it differently. What happens is that users edit a post using url?post=1 (where 1 is the id of the post) when they submit the form it saves it but goes back to url?post=1. The actual post is at url?view=1. Without rewriting a lot of stuff can you think of a better way to get it to go to url?view=1 after the form is submitted?
 
@joshhunt Regardless of the issue with params, you should always use the PRG pattern for handling POSTs anyway. So yes, all you need to do is once you have processed the POST request, issue a 303 redirect to the correct view URL
Post/Redirect/Get (PRG) is a web development design pattern that prevents some duplicate form submissions, creating a more intuitive interface for user agents (users). PRG implements bookmarks and the refresh button in a predictable way that does not create duplicate form submissions. Duplicate form submissions When a web form is submitted to a server through an HTTP POST request, a web user that attempts to refresh the server response in certain user agents can cause the contents of the original HTTP POST request to be resubmitted, possibly causing undesired results, such as a duplica...
 
Lately all my requests are ajax so I haven't dealt with such problem recently
 
10:11 PM
hello
i need a little help
0
Q: code igniter form validation returns false even if data is entered

baig772I am setting new rules to my form, and even if the form fields are not empty, I still get stuck into the validation check block validation function: if (isset($_POST['action']) && $this->input->post('action') === "add_category") { echo "<pre>"; print_r($_POST); $this->...

 
POST requests are for doing things, GET requests are for looking at things. The result of a POST request should always be an instruction to look at something, it should not result in something to look at.
@baig772 I'll warn you now, we don't have many people who hang around in here who know much about codeigniter. You might get lucky though.
 
hm
 
:( ok
 
you explained it a bit confusingly
 
@DaveRandom Looks like I've got some reading to do :)
 
10:14 PM
get is to request data from specified resource
post is to submit data to be processed at the source
 
@zigi I admit, that's the epicly "dumbed down" version
 
well there are more things in depth
for example
Get remains in the history and can be bookmarked
never used when dealing with sensitive data
you are restricted in terms of request length
should only be used to retrieve data
 
Really what matters is that the result of a POST request is not an entity, it is the result of an operation
 
and you can cache it
 
Do you redirect using php or something else? E.g. would you just use header();?
 
10:16 PM
well I have to disagree
if you have a REST api
 
@zigi Forget about what the browser does for the moment. Work with the pure semantics of HTTP and bend the rules when real life doesn't fit.
 
and an application has to handle sensitive data like passwords, auth tokens
then you should use post
 
@joshhunt Yes, the semantically correct way to do it is with a 303 response code, and in PHP the way you do that is with header()
@zigi Don't disagree with that necessarily, the point is not that you shouldn't use POST, the point is simply that the response to that request is not an entity
 
@DaveRandom Thank you
 
how do you define entity?
 
10:20 PM
@zigi In the very simplest terms according to the way HTTP was originally designed, a file. In the modern web, it's probably best described using the slightly meaningless term "application endpoint"
 
but that's really strange since I always see entities after post requests
containing some response in the form of JSON most of the times
 
@zigi I may have clouded this by using the word "entity" when I should probably have said "resource"
 
ok
 
Both words are strikingly clear and unconfusable, right?
 
I agree now
 
10:22 PM
Think about it this way: If I did a DELETE or UPDATE request, I would not expect the result to be a resource, I would just expect a success/fail because my request was an action. POST is basically the same - it's an action
 
GET is for documents usually
or endpoint as you say
yes
that's true
 
@LeviMorrison Yup. Totally my bad.
 
but you would use a get to retrieve a file most likely
 
@zigi Well, the point is that you would expect a resource that you GET to return an entity-body
 
you are right I guess
 
10:26 PM
If I PUT a tin on the shelf in the cupboard in the kitchen, I don't expect the cupboard to return a packet of peanuts. In reality though, it usually doesn't return something at high speed onto my head. I suppose the point is that the world doesn't always fit the ideal semantics. And I should probably clean out my cupboard more often.
 
what I am trying to say, that in practice a lot of the times a post request is used since get can be trunkated or the server might require some sensitive data that should be hidden from guys who sniff
haha :D
 
@zigi Yeh the URL length issue can suck in the real world, that's one area where people regularly have to knowingly break the "rules"
 
What I've seen is that a lot of rest clients are using GET for Read, POST for Create, PUT for Update and DELETE for, well, you know, delete
 
If you are using DELETE you may want to look into PATCH as well for update.
 
^ that's what the verb is, not UPDATE
 
10:34 PM
ha
cool
 
is @rdlowrey on holiday?
 
I think he's on early mid-life crisis, round 2.
To my knowledge he has not jumped out of a plane this time.
 
Base jumping this time then, is it?
I would love to have a go on one of those wing suit things but I would definitely go splat
 
@LeviMorrison you hadn't looked at our chat yet?
 
No, actually. Something very high priority came up at work.
 
10:37 PM
@LeviMorrison then have a very quick look at it…
 
Ah, an unexpected vacation.
 
He is such a rock-and-roll nerd
 
@DaveRandom, I see that PUT and DELETE are not supported by all browsers
that's why people use post for update and delete
 
@rdlowrey should go less on vacation unexpectedly; we're always believing he might know how death feels like…
 
@zigi They're difficult to use meaningfully in conjunction with HTML as well (certainly at present, although obviously with ajax that's not true). In practice they are currently only really useful with REST APIs consumed by computers.
 
10:45 PM
@zigi Mostly REST API's are consumed by clients; often JavaScript or PHP based
 
consumed?
 
or in other words, REST API's generally aren't used directly from browser forms.
 
yep
 
11:13 PM
Goodnight guys
Have a good one
 
morning
 
11:56 PM
What might be the cause of a multiple file input with 30 files attached to only upload 20 and only show 20 in the var dump of $_FILE?
 

« first day (1319 days earlier)      last day (3644 days later) »