Some thoughts on:
"Software engineering: An Idea Whose Time Has Come and Gone?" by Tom DeMarco, in IEEE Software, July/August 2009
(https://www.computer.org/cms/Computer.org/ComputingNow/homepage/2009/0709/rW_SO_Viewpoints.pdf)
Tom says:
|*****-----|----------| | |
0% 50% 100% |
Some thoughts on:
"Software engineering: An Idea Whose Time Has Come and Gone?" by Tom DeMarco, in IEEE Software, July/August 2009
(https://www.computer.org/cms/Computer.org/ComputingNow/homepage/2009/0709/rW_SO_Viewpoints.pdf)
Tom says:
import Data.List | |
let numAndPlace xs ys = length $ (zip xs [0..]) `intersect` (zip ys [0..]) | |
let numNotPlace xs ys = (length $ xs `intersect` ys) - (numAndPlace xs ys) | |
let test xs ys = (numAndPlace xs ys, numNotPlace xs ys) | |
let match xs = map (test xs) [[6,8,2],[6,1,4],[2,0,6],[7,3,8],[8,7,0]] == [(1,0),(0,1),(0,2),(0,0),(0,1)] | |
filter match [[x,y,z] | x<-[0..9], y<-[0..9], z<-[0..9]] |
//import sqlContext.implicits._ | |
import com.databricks.spark.avro._ | |
import org.apache.spark.sql._ | |
import org.apache.spark.sql.types._ | |
//val inschema = StructType(List(StructField("name", StringType, true), StructField("age", IntegerType, true))) | |
val outschema = StructType(List(StructField("summary", StringType, true))) | |
val input = sc.parallelize(List(Row("fred", 34), Row("wilma", 33))) |
>>> import os | |
>>> from os.path import join | |
>>> [join(dr,f) for dr, dirs, files in os.walk('test') for f in files if f.endswith('html')] | |
['test/t1.html', 'test/t2.html', 'test/subtest/t3', 'test/subtest/subsubtest/t6.html'] |
Prelude> let xs = map show [1..5] | |
Prelude> foldr (\x y -> concat ["(",x,"+",y,")"]) "0" xs | |
"(1+(2+(3+(4+(5+0)))))" | |
Prelude> let f = (\x y -> concat ["(",x,"+",y,")"]) | |
Prelude> foldl f "0" (map show [1..5]) | |
"(((((0+1)+2)+3)+4)+5)" |
#!/bin/bash | |
RED=`echo -e '\033[41m\033[37m'` | |
BLUE=`echo -e '\033[44m\033[37m'` | |
NORMAL=`echo -e '\033[0m'` | |
cat "$1" | sed -e s/\ /${BLUE}\ ${NORMAL}/g | sed -e s/$'\t'/${RED}\ \ \ \ ${NORMAL}/g |
from tornado import gen | |
from tornado.ioloop import IOLoop | |
from tornado.tcpclient import TCPClient | |
stream = None | |
def out(data): | |
print(data) | |
stream.read_until(b"\n", callback=out) |
module TimerLoop where | |
import Control.Monad.Loops (iterateUntilM) | |
import Control.Concurrent (threadDelay) | |
-- Adapted from https://stackoverflow.com/questions/19285691/how-do-i-write-a-game-loop-in-haskell | |
-- | |
-- NB must compile with -threaded option or the threadDelay has no apparent effect | |
-- even, then 9 and 10 are printed out simultaneously on my Windows 7 machine (GHCi 7.8.3) |
from collections import defaultdict | |
ROOT = -1 | |
def create_tree(pairs): | |
""" Given an iterable of (parent, child) identifiers, build a tree | |
where each node is a dict whose key is its identifier, and whose | |
value is a list of children (which may be empty for leaf nodes). | |
Multiple root nodes are supported; all roots are placed under a | |
synthetic ROOT node. |