« first day (1527 days earlier)      last day (3418 days later) » 

8:01 PM
@user3692125 Almost certainly not. The values will be stored in an integer like format internally to SQL, and so it will be very fast. The only thing you might want to do is put an index on the date column.
 
Why some people don't use mail()?
 
@user3002233 It's very limited, if you're doing anything more complex than a simple plaintext email, best to use something else
 
@AndreaFaulds like what?
 
@user3002233 Well it doesn't make multipart (attachments), MIME (HTML) etc. emails easy
You can do it, but it requires a lot more effort and is more error-prone than a proper solution
 
@AndreaFaulds Can I use it in production if i just want to send a simple text?
 
8:04 PM
@user3002233 Oh sure, it's fine for that :)
 
@AndreaFaulds Ok. Thank you. :)
 
 additional_parameters (optional)

    The additional_parameters parameter can be used to pass additional flags as command line options to the program configured to be used when sending mail, as defined by the sendmail_path configuration setting. For example, this can be used to set the envelope sender address when using sendmail with the -f sendmail option.

    This parameter is escaped by escapeshellcmd() internally to prevent command execution. escapeshellcmd() prevents command execution, but allows to add addtional parameters. For security reasons, it is recommended for the user to san
headdesks repeatedly
Who the hell thought this was a good idea?!
 
Hey guys, I think my site got hacked... I check all files and the md5 hashes are the same. The problem is, I noticed an empty database 'tmp' but I can'tr find any other evidence... Can someone please help me?
 
@SpeedCoder are you sure you were hacked? How do you know that you were?
 
@AndreaFaulds 1) Unknown empty database 'tmp' appeared. 2) Either the hardware was ultra slow (23 seconds to do a 10 second job) or someone slowed down the system by copying everything from the main database (500MB)
 
8:10 PM
@SpeedCoder Is the server up to date? Are the passwords secure? Is root login allowed? Have you tried rebooting?
 
I am running an RDS database and an EC2 instance.
Everything looks okay, no files modified
I have all updates
 
Hmm. It might just be a brief slowdown
 
My iP board was not up to date and IP informed me of a cross site scripting released 2 days ago. But, can a XSS be used to create a MySQL table?
 
Also, tmp sounds like the kind of temporary database some application might actually create.
 
@AndreaFaulds but this never happened before and what about the table?
 
8:11 PM
@SpeedCoder XSS allows attacking the user, not your server.
Maybe EC2 is having issues?
 
I wrote all the code. The only app I diden't wrote is the IP Borad
 
I'm not saying you haven't been hacked, it just doesn't sound to me like that's what happened
 
Thanks for your help, I really appreciate it
 
:)
@SpeedCoder Actually, here's an idea: grep for tmp in IP Board's source
 
okay, I am quite noob, so how do I run this command? say my ip code is in /var/html/forum
 
8:14 PM
ah
grep <something to search for> <file> or grep -r <something to search for> <directory>
 
okay, great, It returns a lot of code, I will check it out
 
Oh, really?
Hmm
maybe grep -r 'CREATE TABLE tmp' would narrow it down
 
Is it bad to store an object in $_session? I store users information in sessions. a user object with some methods like getUsername(), getAvatar(), etc . I don't know how the other developers do that.
 
@user3002233 It's not bad in itself, but it means you need to have some synchronisation between any code that updates a user in the DB, and also updating them in the session.
And there could be not great side effects if too much data is stored in the session - tbh you may be better off just using a cache like redis / memcache and using that to hold the data as well as moving all the session data there instead of the default file system session storage, if you haven't done that already.
 
@user3002233 To go along with what Danack said: It works, but yeah, you'll need to keep it updated (say if someone changes their profile pic). I suggest just keeping the user ID in your session and fetching the user data from the DB when needed :)
 
8:27 PM
@Danack I don't have any problem with speed. I'll use memcached. I just want to know that what is right way. Do you yourself use object in session?
@AndreaFaulds Yeah, It seems good. Is that what you do yourself?
 
@user3002233 Some yes, occasionally.
 
@user3002233 Yeah. Some older app I wrote stuck a bunch of stuff in the session, but I stopped doing it.
 
Not so much for stuff that is stored permanently elsewhere.
Things like recent searched items - where no one cares if that goes away when the user logs out.
 
To be fair, though, my most recent app doesn't really need to store much user data in the session anyway.
For starters, it's a "single-page web app".
 
Good, I should change the code. Oh, I hate it! Many errors. many debugging. until it works correctly.
How do you guys change your program? Is that hard for you too?
 
8:32 PM
Some errors are hard to deal with. Others less so.
 
The hard part is finding the error ^^
 
Browser bugs can be infuriating. For example, canvas mouse events in Firefox have quantum attributes. What do I mean by "quantum"? Well, the attributes become zero if you read from them. Just like quantum mechanics, you can't observe without changing anything.
 
@NikiC Yeah, I find an error and then I find two more errors.
 
@AndreaFaulds Thanks, id doesn't return anything for the create table tmp create database tmp
 
@AndreaFaulds You should do some hardware programming sometime ;)
 
8:34 PM
@SpeedCoder maybe look for CREATE TEMPORARY ?
@NikiC Oh, I realise that's routine in embedded platforms. But in JavaScript? Native objects really are special.
 
Actually, I have 2 database users one for the forum and one for the main site. Those users CAN'T create a database. So, the only one who can create a database is the db admin user. The only one who can connect there is my PC.
 
WTF
:|
Why would anybody think that is offensive?
 
@PeeHaa declined the flag. Dumbtards
 
@SpeedCoder Out of curiosity, what's in that database, have you had a look?
 
@AndreaFaulds yes, it's empty
 
8:39 PM
@SpeedCoder Ah, probably no need to worry then... I wonder, does MySQL keep logs in /var/log? Might want to look at them.
 
@AndreaFaulds Thanks! I will check the RDS logs
 
@SpeedCoder I just think it might give you an idea of where it came from ^^
 
Hello room... can anyone reccomend me a cheap hosting company who are reliable and support php, MySQL and unlimited smtp messages?
 
@PrimeByDesign small or big site?
 
8:48 PM
@PrimeByDesign any vps should do?
 
small
intending to install joomla
 
^ eww why?
 
any large files will be remotely hosted
 
then maybe shared hosting? or vps?
 
I wanted to have a database that I will use as a CMS
 
8:49 PM
but if you want to go cheap... ramnode
 
or you can buy OVH's ultra cheap vps
 
ovh is good too
 
the VPS start at 2.4$/month
but you are alone if something goes wrong
 
8:50 PM
@PrimeByDesign unlimited smtp messages? A spam company :)?
 
no
I want to have a cms so that I can let recruiters know when I have found a contract
 
@SpeedCoder I won't recommend a shared hosting to any developer
 
many of them ask me to inform them
 
@HamZa well, good point but it's cheap and simple
 
I think a vps is a good option... I write desktop applications also
so I might have the chance to host some of my own applications on there
Do I need to install my own ftp server etc on a vps?
I guess they give you a CLEAN VM right?
 
8:52 PM
@PrimeByDesign Or just use ssh
 
@PrimeByDesign why would you use an ftp server in 2014?
 
@SpeedCoder we're not in 2004. VPS is way cheaper than it was. I don't recommend a VPS to a non-IT guy though. Although you would question if this non-IT guy should just hire someone with experience
 
because I've bnot been developing web applications for a while
infact I've only been doing a liuttle ASP.NET MVC
 
@PrimeByDesign are you using git?
 
8:53 PM
@PrimeByDesign no, you have ssh access. You could transfer files with it. +1 for security
 
Ah I guess I could use GIT
I guess I would need to learn SSH but I think I should learn how to do it...
 
@PrimeByDesign I use a git hook that automatically deploys when I push changes to my master branch in my private bitbucket repo
 
I could just look on you tube
 
ssh username@yourserver.com
There, you now know ssh
 
patrick.. kinda like continuous integration
ah okay
just a little command line stuff
 
8:55 PM
@PrimeByDesign if you're a windows user, you could use putty. You could transfer files using filezilla but you need to change the port to 22
 
@PrimeByDesign it gives you access to the servers command line. There are lots of tutorials from server companies like digital ocean and linode that you can follow to set up everything you need.
 
since by default filezilla will try the ftp port (21)
 
@HamZa why transfer files?
 
@Patrick backup?
 
@AndreaFaulds I don't think I enabled RDS logs. For some unknown reason seems like the logs ware cleared about the time my app recorded an error due to the slowdown. But I am really a beginner as a server admin and not confident enough
 
8:58 PM
@HamZa If you need to back up user files, then yeah I guess it would make sense...
 
guys... I'm looking at ovh.co.uk/vps
 
@SpeedCoder There's a server admin StackExchange which might be helpful
 
I'm not sure what the difference between the 2.99 and the 8.99 hosting plan is?
 
@AndreaFaulds Thanks
 
I mean classic and cloud
 
9:01 PM
cloud should be more reliable, also more backups and you can add more ips
 
one is more expensive? ;)
only you know what you need, but the cheaper one will probably do if it's just for a small app
 
"cloud should be more reliable" :-D
 
@Patrick ok. I admit. I use ssh to transfer my code.
:P
 
99.99% SLA vs 99.98% SLA at least from that
 
This is for later, assuming you have a private repo set up on bitbucket. First you clone the repo (that only has to be done once). After that, you can use the following to update your server from the repo:
git fetch --all && git checkout --force origin/master
 
9:03 PM
@SpeedCoder it's SLA for what?
 
@HamZa lol... want my git hook script? :D
 
@Patrick Sure
 
The SLA represents the OVH commitment to service availability (excluding planned and scheduled maintenance operations).

VPS platform enjoys stability and fool-proof availability. When you rent one of our virtual servers, we guarantee the stability of your service.

We guarantee that your service will be restored within 10 minutes for a VPS Classic (with 99.98% SLA), and 5 minutes for a VPS Cloud (with 99.99% SLA).

In the event that we do not fulfil our commitment, we will undertake to reimburse 5% of the monthly price per hour of delay up to 100% of the monthly amount for the product conc
 
that's including some debugging stuff: http://paste.jesse-obrien.ca/1pZL
setting up the ssh keys was a bit tricky but once it works it's really awesome
 
@SpeedCoder it's not about reliability though, it's about disaster recovery
 
9:05 PM
Good point :/
 
it's obvious that you can recover quicker in a cloud, it does not mean it's more reliable though
 
@Patrick You update production automatically on push?
 
@PeeHaa that's what "crazy" part in XP abbreviation means
 
Or brave :P
 
@PeeHaa yes (this is only for a small app that I test locally first). You could use different branches and a test domain
 
9:07 PM
You realize stuff always only fails on production right?
PeeHaa's Law
 
@PeeHaa now I know who to blame in my faults
 
;-)
 
@PeeHaa well then nothing helps ;)
 
failures are good actually
unless you have small issues here or there in production - you won't know how to recover if something terrible happens
 
@PeeHaa how are you set up?
 
9:09 PM
@Patrick I either run a deploy script or manually upload
 
@PeeHaa But then you are also not testing it before putting it on production?
 
@Patrick Sure I am. On staging
And once more on production
The difference being I don't let git decide when to update production
Note: for personal sites I just blindly update everything and wait for stuff to break :)
 
@PeeHaa makes sense. I'll change it once I have some users, right now I'm just too lazy :)
 
Fair enough :)
 
at work we have deploy scripts too of course... This is just a personal site
 
9:13 PM
@AndreaFaulds Sorry for bothering you again but I noticed something important: The number of create database statements = 2. I have 2 database + tmp. This means, tmp was not created by a script and 99.99% mysql made the table itself for an unknown reason
SO, most likely mysql crashed and i was not hacked
 
@Patrick I was a bit surprised as in "how the heck does cd /var/www/$repo/ && git fetch --all ..." get executed and when I was about to ask you, I noticed the backticks. Nice one +1
although quite unclear to some beginner :P
 
@HamZa if you read the above... just put those commands into a deploy script instead of setting it up as a git hook ;)
 
@Patrick well, I need to get a vps and setup/develop my own website first lol
 
that definitely would help :D
 
9:32 PM
Guys... thank you so much for all your help
I'm going to have some real fun with a vps
I could use it to power apps!
 
take care
 
9:46 PM
Just one more question before I go..
so I've purchased my VPS...
does it take time to set up?
I mean I got an order confirmation from OVH but
no email or anything else
 
9:57 PM
/
?
@Patrick... do you use OVH yourself?
I mean @SpeedCoder
 
@SpeedCoder That might be it :)
 
10:56 PM
<?php
$startMemory = memory_get_usage();
$array = range(1, 100000);
echo memory_get_usage() - $startMemory, " bytes\n";
unset($array);
$startMemory = memory_get_usage();
$array = array_fill(1, 100000);
echo memory_get_usage() - $startMemory, " bytes\n";
@AndreaFaulds ^- on 64 bit 5.x pls, if you have a build handy
 
14649088 bytes
PHP Warning:  array_fill() expects exactly 3 parameters, 2 given in /var/www/test.php on line 7
136 bytes
 
@kelunik array_fill(0, 100000, 42);
sorry
 
13849576 bytes
9048880 bytes
 
@NikiC ;-)
14649048 bytes
9848880 bytes
^ php 5.5.12, php7: 4194392 bytes, 4194392 bytes
 
thx
wondering where the diff comes from between you and @Paul
 
11:03 PM
@NikiC Different PHP versions, see 3v4l.org/OeRkd
 
@NikiC blame windows
 
@PaulCrovella that may well be it
as you'll have smaller longs
 

« first day (1527 days earlier)      last day (3418 days later) »