« first day (2029 days earlier)      last day (2916 days later) » 

1:00 PM
@DaveRandom Can't danack just give us co-owner privs?
Or is that only on repo level?
 
Repo level, apparently
 
sigh
 
But on the up side, he did add my packages in a timely fashion :-)
 
Here's a short question. I'm trying to add 2 foreign keys on a table (One on each column) by using 2 ALTER TABLE commands
The first one worked perfectly
 
\o/
Good guy dan
 
1:02 PM
But if i use the second with by changing the constraint name and column names, i get an error:
"Foreign key is incorrectly formed"
 
What does your statement look like?
 
ALTER TABLE user_rights ADD CONSTRAINT const_user FOREIGN KEY(User_ID) REFERENCES users (ID) ON DELETE CASCADE
 
@PeeHaa Anything wrong with the query?
 
Not that I see
 
> I ran into this same problem with HeidiSQL. The error you receive is very cryptic. My problem ended up being that the foreign key column and the referencing column were not of the same type or length.
 
@PeeHaa First Statement:
ALTER TABLE user_rights ADD CONSTRAINT const_module FOREIGN KEY(Module_ID) REFERENCES modules (Module_ID) ON DELETE CASCADE
 
Not sure wth heidisql is, but it can't be worse than mysql
 
hah
mariadb
 
I read that already
 
1:05 PM
 
but it didn't helped
 
@PeeHaa it's a client for mysql (and others)
 
@ZahidSaeed Are both columns exactly the same?
As in collation, type, length, color of eyes, favorite food etc?
@PaulCrovella I thought it was yet another dbms
 
ping @kelunik?
 
@DaveRandom I may possibly help too?
 
1:12 PM
@PeeHaa I checked that
But it's throwing an error :/
Modules_ID:
int(5)
@PeeHaa Does Column names also have to be same ?
 
No
 
@bwoebi It's regarding the mutex thing discussed the other day. It seems to me that it would be useful to have a set of primitives for this kind of thing, was going to see what he thinks w.r.t a base interface and set of primitives that things like his redis mutex you pointed me to the other day could implement
 
@PeeHaa Then what can be the reason ?
 
@DaveRandom you mean a common interface for potential alternate mutex backends?
 
Yes exactly
 
1:17 PM
hmm
 
With a few default implementations for things like a queued mutex and a thing that is limited to x concurrently, whatever you'd call that
Like a Semaphore in .net
 
I wonder if I can represent PHP values in JS with no wrapper object needed
currently I have a thing like: { type: IS_LONG, lval: 1 } for int(1), for example
oh, but the problem then would be references and zval*s
 
@DaveRandom pong?
 
@Andrea you cannot. there are to many special semantics
 
@kelunik see last few msgs to bob
 
1:19 PM
hrm
 
brb
 
I could at least drop the type: field
PHP's types can map to JavaScript's neatly:
 
@Andrea you can make it an instance of something, yeah
 
@DaveRandom Sure, it's a good idea. We just have to see whether they're compatible, things like stale detection and so on.
 
null -> null, false -> false, true -> true, int -> Number (where (n | 0) === n), float -> Number, string/object/array -> would need special types
 
1:22 PM
@kelunik Yeh I'm certainly not the best person to design an API for something like that, the impl in Jeeves works for me there but I'm not married to it if it causes problems elsewhere
 
@Andrea Uhm… the range of numbers is only up to 2^53 in JS and you cannot distinguish between int(1) and float(1) here
 
That's also the thing with redis-mutex, it works for sessions, but may not work with others.
 
Basically I like the fact that it can be used like the lock() construct in C# at the moment
 
@bwoebi indeed, but that may not be a problem
 
@Andrea it is, when you want strict types
 
1:23 PM
Using 🖕 on Android doesn't seem to work. :-(
 
@bwoebi strict types in PHP 7 allows int -> float
 
@Andrea but not the inverse
 
@kelunik Well there may be cases for complex setups like this for which a simple interface just doesn't apply anyway, and the code that's consuming it just cannot be impl agnostic. Abstractions are rarely watertight.
 
@bwoebi that'd be the tricky bit, yeah :/
 
@Andrea and as said, range of precise floats is limited to 2^53
after that your precision is less than 1
 
1:24 PM
@bwoebi sure. I'd be using JS's 32-bit integers, though
 
that's possible
 
I basically wanna figure out how to reduce the number of objects I'm using
maybe I can flatten everything out if I do some quite aggressive inlining
 
hmm, that built-in server thing is not that bad … Good enough to install wordpress locally for php-src testing :-D
 
@bwoebi I love the built-in server
well, almost. there's two things broken with it
 
@Andrea two?
 
1:37 PM
no directory redirection (going to /foo does not redirect to /foo/), no directory listings
 
the former you can fix and the latter is a feature
 
1:50 PM
o//
 
how to remove .php and add /
 
@MatthewSmart rewrite rules
 
@Andrea i know that, but everything i try isnt working
 
Jay
hi
 
@kelunik Created github.com/DaveRandom/Mutex and added you as collab. Do whatever you want, I'm going to give Jeeves a hard dep on 0.0.* for now.
 
Jay
1:54 PM
I ahve two variables: $amount = 200; $total = 1399; How can I work out the percentage?
 
@Jay $percent = ($amount / $total) * 100 ?
 
Jay
thanks
 
@MatthewSmart understanding them is better than just trial and error. read this first.
 
thanks paul
ill read through it now
 
@kelunik nope, I am not D1
 
2:03 PM
gasp @ircmaxell look at those curls!
 
In cryptography, the one-time pad (OTP) is an encryption technique that cannot be cracked if used correctly. In this technique, a plaintext is paired with a random secret key (also referred to as a one-time pad). Then, each bit or character of the plaintext is encrypted by combining it with the corresponding bit or character from the pad using modular addition. If the key is truly random, is at least as long as the plaintext, is never reused in whole or in part, and is kept completely secret, then the resulting ciphertext will be impossible to decrypt or break. It has also been proved that any...
 
@ircmaxell Is D1 a nickname for Daniel?
 
@ircmaxell Where was that picture taken? Background is fuzzy but looks historic.
 
@Saitama context? you need to know something, or just linking stuff at random?
 
@LeviMorrison in front of the Lourve
 
2:08 PM
Very nice.
 
@Leigh the later one, and... sorry... :(
 
I should refresh my kitten to a different one.
 
@Saitama no problem, just curious :)
 
@LeviMorrison :( I've grown fond of your kitten
 
I don't own any rights to this one, and while it is free to use with attribution I'd rather just get a picture of a kitten from my father's farm.
 
2:17 PM
where can I get documentation for ^= operator in php .I haven't found it on php site php.net/manual/en/language.operators.comparison.php
 
xor equals, bitwise operator php.net/manual/en/language.operators.bitwise.php ($a ^= $b; // $a = $a ^ $b)
 
@John try the "assignment operators" section ;-)
 
!!docs assignment
 
Assignment operators are used to change the value of a variable.
 
the "documentation" for xor equals there is a user note
 
2:19 PM
> In addition to the basic assignment operator, there are "combined operators" for all of the binary arithmetic, array union and string operators that allow you to use a value in an expression and then set its value to the result of that expression.
That's the sum total of the docs on the subject apparently
 
And who reads blocks of text when you're looking for an op in a table
 
@ircmaxell Oops ... thanks :)
 
I need to setup a script to call a php page every x minutes, cron jobs won't work when my mac is turned off.. could someone explain how that works to me?
my php page downloads files from the internet and puts them into a database, but i need to call it every 5 minutes or so
 
@MSU_Bulldog Computers need power to run things.
 
lol thats why I need to set it up on my server.. is that possible to make a php page that gets called every x minutes?
 
2:31 PM
And why wont cron work on your server?
 
excuse my ignorance.. so I can setup a cron job on my server?
 
sure, use crontab
 
whenever I look it up all the answers I get are command line examples...
 
Well usually that's how it's done
You ssh in to your server, you edit the crontab with your favourite command line text editor, profit
 
is it as simple as putting "5 * * * * php /var/www/vhosts/domain.com/httpdocs/scripts/example.php" in a php page and once I call it, it will call that page every 5 minutes
 
2:37 PM
no
 
No, that's a crontab entry, putting it in a php page will not work
 
That seems to be the way they are doing it here: docs.phplist.com/CronJobExamples.html
 
That isn't php
 
@MSU_Bulldog you're misinterpreting that
 
off-by-ones are easy. They can be trivially detected if there are tests. But if misbehavior only starts if you're off by 8 or more … the trivial tests don't detect it :x
 
2:49 PM
Does a write operation to an array always (or ever) reset the pointer to the beginning?
 
@DaveRandom never
 
@DaveRandom The Pointer = 'key' in the current array?
 
tnx
@Duikboot The iteration pointer than things like next() uses
 
@Duikboot no, the internal array pointer with next() each() current() etc
 
Oh nice! I didn't knew that was possible!
Example explains a lot: php.net/manual/en/function.next.php :)
 
3:01 PM
Hmm, wasn't there some caveats where the internal pointer was reset?
Maybe I'm remembering bugs that have now been fixed
 
Why did I have to make this PhpStorm issue?
6
 
That's kind of bull, following a non-standard :/
 
@LeviMorrison They do have a point though. The error message is just wrong.
It shouldn't interpret it as a class, just tell you that you made a typo
 
also, phpdoc should die
 
(Though it's easier to just lowercase it and be done)
 
3:04 PM
@NikiC Types are case insensitive. I'm not sure why there is anything to discuss here.
 
@LeviMorrison there are no language rules in comments
 
@LeviMorrison Oh, nothing really. I just hate people write @param Boolean.
 
@PaulCrovella Ah, but moving something from an actual type to a comment results in a PhpStorm warning?
That's… certainly odd.
 
@Leigh Just ignore it like PHP does
 
@NikiC We always output bool now internally, correct?
 
3:06 PM
@LeviMorrison we should
 
I would love to kill case insensitive names but I doubt we can do it. Very large BC break.
 
@Machavity I haven't been looking hard, but if I see someone using phpdoc and PHP 7 types... names will be called
 
@LeviMorrison the warning in that bug report is on the comment
 
@LeviMorrison you're the kind of person who writes NULL instead of null though :p
 
@PaulCrovella Yes, but it's not a class name.
It's strictly prohibited…
 
3:08 PM
@LeviMorrison why do you add a phpdoc comment if you already have it in the signature? ;-D
 
@bwoebi Not all params/returns have built-in types.
 
Commenting things that don't need explaining is how you prove you're good at documenting
 
I always have the docblock be correct and complete if it has to be there.
I always prefer it to not be there ^_^
 
"has to be there" is what is generally wrong, mandatory docblocks is a coding standards failure
 
3:10 PM
Eh, my language is a bit too strong there.
If I can't document the type in the language I do it in a docblock to explain what should be expected.
 
fair enough
 
Ah, PhpStorm is even worse:
array_shift($this->queue)
// Expected array, got Array
 
@NikiC Don't worry - it's just there to catch as many bugs as I can ^_^
I want scrutinizer to run on it ^_^
Hahaha
> 217 issues (206 minor, 11 informational) were introduced .
Ah man, to many unrelated thngs.
It's apparently best practice now to always declare visibility.
 
imagine for a moment you're creating an IDE and want to support a thing like docblocks. Would you rather pick a standard and follow it, or pick one then hodge-podge it up with special cases where you think it's wrong?
 
3:23 PM
@PaulCrovella I would want "types" in my docs to follow the language types.
That's hardly hodge-podge and special cases.
Scrutinizer didn't fail on the docblocks, which I am happy about.
 
then propose an alternative standard that's complete and coherent
 
@PaulCrovella I imagine for a moment I'm creating an IDE... I'd use official lexers
 
@Leigh the official lexer cares about what's in the docblock?
 
@Leigh I hope you're not going to suggest to use official parsers
 
@NikiC but … why on master?!
@LeviMorrison Scrutinzer … is that some new sort of toilet paper?
 
3:34 PM
@NikiC hm, well that would be a good way of supporting the correct syntax :), why would you think it's a bad idea? what if lex/parse was detached from the executor and was available as a lib that could output a serialised AST?
 
@Leigh Because editors require very high-quality error recovery
Language parsers generally do not bother implementing error recovery that is good enough for an editor, if they have it all
 
oh you mean being able to carry on parsing even with a syntax error
 
@Leigh Yep
 
fair point :)
 
they also do fancy stuff with partial parsing for continuous updates
 
3:38 PM
still the official lexers would give them proper token parsing
 
@bwoebi It's a code quality tool.
 
@LeviMorrison I know that, thanks… Just saying that I like it about as much as dirty toilet paper.
 
@bwoebi But isn't toilet paper important for sanitation?
 
@NikiC yes … as long as it isn't dirty yet.
 
@samayo wow ... that was a pretty stupid statement, Especially if you are not using IE to write this on.
 
3:43 PM
evening
 
Hi, I'm doing a vehicle ads website, and for the Car Model field, I wanted to make a input text field with recommendations of existing values. Any ideas?
 
@AnmolRaghuvanshiVersion2.0 nin'
 
4:15 PM
ping @MadaraUchiha ?
 
4:26 PM
Hi, am using symfony 2 doctrine, and i want to create temporary table, any help where i can learn that?
 
Look at this beautiful answer that deserves high praise stackoverflow.com/a/37077234/1710543
 
@DaveRandom it does ;-)
 
How can I find that Stackoverflow's page which explains "how many rep you need to do x" ?
 
well thank you
 
4:41 PM
@NikiC Do you know of anyone using your PHP AST project to implement code style checkers or alternative pretty printers?
 
@LeviMorrison You can't implement code style checkers with php-ast
If by "style" you mean "formatting"
 
I don't mean formatting - I mean structural things.
 
In that case github.com/etsy/phan ?
 
"Do not nest ternary statements" type stuff
Interesting.
Basically we are looking to have two tools that we either write or wrap around existing tools: orgcs and orgfmt.
The former is for checking structural issues and the latter for doing formatting.
Then on pre-commit we can check with orgcs that no structural issues are there and then run it through orgfmt.
 
I know the php standard is no line length should be over 80 characters... but I absolutely hate this. I don't have many multi-nested statements so that's not the issue, it's just so small relative to today's screen sizes, and my programming screen is actually sideways so that I can see more of the document vertically. I like 120 character line lengths personally. Does anyone else not follow the 80 character standard?
 
4:59 PM
Yes.
But we try to keep it when we can.
The reason is when we post code in other places (emails, online) there may be restricted width.
 
That's what I've read. Do you normally go beyond 80 or do you strictly stick to that yourself @LeviMorrison ?
 
I normally keep it within 80.
 
@Levi I thought you wanted to send a mail to internals with info about nullables RFC?
 
@bwoebi I did but had no time last night.
It will happen in about an hour when I go on lunch break.
 
ah okay
 
5:03 PM
I think I might have enough time to get unions in shape for voting as well.
 
I think that's just going to be one of the few standards I'm going to break unless I'm forced to comply.
 
@BruceBanEm You do what you can read and write nicely. It's not bad to have a few chars more.
 
Thanks @bwoebi
 
Some standards are just subjective.
 
I understand, I just try to keep all my code within prescribed standards for the most part. I'm the lone coder for the application I developed and maintain for the company I'm at... but if I were to be hit by a bus I would cringe in my grave if some other coder come in and was absolutely appalled wondering "what the heck was he thinking?"
I've learned more from developing, and refactoring than I did from the books I'd read. Mainly from Stack Overflow chat, site, and other blogs. There have been quite a few times I was in here and someone would say to someone else "Why do you do that, you should do 'x'." I would then think... yeah I do that and would refactor all my code. It takes time but I spend a lot of my downtime between adding features just refactoring.
 
5:09 PM
@LeviMorrison I remember (a long time ago) you have created a php library about images, am I right? you are who?
 
@BruceBanEm Sure, standards are definitely a nice guide. They're a great starting point.
especially coding standards. Coding standards are important to a) not make projects look like a big mess and b) have projects largely follow the same standard instead of every line looking different if there's more coders.
If you're actually putting a { on the same or next line is subjective and you shall feel free to deviate. if you think the other way is much better in your eyes
 
I like to use the K&R standard
or style I should say.
I do have one issue with using K&R style in notepad++ when using soft tabs (4 spaces). I always like to put a space between the open curly brace and what proceeded it. As in...
for ($i=0; $i <$num_results; $i++) {
 
Night...
See ya guys later
 
However, that extra space always causes notepad++ to believe that the closing curly brace is one space to the right than it should be when it is actually aligned with the for opening statement above.
I would have to have to have the closing curly brace over 7 spaces rather than 8 to make it think it is in line... but it's just a peeve seeing that red dotted line.
If I don't have the space it is fine, but that space causes it to think it's off. Don't know if anyone has experienced this... seems most use an IDE.
I do have one horrible habit... but I won't mention that to avoid being scorned. Someone will just have to deal with it... =/
 
5:28 PM
I need my Windows Task Scheduler to hit a php file and my original thought was to launch a browser then navigate to the url, but that's not very sophisticated. My second thought was to make like a .bat file and somehow hit the script like that, but maybe that's not good either. Any recommendations for something simple and easy?
Ignore what I said, I think the cmd route is my best shot.
 
@Waxi I was going to suggest Autoit. You could set an Autoit script to do everything you need and just have windows task scheduler run the executable Autoit file at a specific time.
I messed with Autoit at its infancy so it has been sometime since I've used it.
Does anyone else code in Python?
I know this is PHP room, just wondering.
 
5:45 PM
@Shafizadeh No, not images.
 
LOL- that was late.
I've been reading the book Advanced PHP Programming. It was released in 2004. As you can imagine there is a lot of code that is deprecated, but there is a lot of really good information in it. Would anyone recommend a more recent PHP programming book that covers more advanced topics?
 
my condolences
are you aware that PHP5.0 was released in 2006?
 
Yes.
Well actually it was 2004.
July 2004.
@tereško
 
Hmm, my youtube video from last year's PHPNW has (I think) both the most views, and the most upvotes and down votes.
I guarantee you the down votes were from butthurt Laravel developers.
 
6:00 PM
link?
 
Well you have an English accent so you already sound smart to me.
<-- Southeast
of US
@Jimbo What IDE environment do you use?
 
@BruceBanEm Ha, I wouldn't go off that at all. PHPStorm with Darkula theme, highly recommended
 
So much hate for laravel developer's Jimbo :p
 
I've yet to use a IDE for PHP. I've used Notepad++ with a lot of style configuration, settings, and plugins. Your IDE looked a lot like the custom color scheme I have.
 
6:18 PM
Sublime Text for life.
 
I know zero about PHPStorm- can you install and use your own fonts?
I love Anonymous Pro font for coding.
 
6:36 PM
It seems that SessionHandler::create_sid does not have a built-in error handling scheme, so I guess I throw an exception if necessary.
Or rather the code that calls it doesn't seem to have any expectations.
 
@BruceBanEm The main advantage of PHPStorm is that it's paid software so you can get things fixed and features added. Unless you're Levi Morrison
It looks like you can add your own fonts (I've not tried myself but it looks like there's a section for that)
 
Good to know.
 
If you don't want to pay for a license, Netbeans is free as well. It's closer to PHPStorm than Notepad++
 
I actually like Notepad++ ... but maybe cause I've not had the need for an IDE as of yet.
 
The major difference (and this is where PHPStorm is king) is in syntax correction. Notepad++ can only tell you when you make basic errors, like not marrying a bracket, etc. But a full IDE can tell you when you've done something more arcane, like forgetting an argument to a function
IDEs are your first line of defense against bad code
 
6:48 PM
ah... phpstorm is so great.
 
it really is
 
For the record I do like PhpStorm.
^_^
 
@LeviMorrison You're not alone in dismissed Jetbrains tickets either
 
I will have to give it a try. Does PHPStorm support its own version control or is that always something that is separately implemented?
 
@Machavity dem comments. hue hue hue
 
6:58 PM
You can do Git and SVN from within PHPStorm
 
Nice!
That's something I've been wanting to do very soon.
 
user895378
You can also do Git from the command line.
 
user895378
just putting that out there.
 
@DaveRandom pong
 
I'm wanting to keep my code private... without paying to keep in private.
 
6:59 PM
it's called bitbucket @Bruce
 
user895378
You can also host your own git repo.
 
i have configured web-server for first time.I installed php,mysql and apache and virtualmin on it.. and then i put codes of first website in /var/www/domain.com/public_html folder is that right?? and now i have to put code of other website too where do i put other code...
 
or use bitbucket
 

« first day (2029 days earlier)      last day (2916 days later) »