|
awesmoe posted:Because 1.5 was only released near the end of 2004 and before that there was no replace all method, iirc Even if that's the case, this is part of a new application that was written last year. And we've been on 1.5 for as long as I can remember. We just started the 1.6 upgrade process a few months ago.
|
# ? Sep 4, 2009 21:35 |
|
|
# ? Apr 29, 2024 04:37 |
|
awesmoe posted:Because 1.5 was only released near the end of 2004 and before that there was no replace all method, iirc replaceAll was in 1.4. At least according to the javadoc.
|
# ? Sep 4, 2009 22:11 |
|
What are you talking about? I love finding code that badly re-implements standard library features and is copy/pasted in three different private methods in the same already-bloated class:code:
|
# ? Sep 5, 2009 00:14 |
|
TRex EaterofCars posted:replaceAll was in 1.4. At least according to the javadoc.
|
# ? Sep 5, 2009 02:39 |
|
Java's String#replaceAll(String, String) is regex based which means there's the overhead of generating internal Pattern object for the actual regex, creating a Matcher object from the said Pattern object and then calling Matcher#replaceAll(String) to get the output. If all you need is simple replacement ("change all 'a':s to 'b':s") which is going to get used a lot in your application then rolling out your own #replaceAll() will actually result in a lot faster throughput than the Java's native regex one. Same applies especially to Pattern#split(String) too. In reality, all the text above means that I've actually done the same thing myself and I need to justify my micro-optimizations to not fall into despair.
|
# ? Sep 5, 2009 08:57 |
|
Parantumaton posted:In reality, all the text above means that I've actually done the same thing myself and I need to justify my micro-optimizations to not fall into despair. Maybe you should try profiling your code next time, bub!
|
# ? Sep 5, 2009 08:58 |
|
Parantumaton posted:Java's String#replaceAll(String, String) is regex based which means there's the overhead of generating internal Pattern object for the actual regex, creating a Matcher object from the said Pattern object and then calling Matcher#replaceAll(String) to get the output. If all you need is simple replacement ("change all 'a':s to 'b':s") which is going to get used a lot in your application then rolling out your own #replaceAll() will actually result in a lot faster throughput than the Java's native regex one. Same applies especially to Pattern#split(String) too. This is all potentially well and good but just look at the code they're using - there's no way it's an optimisation.
|
# ? Sep 5, 2009 10:09 |
|
zootm posted:This is all potentially well and good but just look at the code they're using - there's no way it's an optimisation. Indeed, it messes around with Strings in the most non-performant ways possible. I'm guilty of similar code too so maybe I can't just go completely rampant on it right now. I do agree it's a horror though. ...actually now that I really look at it, it reminds me a lot of PHP's str_replace.
|
# ? Sep 5, 2009 11:59 |
|
10:33:11 < MononcQc> This has to come close to balls next to a cliff in terms of analogies: http://groups.google.com/group/comp.lang.scheme/msg/e7431893c4da4bbf?hl=en Hi, I understand continuations as taking a photo of what is happening, a special photo that you can use afterwards to go "to the past" where the photo was taking. Continuations are very good on daily work, because you can take a photo (capture the *current* continuation) while you're having beers at the bar with your friends. If your daily work is boring you can always get your photo from your pocket and go instantly back to the bar with beers and friends. Great!! Furthermore, when you take your photo (capture the *current* continuation) you pass a procedure to your camera (you *call* this procedure with the *current* continuation). The value returned by this procedure is then substituted in the very place you took your photo. So continuations are a way to "return values from the future too" (you *call* a procedure with the *current* photo). And this is fantastic!! Imagine, for instance, that you're having beers with your friends at the bar. You then capture the current, comfortable, beer&friends continuation (take your photo) and say "let's capture a continuation here, and let's call a procedure that seeks what the winning lottery number is". You then go to work, and you find in google what the winning lottery number is. You then pass this value (the value returned by the procedure) to the photo (the captured continuation). As a consequence you go immediately back to the bar... knowing what the winning lottery number is going to be!! Now, isn't this fantasic? You just can win the lottery while being at the bar with beers and friends!! You won't have to go back to work again if you don't want to!! In real life continuations don't exist (I wish they existed!), but while working with Scheme you can use continuations for doing some sort of things: - Take a photo before seeking for something in a list. Pass a procedure to the photo that seeks for something in the list. (Looping). - Iterate over all possible solutions to a problem. For each possible solution take a photo and pass it a procedure that sees if the solution is acceptable or not (backtracking). - Perform a task. In the middle of the task take a photo and pass it a procedure that does another task (multitasking). For examples of real-life usages of continuations you can take a look at [1], that contains "Design Patterns" explaining common situations for using continuations. Cheers, Antonio
|
# ? Sep 5, 2009 17:46 |
|
Parantumaton posted:Java's String#replaceAll(String, String) is regex based which means there's the overhead of generating internal Pattern object for the actual regex, creating a Matcher object from the said Pattern object and then calling Matcher#replaceAll(String) to get the output. If all you need is simple replacement ("change all 'a':s to 'b':s") which is going to get used a lot in your application then rolling out your own #replaceAll() will actually result in a lot faster throughput than the Java's native regex one. Same applies especially to Pattern#split(String) too. Apache Commons to the rescue. http://commons.apache.org/lang/api-...va.lang.String)
|
# ? Sep 5, 2009 17:50 |
|
Scaevolus posted:10:33:11 < MononcQc> This has to come close to balls next to a cliff in terms of analogies: http://groups.google.com/group/comp.lang.scheme/msg/e7431893c4da4bbf?hl=en Time works the same way.
|
# ? Sep 5, 2009 18:35 |
|
mr_jim posted:Time works the same way. So my stack is actually a cube?
|
# ? Sep 5, 2009 20:40 |
|
Edit: Ignore me, I'm an idiot
|
# ? Sep 5, 2009 20:46 |
|
1337JiveTurkey posted:So my stack is actually a cube? -1 x -1= +1 is WRONG, it is academic stupidity and is evil. The educated stupid should acknowledge the natural antipodes of +1 x +1 = +1 and -1 x -1 = -1 exist as plus and minus values of opposite creation - depicted by opposite sexes and opposite hemispheres.
|
# ? Sep 5, 2009 20:52 |
|
Otto Skorzeny posted:-1 x -1= +1 is WRONG, it is academic stupidity and is evil. The educated stupid should acknowledge the natural antipodes of +1 x +1 = +1 and -1 x -1 = -1 exist as plus and minus values of opposite creation - depicted by opposite sexes and opposite hemispheres. You have opposite brains to think opposite, but Big Brother icepick academic lobotomy has destroyed your mentality to think opposite of the evil singularity you are taught.
|
# ? Sep 5, 2009 21:36 |
|
mr_jim posted:You have opposite brains to think opposite, but Big Brother icepick academic lobotomy has destroyed your mentality to think opposite of the evil singularity you are taught.
|
# ? Sep 6, 2009 12:04 |
|
Zombywuf posted:This is the closest I've seen to managing to parody timecube. However it still falls short. Is it actually possible to parody it? Timecube is invariant under parody operations.
|
# ? Sep 6, 2009 14:03 |
|
Zombywuf posted:This is the closest I've seen to managing to parody timecube. However it still falls short. Is it actually possible to parody it? That's a copy/paste from timecube.com.
|
# ? Sep 6, 2009 17:15 |
|
mr_jim posted:That's a copy/paste from timecube.com.
|
# ? Sep 6, 2009 21:02 |
|
Granted, it's a pretty nice little framework, and yes, I'm using old (last official) code, but there's some weird stuff with Route-Me. Open-Source mapping Framework for iPhone. Before the 3.0DSK it was the only real option for maps. Specifically: their most recent documentation specifies 1 method for getting the bounds of the viewable area: code:
code:
Let's look at the method for setting the bounds of the viewable area: code:
This is all changed in their dailies, but there's no example code or documentation since the deprecated version.
|
# ? Sep 8, 2009 15:31 |
|
Even if this were actually necessary (avoiding 0 as a magic number I guess?) this still can't be the best way to do it. public static class DefaultValues { public static int GetIdDefaultMinValue() { return (0); } public static int GetLoginQAIdMinValue() { return (0); } public static int GetLoginQuestionIdMinValue() { return (0); } public static int GetOtherActivityIdMinValue() { return (0); } public static int GetAwardRecognitionIdMinValue() { return (0); } //etc etc etc for every object in the app } Reaten fucked around with this message at 20:09 on Sep 8, 2009 |
# ? Sep 8, 2009 19:59 |
|
The Doctrine ORM framework for PHP. That is all.
|
# ? Sep 9, 2009 03:59 |
|
PraxxisParadoX posted:PHP
|
# ? Sep 9, 2009 06:49 |
|
Any attempt to start the PHP derail should be bannable throughout CoC.
|
# ? Sep 9, 2009 06:58 |
|
pokeyman posted:Any attempt to start the PHP derail should be bannable throughout CoC.
|
# ? Sep 9, 2009 08:44 |
|
We already have a php coding horrors thread
|
# ? Sep 9, 2009 12:07 |
|
Reaten posted:Even if this were actually necessary (avoiding 0 as a magic number I guess?) this still can't be the best way to do it. I've worked with apps where specifying a starting seed (I guess this is what they are trying to do here?) was a requirement, but yeah, that's pretty much the worst way you could do it.
|
# ? Sep 9, 2009 14:34 |
|
I swear, not a PHP derail. I use it all the time.expertsexchange posted:I could not figure out how to get SSH to work from a key, instead I did find that I could do the following. Have a file with the root password in it that I hide in a bunch of subfolders and run the following command from php... http://www.experts-exchange.com/Security/Unix_Security/Q_20569275.html
|
# ? Sep 10, 2009 06:35 |
|
I've plain-texted a (non-root) password inside a master-to-all rsync script . I don't know if being on a completely cut-off DOD classified network makes that better or worse.
|
# ? Sep 10, 2009 13:15 |
|
i have seen following things at my jobcode:
|
# ? Sep 11, 2009 00:33 |
|
RussianManiac posted:i have seen following things at my job I think this is an entirely reasonable thing to do and not a coding horror at all. Commenting out large blocks of code is a bitch for a few reasons, including: - usually the commented out code will not be syntax highlighted in most (all?) editors, making it harder to tell what it does/did while reading the code without removing the comments - you can't just /* ... */ block comment poo poo out because the code might have some of that style comment inside it.
|
# ? Sep 11, 2009 00:42 |
|
Steve French posted:I think this is an entirely reasonable thing to do and not a coding horror at all. Oh ok, that makes sense. At the time it was exceedingly weird tho.
|
# ? Sep 11, 2009 01:21 |
|
Also unlike using multiple lines of //s that sort of ifdef will properly diff for source control.
|
# ? Sep 11, 2009 01:45 |
|
Steve French posted:- usually the commented out code will not be syntax highlighted in most (all?) editors, making it harder to tell what it does/did while reading the code without removing the comments This applies to #if 0 ... #endif also
|
# ? Sep 11, 2009 02:08 |
|
I have no problem with #if 0 ... #endif but it's nearing horror status when it gets checked in.
|
# ? Sep 11, 2009 05:01 |
|
ehnus posted:I have no problem with #if 0 ... #endif but it's nearing horror status when it gets checked in. Yeah, checking in commented out code is terrible. You're using source control for that reason, just take it out.
|
# ? Sep 11, 2009 05:14 |
|
Ryouga Inverse posted:Yeah, checking in commented out code is terrible. You're using source control for that reason, just take it out. Shavnir posted:Also unlike using multiple lines of //s that sort of ifdef will properly diff for source control. I'm inclined to agree with Ryouga, but there's apparently disagreement.
|
# ? Sep 11, 2009 14:06 |
|
Lurchington posted:I'm inclined to agree with Ryouga, but there's apparently disagreement. I don't make it a habit of checking in commented out code, but I've seen what blocks of //s do to the diffs.
|
# ? Sep 11, 2009 14:10 |
|
Ryouga Inverse posted:Yeah, checking in commented out code is terrible. You're using source control for that reason, just take it out.
|
# ? Sep 11, 2009 16:53 |
|
|
# ? Apr 29, 2024 04:37 |
|
necrobobsledder posted:If you're doing an Agile development model, you'll be checking in code so often you'll probably hit a point where you'll just check it in and fix it up in another commit happening in only a matter of hours while you work on it. I typically check in commented out code when I'm about done for the day or because I'm completely stuck / having a brainfart and could use a kickstart the next time I look at it, but it should be obvious to anyone looking at it why it's commented out. Everyone works differently and so long as it works, I don't see what's wrong. I tend to agree with you, but as the guy who does a lot of the team's source control stuff, a message to my team: please god just use block comment constructs, I don't care if it's /* or #if 0, just don't use // everywhere
|
# ? Sep 11, 2009 17:13 |