« first day (2074 days earlier)      last day (2880 days later) » 
00:00 - 12:0012:00 - 00:00

12:02 AM
2
Q: MySQL adding value from previous row

nickI have a table with a single column. The column is like this: 1 2 3 4 5 ... I want to create a query that will display another column that will have the previous value added to it. So: 1 1 ( 0 + 1 ) 2 3 ( 1 + 2 ) 3 5 ( 2 + 3 ) 4 7 ( 3 + 4 ) 5 9 ( 4 + 5 ) 9 14 (5 + 9) 45 54 ( 9 + 45) How wou...

Depending on your flavor of SQL I suppose.
 
Thanks, but since I am not an expert in SQL (and since SQLFiddle won't load), I'm not sure I understand that well enough to translate.
 
Translate it to what?
 
Don't know what @runtot means
never mind
 
 
1 hour later…
1:20 AM
poop
 
Pretty much.
 
 
2 hours later…
3:08 AM
morning
 
evening
 
Wes
mornin hodor
 
echo "good" . $local_time;
is that right? ^
 
Wes
!!google universal greeting time
 
I meant syntax :p
 
3:26 AM
@Jeeves are you drunk
 
@AnmolRaghuvanshiVersion2.0 Screw you human!
 
o_O
 
@Jeeves am I?
 
I have a website that is not updated very frequently. It does not have blogs or news or any section like that. There are some pages that are coming from database and that's about it. How should I go about creating RSS feed for such website?
 
What kind of feeds do you have on that website?
 
@littlepootis I don't have ANY feeds on the website right now..I'm supposed to create one. And I'm stumped.
 
Due to nature of the website. It's very static. Even though most of the information is coming from database, there is no field in database to track when a page was last modified etc.
Should I just pull all the pages from the database and create a RSS feed and be done with it?
When someone modifies a page, they regenerate the RSS feed?
 
3:59 AM
RSS wasn't made for that content.
 
I agree and that's why I am stumped.
There is actually one section of the website that does updated more frequently - say once a month or something.
Do I create RSS feed for this section alone?
 
Hoi!
 
RSS isn't for content that's updated. It's for periodicals, and other stuff.. like logs, press releases, etc.
or tweets
 
@littlepootis Sorry, that's what I meant by "updated". There is one section that get things added to it more frequently - like news items and such. But the frequency is once a month. Should I create RSS feed for this section alone?
This section is basically list of upcoming seminar. Anytime a new seminar is announced, an entry is made in the database in the seminar table.
So should I create RSS feed for Seminars alone then?
 
4:36 AM
Good morning
 
Do you know wich Api this website lequipe.fr is using to display fixtures teams score ... ?
 
Wes
uh?
 
@Wes api to get score fixtures and teams ....
 
Wes
4:53 AM
why do you assume they are using an api?
 
because they can't have a database where they store fixtures score in real time and get all statitics ...
any idea
 
5:13 AM
posted on June 20, 2016

New Cyanide and Happiness Comic

 
moin
 
'n
 
Wes
\o
long week ahead... gawd
@PeeHaa can we remove explosm from feeds? they are pushing it too much and they aren't funny anymore
 
@Wes y long ?
 
Wes
need to finish lot of work and need to get my hot water boiler replaced because nearly exploded the other day...
 
5:25 AM
o
 
Wes
and i know it's gonna take several days, because it's not in the most accessible location...
 
get a people to do it for you ?
 
Wes
ofc yes... but it's going to take days regardless
 
oh I see
 
Wes
had a bath with boiled water earlier this morning. took me half an hour to get the water hot -__- super annoying...
 
5:28 AM
crappy
 
Wes
i get it checked every year, but clearly they didn't check anything, because it went full dynamite
 
we have one of those checks also, they are here for about 10 minutes ...
I think they are only checking for dangerous leaks ...
 
Wes
same
 
and extraction ... they are the only two things I've ever seen them touch ...
 
Wes
extraction = money? :D
 
5:31 AM
ha
we don't pay them actually ... they are sent by owner of house or estate agent ... requirement of landlord by law
 
Wes
i think i pay about 80€ every year for that, they never did anything basically
 
my early morning head read 80k, nearly crapped myself ...
have you had contact with the people who are meant to check it ?
 
Wes
lol. i would rather have showers with mud
yes, every year. i trusted them :B
 
I mean since it went wrong
maybe they have some sort of guarantee on their work ... probably not ... but maybe worth a phone call
 
Wes
nope, happened saturday so i'm gonna call them today..
it's possible but i don't think they will leave my home without taking some of my money :D
 
5:37 AM
our en-suite has been leaking into our kitchen for about a month, we had a quote to come and look at it ... ridiculous prices, still haven't found anyone reasonable yet ... I super hate baths, but not enough to hand over several hundred pounds for someone to trace some water ...
 
Wes
indeed
 
@Wes yeah probably ... they are shits ... but they must have some kind of insurance I guess, they may be able to claim on that ... or you may be able too ... depends what is wrong with it ...
is it old anyway ?
 
Wes
not too old, it's like 8 years old
 
got a hot water tank ?
 
Wes
nope
i think they are not legal here
 
5:40 AM
because of danger, or because of energy wastage ?
 
Wes
the latter i believe
 
smart rule ...
we have an old one with tank, really want one of the new ones that heats water instantly ...
there is nothing more annoying than running out of hot water ...
 
Found the old #PHP-FI (php 2.0) documentation digging through an old hard drive http://phpden.info/php2doc and examples http://phpden.info/php2doc/examples
heh
 
Wes
the problem is how far the bathroom is from the boiler. i have one of those, still i have to wait several seconds to get hot water
unless your house uses micro tubes, with half a centimeter diameter
 
pfft several seconds ... I have to wait 45 minutes when it runs out ...
 
Wes
5:45 AM
that's annoying
 
> When I build the package without any access logging or access restriction support, I call my binary FI
I prefer the name FI ...
if it didn't mean painful tattoo removal, I would suggest we change the name ... PHP doesn't make any sense ...
 
Good morning!
 
'nin
 
if someone was to rename php, I'd prefer glue as the new name
2
because php glues things together and if you inhale too much of it, you get high
5
oh. and moggu
 
I'm a big fan of languages that are one letter ... so I choose W ... to be superseded by W++, shamelessly copied by M$ as W#
later open sourced as Wono ... but ignored ...
oh ... and 'nin
 
5:57 AM
moin Joe
 
6:11 AM
moin @Anmol
I really hate pointless comments ...
 
Wes
completely disagree with you there joe
"check image dimensions" check for what?
 
the width and heigh provided .... they could be named better ...
 
Wes
i would agree if it was checkIfImageSizeIsLessThan()
 
public function checkImageDimensions($base64String, $desiredWidth, $desiredHeight);
something like that ...
 
Morning
 
Wes
6:14 AM
that would work if named arguments were possible and used frequently.
checkImagedimensions($str, 10, 20) doesn't tell me anything
 
I disagree, I think at the call site it's easier to understand because you have context
at the call site you don't have phpdoc either
if you have an ide, it's going to auto complete using either ...
 
Wes
i meant that function is badly named regardless of phpdoc imho
 
well maybe ...
 
Wes
isImageTooLarge($image, $width, $height)
or something...
 
but I'd rather people put a tiny amount of effort into naming functions, rather than packing every file with as much or more comments than code ...
 
6:18 AM
@JoeWatkins Self documenting code++
 
Wes
comments can be collapsed though...
 
they can be forgotten about, ignored, wrong, and still included in documentation ...
also, my editor doesn't support collapsing, you can't make that assumption ...
 
Wes
also phpdoc is very redundant and that's the major problem imho, because if it was
public function bla(
    Bar $foo /** desc */,
    Baz $bar /** desc */,
){}
or something, it wouldn't be that bad
 
Good code should be readable enough that when you run it it does what you expect. Great code should read like a story such that you don't need to run it to know what to expect.
 
Wes
and by the way, with return types i'm seriously thinking to have multi line function arguments by default... signatures are too long
they easily pass the 90 / 130 chars "limit"
 
6:27 AM
SHARKIRA SHARKIRA https://t.co/3cnD0y9rqf
hilarious
 
Wes
phpdoc is another very important thing in the php world that is in the hands of the wrong people...
 
says someone with /that/ avatar
 
Wes
what's wrong with my avatar
 
6:51 AM
morning
 
MoIn.
 
Happy birthday, @Wes, wasn't really at the computer for some days.
 
Wes
ha, no probs :P thanks
 
@PeeHaa Is @Feeds broken? I don't see the entries for amphp/socket and kelunik/acme-client here. Both released yesterday evening. They show up in the preview in Feedr.
 
Hey
i have some trouble to put a file on a repertory which is one directory before where i execute my script
My script is execute as www/script/file.php
and i would like that the file that is generated by the script go to www/repertory/files/
what is the good path ? ../repertory/files/ isn't it?
 
7:07 AM
@user3206631 have you tried?
 
yep and i don't see the files go there :(
@Victor Ha sorry ! i had to wait for the import to finish ! my ftp is a bit slow haha
Now i can see the files :)
 
ako
    hi there.. i have an index.php page when user wants to logIn i send data to CheckLogIn.php page when data is not valid i want to redirect user to the index.php with a message ...this is what i have done .. in checklogin.php : if(isset($_POST["username"])){
    	$myusername=$_POST['username']; }
    	elsedie(header("location:index.php?loginFailed=true&reason=userName"));
    if(isset($_POST["password"])){
    	$mypassword=$_POST['password'];
    }
    else die(header("location:index.php?loginFailed=true&reason=password"));                      and in index.php : 							                  
 
pastebin
 
ako
but there is an error with this code :
Undefined index: loginFailed
 
7:21 AM
but still pastebin
 
ako
how can i fix it?
 
You have an "elsedie" instead of an "else die" but I don't think this is the only problem
 
Morning.
 
ako
@MorganTouvereyQuilling the problem is not with that
@MorganTouvereyQuilling when first time index.php is loaded there is no "loginFailed" variable ...i think its because of that ...but i don't know how to fix it
 
7:42 AM
o/ @Oldskool
 
@Wes If people agree, sure
@kelunik Not that I know
 
Wes
math exam hypotetical guy is real pbs.twimg.com/media/CjS0cruWsAAh36b.jpg
 
Mornigns
 
Wes
yo
 
Morn
 
7:54 AM
'nin
 
Wes
@Duikboot while i love einaudi, that got me suicidal tendencies
not the best monday soundtrack :B
 
nornininigs
 
8:11 AM
Einaudi is just fantastic imo :D
But indeed if that causes you suicidal tendencies... then it wasn't probably the best share of me.
 
Wes
on monday you gonna need something thrash metal :B
 
You're gunna need a bigger boat.
 
Einaudi is such a funny name… when you are german
because Ein means "a" and Audi is a car brand, so his name is "An Audi"
he could do a couple sideprojects… Einbmw, Einferrari, Einmaserati
 
morning
so ... I installed Banished yesterday
it was a mistake (got to bed after 04:00)
 
@tereško I take it was good?
 
lol
 
> One-time-use moderator actions for buy - except ban.
 
@tereško better than simcity 5?
 
@Oldskool Aiiiight Permission denied (publickey).
@Wes I like this one :D youtube.com/watch?v=j2p_w409y-o
Lol @Gordon I had to see that one as well as 'dutchie'.
 
Wes
@Duikboot this is how headbanging is done properly youtube.com/watch?v=_7EQlfprV9E
 
8:25 AM
morning
 
@Duikboot What else is new? I'm telling you your box is haunted.
 
@tereško I remember that hardcore village survival :P
 
@Gordon I really wonder why ban is excluded if taking rep from other users is explicitly included.
 
Morning
 
Wes
redbull records... is there something redbull don't do?
 
8:29 AM
@Wes You maybe like this one... :D youtube.com/watch?v=oXGs_uai56w ( Friends of me :D )
give it a try :D
 
morning
 
@Victor definitely
but the tech-tree is a bit shallow
 
@tereško will try it then
 
Anonymous
mornin
 
@Victor steam sale starts in 3-4 days
 
Wes
8:31 AM
@Duikboot not bad
 
@SergeyTelshevsky yeah .. in my latest village half of adults died in the first winter
 
I managed to survive two winters iirc
 
that village is now 17 years in (or was it 27)
 
Seems you're talking bout Banished?
 
:D
TBH, the current village is not doing all that great either: it's been balancing on the edge of starvation again .. I shouldn't have accepted the nomads
 
8:36 AM
Build a wall and let the nomads pay for it
 
I also had to build a second school already
 
guys, how would you build an abstraction layer for websocket events handlers?
 
carefully
 
@tereško certainly
 
@tereško this
 
8:40 AM
The approach I though of is having an EventHandler abstract class and derive from it and in the entry point of the server, I would look for the event type and instantiate an event handler and run it. What do you think?
I am not sure I totally understand the mechanisms of async in php, that's why I'm asking
where's @bwoebi when you need him?
 
Some suggestions or people who have knowledge how to do this the best: I have website.com/123 website.com/abc and website.com/xY123 ... All subdomains with other content. Currently tracking in Google Analytics with 1 code.

Now I have to built an other one but it's : xyz.site.com ( which is totally different content then the ones from the /subfolder ones)
Should I setup a new UA tracingcode for that?
 
8:59 AM
o/
 
~o
 
mornings
anyone know how mysql would handle something like
RENAME DATABASE inactive TO active, active TO inactive; .. would I need to rename one to temp or can I just switch them
 
Wes
𓁅
 
@RonniSkansing there is no rename database anymore afaik
 
9:09 AM
what ... lol
"ENAME DATABASE was found to be dangerous and was removed in MySQL 5.1.23" " ah
 
user5020521
what is the matter with this code?
 
user5020521
<?php
if(isset($_POST['submit'])){
	$to = "xxxxx@yahoo.it"; // this is your Email address
	$from = $_POST['email']; // this is the sender's Email address
	$name = $_POST['name'];
	$subject = "Form submission";
	$subject2 = "Copy of your form submission";
	$message = $name . " " . " wrote the following:" . "\n\n" . $_POST['message'];
	$message2 = "Here is a copy of your message " . $name . "\n\n" . $_POST['message'];
	$headers = "From:" . $from;
	$headers2 = "From:" . $to;
	mail($to,$subject,$message,$headers);
 
user5020521
I can't receive anything
 
9:25 AM
@Riccardo990 Nothing is wrong with that code in itself. Problem is likely on your server or a spam filter.
 
user5020521
matter of fact I'm testing it on my personal email address @yahoo and I can't receive it
 
@Riccardo990 Doesn't make any difference. Check the maillog on your server.
 
Wes
@Riccardo990 check swiftmailer
 
user5020521
how can I check it?
 
user5020521
maillog
 
9:28 AM
@Riccardo990 See stackoverflow.com/questions/24644436/… for detailed debugging steps.
 
user5020521
thank you
 
Might be an APC & Tool day today.
 
@Fabor It's not nice to call the maintainer names like that :P
 
heh
 
9:58 AM
how would you require the class to implement a method with undefined number of arguments?
method_exists() ?
 
@SergeyTelshevsky Where do you need that?
 
@kelunik actions (as in controller actions, but standalone classes) may receive zero or more arguments, all extend some base action class
but the method is required
 
What do they receive optionally?
 
core/actionName?foo=1&bar=2&baz=3 - arguments __invoke($foo, $bar, $baz) injected automatically by their var names
seems like the only option is to method_exists($action, '__invoke')..
 
@SergeyTelshevsky I wouldn't do that. Those are user provided, so users could change your method call. Go with an associative array instead.
 
10:10 AM
but this leaves me to choose between checking for it's existence before or after instantiation..
@kelunik that wouldn't hurt, sorry, I had the wrong example
 
@SergeyTelshevsky Provide a consistent signature by accepting an associative array.
Also, instead of method_exists($action, '__invoke') ... why not an interface?
Require all actions to implement Invokable or something like that
 
url: `some.org/user/123`
routing: `(new Route('GET', '/action/{userId}', $actionFactory->make('\App\Action\UserView')))`
method: `__invoke($userId)`
markdown
 
@SergeyTelshevsky How about __invoke($request, $response)?
(Do you have abstractions for the HTTP request/response?)
 
@MadaraUchiha interface requires you to have a defined number of arguments
 
@SergeyTelshevsky In that case the router already knows that all params exist.
@SergeyTelshevsky Which you should have anyway.
 
10:13 AM
2 mins ago, by Madara Uchiha
@SergeyTelshevsky Provide a consistent signature by accepting an associative array.
 
bootstrap sets up the request/response abstractions
 
@SergeyTelshevsky Good, invoke your actions with $request and $response
Action takes anything it needs (URL params, POST params, cookies, files, etc) from the $request
 
why? they're available as $this->getRequest()
 
Hi
Can someone help me for set a cron task on my host
 
@SergeyTelshevsky where does $this->getRequest() get them from?
 
10:16 AM
My host only allow to set cron task with .php file
 
@MadaraUchiha inside the __invoke() method
 
@user3206631 Sounds like a pretty crappy host
@SergeyTelshevsky Edited, my bad
 
@MadaraUchiha Yes … kind of !
 
i.e. is it injected through the constructor?
 
from a request abstraction object
 
10:17 AM
The bootstrap calls setRequest?
Where does it get a Request instance from?
 
@MadaraUchiha yes, before invoking the action itself
 
@MadaraUchiha u think i can use wget in php file?
 
@SergeyTelshevsky Any particular reason it's not in the constructor?
Or directly passed to the action?
I'll ask a different question
 
yeah, I thought about using constructor only for dependency injections (using auryn)
 
Why is your Action an object to begin with?
Sounds to me like it should be a callable
Or a method on a controller
 
10:19 AM
I think I know where you're going
I used the simple callable approach
(new Route('GET', '/', function ($request, $response) {
    return 'hello world!';
})),
 
How was that inadequate?
 
that is also currently available, but sometimes it's reasonable to make an action class when some dependencies are needed (remember, I'm experimenting here)
 
@SergeyTelshevsky Okay, that's fair
But in that case, why break the $request, $response signature?
Don't have those passed into the object, pass them into the __invoke()
Then you can require public function __invoke(Request $req, Response $res); in an interface
 
@MadaraUchiha but why? :)
 
And the rest is implementation dependant.
@SergeyTelshevsky Because that's the contract
That's the interface you expect to have from an action
The basic parameters it can accept
It's not an implementation detail.
 
10:26 AM
give me a second I'll try to show what I had in mind
 
@Victor there … at normal times. :-D
 
@bwoebi I don't know where you live, so I don't know what's normal to you :-P
 
@Victor CEST, but I'm not used to leaving my bed early
 
I am on EEST
so one hour
 
Something had happened with lxr.php.net?
 
10:33 AM
@nikita2206 yes.… :-(
 
for laravel experts how can I get one signle user that his account is activated and permissions are affected to this account I used this $users = User::where('school_id',$school_id); $users = User::whereNotNull('school_id'); $users = User::where('activated',1)->get(); $users = User::whereNotNull('permissions')->get(); foreach ($users as $user){ if(!empty($user->permissions) && !is_null($user->permissions)){ $loginuser = Sentry::findUserById($user->id); } }
 
@bwoebi why isn't any button to create a new chat room?
 
@Victor there is? e.g. click on my profile image "start a new room with this user"
 
can someone take a look at my code
 
@bwoebi I swear I don't see it
 
10:39 AM
@Victor shall I start one then?
 
yes, please!
 
@MadaraUchiha here, remember it's all stuff straight out of my head, but will give you an example of why I would find it useful pastebin.com/iqSEtAXN
also..
AWS releases the x1.32xlarge. 64 cores, 1,952GB RAM,3,840GB SSD, 10Gbps network. Finally you can run Java on AWS.
 
It's like you tried to define a formal grammar based on fragments of a raw database dump from the QuickBooks file of a company that's about to collapse in an accounting scandal.
3
 
Lester.
 
user3119231
If I got an array with column names and an array with values is there a way to do a update statement without building a query with a loop?
 
10:54 AM
@Maurice You can use a prepared statement + array_map + implode to generate the query.
I hope you whitelist the column names at least.
 
user3119231
array_map is a good start. Let me check the docs
 
!!> echo "UPDATE table SET " . implode(", ", array_map(function($column) { return "$column = ?"; }, ["a", "b", "c"]));
 
[ 5.5.0 - 5.6.22, hhvm-3.9.1 - 3.12.0, 7.0.0 - 7.1.0alpha1 ] UPDATE table SET a = ?, b = ?, c = ?
 
user3119231
Jeeves is the room bot?
 
user3119231
btw yeah, array_map is what I've searched for
 
Wes
11:02 AM
youtube.com/watch?v=iw-3IqLPNGg game of thrones: italy spinoff
 
Anonymous
11:19 AM
happy first day of summer.
 
11:45 AM
When I would like to move all files in project/folder1/ from folder1 into project can that be done with mv?
cd folder1
mv * ../ seems to work :)
 
@Maurice hope that you will learn someday that simple readable explicit loop is WAY better than the same loop hidden bihind some cryptic code that needs to be evaluated by the reader in order to comprehend it.
 
Wes
@YourCommonSense i think he was looking for something like "INSERT INTO x($arr1) VALUES($arr2)" but for UPDATEs
 
Does anybody know if lxr.php.net is ever coming back up?
Or is it just gone forever?
 
I'm sure it will once they find out who runs the thing :P
 
Anonymous
Which version of php did start shown undefined function mysql_*() error ?
 
11:56 AM
7
!!docs mysql_query
 
Please, don't use mysql_* functions in new code. They are no longer maintained and are officially deprecated. See the red box? Learn about prepared statements instead, and use PDO or MySQLi - this article will help you decide which. If you choose PDO, here is a good tutorial.
 
Anonymous
Yeah, I checked it in 7, I got that error. So, I guess in 5.6.x it showed the deprecation warnings.
 
!!docs potato
 
[ ps_rotate() ] Sets rotation factor
 
thanks @Jeeves :)
 
11:58 AM
@salathe You're welcome!
 
Wes
loll
 
@samayo It has been deprecated since 5.5.0, dropped (undefined) since 7.0.
 
@Wes so he's got unreadable code out of yet another groundless phobia ("WITHOUT a loop").
 
> Documentation is like sex: when it is good, it is very, very good; and
> when it is bad, it is better than nothing.
> -- Dick Brandon
> (source: http://svn.php.net/viewvc/archived/phpfi/trunk/doc/doc.html?view=markup#l3)
 
00:00 - 12:0012:00 - 00:00

« first day (2074 days earlier)      last day (2880 days later) »