« first day (4089 days earlier)      last day (1085 days later) » 

01:53
Hello, I have a timestamp for future date, now i want to find the duration left between future date and current date. How can i do that in php?
02:05
DateTime object and the diff() method, or DateInterval object
Depending if you need time or not this is incorrect
I guess diff() returns a DateInterval anyway
02:53
@Tiffany Yea, would welcome any advice really :D
do you have options for sleep aids?
 
9 hours later…
11:58
@Mwthreex Yes, because certain functions can be evaluated at compile time, this is only relevant within namespaces where the function name is ambiguous if not fully qualified
Or have special opcodes
cmb
cmb
12:14
There is also use function, and function entry caching, though.
12:29
There is, but the function run time cache doesn't mean you get the best possible opcode, but frankly it is a micro-optimisation
@Tiffany What do you take? I don't usually have trouble falling asleep but staying asleep during the second half of the night. I've thought about taking small doses of melatonin (0.3mg) but it's actually prescription only in Switzerland so I'd have to talk to my doctor first.
12:47
@Tiffany nope :/
13:23
@IluTov melatonin might work for that. I typically don't use it because my trouble is falling asleep, and melatonin isn't as strong as I'd hope. Staying asleep, it might work. You'd need closer to like 2-3mg for it to do much. It's OTC here.
When I used to take it, I told my GP how much I was taking at that time (between 5 and 10mg) and he was gave me a look like "wat"
@SaifEddinGmati do you consume anything with caffeine?
everyday i'm a step closer to consume raw caffeine.

though, i don't drink any coffee/energy drinks at night, usually in the morning after pulling an all-nighter or trying to wake up because i have work at 9 and i fall asleep at 6am :p
13:39
@cmb Can it be done via php core itself? why we should do this manauly in every places? \is_null() ...
I mean who doesnt like the performance ? It would be great if php handle this situation by itself
cmb
cmb
If you write an identifier, that always refers to the current namespace. For constants and functions, there is a fallback to the global namespace. Assuming the global namespace would be bad.
@Girgias So you mean the \is_null() is better than use function ?
@Mwthreex They are the same
@Mwthreex use function is_null; and \is_null() are basically the same, they are better than just is_null() ( only when used in a namespace ).
@Mwthreex It being handled by itself would mean to change the behaviour from having a fallback to not having any, forcing you to fully qualify it anyway
Like how it works for classes
13:54
Gotcha thanks guys
 
1 hour later…
15:08
@Tiffany I have very limited knowledge about any of this but according to this video small doses can trigger your own melanin production.
You know melanin is related to skin, right?
Sorry, the tone of that was a bit rude, at least it was in my head
Melanin !== Melatonin
oh sorry, that was autocorrection
Ahhh
 
1 hour later…
16:23
@SaifEddinGmati I'm giving this as advice as someone who deals with sleep trouble, I'm not a doctor, I'm not a licensed medical professional, I just try to do what doctors have told me.
@SaifEddinGmati First thing is trying to start a consistent sleep schedule and maintain that schedule. Yes, it's challenging, especially with life stuff in the way, but you have to try, or work towards it.
All-nighters will mess with it, try to prevent them as much as possible.
In my case, I can't do all-nighters because I'll get a migraine, so I'm physically prevented from doing them. Still means I fight with insomnia, but at least I'll reach a point of feeling too drowsy and eventually crash.
@SaifEddinGmati in general, reduce the amount of caffeine you consume. I take a stimulant medication in the morning for my ADHD, and will drink yorkshire gold through the day, which has some caffeine, enough to keep me awake if I drink it in the evening.
Granted, caffeine affects people differently, but for me, it was the stimulated effect. For people like me, larger quantities daily will affect sleep, and to my knowledge, it doesn't matter if it's in the morning. The quantity is what matters.
If prescribed sleep aids aren't an option (or over-the-counter), building a "get ready for bed" routine will help. Like performing the steps you usually perform at night to prepare yourself to sleep, avoiding PC/phone screens, reading a book. Sometimes warm milk or chamomile tea can help.
Energy drinks can also be destructive. I haven't touched one in years. I'll still consume lighter amounts of caffeine here and there, but energy drinks... :S
All caffine should be consumed in the form of yorkshire gold tea
IGP
IGP
17:35
The only times I have trouble falling asleep is when I feel I've only done work related stuff or boring stuff during the day and next day is a work day or when I drank too much alcohol close to bed time
Totally unrelated, but is there a good resource to learn about opcodes? I just blank out when they're mentioned and I feel I should know more about them.
@IGP Nikita has a nice blog post on the VM. npopov.com/2017/04/14/PHP-7-Virtual-machine.html In terms of individual opcodes, documentation is sparse. But the upside is that you can usually get a good understanding of what it does by looking at the implementation in zend_vm_def.h.
IGP
IGP
Thanks!
18:00
Anyone here uses swoole ? How can i check if swoole is up and running ? the extension_loaded('swoole)` is useless in my case
18:38
why is it useless?
19:28
@MarkR because it doesnt check if swoole http server is running or not
You have to create the server in code and start it
e.g. $server = new Swoole\HTTP\Server("127.0.0.1", 8080); $server->start();
I have two server, both of them have the swoole extension but only one of them actually runs swoole http server, so i asked how to determine if the swoole actually running
So you want your other server to ping it somehow
19:49
@Tiffany Thanks :D I'll try to take these into consideration, but it's been really hard in the past.
 
2 hours later…
21:36
Bit confused with in/out requests and responses. In a HTTP API app that takes in HTTP requests from client (API endpoint), I also need to call out to external services (eg to get data for the inbound request). So the API app itself becomes a client. I could split the in/out request/response into DIRs but wondered if this is gonna be messy?
what in/out requests/responses?
So e.g.an inbound request will have an outbound response, and an outbound request will have an inbound response. Setting DIRs for these seems urgh. InboundRequest, OutboundResponse, OutboundRequest, OutboundResponse. Any thoughts/suggestions?
are you talking about early days of PSR7?
That pattern is always hell... and comes up frequently, unavoidably especially in monoliths
that's how PSR-7 was initially structured.
21:41
the other idea was to have two divs to separate "in" and "out" bound, so eg "InboundRequest" and "OutboundRequest". In then just have "request" and "response" classes in each of those, with the two parent DIRs already establishing if it's "in" (from a client) or "out" (API sending as a client itself)
my brain is in spaghetti hell and none of the solutions seem clean or likely clear to other devs, or me in 3 months
Verbosity will help, at least somewhat
@James If I follow you correctly, you want to receive requests in your application, and also send requests from your application, and want to not have to mess with 2 different APIs. Is that right?
@James why not use PSR-7? there's already separate requests for incoming ( ServerRequest ), and outgoing ( Request ), as for response, there isn't much difference to have to deal with 2 different APIs.
22:11
Wow. I have never, even considered the idea of separating the concepts of in/out requests and responses and I believe it is a cursed thought, I hereby encourage anyone who's been cursed to literally ignore this, use Response and Request abstractions and free themselves of that lich
I will do everything in my power not to succomb to thinking separating them is useful
@Trowski P.S: introduced sequence again, with cancel method to cancel the pending ones: github.com/azjezz/psl/blob/2.0.x/src/Psl/Async/Sequence.php#L23
 
2 hours later…
23:45
https://labs.f-secure.com/blog/faking-a-positive-covid-test
https://github.com/FSecureLABS/Ellume-COVID-Test_Research-Files

« first day (4089 days earlier)      last day (1085 days later) »