6 ms·
Developer only event at SXSW (code puzzle gets harder with more tweets)
- zdw 16y agoNot going to SXSW, but... tr ',' '\n' | sort -n | uniq -d
- RodgerTheGreat 16y agoIt's also pretty easy to do in Excel, favored tool of "marketing gurus". Find/replace, import, pivot.
- josegonzalez 16y agoI actually found a solution for it in excel before writing the following: asort($data); $duplicate = function ($val) use (&$data) { $count = 0; foreach ($data as $i => $entry) if ($val == $entry) $count++; return $count; }; foreach ($data as $v) if (($count = $duplicate($v)) > 1) { printf("%d, Count %d\n", $v, $count); break; } I assume it would be possible to use a sort+callback to return the value as well.
- jeresig 16y agosort + callback is what I did in JavaScript: .sort(function(a,b){if(a==b){throw a;}return a-b;});
- josegonzalez 16y agoDid you eval the dom to get the dataset?
- false 16y agoI did :) JSON.parse(p.innerHTML.split('\n')[2])
- zdw 16y agoThe point was posting a hack. "most" people don't know unix shell. I'd consider your mention of Excel to be a hack, as I honestly don't have a clue with it beyond the basics.
- deleted 16y ago[deleted]
- y0ghur7_xxx 16y agox = File.read('puzle.txt') y = x.split(/ \w /) module Enumerable def dups inject({}) {|h,v| h[v]=h[v].to_i+1; h}.reject{|k,v| v==1}.keys end end d = y.dups require 'mathn' dp = [] d.each {|z| z = z.to_i; dp << z if z.prime?} dp
- Klonoar 16y agoSo just to summarize: Elite 'hacker' group claims to hate marketing guru/bullshit tactics, then proceeds to ply the hell out of everyone to spread their concept in a viral Twitter hashtag manner. Granted, I totally just did it because that puzzle was way too easy, but c'mon now.
- ejames 16y agoIn that sense, at least, the event is being held by people who understand the hack mindset. I noticed that the puzzle was very easy, and that the "elite hackers" are in fact a recruitment agency, and therefore that the main purpose of the event is probably for a recruitment agency to put their recruiters in the middle of a bunch of hackers while eliminating competing recruiters who have the same goal. ... but I still did the puzzle. [edit] And everyone else is doing it too, and posting their solutions here! "Blazing guitarpocalypse"[1] indeed. I might attend the event, but that's mostly because I'm in Austin and feeling curious, and not because the website convinces me the event will have a high quality. [1]http://www.codinghorror.com/blog/2007/02/fizzbuzz-the-programmers-stairway-to-heaven.html http://www.codinghorror.com/blog/2007/02/fizzbuzz-the-progra...
- cstuder 16y agoI wonder if having to manually launch the puzzles show() method is part of the puzzle itself or just a bug. (Checked with Chrome 9 and Firefox 3).
- qqqq2010 16y agoMaybe inspecting source is their first bar to get over? Pretty low if so...
- div 16y agoI wondered the same thing. Maybe os specific ? OSX + chrome 9 here.
- goldins 16y agoLooks like pressing ESC invokes the puzzle.
- jjcm 16y agoIt has a keypress event tied to it, but it didn't trigger for me. I had to manually invoke $('the_puzzle').show().
- acgourley 16y agoI'm also throwing a hacker only event. It's called stay home and get shit done.
- wmf 16y agoWe already have that the other 51 weeks of the year; sometimes we like a little variety.
- zdw 16y agoCan I come?
- emilis_info 16y agoTwo years ago such a comment would have -2 votes and would be hidden just because of its tone. Sorry for the meta, but I am missing the old HN. I doubt we would be able to have the whole front page dedicated just to Erlang news if the need appeared. It seems that the problem of maintaining quality of discussion in an open forum remains unsolved. Maybe limits to entry (like the problem in the link) or ability to provide negative feedback to posters would help.
- bostonpete 16y agoHow would a comment pining for the days of yore have fared two years ago?
- emilis_info 16y agoEven worse.
- acgourley 16y agoI'm not sure if you're right or not, but if you are right it's very interesting because I've been here since almost day 1 and it's not as if my old comments routinely got down-voted. So if what you're saying is true, not only has the hivemind's up-vote heuristic changed - I've changed my posting habits.
- 16y ago
- whalesalad 16y agoSolved the puzzle with a couple lines of Python ;) Unfortunately, I won't be attending SXSW this year. Boo. If someone can solve that puzzle, I'll teach you all the hacks I know.
- matlaber 16y agoOpen Matlab --> answer = mode(Copy --> Paste)
- krisrak 16y agosolved it with no code by copying and opening as csv, transpose paste, sort, scroll to match column number with number, check for mismatch, bingo!
- 51Cards 16y agoText editor, break into lines, numeric sort, find the line where the count goes out of sync with the line number.
- primodemus 16y agoC#: data.GroupBy(i => i).Where(g => g.Count() > 1) .Select(g => g.Key) .ToList().ForEach(x => Console.WriteLine(x));
- tjarratt 16y agonode.js + underscore.js var numbers = []; require("./underscore-min.js"); var dupe = _.reject(numbers, function(number) { return _.lastIndexOf(numbers, number) == _.indexOf(numbers, number); }); console.log(dupe);
- colinsidoti 16y agoThe ways everyone solves the puzzle are much more interesting than the puzzle itself. I made a mysql table with one column set as the primary key and did an insert. This reminds me of this awesome thread on Sitepoint (5 pages of different ways to output the numbers 0-9): http://www.sitepoint.com/forums/php-34/write-loop-php-prints-numbers-0-9-page-580793.html http://www.sitepoint.com/forums/php-34/write-loop-php-prints...
- annon 16y agoOpen up web inspector. var arr = (paste) arr.sort() for(var i = 0;i<arr.length;i++){if(arr[i+1] == arr[i]){console.log(arr[i])}}
- mitjak 16y agoOr the recursive version, upon sorting: function find_dupe(a){ if(a.length==0) return -1; if (a[0]==a[1]) return a[0]; else return find_dupe(a.slice(1,a.length)); } BTW, are loops more efficient than recursion in JS? It sure seems like a lot of JS libraries out there including jQuery avoid recursion like plague.
- annon 16y agoFor recursion vs. looping, it really depends on what you're doing. In my js experience though, most of the time looping is either faster or equal to recursion, while being significantly easier to understand at a quick glance. In this case, the loop will outperform recursion because of all of the slice calls in the recursive version.
- redredraider 16y ago$data = "http://hackerunderground.com/solution/blank; $ch = curl_init($data); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $base = curl_exec($ch); for($i=0;$i<10000;$i++) { $data = "http://hackerunderground.com/solution/$i; $ch = curl_init($data); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $response = curl_exec($ch); if($response != $base) { echo $i; } } I like my solution best. Everyone should try it!
- mickdarling 16y agoThis will work for all the puzzles too. :-)
- biznickman 16y agoThat's a true hack ... :)
- jkkramer 16y agoI like how it keeps going even after it finds the solution.
- redredraider 16y agoHaha my bad.
- mickdarling 16y agoWell now they are asking for Prime duplicates, and if they keep it going fo the next week, you could end up with some complex puzzles.
- ptarjan 16y agoWhat day is the event?
- swGooF 16y agoYou need to solve the puzzle or are you joking?
- janoulle 16y agoI'm learning Python (3) w/ MIT OCW and here's my solution (http://pastebin.com/EQevWQWC http://pastebin.com/EQevWQWC). def dupefinder(lister): '''Function to find first duplicate in a list; Variable to pass to this function should be of type "list" ''' listerdupe = sorted(lister) for index,item in enumerate(listerdupe): if item == listerdupe[index+1]: print('First duplicate number is {0}'.format(item)) return item
- deleted 16y ago[deleted]
- dotBen 16y agoSince they changed the puzzle to now require finding the prime duplicate number. Is is each number delimited by a (random?) alphabetic letter? Is this to make parsing into Excel/an array harder? Also, even the new 'harder' puzzle is easy to solve in Excel. Maybe that isn't a bad thing, however.
- zackattack 16y agothe lemons of this string when you take out all of the spaces and align the words end to end and prefix it with the word win