-
Posts
11 -
Joined
-
Last visited
Posts posted by doug_h
-
-
Here's a simpler more readable version of my previous submission. It's also commented.
def PowerSet(base): #What size of gray_code set should we make? bits = len(base) power_set = [] #Generate the gray_code gray_code = map(lambda x: x ^ (x / 2), range(0, 2 ** bits)) for gcode in gray_code: #Calculate binary of gray_code binary = map(lambda x: (gcode >> x) & 1, range(bits-1, -1, -1)) #Calculate the indexes of the 1's working_set = filter(lambda x: binary[x], range(0, bits)) #Add the values from the base that coorespond to the 1 indexes working_set = map(lambda x: base[x], working_set) #Add working_set to power_set power_set.append(working_set) return power_set print PowerSet([1,2,3])
-
Nice simple one, but one I have just had to solve.
Challenge: Find the power set of an input set.
Examples: Input Set = {1,2,3}, Power Set = {{},{1},{2},{3},{1,2},{1,3},{2,3},{1,2,3}}
Points for execution time, code simplicity, code readability and extra features (like working on any object not just integers).
Implement in your favorite language.
Here's my submission.
def PowerSet(base): power_set = [] b = len(base) map(lambda g: power_set.append(map(lambda x: base[x], filter(lambda x: g[x], range(0, b)))), map(lambda value: map(lambda x: (value >> x) & 1, range(b - 1, -1, -1)), map(lambda value: value ^ (value / 2), range(0, 2**b)))) return power_set print PowerSet([1,2,3])
This definitely won't win for readability but it's the shortest I could come up with.
-
I was wondering if anyone here has done any pair programming. I really like the idea and am interested in trying it. So far i've found only two editors // IDE's that support remote collaboration the first is Eclipse with ECF (Cola) and Notepad++ with the Dochshare plugin. Both follow the same general idea. One client would serve a document (or connect to a server that would manage sharing it) and another user would connect as a client to either the other user or the server. Both users would be presented with the document in question and could edit it live with changes being sync'd to both clients.
It looks like right now the Npp Docshare plugin is really new and there are a lot of details yet to be flushed out but Eclipse's ECF plugin seems to be pretty mature already. It'd be really cool if there were a pair programming competition.
-
There could be interactive stuff over like IRC and vent and stuff. There could be a projector screen with IRC on it, if the hardware is avalable for that of course.
A vent portion of it would be cool.
-
I would love to see a segment on a linux cluster on Hak.5
Same here.
-
Well since thats what i'm looking for i guess i'm stuck. It'd be awesome if i could do distributed video encoding. I know MPEG video can be distributed without too much trouble but when getting into other codecs such as xvid or wmv then it gets really ugly on deciding how to split the workloads.
It's all just a matter of spending the time to do it. I'm hoping hak5 can come up with a quickfix for it in similar simplicity to the steady-cam they demonstrated.
-
I think a show about this would be much more useful for people that want recreational clusters. Just something to play with, i doubt many people would like to spend their computing time running fluid-dynamics applications. Video encoding i know has always been a desire for all DIY cluster builders.
-
I've managed to get a clusterKnoppix openMosix cluster up and running but i sat there and stared at the screen and said "now what?".
Here's a look at what i put together:
-
Thanks much. I just recently started watching the Hak.5 episodes. I've learned some intersting things so far.
-
I've been on a search for a little while now on the simplest//most straight-forward way to build a linux cluster that has useful applications such as video encoding.
I'm sure there are plenty of people out there with lots of older or extra boxes that simply don't have a purpose. Why not do a show on how to put them all together and use them.
This would be especially useful for people who don't have a lot of power in one box but several mediocre computers.
Built a Processor?
in Hacks & Mods
Posted
What software are you designing it in? I've done some really simple digital component design in Logisim which isn't really professional by any means but does the job for learning your way around things like that. Or are you using something like verilog?