349 karma · joined May 4, 2008 (18y ago) · 170 submissions
comment 17y ago · link · parent
Wireless still seems to be the most annoying thing about Linux.
5.
Ask HN: So do these companies make actual money or they just have revenue?
8 points · by globalrev · 17y ago · 3 comments
comment 17y ago · link · parent
####### def throwaway_function(emp): if emp.salary > developer.salary: return fireEmployee(emp) else: return extendContract(emp)
employees.select(throwaway_function) ######
Python lambda: filter(lambda emp: fireEmployee(emp) if emp.salary > developer.salary else extendContract(emp), employees)
Don't know what select does but it sounds like filter. So if that works as intended(is the ruby version both returning value and side-effecting?) or not I'm not sure but you probably could make it.
comment 17y ago · link · parent
git init git add . git commit -m "blah" git push origin master
git branch name git checkout
easy-peasy
comment 17y ago · link · parent
from __future__ import division
import matplotlib.mlab as M
import matplotlib.pyplot as plt
import random as R
def crossover(a, b):
new = []
for x,y in zip(a,b):
if R.random() > 0.5:
new.append(x)
else:
new.append(y)
return new
def mutate(xs):
xs[int(R.uniform(0, len(xs)))] = int(R.uniform(1, 10))
return xs
def fitness(xs, goal):
summa = 0
for x,y in zip(xs, goal):
summa += abs(x-y)
return summa, xs, True if summa == 0 else False
def nFittest(xs, goal, n=2):
fittest = sorted(fitness(x, goal) for x in xs)[:n]
if fittest[0][2] :
return fittest[0]
elif fittest[1][2]:
return fittest[1]
else:
return fittest
def init(fields, n):
return [[int(R.uniform(1,10)) for x in xrange(fields)] for y in xrange(n)]
def newGen(a,b,n):
next = [crossover(a,b) for x in xrange(n)]
mutated = []
for x in next:
if R.random() > 0.9: mutated.append(mutate(x))
else: mutated.append(x)
return mutated
def run(printing=True):
n = 0
first = init(15, 10)
while n < 1000000:
n += 1
next = nFittest(first, [1,1,1,1,1,1,1,1,1,1,1,1,1,1,1], 2)
if type(next) == tuple: break
first = newGen(next[0][1],next[1][1], 10)
if printing:
print "Nbr of generations: ", n
print next
return n, next
def plot():
trials = [run(False)[0] for x in range(100)]
print "Done trials"
averages = [sum(trials[:x]) / len(trials[:x])\
for x in xrange(1,len(trials)+1)]
print "Done averages"
plt.plot([x for x in xrange(len(averages))], averages, 'ro')
plt.axis([1, 100, 0, 1000])
plt.show()
def test():
goal = [1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]
c=0
while 1:
c += 1
x = [int(R.uniform(1,10)) for y in range(15)]
if sum(x) == 15: break
if c % 10000 == 0: print c
print xcomment 17y ago · link · parent
And for the really attractive jobs, do you even get a shot if straight out of college if you are not from a top one(often you don't either how because of no experience but when you do)?
Don't want to bash the point though. Effort > talent, I agree.
comment 17y ago · link · parent
But Lisp has been around for 50 years and never hit the mainstream so it seems there perhaps is something about it that doesn't fit with most programmers?
Also it only offers one form of concurrnecy and while I like it there is still much speculation and research in the area. Scala for example kind of builds on the whole Java-language and offers a more recognizable language for Java-developers and more opportunities to roll your own concurrency-mechanisms, or at least that's the impression I've gotten.
And then we have Haskell and Erlang.
comment 18y ago · link · parent
First I thought it was simple but the I got stuck, maybe I'm just tired. No matter how I twsit and turn it I seem to get only an even distribution over 5 numbers.