« first day (1016 days earlier)      last day (4157 days later) » 

m59
m59
Unfortunately, not everyone wants to pay for that.
Unless it is a certainty that the performance cost is too high, I want to give it a shot.
there is no callback there
IIRC
@m59 they are cheap and sometimes even free
@tereško I thought I'd be using a closure? Wouldn't I need a callback to pass that?
I'll ask my question more directly: what would be in the closure?
the closure is that $provide which you pass int for establishing the connection , when you first time try to create new "structure"
m59
m59
00:03
@PeeHaa interesting
@tereško but if I pass that around, aren't I just reconnecting every time?
what are you passing around ?
@tereško $provider?
you pass the provider to the factory
then you pass around the factory , not the provider
@tereško I thought that was what I originally asked:
15 mins ago, by Jeremy
@tereško Okay, say I have a class D that needs the connection. D is initialized by C which is init by B which is init by A. Would I pass $factory through the constructors of A, B, C, D?
But that violets the law of Demeter, doesn't it?
00:06
all i saw was "alphabet soup"
@tereško okay, let me use legit things:
The $provider is used in the factory, to create a connection instance. Provider itself does not get passed along. Instead factory inject the connection instance in each new thing it creates.
@tereško UserMapper uses a connection. Any class that uses UserMapper in it would need to be constructed by passing $factory along. The same would apply for any class that uses a class using UserMapper.
You did not pass the connection to the factory. Only a anonymous method which will create a connection.
.. this is why i keep telling people "you need to learn native javascript" .. ehh ..
@tereško I understand that. Say I have Game. Game has a method that creates an instance of GameBoard. As it turns out, GameBoard needs to use a UserMapper to find which users are in the Game to place them on the board. That means when constructing Game, I need to pass $factory. When constructing GameBoard, I need to pass $factory. When constructing UserMapper, I need to use the create method.
00:14
no , it means that you abstraction architecture is broken
=]
@tereško confused
all i can currently recommend is: "do some additional research on dependency injection"
Anonymous
Aghhh @Jeremy You'r getting on my nerves
.. and now I will have a nap
@Simon_eQ why's that?
@tereško okay, I'll ping you for that example tomorrow and hope that you're really bored
Anonymous
00:17
go figure
@Simon_eQ ..?
I'm not usually this much of a question-asker... but I really want to get better at my architecture
then read PoEAA
@tereško I'm on chapter 3
btw, finished yesterday "Stealing Light" by Gary Gibson .. was ok. I would give 4/5.
Anonymous
damnit now, I'm curious ..
Anonymous
@tereško 4/5 isn't worth keeping me away from php for some hours.
hey, I have an email script and I am trying to place html code inside the $body and it has php inside the html. how should it be wrote properly?
Anonymous
@Alex show some codes, imagination costs more than retinal replacement from where I am.
@Simon_eQ there are really few books that i give 5 out of 5 , believe me =P
$body .= "something here <td>' . $number . '</td> something here";
@Simon_eQ I was working on it eheh
Anonymous
00:29
@tereško I would be interested to hear 1. Just to know, what the great tereško is interested it.
if I use it that way, I get syntax error, unexpected T_STRING
@Alex Probably because it doesn't do what you think it does. Read up on concatenation
Anonymous
$body .= "something here <td> $number </td> something here";
Anonymous
Plus $body must be a declared variable
.. can nobody spot a vamp .. gods below
00:33
Good morning everyone!
good morning!! :))
Does anyone know of a way to handle the gmail sms capability? do they have an API for interaction?
Anonymous
Oh shit Gotta go to sleep
bye
00:37
/me put on a sad little song for a night and goes AFK
 
1 hour later…
m59
m59
01:37
nice song @tereško
4
A: Turn Plain Text URLs into Active Links using PHP

Maciej CzyżewskiYou may wonder how it works. I'll try to explain how it should be done by various methods. We'll start first with how regex works and how it is used. Regex - Regular expression In computing, a regular expression (abbreviated regex or regexp) is a sequence of characters that forms a searc...

01:59
@DannyBeckett Back to the same issue as before. Two servers one website using xampp.
user895378
02:13
@saeid What can I do for you?
0
Q: Running xampp on multiple computers for one website

TheGuyWhoCouldn'tTalkToTheGirlI have a desktop and a laptop, both of which I would like to use to manage one common website among the two. Currently, I have XAMPP installed on my laptop (Windows 7) and it works fine. I would like to install XAMPP on my desktop (Ubuntu 12.04 LTS) too and have it manage the same website. Basica...

@TheGuyWhoCouldn'tTalkToTheGirl off topic
user895378
@saeid Judging from your question you may benefit from amp -- it lets you dispatch asynchronous calls PHP (or python) function calls to a pool of worker processes from inside an event loop.
@rdlowrey hi
nice to meet you :))
but it was very complex
and I dont understand it
user895378
02:20
@saeid What exactly are you trying to do? I see the example code in your question but what is it you're ultimately trying to accomplish once you get that working?
@rdlowrey I want to make a lot of crawler that which on gets some information from Specific sites
which one of crawlers are one php script
user895378
@saeid Ahh ... well in that case I have lots of libraries to help you :)
I want to write this code myself to learn and obtain Experience
user895378
@saeid I strongly suggest artax for the http retrieval. HTTP/1.1 is not one of those things you really want to implement yourself ...
@rdlowrey your project coding is very complex and understanding it is very difficult
user895378
02:26
HTTP/1.1 is complex and multiprocessing is complex. Moreso in PHP.
user895378
Your best option in PHP for multiprocessing in a windows environment is non-blocking IO.
yes I know. I want to know basics codes
please explain more about non-blocking IO.
user895378
$data = fgets(STDIN); // <--- blocks script execution until a newline is received
yes this one of my problems
and dont know how to solve it
@rdlowrey does amp have any external dependencies?
user895378
02:31
@Orangepill php 5.4 -- that's it.
user895378
It works better if you have the libevent extension, but it's not required.
@rdlowrey how must I use non-blocking IO ?
user895378
@saeid working on an example ... hold on.
@rdlowrey sweet I gotta start playing with it
02:35
i get Jquery is not defined when i do this in PHP
echo "<script type=\"text/javascript\"> $('#Error').show(); </script>";
user895378
@saeid Now compare the line of blocking code above to this:
if i do that in the console, it works
user895378
class Parser {
    private $buffer;
    function parse($data) {
        $this->buffer .= $data;
        if (strstr($this->buffer, "\n")) {
            // do something because we now have a full line of data
        }
    }
}

$parser = new Parser;

stream_set_blocking(STDIN, FALSE);

while (TRUE) {
    $data = fread(STDIN, 8192); // <-- returns immediately, won't block
    if ($data || $data === '0') {
        $parser->parse($data);
    } elseif (!is_resource(STDIN) || feof(STDIN)) {
        // the stream is dead ... do something
(see full text)
user895378
@saeid In that simple example above we're able to read from the input stream without blocking the rest of the event loop. We can do other things after the read.
Jquery is included, since i can do it in the console, but for some reason, it return as undifined
anyone got a idea of why it is doing that?
user895378
02:36
But the above example is resource-hungry; it will continue looping infinitely whether or not there is any data to read on STDIN.
user895378
This is why you need tools like stream_select() so that you only read from the streams when there is actually data waiting on them.
@EliteGamer undefined in the console ?
no, it works in the console, but when it echoes, it says it is undifined $
user895378
You can operate on sockets, pipes, etc. in this manner.
Uncaught ReferenceError: $ is not defined
but it is, since i can run the command in the console
user895378
02:38
@saeid Here's an article that will likely help you.
@EliteGamer lol I don't get you, are we talking about the browser's console or the OS console ?
browser
google Chrome
@rdlowrey many thanks
is there any way i can call the function instead of echoing it?
@EliteGamer So you're pasting this $('#Error').show(); ?
02:40
no
echo "<script type=\"text/javascript\"> $('#Error').show(); </script>";
@EliteGamer that's PHP FYI
yea...
i know that
Using PHP in the browser's console won't get you anywhere
i am doing that in the php, but i get undefined for Jquery
NO :l
i use that command in the console
and it works
when echoed, it does not for some reson
is says it is undefined
Are you sure "Error" is with uppercase ?
02:42
yea
the ID is
<div style="display:none; width: 400px; margin: 0 auto; margin-bottom: 10px;" id="Error" class="alert alert-error">Signup not successful. Please try again.</div>
is the html div
user895378
@Orangepill Cool. If you have questions or trouble let me know, I'm happy to help. It may seem a bit awkward until you understand what's going on.
user895378
From the article linked above:
user895378
Event-based programming like this is not elementary. While Listing 1 is reduced to its essentials, any coding that involves callbacks or coordination, as is necessarily the case for a multitasking application, will be less familiar than a simple procedural sequence.
your docs and examples seem concise enough to be understandable.
user895378
Well they're understandable to me, but I wrote them so that doesn't count :)
user895378
02:44
I think it can be difficult for many people because they aren't used to writing event-driven code.
@HamZa when a event is triggered, i want a popup to show
that is what the code is for
when it is echoes (with the scirpt tags) it is undifined
but when i plug the command in (no script tags)
in, it works
@EliteGamer can you send a screenshot ?
yea
works in the console, but not when echoed
@EliteGamer lol, you're calling it BEFORE invoking jQuery
no, because the page loads
before i issue the echo
right?
02:49
no, jQuery syntax isn't built in in the browser. You have to include the jQuery file and then include that piece of code. Or you may use something like document ready, not sure if you could do that with pure JS ...
@EliteGamer I misread that as "yes" then clicked on the image. It seemed rather plausible that someone would be happy about the lack of jquery in this room :P
When you enter it directly in the console, the jQuery file is already loaded, thus it works
user652649
@EliteGamer proper html over here
si there a way i can echo the data after the html tags?
or in the Head tag?
when i echo, it shows up before everything
and the echo is after a form is submitted
aaargh just use your logic, you won't use a feature that isn't already loaded ?
So please:
1- in the <head> you should have included the jQuery file
2- in the body (most of the times at the bottom) add that echo command
02:52
i did
well, number 1
@EliteGamer From the screenshot it seems you echoed it before everything (facepalm)
and number 2, how?
all my php is up top
@EliteGamer lol I hope you're kidding
PS: this is my first php file to make XD
no, i am not
@EliteGamer I saw you around here before, so can't think that's your first file ...
02:55
ha, first php file to use as a website
other things, just processing data is easy
never combined html and php before
ok, grasp and think of the concept ...
Browsers by them self don't have jQuery "syntax" and "functions" built in. That's why you include the jQuery file in the head to enable them to read. Do you grasp this concept ?
yea, i have already added Jquery into the html file
but i thought that Jquery would have already loaded, when i echoed the script command
No, the browser will read your file from top to bottom. What you have there
1- echo jquery data: browser thinks what the hell is that syntax $ ??? Throw an undefined error
2- browser reads the documents further, and finally include the jquery file. It's now able to read something like $('#Error').show();
3- now that the jquery file is loaded, le wild Elite Gamer puts $('#Error').show(); in the console, hey and it works ! Because the jQuery file is loaded
aside from it not working, that's not a valid html, well the structure ...
-11
Q: Need a strong exploit that works on windows 7?

vabo juninhoIs there any exploit that work on new windows versions ? I have tried many exploits such as handler, adobe, browser, i need any strong exploit.

^ Best Security SE question of the week lol
03:59
anyone here?
@HamZa
i understand know lol
@EliteGamer good
i have 1 question though
session_register() if this is depreciated, what takes its place?
this is on the page i want to protect
$username = $_SESSION['username'];
$password = $_SESSION['password'];
but i can not set a session any more
@EliteGamer Have you put session_start() at the beginning of your script ?
04:02
yea
but i get depreciated notices on my login
For example ?
Deprecated: Function session_register() is deprecated in .......
Warning: session_register() [function.session-register]: Cannot send session cache limiter - headers already sent .....
Well the docs says it all http://php.net/manual/en/function.session-register.php
Use $_SESSION['foo'] = 'bar';
could you link me to the docs please
well, that one
For headers already sent you may take a look here stackoverflow.com/questions/8028957/headers-already-sent-by-php
And where in the world are you learning those deprecated functions ?
04:05
well, some old source code i was lookig at
to make a login script
sigh
which is more secure?
Does anyone know if php interprets application/x-www-form-urlencoded and multipart/form-data or is that something that is just exposed by php from the server api?
mysql, or mysqli ?
mysqli though it is possible to write shitty and insecure code in either
04:07
ah, ok
@EliteGamer Don't use mysql_ at all
in the page i want to protect, i have this
session_start();

$username = $_SESSION['username'];
$password = $_SESSION['password'];

//Check do we have username and password
if($username && $password){
then in that, i wrapped my html code in this:
?> <?php
it looks wierd, is that the was your supposed to do it?
lolwut
uhh, seems legit, so what's the problem?
well, if i am logged in, then display that html code
am i correct?
@HamZa in the link u sent me about the headers, it says that
?>

<?php
It can likewise occur for appended scripts or script sections:
so, is that it?
04:12
@EliteGamer thumb rule: don't send any data before sending your headers
example?
is it this?
else
{
header("Location: login.php");
}
@EliteGamer well the answer there is full
this is what i have
$_SESSION['username'] = $username;
$_SESSION['password'] = $hash;
header("Location: index.php");
and it gives me that
@EliteGamer recap what the problem is and send a pastebin of the relevant code.
i am getting this error
Warning: Cannot modify header information - headers already sent by (output started a ..... line 69
this is line 66 - 69
		// If good, continue to login
		$_SESSION['username'] = $username;
		$_SESSION['password'] = $hash;
		header("Location: index.php");
04:19
@EliteGamer you are surely outputing HTML before that
that is in the login script
in what?
post the complete error message... ususally it will tell you where the offending output was created
the login or the index.html i am protecting?
Warning: Cannot modify header information - headers already sent by (output started at /home/content/64/11486764/html/fear/admin/login.php:40) in /home/content/64/11486764/html/fear/admin/login.php on line 69
@EliteGamer ok, just put that thing in a pastebin.com
Line 40 in /home/content/64/11486764/html/fear/admin is the culprit ... you are echoing something or dropping out of a php block
04:21
ok, one sec, i am really thank you all for helping me
here
i made sure to take out my data, also, there is html before all that php
that is just the php
@EliteGamer I've been telling you several times DONT SEND DATA BEFORE USING HEADER
where am i doign that?
Line 40 of /home/content/64/11486764/html/fear/admin/login.php
You just said there is html before all that php
yea, i need my login page
04:25
Well good luck, my patience is up. I gave you a link to read, read it. Grasp the concept. Search for a solution
@eliteGamer the error message is telling you exactly where you are falling down .... look there
line 40 is <?php
so line 1-39 are generating output.... which is making the header call fail
ok, let me try to get it fixed
nothing that produces any output can be done prior to sending a header call... that means there can be nothing that in not in <?php ?> and there can be no echo, print, readfile or includes that do any of the things I just mentioned. No output can be sent to the output buffer prior to sending a header
04:30
ok
@Orangepill where in my code did i mess up?
i put all the php before the html
i am confused on how that works. Is the header like the header("Location: domain.com");
what is on line 1 - 39 on /home/content/64/11486764/html/fear/admin/login.php is it text outside of a <?php block.... then that is where it is....
the format for header is right... the timing is wrong.
39 gets in the html
32 stops the php
you just told me that you sent content that is what is breaking your header call.
all the php...in the pastebin is before the html
@Orangepill it's useless this conversation. He doesn't grasp the concept or he doesn't want to. If you want to help him he should just show the FULL code he has now
04:37
the pastebin
when will cv-pls.com work? :) reviewing with SO is difficult
@HamZa and @Orangepill here is the pastebin
that is everything, besides the passwords and stuff for the DB
$result = mysqli_query($conection, "SELECT * FROM users WHERE username='$username' AND password='$hash'"); brill
brill?
brilliant :D
04:40
thanks
I was being sarcastic
@EliteGamer it's a joke, actually it's so bad
@EliteGamer what is the filename for this.
login.php
i do not see where i went wrong
04:43
and in your browser you are navigating to login.php directly?
what happens when you remove die("Please retry Again") ?
if die does show up, that will break any headers, -- the redirect.
let me try
oh
then that is it
04:45
omg
lol
if die shows up you shouldn't be getting the headers can't be send message
ahhaaha forgot it was an alias of exit :P
now the echo "Failed to connect to MySQL:"
I only escalate from exit to die if the code is misbehaving.... :)
oh that's weird, there's no session_start.
04:49
@DaveChen that will be the next issue :)
hehehe
sad but true
@Simon_eQ what did you end up doing to solve your multiple inheritance problem?
why gammers laugh "ahahahhaha" ??
@ramiromd huh?
generally I just mash [h,a], doesn't really mean anything if it's hahahhhh ahahha or hhhhaaahhhhh
lucky! you got stackoverflow.com/help/badges/63/tumbleweed?userid=1618360 well, not really lucky :P
05:06
That must be tough...
Hey @TheGuyWhoCouldn'tTalkToTheGirl
@Orangepill Hey
As usual, I am here for help :D
what's ailing you
0
Q: Running xampp on multiple computers for one website

TheGuyWhoCouldn'tTalkToTheGirlI have a desktop and a laptop, both of which I would like to use to manage one common website among the two. Currently, I have XAMPP installed on my laptop (Windows 7) and it works fine. I would like to install XAMPP on my desktop (Ubuntu 12.04 LTS) too and have it manage the same website. Basica...

05:11
@TheGuyWhoCouldn'tTalkToTheGirl that one might be one for superusers.
why not just install linux/windows with ssh server on one machine, then control it from every other machine with ssh/ftp?
when you say manage do you mean serve?
you have one website right? And you want to be able to manage this website (assets, resources, backend), from other computers right? If you setup an ssh server on your main host, you can manage it from any other computer (even those not in your LAN).
What I am trying to do is create a two-server host, if that makes sense.
Think of it similar to what you would see in server farms. Where tons of servers run one website.
05:17
I think I understand.

computer1: /var/www/html/site1/index.html
computer2: /var/www/html/site2/index.html

http://website.com/site1 http://website.com/site2
you want both links to work
no he wants website.com/site/index.html to go to whichever of those machines is on and available
Let's look at twitter.com.
It is said twitter.com by itself is powered by over thousand servers.
That means 1000+ servers are running to keep Twitter running, correct?
unless you want to introduce another machine to act as a load balancer it ain't gonna happen.... your better off ponying up for a VPS
05:19
There is some load-balancing going on there.
I want some thing along the lines of "load-balancing."
cdn is for static assets...
Basically you the two computers I have available to power the site, much like those 1000's of servers they have available are used to power twitter.
that is interesting
another thing to consider in this situation is how are you going to track sessions.... because sessions created on one node of the array are not going to automatically be available on the others .... you would have to have a separate common store (we are now introducing the fourth host)
such as that, I ping google from home (Canada), and ping google from my vps (America), it returns different host IPs :), if you have two servers, I wonder how you could setup something like this
05:24
if you are on a major carrier at home then they likely have there own route into googles servers. I know major carriers here in the states have that...
I traceroute to google from my office and i never hit the public internet.
@TheGuyWhoCouldn'tTalkToTheGirl I would just get a VPS and call it a day ... they are pretty cheap now a days.
@Orangepill You mean introducing the third host? And there has to be some way to deal with it and it shouldn't be that hard, I mean Facebook, Twitter, Google, Microsoft and others all use sessions and have tons of servers.
@Orangepill Well, the reason I am not getting a VPS is because I don't have the fund currently (I'm in college) and I figured I can see how it goes by building the infrastructure at home. If the site does actually do well, then I might opt for getting VPS.
that's because cookies are saved by hostname, not IP :)
@TheGuyWhoCouldn'tTalkToTheGirl You willl need 1) laptop 2) desktop 3) load balancer 4) common db server
@DaveChen Well, Google is pretty big after all. They have their servers in every part of the world. I probably won't have servers in Canada since my two computers will be in U.S.
@TheGuyWhoCouldn'tTalkToTheGirl don't even try to get dedi/vps in Canada, so expensive omg
05:31
@Orangepill Wo wo wo, I thought "load balancing" was a concept, not a server on its own.
Uhh it is, just like reverse proxy
It also requires a level 3 network switching ... there may be some appliances out there that do load balancing but regardless it's another piece of network equipment
what language is this?
-1
Q: How to make SQL Nested Select and Nested Insert

WidhiartaCan I optimize this code with SQL Nested Query code? Please help me... select(data1) from table1 where GET_ID1; if(TRUE){ data1; select(data2) from table2 where GET_ID1; while(TRUE){ arraydata2[]; } select(data3) from table3 order by ID desc;{ data3; } ...

Maybe I am thinking too much, then?
@TheGuyWhoCouldn'tTalkToTheGirl you think you could bankroll $16/month USD?
05:35
@Orangepill I doubt. I don't have a job currently and if you are in U.S., you know the economy.
Programming has got to be the easiest hobby to support, seriously, look at singing, you're going for a $200 mic/xlr-usb adapter. -- haha sorry for off-topic, but true imho.
thank god I can't sing
actually, I got my host for $4/mo ($1 for domain name), you can be the judge of the download speed kureku.com/music
@DaveChen That is pretty quick.
@TheGuyWhoCouldn'tTalkToTheGirl Here's what I use at work rackspace.com/cloud/servers
scale it up or down realtime... billing is done per host per hour.
05:38
or just use GAE/Heroku -- I heard google is supporting PHP soon
think it's in beta now
can't use it, it's whitelist only, hopefully they won't disable all the awesome functions
@Orangepill so you can choose price/h or price/mo?
no ... it's per hour.... the month price is just what it ends up being at the end of a month based on the number of hours in the month
Well, when Page and Brin built Google.com or when Zuckerberg built Facebook.com or when Dorsey and Co. built Twitter.com or when Jimmy Wales built Wikipedia.com or when Jeff Bezos built Amazon.com, did they just do it as simple as signing up for an online web host, buying a domain and launching the site?
Seriously?
hah, my math is rusty. That seems fair.
05:43
but you can put up a low end server for an hour and at the end of the month pay $0.02
@TheGuyWhoCouldn'tTalkToTheGirl uhh don't think they had host providers back then (maybe, but not simple like paypal hahha), they had their own server setup I think
all of them where bankrolled in some form or another after they got past the prototyping phase
@DaveChen So they just installed xampp on one of their computers and launched the site?
xampp pls. lamp ftw
they probably had a colocated server set up at an existing isp.
05:46
But I thought Zuckerberg "rented a server (so he went with online hosting)" for Facebook?
en.wikipedia.org/wiki/Mark_Zuckerberg hmmm Zuckerberg launched Facebook from Harvard's dormitory rooms., maybe he rented servers when it got big idk.
"In fact, being at Harvard and all, Facebook had no cash to run the business and operated it for the first few months for $85/month, which was the cost of renting one server. Facebook’s first server."
So he did rent servers "for first few months" which is basically when he launched the site.
Crazy. So I think you should be able to afford 16$/mo
But then again, in The Social Network movie (I know its not correct, but still, they have the concept correct in it), you hear Zuckerberg say "I need a dedicated Linux box running Apache with a mySQL backend. It’s gonna cost a little more money."
dedicated server sounds about right, do you think they used mysql_*? xD
05:56
LOL, but seriously, what I am setting up is also dedicated server after all.
Dave Chen I'm sure they did... that was the only option available
There is nothing intristically wrong with mysql_* ... it's just it is no longer supported and there are better options.
there's nothing wrong if you real_escape_string, :) I agree
So basically my idea to have two servers run the website is impossible, right?
even with pdo and mysqli its really easy to write bad and insecure code....it's more the discipline of the developer the the tools.

« first day (1016 days earlier)      last day (4157 days later) »