-
Posts
14,780 -
Joined
-
Last visited
-
Days Won
43
Everything posted by .josh
-
[SOLVED] Best way to force a line break in HTML
.josh replied to transparencia's topic in PHP Coding Help
wordwrap might work out for you. By default it inserts a \n at the length you specify, without breaking the word (will move the whole word to next line), but you can specify what it inserts and you can flag it to break at that length no matter what. Only problem I see with wordwrap is how long your string is. If you're only wanting to break it once, and it's a long string, it will keep adding the <br />'s every x length you specify. If that isn't going to work for you, you could always use substr to half the string at your length and concat them all together. -
ereg_replace remove text that begins with ___ and ends with ___
.josh replied to dallypost's topic in Regex Help
$string = preg_replace('~\[keywords\].*?\[/keywords\]~','',$string); -
He either banked on being lazy and hoped nobody would check, or else he simply didn't know it was listed there. I opted for the simpler explanation, and actually, it didn't even cross my mind he was being lazy or trying to lie or whatever. He sounded like he didn't remember voting in any polls. Since I don't think he's an idiot, I assumed he simply didn't know it was listed in the stats, and pointed it out to him. That's a perfectly acceptable way to take my post, and coincidentally, that was the reasoning and intention behind it. I did not say "You're a damn liar, your stats say otherwise," or "You lazy bum, it would have taken you 2s to check your stats." But if he (and you, apparently) wants to think I was trying to somehow call him lazy, then by all means, whatever gets you off. I'm not going to lose sleep over people taking what I say in a negative way. But if you think that's CV's way of being negative...you obviously have not seen my sword.
-
Reminds me of a phpfreak bot I was working on for a while. I got as far as it picking unsolved, non-stickied, non-moved, non-locked threads, scanning the OP for keywords and phrases and suggesting links to the manual based on what it found. It came out surprisingly accurate sometimes but the error of margin was way too high. Damn, I'm exposed... Was that intended to illustrate my laziness to not check my user stats? Cause if it was, good illustration. If you want to take it like that, then sure. Was not my intention, though. Maybe you didn't know it was listed in the stats.
-
according to your stats, you voted in 4 polls.
-
that's how it used to be...did the permissions somehow reset when we upgraded?
-
If you want a generic message if any of the conditions are not met, the code posted by others is right, and you need to go back and re-examine what it's doing. If you want it to spit out two different error messages, then you cannot combine those two conditions. You have to make separate if(...) statements.
-
I think there might possibly be some official limit but I'm pretty sure it is so massively large it's easier and just as accurate to say that limit is as big as your free hard drive space. As far as your jpg files not uploading...okay here's the thing, filetype for files are not always consistent from browser to browser. Browser could be sending it as 'image/pjpeg' or 'image/jpeg' or 'image/jpg' or some browsers will actually scan the file so for instance, if you rename an image to some other extension, the browser may scan it and say it's still that image type, instead of the extension you changed it to. That's why I suggested in one of your previous threads to use substr to check the actual extension, instead of relying on what is given as the filetype. And that's why printf also mentioned using the gd library to try and load it up to verify it is a valid image (btw, please stop making multiple threads that address the same issue. It looks like you have 3...)
-
Just depends on what delimiter you are using for the pattern. For instance, if I chose / as my pattern delimiter, I would have to escape any /'s in the pattern, like this: "/<span class="credits"><b>(.+?)<\/b>/s" so the regex engine knows that that / for the closing b tag isn't the end of the pattern.
-
yes.
-
p.s.- And even if you did in fact know with 100% positive certainty that the only reason why she wanted a function vs. your method is because she doesn't know any better, you're still foolish for overstepping her like that. It doesn't matter how right you are. At the end of the day, she's the one who passes or fails you. You aren't going to get very far in life if you don't learn to respect the boss. People rarely succeed in overruling the boss. Try to convince her in the first place. Try to reason. If that doesn't work, find another job or do what you're told, because that's what you are getting paid (or marked) for.
-
You are wrong, and you yourself stated why. You do what is asked of you. There could be 100 reasons why she wanted you to make a function. Maybe to learn about how functions work, maybe so that in a future lesson she can show how to make a class out of it, who knows? In the real world, clients invest money in what they think is right. If you really feel you could do something 'better,' then the appropriate thing would be to go to the teacher and ask ahead of time, instead of assuming you know what's best.
-
Your naming all of your buttons the same thing. So every one of your conditions are evaluating true. If you want to make them all the same name, then you need to execute your code based on value, not name.
-
we can't possibly tell you that without you posting example data and what you are wanting to be matched.
-
because you have whitetail doe in your db with two different huntid's and you are grouping by both itemid and huntid. If you take out the huntid in the group by it will list the total for just itemid (whitetail doe - 53)
-
There are plenty of people who learn how to code "properly," who started with php. coding properly is not a matter of what language you use, but of discipline. And we can argue all day long whether it's really bad practice to (not) do things like declare variables....but at the end of the day, the only thing I can conclusively say about not doing those things, is that you learn to program a certain way that is not the same way as those other languages, and so it may or may not be harder for you to learn those other languages. IMO I do not think it's fair to say this makes them a bad habit. That's like saying I shouldn't learn the grammar rules and spellings of english, because the grammar rules and spellings of spanish or french are different, and it will make it harder for me to learn them. It's simply a different language, made for a different environment. And I don't think it's necessarily fair to say start with one, then the other. A lot of programming concepts and practices are the same, but they are two different languages being used in two different environments. It really depends on what you want to be programming. If you are wanting to make the next awesome WoW game, then you really shouldn't start with languages meant for working on servers and web pages, like php. If you are wanting to design websites and work with databases and flatfiles and stuff, then it's really not necessary to take on the extra baggage of a full blown language like java or c/c++.
-
Can PHP query both Oracle remotly and MySql locally?
.josh replied to dayjob's topic in PHP Coding Help
If you have the proper access and the remote oracle db is setup to allow remote conditions, then yes, you can do that. -
no...if you are thinking of an object as just a fancy variable then I think you might be missing the point of oop...
-
I don't think anybody would disagree that java has a much higher learning curve. I mean after all, it is a full blown programming language, built to make any application you want. If it was easier to learn than php, then IMO, someone didn't do something right...
-
use the query premiso provided. It does all the totaling for you, so all you have to do is echo it out. You should always keep your data filtering on the query level, because your database is optimized to do that sort of thing.
-
Well if you insist on giving them another chance, I would echo "I'm going to be back in 3 days. When I walk through that door, I expect to receive one of the following: a) my repaired laptop b) a replacement laptop c) a refund";
-
how should I know? I don't have access to your database.
-
~<h2 id="cost">(.*?)</h2>~
-
java is a standalone program, to be compared with c/c++/vb/delphi/etc... comparing php to java isn't exactly a fair comparison. Having said that, I personally do not foresee php going anywhere but up.