« first day (1012 days earlier)      last day (4162 days later) » 

19:00
@rdlowrey What is happening here: $this->acceptSubscription = $this->reactor->onReadable($this->serverSock, function() { $this->accept(); });?
user895378
@bwoebi It's using my underlying event reactor to attach a callback function that's invoked any time there's "readable data" on the socket. For servers, "readable data" means "there are clients who want to connect."
@echo_Me remove it from the last line of the function or conditionally do it based on a parameter that defaults to don't regenerate id.
@rdlowrey and how does this method look like? it's maybe important to know?
@Orangepill ok thanks , understood , i didnt think of this regenerate id , now i know :)
user895378
@bwoebi which method? The callback? Or how an event loop works in general?
@rdlowrey I mean how you decide if the callback is invoked here
user895378
@bwoebi It depends. If you have ext/libevent the underlying reactor uses that to tell when it's readable. If you don't, if falls back to the native stream_select.
@hamza I so want one of those...
Hello
19:05
hehe
@HamZa Hello
@user4035 hello there
As we know, the constructor should only init the state of a class. But how about its destructor, it is a bad practice, say to do something inside it? Say, something like, session_write_close() ?
@HamZa What to do with the person who asks about binary numbers, understanding nothing in binary arythmetics and not understanding, how ints are designed: stackoverflow.com/questions/17833990/opposite-of-binary-number/…
19:08
@rdlowrey What I see is that it depends on the usleep here: github.com/bwoebi/http-websocket/blob/master/includes/threads/… (if I set MAX_SOCKET_SLEEP_TIME to 100, it just uses 0.1% CPU…) But I don't know if there's a way to check simultaneously if there is data to write or to read...
Hello
@DaveJust Destructors are for clean-up... that sounds like a good cleanup call for a Session Class
I have a problem with mysql crosstab
sum total
@user4035 lolz
@HamZa Yup, he thinks, that number of bits is arbitrary in the number
19:10
@rdlowrey I can listen on the socket with the socket_select … or I can wait() in the thread, but not both at the same time
@Orangepill sure... constructors are for initialization, but it doesn't mean its good practice to put session_start() inside it (for unit testing)
user895378
@bwoebi Wait ... are you spawning a new thread for each websocket connection?
that would be extremely inefficient
19:12
@DaveJust seem like if it was for a session abstraction it would be pretty useless if it didn't do any session manipulation.
@Someone `$string = "Media/Cinema/funny/mp4/anothervideo1.mp4";

echo pathinfo($string, PATHINFO_EXTENSION);`
there is just a fix pool of 16 threads to work on the received data
@DaveJust don't know how that would fit in with unit testing though...
@Orangepill $session = new SessionHandler($options); $session->start() vs $this->start() inside its constructor <--- That's what I'm talking about
well .. abstracting session sucks in PHP
user895378
19:14
@bwoebi okay, just making sure. Well the problem is your usleep calls for sure. It's much simpler to have timers/alarms that go off when things need to happen. You're always going to have that problem if you rely on timeouts in your select calls.
@user4035 can't be helped, maybe give him some links ... php.net/manual/en/language.operators.bitwise.php
Since abstraction is a concept, how would it suck?
> Asiana actually threatened to sue for defamation—apparently because, as Stephen Colbert noted, the racist joke was threatening to Asiana's "sterling reputation as a world leader in almost landing planes."
@DaveJust concepts can suck for sure :)
@ircmaxell :-P
Jan
Jan
19:16
@tereško I did not really understand your question. I just wanted to ask where it would be the best place – but I clearly know, what to do. I just came up to extend the Utility "CakeTime" and set the engine in my AppController (see <http://book.cakephp.org/2.0/en/appendices/new-features-in-cakephp-2-1.html#helpers>)
@DaveJust if that's the case then the desctuctor shouldn't do anything with the session either. How is the class manipulating the session variables? $_SESSION directly or are you going to inject the $_SESSION as well
@ircmaxell that's getting quite popular as a tactic. CNBC tried to pull the same with Warren's interview
yeah, which is a problem
@Jan I asked you that because Cake's codebase is one of the worst ones among all frameworks in PHP. And that's quite an achievement. Which is why I was trying to point out that using "best practices" and cakephp could be considered oxymoron.
@ircmaxell there is always hope that google will get fed up with this
@tereško How would you do tests on a session class like that ?
user142019
19:20
@DaveJust Abstraction doesn't suck.
user142019
You cannot write programs without abstraction.
@tereško there is hope that the people in this country will get fed up with the bullshit and lies from the government, and actually fix the problem
@Orangepill honestly, i have no idea. Seems like best option would be using php.net/manual/en/class.sessionhandler.php
user142019
Single CPU instructions are already abstractions.
@rightfold Yes I know. That's the point... it all depends on how you implement it
19:22
@ircmaxell such naiveté in your age
SessionSaveHanlder has nothing to do with session abstractions
you have the best government money can buy
@ircmaxell I'm with @tereško on this one. I really doubt your people will act any time soon
@tereško whose money. because it ain't mine
@PeeHaa If there is no hope, there is no point living. A little bit of hope, no matter how futile, is reason enough to try
Am I doing this right? — Madara Uchiha 1 min ago
Awesome :D, continue the series
19:24
@ircmaxell True
@MadaraUchiha done
well .. technically it is, if I understood US policy. You give money to government and government gives to the corporations and billionaires that got them elected .. the corporations pump some of that money back into media and next election cycle
something along those lines
@tereško Hey, it happened in Egypt, twice. No reason why it can't happen elsewhere.
@tereško just described America
period.
@tereško I think the naivety is in the people who think Obama is for change. He's just another politician. End of story. They are the naive ones, and that's scary as hell...
19:27
@ircmaxell well .. the first round was part naiveté, part hope ... the second, well, i have no idea
@Gordon i found something i can use, but it confuses me
I don't think ALL Obama "supporters" are naive. I voted for Obama, and would again. Not because I think he is a great leader or will change the essential nature of greed and oligarchy, but rather because we are given a binary choice. Mitt Romney would have expanded the drones, and cut social programs, etc, etc, etc. Nothing would have been different.
6
You can vote for a third party, but realistically, pragmatically, that is a non-choice
^ Rage Against The Machine - Testify
@Chris The election system in the US is perfectly laid out precisely for that.
@tereško right, agree there
19:29
It would take violence and demonstrations to change America. People would have to not go to work, they would have to leave the relative comfort of their lives, and FORCE the change. And we won't. Why? Because this is a comfortable slavery. We're peasants, yes, but we aren't in North Korea. Life does not actively suck if you just stay in the bubble; you can go whole days or weeks without becoming enraged.
@rdlowrey I just don't know how to do better… :-/
@Chris Oh, I'm not saying all are. I'm saying those that still believe that it's a radical fundimental change from the past 40 years of politics are naive...
You get two "halves" which are the only realistic choices.
has anyone used the PHP fast cache?
Both are equally bad
@rdlowrey If you give me a few hints / pseudo-code?
@EliteGamer What's your question?
@EliteGamer Wow that site is annoying
well, i am trying to cache some data, and i see this
yea
saw that, how do i use it?
Simply put, there is no incentive TO change, though. What is in it for the wealthy? Nothing. What is in it for you and I? Realistically speaking... not much. If we tried to force a real change in America, it would actually make our lives worse, and our children's lives worse. It would be something that we do for future generations, and as America becomes more comfortable and more decadent, the likelihood of selflessness for the sake of posterity becomes vanishingly small.
19:31
@Chris Also, I'm not saying those who voted for him are naive... I was more targetting that subset of supporters who honestly believe he's different from every other politician in washington
user895378
@bwoebi everything I know I tought myself. I can do better than pseudo code, though. Feel free to browse my implementation
I've never met someone like that, thankfully, heh
@ircmaxell oh .. I remember how he got in the second time: the alternative was even worse and 3rd party candidates did not get any exposure in media
@EliteGamer examples are shown if you click the [example] button
i know
but i do not understand the foreach statment?
i need a if (there is cache) use it else (re cache)
19:33
@rdlowrey I'm looking at it.
So... IDK if you guys saw the issue I was dealing with earlier; Gordon suggested a couple of alternatives. One of them may be viable, BUT, it flips the model I had conceived on its head. I'd like to figure out the one tiny problem I have (or determine it is hopeless) before I completely change direction.
What it boils down to is this: exec is taking output from a DOS command and doing... something to the character encoding. Why? Can I influence that?
user895378
@bwoebi Personally I think threads complicate your solution. An event-loop is much more tractable for this IMO.
@elitegamer it's basically saying: look for the asset in the cache ... if its not there make it and stuff it in the cache for the next go round. you avoid doing the work in the if statement if the results are already in the cache
@rdlowrey An event loop is useful if everything is event-driven. But in my application there are also things which aren't based on events.
how would i use it to check if there is a cache, and if not, run this code?
19:37
@Chris unfortunately, I work with a lot of them... :-(
@elite gamer that is what this does

$products = phpFastCache::get("products_page");

if($products == null) {
$products = YOUR DB QUERIES || GET_PRODUCTS_FUNCTION;
// set products in to cache in 600 seconds = 10 minutes
phpFastCache::set("products_page",$products,600);
}
user895378
@bwoebi Which is why I wrote a multiprocessing library to go with it. Non-blocking is only useful to a point. Then you're stuck in callback hell. But threads are even worse. The trick is to avoid both and allow yourself to multiprocess with neither threads nor non-blocking semantics :)
@Chris UCS2-LE or UTF-16. You'd need to convert it
@rdlowrey let me first look at your github.com/rdlowrey/Amp/blob/master/src/Amp/NativeReactor.php … maybe I have some better solution after having looked at it
oh
what about if it is in the cache?
how do i get the data?
@Orangepill
19:39
@rdlowrey multiprocessing is useful, but at the moment where you need to transfer huge chunks of data, duplicate data in multiple processes etc., it'll loose its advantage to threads.
user895378
@bwoebi Do as you please.
@rdlowrey I just think both things have their advantages
@EliteGamer if it's in the cache it will be in $products so the if will fail.... either code path you end up with $products containing the data
user895378
@bwoebi They do, but there's a reason why nginx runs primarily in an event loop and has far surpassed apache in terms of usefulness and scalability. When you're talking about servers threads are at a severe disadvantage.
@rdlowrey is the a reason you aren't setting visibility on public methods...intentional or an old habit?
19:44
@ircmaxell Hmm, if I use mb_detect_encoding, I get "ASCII". Conversion to UTF-8 turns the blank space (where an accent 'a' is supposed to be) into a '?'
Confession: I don't understand character encoding very well
user895378
@Orangepill I used to hate it when people omitted the public declaration but I decided a few months ago that it was implicit and that I like the brevity of not adding useless terms whose meaning is redundant.
user895378
So now I always use function someFunc over public function someFunc
@rdlowrey heh, I've went the opposite direction: I used to omit it, but I reinstated it in the interest of always being explicit
@Chris var_dump(bin2hex($string))`
@rdlowrey yes. If can run the whole thing on one server, threads have more power than multiple processes, but when you begin to split the load, you rapidly run into problems.
19:46
@Orangepill but if products come null, then where is the data?
user895378
@bwoebi Not in the least.
@EliteGamer you create it within the code in the if statement
@EliteGamer /dev/null obviously ;-)
@peehaa I get mine from /bin/true ...
@rdlowrey (I didn't say much more and also not under all circumstances…)
19:49
@Orangepill :-)
@ircmaxell The trouble string bin2hex'd is 3130204e616461204da0732e6d703 -- in DOS, this is 10 Nada Más.mp3. exec is giving me 10 Nada M s.mp3
user895378
@bwoebi It's okay -- I just favor non-blocking and you favor threads. No problem :)
@EliteGamer basic template for any caching system follows these steps
1) see if there is a valid results in the cache (also called a cache hit)
2) if yes then use it
3) else create the asset and stuff it in the cache (that way next time around you fall into case 2)
@Chris one sec
So weird to me.
/me resolves to sit down with character encoding and clear the fog
@Chris are you sure?
user895378
@bwoebi I will in a couple hours -- I'm trying to balance chat and lots of work just now and it's not working out too well for the work side :)
@rdlowrey oh. okay . I'll remind you at 18:00 your timezone :-P
@Orangepill but what is this?
opps
it's not iso-8859-1
19:56
this
products_page
the accented a is code point 0x2e
Code page 437 is the character set of the original IBM PC (personal computer), or MS-DOS. It is also known as CP437, OEM 437, PC-8, or MS-DOS Latin US. The set includes ASCII codes 32–126, extended codes for accented letters (diacritics), some Greek letters, icons, and line-drawing symbols. It is sometimes referred to as the "OEM font" or "high ASCII", or as "extended ASCII" (one of many mutually incompatible ASCII extensions). In a strict sense, this character set was not conceived as a code page; it was simply the graphical glyph repertoire available in the original IBM PC. This charac...
@ircmaxell So when I run the batch a DOS shell, this is the output:
10 Nada Más.mp3
When I run that same command from exec and do print_r/die on the output, this is what I get:
10 Nada M s.mp3
So I did the bin2hex on it, and got that hex string
But then if I try to do anything with it, I still seem to get back a space (or error messages)
@peehaa wtf .... eval the code instead of include it to make it more secure...

« first day (1012 days earlier)      last day (4162 days later) »