@TimeBandit yeah, I did in fact remove them first thing, I was getting white screens with no clue why. Quickly set error_reporting
to E_ERROR | E_WARNING
though. Choose your battles and such...
Posts made by toon
-
RE: Someone wants to help me build a site!
-
RE: Someone wants to help me build a site!
@bb36e I found 25 instances, excluding legitimate uses such as doc comments and stuff. I also decided to exclude Smarty, because I happen to know that those guys use the @ operator deliberately as a way of writing code that's dirty, but optimized for speed. For instance, if in benchmarking, they find that checking if a file exists and then getting the mtime, is slower than just getting the mtime with an
@
, then they'll go for the@
. -
Someone wants to help me build a site!
So in my spare time, I've had a project thrust upon me that needs a site built. As a PHP guy, I figured, sure. I'll help. So they gave me FTP credentials to have a look. Of course, this "framework" is some of the shittiest code I've ever seen. Those of you who have had the displeasure of having to work with legacy PHP code will appreciate the following:
$ grep -r 'error_reporting(0)' | wc -l 26
Can someone please brexit my life for me right now? I'm not even being paid for this. :(
-
RE: More stupid Git errors THIS TIME IN FIRST-PERSON!
No problem. I think there's some miscommunication here, as you mentioned a pre-commit hook, which I took to mean that this hook would execute locally. I think that the hook that both of us have in mind, is called post-receive in Git.
-
RE: More stupid Git errors THIS TIME IN FIRST-PERSON!
I don't see why it's anyone's business what I do in my own local repo. Stuff like that goes in the remote in a receive hook, not in a local pre-commit hook. I want to be able to make shitty test branches or be able to make lots of commits that I may throw away or combine and/or split with
rebase -i
.I'll push things that are ready to be pushed and I think it makes perfect sense that I am not allowed to push whatever I want. But until then I want to be able to do my job without getting nagged by management's mandatory micromanagement tools. I don't want to have someone write a program that keeps checking if I'm making a mistake, before I've made it in any real sense.
-
RE: All work and no play makes Jack a dull boy.
Man, I hope the OP doesn't complain about your unfunny OT comment.
Dammit, @blakeyrat! Why, I oughta...
-
All work and no play makes Jack a dull boy.
Trying to install Bugzilla on a server that only runs the 9 year old Perl version of 5.8.8, which is a whole WTF in and of itself. Anyway, when installing the required modules this happens:
Can't stat `../apache_x.x/src' Please tell me where I can find your apache src [../apache_x.x/src] ../apache_x.x/src Can't stat `../apache_x.x/src' Please tell me where I can find your apache src [../apache_x.x/src] ../apache_x.x/src Can't stat `../apache_x.x/src' Please tell me where I can find your apache src [../apache_x.x/src] ../apache_x.x/src Can't stat `../apache_x.x/src' Please tell me where I can find your apache src [../apache_x.x/src] ../apache_x.x/src Can't stat `../apache_x.x/src' Please tell me where I can find your apache src [../apache_x.x/src] ../apache_x.x/src Can't stat `../apache_x.x/src' Please tell me where I can find your apache src [../apache_x.x/src] ../apache_x.x/src Can't stat `../apache_x.x/src' Please tell me where I can find your apache src [../apache_x.x/src] ../apache_x.x/src Can't stat `../apache_x.x/src' Please tell me where I can find your apache src [../apache_x.x/src] ../apache_x.x/src Can't stat `../apache_x.x/src' Please tell me where I can find your apache src [../apache_x.x/src] ../apache_x.x/src Can't stat `../apache_x.x/src' Please tell me where I can find your apache src [../apache_x.x/src] ../apache_x.x/src Can't stat `../apache_x.x/src' Please tell me where I can find your apache src [../apache_x.x/src] ../apache_x.x/src Can't stat `../apache_x.x/src'
Etcetera etcetera. Good thing I was paying attention so I could hit Ctrl-C, after which the installation went on its merry way.
I hate you, Bugzilla. I hate you, Perl.
-
RE: From my friend who works in IT at a school, here are some screenshots of PDFs:
There is technically definitely such a thing as captcha breaking software. What you do is, you are a shady person with a bunch of shady websites that a bunch of people comment on, and you write bots that write comments on captcha protected websites. And you then proceed to simply serve the captchas your bots encounter to the humans on your own sites as if they are your own captchas.
-
RE: Male ♡s Female Greco-Roman wrestling
Me neither.
This is a fine joke for poking fun at stereotypes. If you want to go into the reality, then it breaks down. It's all well and good for @Buddy to be all PC about gender, but they should probably either lighten up or make decent arguments, I guess that's my point.
-
RE: Male ♡s Female Greco-Roman wrestling
Agreed. 96-99% probably fit one gender fine.
-
RE: Male ♡s Female Greco-Roman wrestling
Someone who wants to make a joke about men vs. women.
Also, the gender binary? People engaged in a discussion about gender, where the obvious hidden premisr is that male and female are the only two options, are a pet peeve of mine. In actual fact, there is no such binary and there is a large grey area between, and beside, the two. I personally am a male and I feel like one and am comfortable being one, but many people don't share my feelings about their own respective genders.
Some people are born both male and female, some neither, some feel they are the wrong flavor. And here you are saying everybody is fundamentally the same? Not afaic.
-
RE: Male ♡s Female Greco-Roman wrestling
I don't know about you, but I can think of one great and glorious, quite fundamental difference between men and women right off the top of my head.
-
RE: Male ♡s Female Greco-Roman wrestling
I'm a guitar player in my spare time. I'll bet this would work great as a comedy duet.
-
RE: Poll: how often do programs have collections sorted/hashed by pointer/reference value?
Also sometimes you know an order by is going to incur you with a significant performance hit and you don't care about the order. Having order by be mandatory is going to look real annoying in those cases. That admittedly doesn't happen often but I've been in a few situations like that.
-
RE: Getting badges twice
It may not be the badge that pops up twice, but the notification.
-
RE: Getting badges twice
What if 512 posts were made, then one got deleted, then another was made?
-
RE: Phew! I cancelled the 'sudo rm -rfv --no-preserve-root /' just in time!
Neat, didn't know about that. I knew about PAM and SELinux, but AFAIK root can just flip those off and do his/her thing regardless.
-
RE: Phew! I cancelled the 'sudo rm -rfv --no-preserve-root /' just in time!
The read only thing stopped protecting your files from you when you used sudo. That gave you root permission and in Linux, root can do everything.
-
RE: IBM's JSONx, or how to represent JSON in XML
Or use your favorite browsers's dev tools.
-
RE: I have been doing this too long, I swear
I work with legacy PHP code a lot and sometimes I'll spend some time tracking down unused functions and stuff, and big blocks of commented code, and just yank them out. I always figure, they can only serve to confuse people and if someone is very emotionally attached to them they can just go into the Git repo to get them out again.
-
RE: Bookkeeping code redux: light at the end of the tunnel
That's just the thing. The stories can't actually directly be edited except by our client. The point of making the deep copies was that all the licensees could see that the story is available to them, as a template to build upon. So none of the users ever actually think of these copies as copies. To them, it looks like a single story. Details are in my original post.
The storytellers (sorry for the shitty metaphor btw) take these templates and make a separate deep copy that they then edit, or leave as is, or whatever. This is fine and intentional.
-
Bookkeeping code redux: light at the end of the tunnel
A few months ago, I posted this topic: Bookkeeping code or: how I learned to stop worrying and love data duplication.
TL;DR of previous topic: we have an application that among other things, manages "stories" (actually they're not stories, don't want to give away too much), which can have many chapters, which can have many paragraphs. These stories can be linked to clients and their licensees. An ex-coworker thought it would be a good idea to interpret "licenses share stories", as "each license gets a deep copy of the story", resulting in lots of bookkeeping code and thousands of database queries.
I'd already pulled a few tricks out of my top hat and this alleviated the problem, but still, when the client would try to change a chapter title, it would take five minutes. This was basically my fault: I'd written a method that would take one story, delete all the data in the copies, and then repopulate the copied stories. It would get called each time a story got saved. This is the only way I knew how to be sure that the whole bookkeeping code thing didn't cause any bugs. This problem would, of course, only get worse with time unless something was done, and I was just about out of tricks. So I talked to my boss about it, and although he knew a bit about what was causing these screens to be so unresponsive, it turned out that he didn't really realize how bad the problem actually was. So I decided to clue him in, and flat-out recommend that I just yank out the whole godawful mess. And he agreed.
So last week I spent about a day and a half rewriting this stuff. Now we have an extra database table, and also we have 80,000-100,000 fewer records overall, that no longer need all that bookkeeping code to manage them. Many, many known and unknown bugs got squashed. Screens went from thousands of database queries, to like two or three. Git tells me I took 1,151 LOC out and wrote 333 new ones, not including any whitespace changes.
I'll be deploying tomorrow. I did a good thing last week.
-
RE: An instance of PHP being actually WTF
Believe me, I know. Our hosting provider is thankfully scrapping all their php 4 boxes so my boss no longer has any excuse to hang onto that. Soon, no more four. SOON.
-
RE: An instance of PHP being actually WTF
Wow. I'll have to try that one out sometime.
I had a cool one in a PHP 4 project the other day. It only happened in production and only for me, because it only happened when a certain variable equaled true, and this variable is used to provide us with debugging information.
When I would write
include("somefile.php");
that would take 30 seconds but without the parentheses it would be as fast as I'd expect. And the difference, I'm absolutely sure about this, is in the step where PHP includes the file. It's in the execution of the include statement itself. Still no clue why this happens or how to replicate the problem. -
RE: Vending machine wtf
I think they sort of refuse to import the scanned image or something. Like you can scan it but Photoshop just says no, it doesn't allow the picture "into" the program.
-
RE: Vending machine wtf
I know that there is a thing where photoshop refuses to let you scan euros. I know because I remember reading an article where Adobe confirmed it to the journalist but said they couldn't really say more than that. I could be mistaken about the currency so it might be dollars instead of euros.
-
RE: Vending machine wtf
Apparently, here in the Netherlands, there used to be a vulnerability in the ATMs that allowed you to get free cash. This was before my time so it would have been in the seventies or before that. The way it worked was you asked for 300 guilders (the Dutch currency before the euro), which was the maximum you could get and you'd get three 100 guilder bills. You'd take out the middle one, and leave the other two: the machine would assume you had not taken any cash and bam, free money. A guilder was worth about half a United States dollar. I'm told that students caught on and exploited the flaw and they fixed the ATMs after that.
Of course this may well be an urban legend.
-
RE: Git troubleshooting flowchart
Things are as they are only because people like you want them to remain as they are. Personally, I don't think anybody-- anybody on Earth-- should be excluded from participation in software development.
Well, that makes one of us. I, for one, heartily dislike people who write viruses, malware and anything related to it. I wish they didn't and hope they find some other hobby they could do, that would bother fewer people.
@toon said:
So every book ever written should use one syllable words and pretty pictures of cheerful anthropomorphic animals, because some other books do and those are easier to read!
If I want to read a book like that, they exist. I can go to the bookstore and find thousands of them.
Yes, and precisely none of them will be about software development, because the authors of books about software development expect their audience to be able to read words of more than one syllable.
-
RE: Git troubleshooting flowchart
1) It communicates to the end-user that they just didn't give a shit about them. It disrespects them and their time right off the bat. If the end-user has a disability that makes use of a CLI difficult, it excludes them entirely for no good reason.
A disability like that would also make programming difficult. Seems like a pretty good reason to me?
@toon said:
DBMS'es, web servers, debuggers, IDE's, text editors, even web browsers, it's all the same in that respect, they all come with manuals, and I don't see why VCS should be any exception.
So RCS/VCS should be shitty because everything else is shitty. Brilliant argument.So every book ever written should use one syllable words and pretty pictures of cheerful anthropomorphic animals, because some other books do and those are easier to read! Brilliant argument.
-
RE: Git troubleshooting flowchart
Sorry @boomzilla, I don't get it... You're trying to tell me something, but I honestly have no idea what it is.
-
RE: Git troubleshooting flowchart
I find it interesting that you say both "Git may take a while to get used to" and "it's a breeze to use". That's like saying a complicated piece of construction equipment is easy to use because the guy with years of experience is having no problems.
Good analogy, but you're taking my words out of context so it looks like I'm contradicting myself. What I actually said was:
[quote=toon, post:133, topic:3005]Git may take a while to get used to, but if you learn a few commands and get used to a couple of GUI's then it's a breeze to use.[/quote]
That's not a contradiction from where I'm standing.
Take a forklift: I used to drive one for a living. Forklifts definitely take a while to get used to. They handle differently from most other kinds of vehicle you might drive, such as cars or trucks. You need to know a fair bit about the forklift in question to be able to maintain one. There are even things you need to be aware of, to be able to drive one without seriously risking property damage or human injury. So yeah, I'd say you shouldn't be driving a forklift around other people unless you know what you're doing, and that takes a definite amount of effort.
But would I argue that forklifts are not easy to use? No, I wouldn't. In fact, I'd say at least 95% of all adults under 65 could do it if they were so inclined. Of course, I'd also argue that pallet jacks are much easier to use than a forklift. Basically anyone who can walk upright can use those. But if I need to move a tank of water over dozens of yards of pavement through the rain to the next warehouse, why I can do it with both, but I know which tool I'd consider better suited for the job, and it's not the more easily usable one.
Look, this is a forum where people go, "this person should have his keyboard license revoked". Developing software is a craft, there are ways to do it properly and improperly, and some of the best tools you can have in any craft, take time to get used to, and then all of that time pays itself back tenfold. DBMS'es, web servers, debuggers, IDE's, text editors, even web browsers, it's all the same in that respect, they all come with manuals, and I don't see why VCS should be any exception.
-
RE: Git troubleshooting flowchart
Maybe you missed the discussion you had about branching in SVN but it seems a lot more@Jaime said:
Which exactly matches the "branch per developer" workflow of every centralized version control system out there. I have nothing against git, I just don't like it when people say that git is inherently significantly better than everything else. The whole "the file is identified by its content hash" thing is pretty useful and is a plus for git, but that's balanced out by git being far less usable than almost everything else.
Admittedly having never used SVN, I don't know that I believe you when you call Git "far less usable". Looking at the discussion you and @Yamikuronue just had about branching/merging in SVN, it looks a lot more complicated than in Git. I'd call Git's branching/merging stuff another definite plus. Git may take a while to get used to, but if you learn a few commands and get used to a couple of GUI's then it's a breeze to use.
-
RE: Git troubleshooting flowchart
... you can apply permission and make sure contractors are actually doing their working and committing their incremental changes somewhere safe instead of the local repo on their C drive.
Situation my company encountered: they employed a developer who was very sloppy, in that he would push code to production without checking it, and not use VSS properly. As I've mentioned in another comment, we're switching to Git at the moment. One reason against switching from VSS, is the "bliss" of file locking and check-in, check-out mentality of having everything at a central hub so at least the boss knows what the guy is doing!
My argument against this was, well, Git won't be much different because the guy will just go from not checking in or checking out, to not committing and pushing, which of course is exactly what happened. They still had production sites that didn't match source control, they were still mile high in regressions and spaghetti code, and they discover that honestly, with VSS it was just the same except at least they could see which files he had checked out, but they discovered that unfortunately they had no magic mirror that looked into his workstation.
You see, he'd just do what I do when I need to work with VSS: flip the read-only bit, do some work, then do a project diff, and check in/out the changes you need to commit all at once. Except he'd skip the checking in/out part.
But in the end they solved the problem!
So what was the solution? What source control software trick saved the day? What productivity management tool did the trick? They canned the guy, that's what.
If your contractors can't be fucked to work with you, hire someone else and state in their contract that they are obligated to manage your code responsibly. This sort of thing should not be enforced by software, but by people.
-
RE: Git troubleshooting flowchart
TFS works like this too. I see no problem with the paradigm of "Whoa, you better verify your changes before committing them, someone else messed with these files". Otherwise, you get a blind merge and no one verifies that the merged code actually works.
You, as a developer, should be responsible for checking that the code actually works. If nobody's checking that, you who committed the code at the very least are at fault.
In Git, the philosophy is that you can do whatever you want, and then decide what to share by deciding which commits to push to the outside world. So you work, you commit but check your fucking work while you commit, and then if necessary, you merge stuff other people did and proceed to check your fucking merge before you push. In Git, a merge is just a commit with more than one parent, so if you push a merge, you should be responsible.
-
RE: Git troubleshooting flowchart
It might have something to do with VSS being deprecated like A FUCKING DECADE AGO, why the holy shit in hell do people keep bringing up VSS in source control treads as if it were relevant at all? Christ.
Although I wholeheartedly agree with you, the company I work at used VSS until they started having applicants go "fuck this noise" and apply somewhere else. This was a year ago. Faced with the fact that it's probably time to switch somewhere else, they decided to go for Git. Our company is loosely structured into a .NET department and a PHP department, I'm part of the latter. We've been using Git, the .NET guys are still on VSS.
I know it's just an anecdote, but I do feel I need to pipe up here and say that there are jackasses out there who think VSS is awesome and don't want to use anything else, and some of those jackasses are lead developers at companies that employ a dozen people.
-
RE: When even PHP programmers call each other lazy
Also the longer I program the more I learn about what frameworks really do and about the problems they solve, and that just makes me realize I can't build a framework at all as well as existing frameworks.
Do you see the irony there?
-
RE: When even PHP programmers call each other lazy
Personally I think you should have to go through a competence test to use frameworks: if you can build something like it yourself, then you get to play with the grown up toys. If you can't, you have no business playing with one.
Yeah, well I don't know about you, or anyone else who uses PHP on here, but I've seen my share of people trying to build "something like it" themselves, and my experience is that people build POS systems when they decide they want to build a framework.
I only learned how it's done by experience and by being exposed to proper frameworks, and I don't see why exposing people to decent software development at an early stage is a bad thing.
Are you suggesting people need to be the next Taylor Otwell to aspire to use Laravel? Because that, being an experienced PHP developer, makes no sense to me whatsoever.
-
RE: How not to PHP
Ah fuck, thanks. I knew I was doing something wrong, didn't know what at the time.
-
RE: How not to PHP
Y'know, that's one of the things that gets me wondering: PHP has been around for ages and yet it doesn't seem like anyone has developed much in the way of best practices, patterns and things never-to-do-under-any-circumstances.
You are quite mistaken. 5-10 years ago that was true, but not anymore. The thing is, this standardization is coming from the developer community, not the PHP team itself. There is a number of excellent frameworks out there (e.g. Laravel), and the different framework development teams have banded together to see what can be done standards wise, and have already come up with a few good recommendations, known as PSRs.
Also, there is this. This last one in particular is a great way to see what can be done with PHP these days, and what problems have been solved. It gets thrown at newbies all the time, or at people who have been away from PHP and are looking to see what they've been missing out on.
Don't get me wrong, there's still a lot of cruft out there in terms of shitty code and shitty PHP programmers, but there is also a big, and growing, number of really good developers out there who write solid code riddled with best practices. In PHP, you can do OOP and TDD, there are great build systems and things like Vagrant support PHP out-of-the-box.
I mean, PHP is primarily used for web development and most of the time you're likely to be dealing with a relatively small number of standard problems (DB access, accepting input, display) that really should have been adequately solved by now. However, it seems to me that sensible solutions are drowning in a sea of downright insane ones - including (especially?) mature and well-known software. Why is this?
I don't know that that's true. If you pick a decent framework, all of those things will have good solutions that are present in the framework, and more, such as session encryption, CSRF prevention, caching, and templating. Folks who know what they're doing use them.
And let's not forget that it's entirely possible to write really, really crappy code in any language, with any framework. I understand why PHP is often singled out, but it's not like writing an application riddled with spaghetti code that's full or SQL injection vulnerabilities is mathematically impossible in C#/.NET.
-
RE: Hey, you know the difference between the old forums and these?
What a musician. I don't know much of his work, but what I do know tends to send shivers down my spine. I can see why Blakey's a fan (assuming he is; are you, @blakeyrat?).
-
RE: Hey, you know the difference between the old forums and these?
If blakeyrat wants to say he's a rat instead of a person, I'd argue that's his problem, not mine.
I'll just leave this here.
-
RE: They'll NEVER hack this!
Arantor is correct, the value gets stored in a session variable. Every visitor gets a session token that gets set in a cookie, so PHP knows which requests belong together. All of this is standard behavior for PHP.
-
RE: They'll NEVER hack this!
They are not getting warnings per se. It's just that the input for the md5 call is generated using one of the functions PHP's manual warns not to use in a security context.
-
They'll NEVER hack this!
<script>document.write('<i' + 'nput ty' + 'pe="hi' + 'dde' + 'n" n' + 'ame=' + '"' + 'code"' + ' i' + 'd=' + '"sec' + 'urity_co' + 'de" va' + 'lue="c5aa7edfb4f10c169f279ecfebb55a22" />')</script>
Background: this is a CSRF token: the MD5 output in the field changes upon page refresh.
For a bonus WTF, the source for the MD5 is not extremely easy to guess, but not actually very hard either. In fact, the PHP manual specifically warns not to use the functions used for generating the MD5 for security purposes.
-
RE: The "That Moment" Topic
The hidden premise here seems to be that you need to be good at Windows to be a good developer, or so I thought at first.
Thinking about it more made me realize that what you guys all seem to be agreeing on is not that the dude is a bad developer for not knowing how to change the extension, but for not being able to find out, and coping with that by writing a shitty hack instead.
If there's anything I've learned in my short career, it's that what makes a good developer is being able to solve problems you've never seen before, because of a thoroughly developery mindset.
-
RE: Representative lines from a view file
Buttons are supremely annoying in that they behave differently from links css-wise, and that when in IE you press enter, it automatically clicks the first button it sees in certain circumstances. An a element is often much more convenient than a button.
Also they look different on different platforms.
-
Representative lines from a view file
<button class="button" id="buttonOK" type="submit">OK</button>
<script type="text/javascript">
document.getElementById("buttonOK").style.display = "none";
</script>