|
code:
code:
|
# ? Jun 23, 2011 03:26 |
|
|
# ? Apr 26, 2024 15:15 |
|
Ranma posted:
What in the deferred gently caress.
|
# ? Jun 23, 2011 05:43 |
|
code:
|
# ? Jun 23, 2011 09:14 |
|
Wheany posted:
It works correctly? What's the problem? You mean if it equals "0", right?
|
# ? Jun 23, 2011 10:37 |
|
shrughes posted:It works correctly? What's the problem? You mean if it equals "0", right? ob1.id = 0 ob2.id = "5" sortById(ob1, ob2) gives -1 sortById(ob2, ob1) gives -1 So ob1 is both lesser AND greater than ob2? Also: ob3.id = 0 sortById(ob1, ob3) gives -1 sortById(ob3, ob1) gives -1 Shouldn't they be equal?
|
# ? Jun 23, 2011 12:56 |
|
Holy poo poo I feel like I should post daily digests goddamn. Ternary operations are a sign of skill and you should use long chains of them whenever possible to avoid unsightly if - else if chains. But this is even better: this.val?htmlCode+=' : ':{}; : is a colon, btw.
|
# ? Jun 23, 2011 13:22 |
|
Is it not a String at that point? Otherwise, why the call to parseInt()? Edit: Oh wait, it's JavaScript, not Java. Still shouldn't be a problem if the id is from a DOM element. I think, anyway. zergstain fucked around with this message at 13:34 on Jun 23, 2011 |
# ? Jun 23, 2011 13:22 |
|
Aleksei Vasiliev posted:Strings are immutable and persist in memory for an undefined amount of time, using char arrays and zeroing them after use is proper http://msdn.microsoft.com/en-us/library/system.security.securestring.aspx
|
# ? Jun 23, 2011 15:21 |
|
gold brick posted:For what it's worth, .NET has a facility for just this purpose. That's actually ... remarkably sensible of them. I wonder how often it's been badly reinvented.
|
# ? Jun 24, 2011 02:01 |
|
The only way to read a SecureString is to copy it to unmanaged memory, so hold your praise.
|
# ? Jun 24, 2011 02:15 |
|
Check out the comments if you want to see the point of that class practically in orbit over some people's heads.
|
# ? Jun 24, 2011 02:56 |
|
This is my first time reading about DPAPI after looking at SecureString.Microsoft posted:Figure 4, later, shows how all the different keys operate together to allow DPAPI to provide data protection. I think I'll go back to loving around with 3d graphics in XNA.
|
# ? Jun 24, 2011 04:17 |
|
suction posted:has this been posted? Found it on Reddit from 4chan Showed this to a co-worker of mine. He decided to turn it in to merge sleep sort: code:
|
# ? Jun 24, 2011 22:54 |
|
CoasterMaster posted:And here's a fun question: is sleepsort stable? It's not even guaranteed to be correct, so, no. It's still awesome as gently caress though
|
# ? Jun 24, 2011 23:18 |
|
gold brick posted:For what it's worth, .NET has a facility for just this purpose.
|
# ? Jun 24, 2011 23:58 |
|
CoasterMaster posted:And here's a fun question: is sleepsort stable?
|
# ? Jun 25, 2011 00:18 |
|
Considering that sleepsort is just insertion sort with a whole lot of system call overhead chucked in...
|
# ? Jun 25, 2011 03:54 |
|
Nope. It's not even very hard to get it to give bogus results: plorkyeran@valdr:~$ ./sleepsort.bash 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 0 1 11 0 1 0 1 1 0 0 1 1 10 1 0 1 0 0 00 1 1 0 0 0 0 0 0 0 0 0 0 0 0 1100101010101010101010101010110010101010101010101010
|
# ? Jun 25, 2011 04:58 |
|
Day 2 of 3 of iOS boot camp. My first 2 days with objective-C. I can get past lots of the weird assed syntax. But why the gently caress do you #define boolean true and false as YES and NO?
|
# ? Jun 25, 2011 20:57 |
|
Wrong thread? It's to make things more natural language readable. if ([obj isFinished] == YES), and so forth
|
# ? Jun 25, 2011 22:17 |
|
NotShadowStar posted:Wrong thread? Honestly, if I saw this, I would think it's weird. Usually, this is all people do: if ([obj isFinished]) { ... It reads more naturally that way. Where YES/NO reads well is stuff like: [obj doSomethingWithFile:filePath atomically:YES];
|
# ? Jun 26, 2011 00:39 |
|
Wrong thread? Didn't think so and I didn't think it was appropriate making GBS threads up the Apple Dev megathread. Yes, the reading angle makes sense, but just about every other language I can think of defines boolean "true" using the keyword TRUE and boolean "false" using the keyword FALSE. Kind of like all the other little apple differences. I should say it is a pretty slick language and environment once you get past the funkiness.
|
# ? Jun 26, 2011 01:13 |
|
wwb posted:just about every other language I can think of defines boolean "true" using the keyword TRUE and boolean "false" using the keyword FALSE. I actually quite like how YAML defines true, yes, and on all as boolean true. code:
|
# ? Jun 26, 2011 08:21 |
|
It's old ugliness. Objective-C is a C language extension, and C didn't get a native boolean type until C99.
|
# ? Jun 26, 2011 20:12 |
|
Anyway it isn't like you're going to forget which is which. I hope.
|
# ? Jun 26, 2011 22:25 |
|
Yeah so I had a desperate need to change/renumber a bunch of html tags. It needed to be quick and dirty but it was complicated so I decided to use awk. This was mistake #1. Have fun.code:
EDIT: more line breaks to fix the tables lazer_chicken fucked around with this message at 20:16 on Jun 28, 2011 |
# ? Jun 28, 2011 20:01 |
|
Ryouga Inverse posted:Anyway it isn't like you're going to forget which is which. I hope.
|
# ? Jun 29, 2011 03:24 |
|
lazer_chicken posted:Yeah so I had a desperate need to change/renumber a bunch of html tags. It needed to be quick and dirty but it was complicated so I decided to use awk. This was mistake #1. Have fun. awk owns
|
# ? Jul 3, 2011 23:07 |
|
I'd much rather use perl -pe (or -ne) than awk. More like awkward
|
# ? Jul 4, 2011 00:40 |
|
sh (or rc) + awk = all a real man needs.
|
# ? Jul 4, 2011 01:07 |
|
Awk basically would have disappeared years ago if cut was able to handle multi-character delimiters
|
# ? Jul 4, 2011 15:49 |
|
Cut is great if you only want to cut out fields, but I usually want to output things in more interesting ways.
|
# ? Jul 4, 2011 16:51 |
|
Misogynist posted:Awk basically would have disappeared years ago if cut was able to handle multi-character delimiters And field reordering + duplication - I want to do "cut -d, -f 4,2,3,3", drat it.
|
# ? Jul 4, 2011 17:06 |
|
is it wrong to want a version of awk that handles xpath
|
# ? Jul 4, 2011 17:39 |
|
Mustach posted:Cut is great if you only want to cut out fields, but I usually want to output things in more interesting ways.
|
# ? Jul 4, 2011 18:09 |
|
Saw this in a diff during merge: before: code:
code:
|
# ? Jul 4, 2011 20:30 |
|
Regarding all the talk about HTML parsing, just thought I'd mention this for those that don't already know about it: http://www.crummy.com/software/BeautifulSoup/ Beautiful soup is a Python library for handling HTML parsing/modification. It DOES handle imperfect markup and all that...
|
# ? Jul 4, 2011 20:38 |
|
although I'd totally recommend Beautiful Soup over something like regex parsing, I think 'best practices' for this kind of thing is lxml.html
|
# ? Jul 4, 2011 21:13 |
|
php:<? $fn = $w['type'] . '_form'; if ($w['is_container']) { $ao .= $fn($w, '', $clonedFrom, 'edit'); } else { if($w['type']=='image'){ $ao .= $fn($w, '', $clonedFrom, 'edit'); }else{ $ao .= $fn($w, '', $clonedFrom, 'edit'); } } ?>
|
# ? Jul 4, 2011 21:51 |
|
|
# ? Apr 26, 2024 15:15 |
|
FeloniousDrunk posted:
indeed. e: wait those are two different smilies. Herp. Anyway, here's one from the files: code:
Thel fucked around with this message at 23:51 on Jul 4, 2011 |
# ? Jul 4, 2011 23:44 |