« first day (3169 days earlier)      last day (1779 days later) » 
00:00 - 15:0015:00 - 22:00

3:08 PM
@NikiC The PHP 7.4 deprecations RFC mentions that "incorrect results may be returned for properties with integral keys". Should that be integer keys?
 
@TheodoreBrown they are integer keys represented as strings
 
So is "integral" a typo?
 
cmb
@TheodoreBrown, nope, see e.g. dict.cc/?s=integral
 
@cmb Ah, makes sense now.
 
mb_split now return false with ISO strings – #78190
 
3:30 PM
Is it a bad practice to use file_exists() inside a directory contains about 2 million files?
 
it's bad practice to have a directory that contains 2 million files with no sub-directories
the use of file_exists() is irrelevant to that
put it this way, if file_exists() is causing you a problem, you have a bigger problem
 
Its security by making it hard to look into it with a file explorer/ftp
:P
but if youre working on a linux system with a not legacy filesystem you will be fine
it doenst cost more
 
yes, but I would still argue that it's a bad idea to have that many files in a single directory, just purely from a sanity point of view
sounds like some stuff is deleteable/archivable, and if not then it needs breaking up in order to facilitate general management of the data
 
It is. you should avoid it from the beginning. The cleanup will be more work
 
@DaveRandom got it .. assume I break them down inside 5 sub directories. So, is it ok to use file_exists() on 500 thousand files?
 
3:37 PM
i had a folder with 200k faxes with a qrcode on it. That was some fun!
 
@Shafizadeh file_exists() is irrelevant to this
 
@Shafizadeh no
 
on any sane filesystem that will be O(1)
 
well, if file_exists() is O(1), so it would be pretty fast .. so, what's the issue?
 
I don't know, you didn't explain the issue :-P
 
3:39 PM
order your files so that if the database who knows the location is deleted you have at least some points where something is in the dirtpile
 
:-)
 
1 min ago, by DaveRandom
on any sane filesystem that will be O(1)
^ check the file system is sane...
 
I've a dictionary online. So I've about 2 million unique URL
 
it's not really my area but I know there are some older/dumber things where that isn't true
 
@Shafizadeh dont save urls as file
 
3:40 PM
well...
caching isn't unreasonable
 
I want to generate a image (using php) for each word, So I will have about 2 million images
 
uhhh you are the guy with the pakistani searchengine?
 
I want to avoid regenerating an image every time .. that's why I want to check before generating
 
iranian iirc
 
uhhh you have to move your index from a filesystem to a real search engine like lucene
oh sorry
iranian
 
3:41 PM
@user3655829 no
 
@Shafizadeh what you want is a web-server level cache
 
@DaveRandom ok, any shorter way? what I've experienced/implemented before?
 
varnish-cache.org for example
basically, don't try to implement it yourself
 
As I read the php doc, apparently file_exists() has its own cache
 
throw a cache in front of it, and that way you can just keep you PHP code simple and generate the image every time
let the cache handle storage and existence checks etc
"2 hard problems"... caching is one of those things that I leave to people who are cleverer than me
 
3:43 PM
If the project allowed it you could missuse a cdn like cloudflare for caching the images but....
 
can you please tell me is that another server? or that service should be hosted on my local server?
 
It's just one of many options... there are also apache modules, nginx modules, other 3rd party things that run as reverse proxies... loads of things to choose from that require configuration instead of code
 
Why do you deliver words as image :?
 
You know, I want to have those generated images on my own server (domain name), because of SEO benefits. Google will index them and increases my website credit.
 
what i am doing today: serving banners responsively
as in, responsive design :B
 
3:47 PM
what i am doing today: banning servers irresponsibly
 
what i do every day, banning people using ad blockers
 
guys .. what are you talking about? :-)
 
talking crap, basically
 
@WesAtWork Show me your work!
now!
But that must be a frustrating job. :X
@Shafizadeh I dont google will fall for that
 
so to wrap up, is it ok to use file_exists() ?
 
3:50 PM
yes
 
@user3655829 what do you mean by "fall" ?
 
btw, new entry on the book of techs that fail at their no. 1 feature. responsive mode in adsense uses the container's clientwidth/clientheight to determine what banner size to serve
 
yes, but it's irrelevant to your problem
 
you wont push your score with 2 million images
google is so intelligent their robots will filter you out instantly
 
which is not a thing in modern css, since it is the content that dictates the size of the container
 
3:51 PM
7 mins ago, by DaveRandom
"2 hard problems"... caching is one of those things that I leave to people who are cleverer than me
Google are an example of "people cleverer than me" (and you)
 
@user3655829 buddy, I know what I'm doing :-)
 
nah people did that 10 years ago with a german cookbook. They arent making money now.
 
@Shafizadeh that's the precursor statement to any major fail ever
 
if you want to cache things, use a cache. PHP is terrible way to do that for a whole host of reasons, ranging from low-level technical concerns to general code sanity and maintainability problems
 
@WesAtWork Ok, google for "معنی سلام". And tell me what you're seeing in the "Images for" section of the result?
 
3:53 PM
If youre really want seo to work go to the black/grey side. White seo is just some marketing speak. All the people doing that and google is working against them with tons of good paid developers. Your wont win against them.
@Shafizadeh you cant compare google results. They are heavily user dependend
 
at least three images with purple background color. right?
 
two :D
 
:-)
if you keep searching, you will get three ;) or even more
 
thats your side?
 
nope, that's our rival
 
3:54 PM
but i dont know what i searched
is it a basic word?
 
you searched "hello meaning" in Persian
 
Probably the irian seo hasnt filled with seos yet. Then youre good to go.
 
exactly .. google is thirsty for content (specially images with Persian alt) in Persian
 
But to get back to daves tips. If youre starting now just order your images in a folder structure with the first chars... than the second...
 
"then the second", what's the second one?
 
4:00 PM
the second char of the filename
 
Oh .. it would be lots of subdirectories
 
the filename is the word or something you can check against in one year to find the file
yes but these will help you
alot of software has these dirs where are a lot of subdirs to store data
 
I have Nginx running on my server (as a reverse proxy). Can I dockerize a PHP application by just bundling the application with PHP FPM, so that Nginx can forward everything to the container?
 
@LukasKnuth If you make your dockerrized application it has its own nginx or other webserver
an then you only proxy_pass the ip and port to a upstream
 
@user3655829 does it have to? Can't i just run FPM?
 
4:03 PM
this sounds totaly like bad practice
 
to reduce image size and overhead
 
you want to run your stack everywhere
not where you configured a nginx
also you have multiple containers in a compose file
if youre gonna make one big container it has to include all the things
else you have to mount all files outside and this is more work than use docker the right way
 
i get where you're coming from. I will have dependencies for the application (e.g. MySQL) which are not running in containers, so this would be fine in this case.
 
replace your nginx host with something like traefik.io
no the most problems you get with static files inside the php-src-app dir which has to be accessed by the nginx without the php-fpm
thats some crazy infrastructure
 
its a small single web-server for my personal blog. its fine for the scope. I mainly want Docker to bundle all application depndencies (like libraries, runtime, etz).
 
4:08 PM
then make the stack complete if its alone.
 
how do you mean?
 
Now youre gonna let your host machine deliver appliation files which are located insinde a docker volume
nginx + mysql + phpfpm in a compose file
thrust me you can link your container to the outside nginx and mount the volume or something but this sound 3 times longer than doing it the docker way
This wont take long and you will learn the full stack :X
 
and 15 times longer than just not bothering with docker and deploying your app on a server under nginx with a git checkout and composer install... if you are running your personal blog on one server I don't see what you are gaining by pointlessly containerising things
I am a luddite when it comes to docker but I'm pretty sure I'm right so... :-P
it sounds good in theory, but in practice it's always hours of buggering about when I could have just yum install/git clone/composer install and it would have taken 10 minutes
 
When you got it its easy. You just have to learned it. Im now happy that most of my personal stuff is dockerized. I just dont care about my servers and machines anymore. They are showed on the new root machine after it joined the swarm. Nothing to admin
 
btw - docker-compose can be used in production....if you don't mind some downtime occassionally.
 
4:18 PM
compose is for dev... you have to deploy the compose file to a stak make it into production
 
But you have to do some tricks to move local dev settings outside of the normal compose file:
https://github.com/Danack/Imagick-demos/blob/master/docker-compose.yml
https://github.com/Danack/Imagick-demos/blob/master/docker-compose.override.yml
https://github.com/Danack/Imagick-demos/blob/master/docker-compose.prod.yml
 
I'm not too keen on docker-compose either. Basically I want a zero-dependency container that exposes it's HTTP port and then I can reverse-proxy it via Nginx. There will be many small services on that server, many of which are written in different languages. Most of this is for learning and not "mission critical"
 
only if youre locking your dev to your machine
my stacks are totally deployable and now i am able to scale all the things
(i dont do that but it works!)
@LukasKnuth Many sound like you want a compose
 
> docker-compose build
> docker-compose -f docker-compose.yml -f docker-compose.prod.yml up -d
 
deploying a prod is made with docker deploy
in a swarm
 
4:25 PM
Opinions on Docker Swarm vs. Kubernetes ?
 
docker stack deploy --compose-file ".$dockerComposeFile." $stackName"
 
@LukasKnuth Shoot the hostage.
 
Kubernetes supports docker swarm i think but im no admin and i dont have such high numbers of containers
but if you want to be goolge and got the same traffic i think kubernetes is the way to go.
 
@Danack i get it, hurr durr containers are shit. But if you need to run stuff on AWS or any other Cloud stack, how else could I do it? I'm trying to learn this stuff, so i know more than nothing if needed.
 
Its not about the aws stuff. You can use it to make your own cloud at home
i got 3 clouds personally and they are worth it
just the learnings i got from it
Even my CEO hates docker but as i made the whole infrastructure for the devs and made a "small office cloud" with some notebooks he was amused as i said "if i were u i would put all the computers here in a swarm so i got performance like hell"
and then he got it
Do you guys have multiple servers/computers/raspberrys live?
 
4:33 PM
@LukasKnuth No, containers are great, but the tools to deploy them are terrible, but I think at some point they will improve. Delaying needing to use them for as long as possible is probably the only winning strategy.
 
meanwhile i click on the up button to increase my performance on the developer server :3
 
I don't have enough experience with all of them to be authoratative but my thoughts are:
Hobby site with no redundancy - docker-compose running a single box.

Hobby site with a little redundancy - docker-compose running on a couple of boxes, with a load balancer in front of them

Actual site that people care about but doesn't need to scale massively - either https://platform.sh/, heroku if it's really low load or AWS.

Something that needs to scale massively or needs to deploy many, many services - kubernetes.

I'm reasonably sure that kubernetes only makes sense if you can afford someone to look after the services full time.
 
Kubernetes makes sense if youre gonna want to work in that field
learning is the best. Learn all the shit you can
even if its a hobby project and you want to see results. Try to learn new stuff everytime
 
yes, well kubernetes certainly falls under the 'shit' category.
 
yes
 
4:37 PM
@user3655829 What about good ol' save-path-in-database concept (or I'm not reading problem well)?
 
in this state this will be there for 2 years but if you start now you get a grip of the topic.
 
And hello to room. \o
 
@Tpojka the problems occur after deleting it or something like that. You want to find the files you looking for. Good look with our folder. Just make some more. It costs 5 minutes of your time now and saves hours in one year
 
On top of my head is always save/delete in conjunction with file_put_contents/unlink.
Didn't consider 2m files this way before.
 
4:51 PM
```
$file = $db->table->file_path;
if (!is_file($file)) {/** make file/update path/etc */}
```
Wouldn't this be faster?
Do not search for 2m. Just check one saved in db. At least I'd do it this way.
 
no its not about the speed. The speed is actually no problem
 
Problem is to have 2m of something but not stored in some kind of DB system.
 
No. It is stored but if you lose your db your it will be out of sync with our filesystem youre doomed
you can check against 2m files the validate. But do you want to do that as 5min cron?
that would overflow.
later... if you want to implement a check... you will be happy if you throw the files in diffrent folders
you will be happy because a lot of reasons. There is nothing to clap about a folder with 2m files.
i tried to catch up with a folder like that while the userbase still is uploading a ton of files to this dir. You can imagine how fun that was?
and the files were uploaded via fax not bigdata
 
5:08 PM
Restoring lost files is completely another issue.
Regardless, I am fan of well sorted path (through subdirs).
 
Its another issue yes. But dont store 2m files in one folder in the first place was the opinion here
he can use file exist if he wanted but some tips beside werent wrong.
 
this says, absolute paths start with (protocol) http. From the other side, it is suggested to use absolute path in file_exists() function. But sadly the path I want to check file existing inside, is not accessible through http. So, any idea how can I use absolute path without http ?
 
you are confused about absolute/relative paths in the web vs the filesystem
no filesystem path will ever have http at the beginnin
 
path vs. URL
 
just use your harddisk path beginning from / or C:
thats a absolute path
in linux /home/user is a absolute path
if i am in home "user" would be a relative path to /home/user
@Shafizadeh var_dump(DIR) and you will see the current absolute path of your app
*_DIR*_ without the *
and two _ besides them
 
5:24 PM
well, ok, can you please tell me two paths example, one relative and one absolute ? (it would be great if you start it with /var/www/html)
 
/var/www/html/resources/upload/user_avatar.jpg would be absolute resources/upload/user_avatar.jpg would be relative from your app perspective
if the index.php is located at /var/www/html
 
/var/www/html/readme.md is an absolute path in filesystem.
http://example.tld/readme.md is URL from outside world to that file
^that
@Shafizadeh So you would like to make it easier for use having some base constants. For path that would be const PATH_BASE = /var/www/html/ and for URL probably const URL_BASE = http://example.tld/.
 
Do you mean DIR AND $_SERVER['HTTP_HOST']?
:3
 
ah I see guys, thank you
 
From that point you just need to manage readme.md name in both cases.
 
5:31 PM
but @Shafizadeh its not better to use absolute pathes. Please use relative server pathes thanks
thrust me again. This will help in the following years a lot
 
actually I was following this
 
And conclusion can be readme.md is relative path. If in subdirectory: sub-dir-name/readme.md would be relative path to that app/server root.
 
hmmm. that is right but he refferes to 0.001% performance optimisation
 
Hey guys, I am using trusty Ubuntu 14.04 and I have php 7.2 via Ondrej. Problem is it's missing php7.2-intl. How can I get this installed?
 
you dont have to care about that.
@Shafizadeh the diffrence will be include 'test.php' vs include DIR.'/test.php';
just to show the real world difference for you. You could use the dir option here without problems.
 
5:40 PM
I see
 
5:53 PM
@Fabor that extension will be available....something weird must be happening for your apt to not see it.
 
@Shafizadeh Check here too.
 
@Tpojka sure, thx
 
@fabor - just run php -m (i think) to show the extensions loaded. I think maybe intl might be compiled into the 7.2 package.
 
6:13 PM
@Danack Not there sadly :(.
Tried updating too, not showing in apt-cache search
Only for php5
 
6:28 PM
getting fiber todayyyy
 
\o/ were got fiber 2 home as a internet family ... that was a great day as the guy was there
me and my brother were like "YES NO MOre ping shit"
 
best part is the bill is going down, bandwidth is going up
 
But it was funny as the guy got down the stairs and saw that big server room in the middle of a 4k people city. Big rags everywhere with some sort of cable chaos. "Spagetti everywhere!Spagetti everywhere!" he said to his boss on the phone. GREAT DAY
 
150 Mb/s to 1000 Mb/s, and down like ten dollars
 
yes. The cable did cost nothing here
and then there were 25 euro a month and if you had a old contract they even paid that
and its a sync cable so down and upstream are 1gbits
! unlimited
After that i do not accept any argument that you cant put good cables for low cost anywhere. Its totally possible. this was a company which was building a lot in the nederlands but that country is finished so they moved to germany and did this in a fraction of cost which the goverment gave T Systems to do the job.
 
Wes
7:32 PM
evenings
got myself stuck in some annoying math problem today. fml
heuristics kinda stuff
i think. i can't find a formula
 
7:52 PM
i wonder why u need math as a developer so go on.
 
932 Mb/s download, 904 Mb/s upload
beautiful
 
@Wes a^2 + b^2 = c^2
 
Wes
yeah, no :B
 
I used to remember the quadratic formula, we were taught it to the tune of Pop Goes the Weasel
the opposite of b plus or minus the square root of b squared minus four a c, all over two a
 
8:22 PM
@Wes do you do much art in meatspace, like painting?
 
Wes
no
only sites graphics
logos, and kinda stuff
 
that's no fun
trying to decide what to paint
 
8:54 PM
@Tiffany That's actually helpful.
 
9:22 PM
@NikiC Yes, but I don't use an OS provided clang.
Mine uses -lc++ and -lc++abi.
Getting rid of libstd++.so is half my reason to use clang lol
 
duh, there seems no way to get php7.2-intl on ubuntu 14.04
if only I could upgrade ubuntu
 
00:00 - 15:0015:00 - 22:00

« first day (3169 days earlier)      last day (1779 days later) »