Anand B Pillai
Consulting Software Architect
<EMAIL_ADDRESS>@pythonhacker
Code Example #1
# Make a list of odd numbers < 100
# Solution A
odd = []
for i in range(100):
if i % 2: odd.append(i)
# Solution B
[i for i in range(100) if i%2]
Coding Example #2
# Print 20 random prime numbers < 1000
# Solution A
def is_prime(n):
""" Is the number 'n' prime ? """
prime = True
for i in range(2,int(pow(n,0.5))+1):
if n % i==0:
prime = False
break
return prime
count, numbers = 0, []
while count<20:
num = random.randrange(1,1000)
if num not in numbers and is_prime(num):
numbers.append(num)
count += 1
Coding Example #2
# Solution B
sieve = lambda n: not any(n % num==0 for num in range(2, int(pow(n,0.5))+1))
from itertools import cycle,imap,dropwhile,takewhile
nums = set()
for i in takewhile(lambda x:len(nums)<=20,
dropwhile(sieve,imap(random.randrange,cycle([1]),
cycle([100])))):
nums.add(i)
Observations
Idiomatic
Pythonic
A style of coding that fits into the Zen of Python .
# Pythonic
>>> from __future__ import with_statement
>>>
# Un-Pythonic (quite obvious eh ?)
# WARNING: Don't try this at $HOME.
>>> from __future__ import braces
File "<stdin>", line 1
SyntaxError: not a chance
>>>
Enumerating a list
# Solution A1
fruits = ['apple','mango','grapes','jackfruit','lemon']
for i in range(len(fruits)):
print i,'-->',fruits[i]
# Solution A2
i = 0
while i<len(fruits):
print i,'-->',fruits[i]
i += 1
Enumerating a list
# Solution B1
for i,fruit in enumerate(fruits):
print i,'-->',fruit
# Solution B2
for i,fruit in zip(range(len(fruits)), fruits):
print i,'-->',fruit
# Output
0 --> apple
1 --> grapes
2 --> jackfruit
3 --> lemon
Sorting to a field
# Sort a website according to its alexa rank
topsites = {'google': 1,'wikipedia': 6,
'linkedin': 8,'yahoo': 4,
'baidu': 5,'youtube': 3,
'facebook': 2,'qq': 7}
# Solution A
# Make a list/tuple with first members as the rank
topsites_items = [(y,x) for x,y in topsites.items()]
print topsites_items
# Output
[(5, 'baidu'), (7, 'qq'), (1, 'google'), (2, 'facebook'),
(3, 'youtube'), (6, 'wikipedia'), (4, 'yahoo'), (8, 'linkedin')]
# Sort it
topsites_items.sort()
[x[1] for x in topsites_items]
Sorting to a field
# Solution B
>>> import operator
>>> [x[0] for x in sorted(topsites.items(), key=operator.itemgetter(1))]
['google', 'facebook', 'youtube', 'yahoo', 'baidu', 'wikipedia',
'qq', 'linkedin']
Transposing a Matrix (list of lists)
# Solution A
from random import randrange
class MatrixA(object):
def __init__(self,m,n):
self.m, self.n = m,n
self.rows=[[randrange(1,10) for j in range(n)] for i in range(m)]
def __str__(self):
s='\n'.join([' '.join([str(i) for i in r]) for r in self.rows])
return s + '\n'
def transpose(self):
""" Transpose a matrix """
rows2 = [[0]*self.m for i in range(self.n)]
for x in range(self.m):
for y in range(self.n):
rows2[y][x] = self.rows[x][y]
self.rows = rows2
# Swap m and n
tmp = self.m
self.m = self.n
self.n = tmp
Transposing a Matrix (list of lists)
# Solution B
class MatrixB(MatrixA):
""" A simple matrix class (see Ref) """
def transpose(self):
self.m, self.n = self.n, self.m
self.rows = zip(*self.rows)
In general zip can be used for making a list of tuples, each containing
the ith element of the passed sequence.
>>> zip([1,2],[3,4],[5,6])
[(1,3,5),(2,4,6)]
OR
>>> l = [[1,2],[3,4],[5,6]]
>>> zip(*l)
[(1,3,5),(2,4,6)]
Grouping with dictionaries
# Bag containing more than 1 fruit of same type
fruit_bag = ['apple','grapes','apple','mango','mango','apple',
'banana','orange','guava','sapota','apple','orange',
'litchi','strawberry','lemon','apple','grapes']
# Group counts according to fruit
# Solution A
fruit_group = {}
for fruit in fruit_bag:
if fruit not in fruit_group:
fruit_group[fruit] = 0
fruit_group[fruit] += 1
print fruit_group
# Output
{'sapota': 1, 'apple': 5,
'litchi': 1, 'strawberry': 1,
'mango': 2, 'grapes': 2,
'orange': 2, 'lemon': 1,
'guava': 1, 'banana': 1})
Grouping with dictionaries
# Solution B1
fruit_group = {}
for fruit in fruit_bag:
fruit_group[fruit] = fruit_group.get(fruit, 0) + 1
# Solution B2
# Grouping using defaultdict
fruit_group = collections.defaultdict(int)
for fruit in fruit_bag:
fruit_group[fruit] += 1
print fruit_group
# Output
defaultdict(<type 'int'>, {'sapota': 1, 'apple': 5, 'litchi': 1,
'strawberry': 1, 'mango': 2, 'grapes': 2,
'orange': 2, 'lemon': 1, 'guava': 1,
'banana': 1})
Filter data from iterable using (multiple) conditions
Let us say we are given a dictionary of cut off marks for different engineering subjects, given out of 100.
Problem - Find students who passed in each.
cutoffs = {'maths': 40, 'elec': '35',
'lab' : 45, 'cs': 30,
'phy' : 25, 'chem': 35}
marks_dict = { 'Karan': {'maths': 39, 'elec': 78, 'cs': 83,
'lab': 32, 'phy': 60, 'chem': 91},
'Arjun': {'maths': 49, 'elec': 45, 'lab': 53,
'cs': 43, 'phy': 86, 'chem': 54},
'Rancho': {'maths': 86, 'elec': 85, 'cs': 95,
'lab': 83, 'phy': 91, 'chem': 75},
'Raju': {'maths': 32, 'elec': 36, 'lab': 50,
'cs': 26, 'phy': 35, 'chem': 41},
'Farhan': {'maths': 30, 'elec': 56, 'cs': 21,
'lab': 33, 'phy': 27, 'chem': 56}}
Filter data from iterable using (multiple) conditions
# Solution A
def find_passed(marks_dict,cutoffs):
""" Find students who passed for each subject """
# Using a dictionary and two for loops
pass_dict = {subject:[] for subject in cutoffs}
for subject, cutoff in cutoffs.iteritems():
for student, student_marks in marks_dict.iteritems():
if student_marks[subject] >= cutoff:
pass_dict[subject].append(student)
return pass_dict
Filter data from iterable using (multiple) conditions
# Solution B
# Solved idiomatically by using itertools.compress which allows
# "selecting" items from an iterable using a second iterable of
# boolean "selectors".
def find_passed(marks_dict, cutoffs):
""" Find students who passed for each subject """
pass_dict = collections.defaultdict(list)
# two dicts to single dictionary using 'dict comprehension'
selectors = {(subject, student) :cutoffs[subject]<=val[subject] for
subject in cutoffs for student,val in marks_dict.items()}
# Select students who passed using itertools.compress
passd = list(itertools.compress(selectors.keys(), selectors.values()))
# Create dictionary using defaultdict(list)
for subject,student in passd:
pass_dict[subject].append(student)
return pass_dict
Itertools at work
Infinite iterators - count, cycle and repeat.
# itertools.count can provide an infinite counter.
for i in itertools.count(step=1):
print i
# itertools.cycle cycles through an iterator
# Will keep printing 'python'
for i in itertools.cycle(['python']):
print i
# itertools.repeat keeps repeating from an iterator
# Will keep producing range(10) when called in a loop
itertools.repeat(range(10))
Itertools at work
# chain returns elements from 'n' iterators until they are exhausted.
# Make a dictionary of count of letters in a list of strings.
birds = ['parrot','crow','dove','peacock','macaw','hen']
frequency = collections.defaultdict(int)
for letter in itertools.chain(*birds): frequency[letter] += 1
# takewhile returns elements as long as a predicate(condition) is True.
# Give list of favorable countries
countries=['U.S','U.K','India','Australia','Malaysia','Pakistan']
list(itertools.takewhile(lambda x: x != 'Pakistan', countries))
['U.S', 'U.K', 'India', 'Australia', 'Malaysia']
# dropwhile keeps dropping elements while predicate is True.
# Produce iterator of files > a minimum size in current folder.
files = sorted([(file, os.path.getsize(file)) for file in os.listdir(".")],
key=operator.itemgetter(1))
list(itertools.dropwhile(lambda x: x[1] < 8192, files))
[('idiomatic.md', 14749L), ('iterators.md', 17706L),
('idiomatic.html', 119014L) ('PSSI.pdf', 166270L)]
Problem Statement
A stock trader wants to trade only in securities that match certain conditions. For some securities, it would be if it crosses a limit value, for some if it goes below the limit value (possibly for shorting).
You are given a dictionary of securities and their limit values and a condition as a dictionary. You are also given a list of securities and their CMP.
The problem is to idiomatically solve the problem of which securities he needs to buy according to his conditions.
Problem Data
stock_limits = {'REL' : (1200, '>='),
'INF': (2500, '>'),
'GLB': (850, '<'),
'ACC': (1330, '=='),
'JIN': (720, '<='),
'TRA': (1800, '>='),
'PAC': (95, '>')}
# Input - Current Market Price of the securities
stock_prices = {'REL': 1222,
'INF': 2312,
'GLB': 829,
'ACC': 1335,
'JIN': 755,
'TRA': 1889,
'PAC': 85}
# Expected answer - Sample
'Stocks to trade in are REL,INF,ACC, TRA'
What you should (ideally) use ? - itertools, collections, operator modules.
Problem - Next Step
Extend your solution to receive streaming input to simulate real-time data coming from the stock market.
HINT: Look at the infinite itertools functions - Namely itertools.cycle, itertools.repeat and itertools.count .
Itertools at work (contd.)
# Problem - Drop punctuations from a list of strings
>>> import string
>>> from itertools import imap
>>> punc = string.punctuation
# Solution A1 - Using a generator expresson nested
# inside list comprehension
>>> strings = ['#I love,@,#',' PyCon India..$#,']
>>> [''.join(i for i in s if i not in punc) for s in strings]
['I love', ' PyCon India']
# Solution A2 - Functional tools
>>> map(lambda x: ''.join(i for i in x if i not in punc),strings)
['I love', ' PyCon India']
# Solution B1 - Itertools imap
>>> list(imap(lambda x: ''.join(i for i in x if i not in punc),strings))
['I love', ' PyCon India']
# Solution B2 - Itertools chain, ifilter
>>> from itertools import ifilter, chain
>>> ''.join(ifilter(lambda x: x not in punc, chain(*strings)))
'I love PyCon India '
Sometimes, brute force does the trick faster!
# Problem - Drop punctuations from a list of strings
>>> import re
>>> [re.sub('[' + punc + ']+', '', x) for x in strings]
['I love', ' PyCon India']
Really ? Let us time them!
My timing functions look like this.
def repl_listcomp(strings):
return [''.join(i for i in s if i not in punc) for s in strings]
def repl_functional(strings):
return map(lambda x: ''.join(i for i in x if i not in punc),strings)
def repl_itertools1(strings):
return list(imap(lambda x: ''.join(i for i in x if i not in punc),strings)
def repl_itertools2(strings):
return ''.join(ifilter(lambda x: x not in punc, chain(*strings)))
def repl_re(strings):
return [re.sub('[' + punc + ']+', '', x) for x in strings]
Timing results
NOTE: I am using my own timing function built on top of timeit module.
$ python timing.py
Listcomp => 6.39 usec/pass
Functional => 7.00 usec/pass
Itertools #1 => 7.78 usec/pass
Itertools #2 => 8.14 usec/pass
Re => 6.10 usec/pass
As (some of you might have) expected,
However the scale of time difference between best (6.10 usec) and worst(8.14 usec) is just about 2 usec/pass - that is roughly 2 sec per million calls, which is quite trivial .
However,
Let us look at the timing functions rewritten now to NOT do the join.
def repl_listcomp(strings):
return [[i for i in s if i not in punc] for s in strings]
def repl_functional(strings):
return map(lambda x: [i for i in x if i not in punc],strings)
def repl_itertools1(strings):
return list(imap(lambda x: [i for i in x if i not in punc],strings))
def repl_itertools2(strings):
return list(ifilter(lambda x: x not in punc, chain(*strings)))
And,
$ python timing2.py
Listcomp => 4.25 usec/pass
Functional => 4.71 usec/pass
Itertools #1 => 5.73 usec/pass
Itertools #2 => 7.84 usec/pass
A relook at the Prime number problem
Solved the problem of generating a fixed number (20) of prime numbers from a random pool.
sieve = lambda n: not any(n % num==0 for num in range(2, int(pow(n,0.5))+1))
from itertools import cycle,imap,dropwhile,takewhile
nums = set()
for i in takewhile(lambda x:len(nums)<=20,
dropwhile(sieve,imap(random.randrange,cycle([1]),
cycle([100])))):
nums.add(i)
Find Circular Primes
The number 197 is a Circular Prime because all rotations of the digit 197, 917 and 719 are themselves prime.
There are thirteen such primes below 100:
2, 3, 5, 7, 11, 13, 17, 31, 37, 71, 73, 79, and 97.
Problem - Find all circular prime numbers less than 5 million.
HINT(S) - Use the sieve function with itertools functions.
Modules you can(should) use - itertools, collections, operator.
Checking for Sentinel values
Often you need to write a piece of code that stops after a certain value (often called a sentinel). For example, let us look at this block of code that stops after it finds a certain number in a random stream.
# Solution A
# Append numbers till you hit say 41
nums = []
sentinel = 41
while True:
num = random.randrange(1, 100)
if num == sentinel: break
nums.append(num)
Checking for Sentinel values
# Solution B1
import functools
func = functools.partial(random.randrange, 1, 100)
nums, sentinel = [], 41
for num in iter(func, sentinel):
nums.append(num)
# Solution B2
# WARNING: This itertools solution is almost like magic.
sentinel=49
list(takewhile(lambda x: x!=sentinel,
imap(random.randrange, cycle([1]), cycle([100]))))
Word Checker
Write a function that scans a folder for the combination of two specific words in a file. Once it finds the combination, it should stop reading the files. The words can occur anywhere in the file (need not be in order) and are case insensitive.
Modules to use - os, itertools, collections, functools,... Arguments to accept - Folder path, the two words.
Sample Usage
>>> s = FolderScan(".", 'python','pycon')
>>> s.start()
"Words found at file ./pyconindia.txt'
Problem of Code Overhead
Look at the following code.
def add(x,y):
""" Add 2 numbers """
safe = (type(x) in (int, float)) and (type(y) in (int, float))
if safe: return x + y
else: raise TypeError, "Wrong type!"
def add(x,y):
""" Multiple 2 numbers """
safe = (type(x) in (int, float)) and (type(y) in (int, float))
if safe: return x * y
else: raise TypeError, "Wrong type!"
The type checks are basically management code which are common to both functions. Such code overhead is better moved to decorators at one single place.
Management code using Decorators
def isNumber(f):
def wrapper(*args):
if not all(type(item) in (int, float) for item in args):
raise TypeError,'Wrong type!'
return f(*args)
return wrapper
@isNumber
def add(x,y):
return x+y
@isNumber
def mul(x,y):
return x*y
Caching Decorators
A common use of decorators is to cache frequently required information. Here is a simple example.
def cache(f):
results = {}
def wrapper(*args):
if args in results:
print 'From cache'
return results[args]
res = f(*args)
results[args] = res
return res
return wrapper
@cache
def factorial(n):
return reduce(lambda x,y: x*y, range(1,n+1))
>>> factorial(5)
120
>>> factorial(10)
3628800
>>> factorial(5)
From cache
120
>>> factorial(10)
From cache
3628800
Anagram Finder
Implement a class with a caching decorator that returns anagram words from a dictionary. The class would consist of two actions - First indexing a dictionary file to find similaries and then given a word, find words which are anagrams of it and cache the results. You can try implementing LRU semantics for least frequent words. (It would be also nice to take care of punctuations.)
Sample Usage Below.
>>> d = DictReader('/usr/share/dict/words')
>>> d.index() # Takes a while
>>> d.anagrams('crates')
Anagrams => ['carets', 'caster', 'caters', 'crates',
'reacts', 'recast', 'traces']
Factoring out local contexts with "with"
There are many cases in programming where you need to call some methods when you enter and exit out of the context of a statement. For example,
# Locking a critical section
# Solution A
lock = threading.Lock()
# Entering critical section
lock.acquire()
try:
# Critical section code
my_critical_section()
finally:
# Exiting critical section
lock.release()
The with statement allows you to factor out these contexts.
# Solution B
with threading.Lock(): # lock acquired at this point
my_critical_section()
# lock released at this point
You can write your own context managers by using the contextlib module that can be used with the with statement.
Making sure an child text block is always printed nicely indented relative to its parent block
from contextlib import contextmanager
spaces = 0
@contextmanager
def indent():
global spaces
spaces += 1
print '\t'*spaces,
yield
spaces -= 1
for i in range(2,5):
with indent(): print 'This is number',i
# Indent more
with indent(): print 'This is its square',i*i
# Output
This is number 2
This is its square 4
This is number 3
This is its square 9
This is number 4
This is its square 16
Context manager classes
You can also create classes that implement context management semantics by implementing special __enter__ and __exit__ methods.
class Indent(object):
def __init__(self):
self.spaces = 0
def __enter__(self):
self.spaces += 1
print '\t'*self.spaces,
def __exit__(self, type, value, traceback):
self.spaces -= 1
Usage difers a bit.
for i in range(2,5):
# Indenter has to be created once and reused, or should be a Singleton
indenter = Indent()
with indenter:
print 'This is number',i
with indenter:
print 'This is its square',i*i
Context-Aware Source Code Debugger
Implement a context manager class that can be used to keep track of source code information - i.e file name, line number in the source when the context is entered. This can be used to implement a context-specific debug manager that keeps track of details of when the specific context is entered.
These information should be saved to a dictionary and then persisted to disk.
Sample Usage.
with my_debugger():
# Start keeping track of function, filename etc.
do_something()
# End my_debugger - calculate time spent in context
| Idiomatic Programming with Python | 1 |
|---|---|
| - | 2 |
| - | 3 |
| - | 4 |
| - | 5 |
| What is the difference between the code in Solution(s) A and B ? | 6 |
| - | 7 |
| - | 8 |
| - | 9 |
| Idiomatic ~= Pythonic | 10 |
| Iterators & Dictionaries | 11 |
| - | 12 |
| - | 13 |
| - | 14 |
| - | 15 |
| - | 16 |
| - | 17 |
| - | 18 |
| - | 19 |
| - | 20 |
| - | 21 |
| - | 22 |
| - | 23 |
| - | 24 |
| Problem 1 | 25 |
| - | 26 |
| - | 27 |
| - | 28 |
| - | 29 |
| - | 30 |
| - | 31 |
| - | 32 |
| - | 33 |
| - | 34 |
| Problem 2 | 35 |
| - | 36 |
| - | 37 |
| - | 38 |
| Problem 3 | 39 |
| - | 40 |
| Decators, context managers, "with" | 41 |
| - | 42 |
| - | 43 |
| - | 44 |
| Problem 4 | 45 |
| - | 46 |
| - | 47 |
| - | 48 |
| - | 49 |
| Problem 5 | 50 |
| - | 51 |
| yield Q&A | 52 |
| Thank You! | 53 |
| Table of Contents | t |
|---|---|
| Exposé | ESC |
| Full screen slides | e |
| Presenter View | p |
| Source Files | s |
| Slide Numbers | n |
| Toggle screen blanking | b |
| Show/hide slide context | c |
| Notes | 2 |
| Help | h |


[Erowid note: this person took 1800 mg of acetaminophen (paracetamol) which can be dangerous to the liver if taken in very high doses; over 10 grams at a time can be fatal. The maximum daily dosage (adult) is 4 grams (this estimate is from emedicine.com, more on acetaminophen can be found through your favorite search engine). People with liver disease or who are regular users of alcohol are more at risk of liver failure from high doses of acetaminophen, even doses lower than 4 grams.]
I consider myself an experienced Opiate user. Having taken almost every Prescription based drug in hopes of a Euphoric experience. Never having a bad experience, the thought of my shiny new Tylenol 3 prescription made me orgasmic. I recieved this prescription due to a pretty severe toothache. Seconds after leaving the dentists office I had 12 T3's in my possesion. I decided that I would wait until I got home before I took this new endeavor on.
Like all my other Opiate experiences I usually wait until late at night, 10:30 or so. Mainly because there are less distractions and enjoyability is increased.
Time ticked away and eventually so did 10:30. Gulp. 6 Pills downed.
180MG codeine is now settling in my stomache. My virgin stomache now has enough codeine in it to hopefully give me a -very- intense trip, I could never have been farther from the truth.
10:45.
A new sort of feeling is coming over my body. Not like the Hydrocodone feelings I am used to. This is more subtle, almost like Marijuana. I do things, like turn my head, and wonder if I actually did it.
I am lying in my bed with my now sleeping girlfriend. I am listening to her breath and I suddenly realize that she is breathing normal compared to me. I am taking very short breaths. Then I remember reading about OD symptoms and that is one of them. Yet, I did not take enough of to justify an OD. The thought doesnt help, panic sets in. I think I am od'ing.
11:26.
The shallow breathing is now being forced. I have to force the Oxygen into my lungs. I am in the midst of a severe panic attack. I don't know what to do. I wake my girlfriend up and explain it to her. She convinces me that I am not od'ing that I am manifesting the symptoms. She could be right. I decide to go outside.
11:40
I have been walking around outside for awhile now, everything seems ok. When I don't think about my breathing I am ok. I decide to try and enjoy this experience. I go back inside and lay back down with my Angel. I lay there for quite some time, falling in and out of sleep. Then I get up to go to the bathroom. When I begin to open the door to the bathroom I realize I am trying very hard to turn the handle. Pushing the door open seems impossible. Fatigue. OD symptom #2. Panic attack #2.
After walking around some more outside I realize that I am not really fatigued, just a bit tired.  Drifting in and out of consciousness, my thoughts are flooded with the most obscene images. The second I close my eyes I have visions of a strange old lady with two crayons in her hand, screaming. I can't take this, eyes open.
12:44.
After 20 minutes of fighting sleep I can't control it anymore. I fight off the strange thoughts and let myself drift off into happy sober land. Severe pain in my stomache. My lungs. My chest. OD symptom #3. Codeine is the devil. I lay there with my new OD symptoms and realize that i will never partake of the codeine again. Sleeping.
2:11.
I wake up, look at the clock, realize that the drug has already peaked and I have not died. I lived. I experienced. Goodnight.
Experience Reports are the writings and opinions of the individual authors who submit them.
Some of the activities described are dangerous and/or illegal and none are recommended by Erowid.


case class Complex(re: Double, im: Double = 0) extends Product with Serializable
A class which represents a complex number, that is, a number in the form a + bi
,
where i is one of the two square roots of -1.
a
is called the real part, and b
is called the imaginary part.
- re
The real part
- im
The imaginary part
- Source
- Complex.scala
- Alphabetic
- By Inheritance
- Complex
- Serializable
- Serializable
- Product
- Equals
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Instance Constructors
-
new
Complex(re: Double, im: Double = 0)
- re
The real part
- im
The imaginary part
Value Members
-
final
def
!=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
##(): Int
- Definition Classes
- AnyRef → Any
-
def
*(that: Complex): Complex
Multiplies this complex number by another one and returns the result.
Multiplies this complex number by another one and returns the result.
This implements the formula:
(a + bi) * (c + di) = (ac - bd) + (ad + bc)
- that
The complex number to be multiplied with this one
- returns
this * that
-
def
+(that: Complex): Complex
Adds this complex number to another one and returns the result.
Adds this complex number to another one and returns the result.
This implements the formula:
(a + bi) + (c + di) = (a + c) + (b + d)i
- that
The complex number to be added to this one
- returns
this + that
-
def
-(that: Complex): Complex
Subtracts another complex number from this one and returns the result.
Subtracts another complex number from this one and returns the result.
This implements the formula:
(a + bi) - (c + di) = (a - c) + (b - d)i
- that
The complex number to be subtracted from this one
- returns
this - that
-
def
/(that: Complex): Complex
Divides this complex number by another one and returns the result.
Divides this complex number by another one and returns the result.
This implements the formula:
(a + bi) / (c + di) = (a + bi)(c - di) / (c^2 + d^2)
The divisor is then a real number, and thus it is easy to compute the result when the nominator is divided by it.
If the divisor is 0, the result will be NaN + NaNi.
- that
The complex number by which this one is to be divided
- returns
this / that
-
final
def
==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
def
abs: Double
Calculates the absolute value of this complex number, also known as the modulus, and returns it.
Calculates the absolute value of this complex number, also known as the modulus, and returns it. The absolute is the distance between a point on the complex plane representing the number and the origin.
This implements the formula:
|a + bi| = √(a^2 + b^2)
where
|z|
denotes the absolute ofz
.If either the real part of the imaginary part, or both, are infinite, the result will be positive infinity.
- returns
The absolute
-
def
acos: Complex
Returns the principal inverse cosine of this number, that is, the number whose cosine this is.
Returns the principal inverse cosine of this number, that is, the number whose cosine this is.
This implements the formula:
acos(z) = 1/2 * π - asin(z)
- returns
cos
-1
(this)
-
def
acosh: Complex
Returns the principal inverse hyperbolic cosine of this number, that is, the number whose hyperbolic cosine this is.
Returns the principal inverse hyperbolic cosine of this number, that is, the number whose hyperbolic cosine this is.
This implements the formula:
acosh(z) = log(z + √(z + 1) * √(z - 1))
- returns
cosh
-1
(this)
-
def
arg: Double
Calculates the argument, that is, the angle between the positive real axis and the point representing this number on the complex plane.
Calculates the argument, that is, the angle between the positive real axis and the point representing this number on the complex plane. The result will be between
π
and-π
.NaN and infinite values are handled by
math.atan2(Double, Double)
.- returns
The argument
-
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
-
def
asin: Complex
Returns the principal inverse sine of this number, that is, the number whose sine this is.
Returns the principal inverse sine of this number, that is, the number whose sine this is.
This implements the formula:
asin(z) = -i * log(iz + √(1 - z^2))
- returns
sin
-1
(this)
-
def
asinh: Complex
Returns the principal inverse hyperbolic sine of this number, that is, the number whose hyperbolic sine this is.
Returns the principal inverse hyperbolic sine of this number, that is, the number whose hyperbolic sine this is.
This implements the formula:
asinh(z) = -i * asin(iz)
- returns
sinh
-1
(this)
-
def
atan: Complex
Returns the principal inverse tangent of this number, that is, the number whose tangent this is.
Returns the principal inverse tangent of this number, that is, the number whose tangent this is.
This implements the formula:
atan(z) = i(log(1 - iz) - log(1 + iz)) / 2
- returns
tan
-1
(this)
-
def
atanh: Complex
Returns the principal inverse hyperbolic tangent of this number, that is, the number whose hyperbolic tangent this is.
Returns the principal inverse hyperbolic tangent of this number, that is, the number whose hyperbolic tangent this is.
This implements the formula:
atanh(z) = -i * atan(iz)
- returns
tanh
-1
(this)
-
def
clone(): AnyRef
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
def
conj: Complex
Returns the complex conjugate of this number, that is, a complex number with the same real part but with the imaginary part negated.
Returns the complex conjugate of this number, that is, a complex number with the same real part but with the imaginary part negated.
The conjugate of
a + bi
, therefore, isa - bi
- returns
The complex conjugate
-
def
cos: Complex
Returns the cosine of this number.
Returns the cosine of this number.
This implements the formula:
cos(z) = (e^(iz) + e^(-iz)) / 2
- returns
cos(this)
-
def
cosh: Complex
Returns the hyperbolic cosine of this number.
Returns the hyperbolic cosine of this number.
This implements the formula:
cosh(z) = cos(iz)
- returns
cosh(this)
-
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
exp: Complex
Calculates
e
to the power of this complex number and returns the result.Calculates
e
to the power of this complex number and returns the result.This implements the formula:
e ^ (a + bi) = (e ^ a) * (cos(b) + i * sin(b)
- returns
e
this
-
def
finalize(): Unit
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( classOf[java.lang.Throwable] )
-
final
def
getClass(): Class[_]
- Definition Classes
- AnyRef → Any
- val im: Double
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
-
def
log: Complex
Calculates the principle natural logarithm of this number.
Calculates the principle natural logarithm of this number. Although numbers have infinitely many logarithms, separated from each-other by
2πi
, this will only return the one with its imaginary part in the range[-π, π]
.If the input is 0, the result will be negative infinity.
- returns
logₑ(this)
-
final
def
ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
final
def
notify(): Unit
- Definition Classes
- AnyRef
-
final
def
notifyAll(): Unit
- Definition Classes
- AnyRef
-
def
pow(that: Complex): Complex
Raises this number to the power of another and returns the result.
Raises this number to the power of another and returns the result.
This implements the formula:
a ^ b = e ^ (b * logₑ(a))
When this number is 0, then:
- if the real part of the exponent is greater than 0, then the result will be 0
- otherwise, the result will be NaN.
Note that this is a multivalued function, so there would be multiple possible results in reality. This will return the principle value, as determined by the principle value of
logₑ(a)
.- that
The exponent
- returns
this
that
- val re: Double
-
def
round(implicit precision: Int = 8): Complex
Rounds this complex number to the given number of significant figures and returns the result.
Rounds this complex number to the given number of significant figures and returns the result.
- precision
The number of significant figures to round to
- returns
The rounded complex number
-
def
sin: Complex
Returns the sine of this number.
Returns the sine of this number.
This implements the formula:
sin(z) = i(e^(-iz) - e^(iz)) / 2
- returns
sin(this)
-
def
sinh: Complex
Returns the hyperbolic sine of this number.
Returns the hyperbolic sine of this number.
This implements the formula:
sinh(z) = -i * sin(iz)
- returns
sinh(this)
-
def
sqrt: Complex
Returns the square root of this number, as given by
pow(0.5)
.Returns the square root of this number, as given by
pow(0.5)
.Every number apart from 0 has two square roots. The other square root will be the negative of this one. The returned square root will be the one whose real part is positive.
- returns
√this
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
-
def
tan: Complex
Returns the tangent of this number.
Returns the tangent of this number.
This implements the formula:
tan(z) = i(1 - e^(2iz)) / (e^(2iz) + 1)
This will return NaN where the tan function is undefined, which is where:
e^(2iz) + 1 = 0
- returns
tan(this)
-
def
tanh: Complex
Returns the hyperbolic tangent of this number.
Returns the hyperbolic tangent of this number.
This implements the formula:
tanh(z) = -i * tan(iz)
- returns
tanh(this)
-
def
toString(): String
Returns a string representation of this complex number as it would be written mathematically.
Returns a string representation of this complex number as it would be written mathematically.
For example, the string representation of
Complex(1, -2)
is1 - 2i
, and the string representation ofComplex(0, -1)
is-i
.- returns
A string representation of this complex number
- Definition Classes
- Complex → AnyRef → Any
-
def
unary_-: Complex
Calculates and returns the negative of this complex number.
Calculates and returns the negative of this complex number.
This implements the formula:
-(a + bi) = -a - bi
- returns
-a - bi
-
final
def
wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
def
~^(that: Complex): Complex
Raises this number to the power of another and returns the result.
Raises this number to the power of another and returns the result.
This implements the formula:
a ^ b = e ^ (b * logₑ(a))
When this number is 0, then:
- if the real part of the exponent is greater than 0, then the result will be 0
- otherwise, the result will be NaN.
Note that this is a multivalued function, so there would be multiple possible results in reality. This will return the principle value, as determined by the principle value of
logₑ(a)
.- that
The exponent
- returns
this
that
This is the documentation for the Evaluator project (see GitHub).
The main package net.totietje.evaluator. The net.totietje.complex package contains an example usage of this package, which may also be useful.


Free code camp Wikipedia app
Search Wiki
Random Article
Search results for "{{searchResults[0]}}"
{{index+1}}. {{item}}
{{searchResults[2][index]}}
More about {{item}}


It can be hard to know where to start when planning your dream trip. What’s the first step? What’s the second? Third? Fourth? Travel can seem like a daunting subject with so much information available and, the longer you go away, the more things you seem to have to think about. I want to make planning your next gap year, family vacation, round the world, or backpacking trip simple and easy.
With over 1,400 articles on this website, finding what you need might seem hard but on this page, you’ll find a curated list of the best articles on this site related to planning a trip – whether it’s a two week vacation to Italy, or a year-long trip around the world. The tips are broken down into categories so you can find the information you need fast and effectively. Click the images to find a list of related blog posts.


Deep Unsupervised Learning
NUS SoC, 2019/2020, Semester I
CS 6101 - Exploration of Computer Science Research
Thu 18:00-20:00 @ i3 #03-44 (STMI Executive Classroom)
This course is taken almost verbatim from CS 294-158-SP19 – Pieter Abbeel’s course at UC Berkeley. We are following his course’s formulation and selection of papers, with the permission of Pieter.
This is a section of the CS 6101 Exploration of Computer Science Research at NUS. CS 6101 is a 4 modular credit pass/fail module for new incoming graduate programme students to obtain background in an area with an instructor’s support. It is designed as a “lab rotation” to familiarize students with the methods and ways of research in a particular research area.
This course is also offered as a Do-it-Yourself Module (DYOM) for NUS undergraduates. Please see the Slack group channel #dyom
for details.
Our section will be conducted as a group seminar, with class participants nominating themselves and presenting the materials and leading the discussion. It is not a lecture-oriented course and not as in-depth as Abbeel’s original course at UC Berkeley, and hence is not a replacement, but rather a class to spur local interest in Deep Unsupervised Learning.
This course is offered in Session I (Weeks 3-7) and Session II (Weeks 8-13), although it is clear that the course is logically a single course that builds on the first half. Nevertheless, the material should be introductory and should be understandable given some prior study.
A mandatory discussion group is on Slack. Students and guests, please login when you are free. If you have a @comp.nus.edu.sg, @u.nus.edu, @nus.edu.sg, @a-star.edu.sg, @dsi.a-star.edu.sg or @i2r.a-star.edu.sg. email address you can create your Slack account for the group discussion without needing an invite.
For interested public participants, please send Min an email at<EMAIL_ADDRESS>if you need an invite to the Slack group. The Slack group is being reused from previous semesters. Once you are in the Slack group, you can consider yourself registered for the course.
Details
Registration FAQ
-
What topics are covered?
Generative adversarial networks, variational autoencoders, autoregressive models, flow models, energy based models, compression, self-supervised learning, semi-supervised learning.
-
What are the pre-requisites?
From the original course: significant experience with probability, optimization, deep learning
For our NUS course iteration, we believe you should also follow the above pre-requisites, where possible. As with many machine learning courses, it would be useful to have basic understanding of linear algebra, machine learning, and probability and statistics. Taking online, open courses on these subjects concurrently or before the course is definitely advisable, if you do not have to requisite understanding. You might try to follow the preflight video lectures, and if these are understandable to you, then you’re all good.
-
Is the course chargeable? No, (see caveats for NUS undergraduate students) the course is not chargeable. It is free (as in no-fee). NUS allows us to teach this course for free, as it is not “taught”, per se. Students in the class take charge of the lectures, and complete a project, while the teaching staff facilitates the experience.
-
Can I get course credit for taking this? Yes, if you are a first-year School of Computing doctoral student. In this case you need to formally enroll in the course as CS6101, And you will receive one half of the 4-MC pass/fail credit that you would receive for the course, which is a lab rotation course. Even though the left rotation is only for half the semester, such students are encouraged and welcome to complete the entire course.
Yes, also for NUS undergraduate students (in any faculty). You can enrol in this class through the Do-It-Yourself Module (Group initiated) for 4 MCs. Undergraduate students must attend (physically or virtually) all 13 sessions of the course and complete the video lectures from Prof. Abbeel (in addition to the below requirements). For undergraduate students, we believe that the class is counted towards your maximum workload and is chargeable as a regular module.
No, for everyone else. By this we mean that no credits, certificate, or any other formal documentation for completing the course will be given to any other participants, inclusive of external registrants and NUS students (both internal and external to the School of Computing). Such participants get the experience of learning deep learning together in a formal study group in developing the camaraderie and network from fellow peer students and the teaching staff.
- What are the requirements for completing the course? Each student must achieve 2 objectives to be deemed to have completed the course:
- Work with peers to assist in teaching two lecture sessions of the course: One lecture by co-lecturing the subject from new slides that you have prepared a team; and another lecture as a scribe: moderating the Slack channel to add materials for discussion and taking public class notes. All lecture materials by co-lecturers and scribes will be made public.
- Complete a deep unsupervised learning project. For the project, you only need to use any deep learning framework to execute a problem against a data set. You may choose to replicate previous work from others in scientific papers or data science challenges. Or more challengingly, you may decide to use data from your own context.
-
How do external participants take this course? You may come to NUS to participate in the lecture concurrently with all of our local participants. You are also welcome to participate online through Google Hangouts. We typically have a synchronous broadcast to Google Hangouts that is streamed and archived to YouTube.
During the session where you’re responsible for co-lecturing, you will be expected to come to the class in person.
As an external participant, you are obligated to complete the course to best your ability. We do not encourage students who are not committed to completing the course to enrol.
Meeting Venue and Time
For both Sessions (I and II): 18:00-20:00, Thursdays at the STMI Executive Classroom (i3 #0-44)
For directions to NUS School of Computing (SoC) and i3: please read the directions here, to park in CP12B and/or take the bus to SoC. and use the floorplan
People
Welcome. If you are an external visitor and would like to join us, please email Kan Min-Yen to be added to the class role. Guests from industry, schools and other far-reaching places in SG welcome, pending space and time logistic limitations. The more, the merrier.
External guests will be listed here in due course once the course has started. Please refer to our Slack after you have been invited for the most up-to-date information.
NUS (Postgraduate, as CS6101): Session I (Weeks 3-7): CAI Qingpeng, SONG Kai, ZHU Fengbin
NUS (Postgraduate, as CS6101): Session II (Weeks 8-13): Dogukan Yigit POLAT, LIANG Yuxuan, Rishav CHOURASIA, WANG Wenjie, WANG Yiwei, WU Zhaomin, XU Cai
NUS (Undergraduates, as DYC1401): ANG Yi Zhe, Eloise LIM, Eugene LIM, Terence NEO, NEW Jun Jie, SHAO Yang
WING: Ibrahim Taha AKSU, HU Hengchang, Min-Yen Kan
External Guests: ANG Shen Ting, Takanori AOKI, Martin KODYŠ, LEE Xin Jie, Joni NGO Thuy Hang, Tram Anh NGUYEN, Harsh SHRIVASTAVA, Chenglei SI, Pardha VISWANADHA, Sunil Kumar YADAV, David YAM
Schedule
Schedule
| Date | Description | Deadlines |
|---|---|---|
| Week 1 15 Aug |
Motivation / Likelihood-based Models Part I: Autoregressive Models
Lectured by: Min Scribed by: Ang Shen Ting, Sunil Kumar [ « Scribe Notes (.pdf) ] [ « Recording @ YouTube ] |
|
| Week 2 22 Aug |
Likelihood-based Models: Autoregressive Models / Flow Models
Lectured by Ang Mingliang and Eugene Lim Scribed by: Shao Yang Hong, Kan Min-Yen, Joni Ngo, [ « Scribe Notes (.pdf) ] [ « Recording @ YouTube ] |
|
| Week 3 29 Aug |
Lossless Compression / Flow Models
Lectured by Daniel Pyone Maung, Terence Neo, Eloise Lim, Amit Prusty Scribed by: Eugene Lim, Ang Ming Liang, Ng Wen Xian [ « Scribe Notes (.pdf) ] [ « Recording @ YouTube ] |
|
| Week 4 5 Sep |
Lecture 3a: Likelihood-based Models Part II: Flow Models (ctd) (same slides as week 2) /
Lecture 3b: Latent Variable Models - part 1
Lectured by New Jun Jie, Eloise Lim, Shao Yang, Terence Neo. Scribed by: Taha Aksu, Shen Ting Ang, Song Kai, Daniel Maung [ « Scribe Notes (.pdf) ] [ « Recording @ YouTube ] |
|
| Week 5 12 Sep |
Lecture 4a: Latent Variable Models - part 2 /
Lecture 4b: Bits-Back Coding
Lectured by Song Kai, Hitoshi Iwasaki and David Yam Scribed by: Terence Neo, Eloise Lim, Xueqi, Rishav Chourasia [ « Scribe Notes (.pdf) ] [ « Recording @ YouTube ] |
|
| Week 6 19 Sep |
Lecture 5a: Latent Variable Models - wrap-up (same slides as Latent Variable Models - part 2) /
Lecture 5b: ANS coding (same slides as bits-back coding) /
Lecture 5c: Implicit Models / Generative Adversarial Networks
Lectured by: Ang Shen Ting, Sunil Kumar Yadav, Takanori Aoki and Qingpeng Cai Scribed by: Amit Prusty, Harsh Shrivastava and Ang Yi Zhe [ « Scribe Notes (.pdf) ] [ « Additional Lecture Slides (Ang Shenting) ] [ « Recording @ YouTube ] |
Preliminary project titles and team members due on Slack's #projects |
| Recess Week 26 Sep |
Lecture 6a: Generative Adversarial Networks
Lectured by: Takanori Aoki, Qingpeng Cai Scribed by: Kevin Ling [ See consolidated scribe notes from Week 7 ] [ « Additional Lecture Slides (Takanori Aoki) ] [ « Recording @ YouTube ] |
|
| Week 7 3 Oct |
Lecture 6a: Generative Adversarial Networks (ctd)
Lectured by: Ang Yi Zhe, Wong Cheng Heng, Rishav Chourasia, Wu Zhaomin Scribed by: Kevin Ling [ « Scribe Notes (.pdf) ] [ « Additional Lecture Slides (Ang Yi Zhe) ] [ « Recording @ YouTube ] |
Preliminary abstracts due to #projects
|
| Week 8 10 Oct |
Lecture 7: Non-Generative Representation Learning (same slides as 6b)
Lectured by: Zhaomin Wu, Tram Anh Nguyen, Pardha Viswanadha, Liling Tan Scribed by: Fengbin Zhu, Yizhuo Zhou, Hengchang Hu [ « Scribe Notes (.pdf) ] [ « Additional Lecture Slides (Tomaso Poggio via Pardha Viswanadha) ] [ « Recording @ YouTube ] |
|
| Week 9 17 Oct |
Lecture 8a: Strengths/Weaknesses of Unsupervised Learning Methods Covered Thus Far /
Lecture 8b: Semi-Supervised Learning /
Lecture 8c: Guest Lecture by Ilya Sutskever
Lectured by: Joni Ngo, Eloise Lim, Xueqi Li, Fengbin Zhu, Eugene Lim Scribed by: David Yam, Tram Anh Nguyen, Liling Tan, Yuxuan Liang [ « Scribe Notes (.pdf) ] [ « Additional Lecture Slides (Eugene Lim) ] [ « Recording @ YouTube ] |
|
| Week 10 24 Oct |
Lecture 9a: Unsupervised Distribution Alignment /
Lecture 9b: Guest Lecture by Alyosha Efros
Lectured by: Hengchang Hu, New Jun Jie, Shao Yang Scribed by: Takanori Aoki, Liu Ziyang, Wong Cheng Heng [ « Scribe Notes (.pdf) ] [ « Recording @ YouTube ] |
|
| Week 11 31 Oct |
No lecture due to the Singapore Symposium on Natural Language Processing (SSNLP '19). | |
| Week 12 7 Nov |
Lecture 10: Language Models (Alec Radford)
Lectured by: Lee Xin Jie, Si Chenglei, Li Xueqi, Liu Ziyang, Wang Wenjie Scribed by: Hitoshi Iwasaki, Wu Zhaomin [ « Scribe Notes (.pdf) ] [ « Additional Lecture Slides (Si Chenglei and Wang Wenjie) ] [ « Recording @ YouTube ] |
|
| Week 13 14 Nov |
No Lecture due to conflicts | Participation on evening of 15th STePS |
| Reading Week 21 Nov |
Lecture 11: Representation Learning in Reinforcement Learning |
Projects
Student Projects
Stay tuned!
Other Links
General Texts:
- Ian Goodfellow, Yoshua Bengio and Aaron Courville Deep Learning - an MIT Press book http://www.deeplearningbook.org/
- Michael A. Nielsen, Neural Networks and Deep Learning - free, general e-book - http://neuralnetworksanddeeplearning.com/
Previous CS6101 versions run by Min:
- Deep Reinforcement Learning - http://www.comp.nus.edu.sg/~kanmy/courses/6101_1820
- Deep Learning for NLP (reprise) - http://www.comp.nus.edu.sg/~kanmy/courses/6101_1810
- Deep Learning via Fast.AI - http://www.comp.nus.edu.sg/~kanmy/courses/6101_2017_2/
- Deep Learning for Vision - http://www.comp.nus.edu.sg/~kanmy/courses/6101_2017/
- Deep Learning for NLP - http://www.comp.nus.edu.sg/~kanmy/courses/6101_2016_2/
- MOOC Research - http://www.comp.nus.edu.sg/~kanmy/courses/6101_2016/


#define _GNU_SOURCE /* See feature_test_macros(7) */ #include <sched.h> void CPU_ZERO(cpu_set_t *set); void CPU_SET(int cpu, cpu_set_t *set); void CPU_CLR(int cpu, cpu_set_t *set); int CPU_ISSET(int cpu, cpu_set_t *set); int CPU_COUNT(cpu_set_t *set); void CPU_AND(cpu_set_t *destset, cpu_set_t *srcset1, cpu_set_t *srcset2); void CPU_OR(cpu_set_t *destset, cpu_set_t *srcset1, cpu_set_t *srcset2); void CPU_XOR(cpu_set_t *destset, cpu_set_t *srcset1, cpu_set_t *srcset2); int CPU_EQUAL(cpu_set_t *set1, cpu_set_t *set2); cpu_set_t *CPU_ALLOC(int num_cpus); void CPU_FREE(cpu_set_t *set); size_t CPU_ALLOC_SIZE(int num_cpus); void CPU_ZERO_S(size_t setsize, cpu_set_t *set); void CPU_SET_S(int cpu, size_t setsize, cpu_set_t *set); void CPU_CLR_S(int cpu, size_t setsize, cpu_set_t *set); int CPU_ISSET_S(int cpu, size_t setsize, cpu_set_t *set); int CPU_COUNT_S(size_t setsize, cpu_set_t *set); void CPU_AND_S(size_t setsize, cpu_set_t *destset, cpu_set_t *srcset1, cpu_set_t *srcset2); void CPU_OR_S(size_t setsize, cpu_set_t *destset, cpu_set_t *srcset1, cpu_set_t *srcset2); void CPU_XOR_S(size_t setsize, cpu_set_t *destset, cpu_set_t *srcset1, cpu_set_t *srcset2); int CPU_EQUAL_S(size_t setsize, cpu_set_t *set1, cpu_set_t *set2);
The cpu_set_t data type is implemented as a bit set. However, the data structure treated as considered opaque: all manipulation of CPU sets should be done via the macros described in this page.
The following macros are provided to operate on the CPU set set:
Where a cpu argument is specified, it should not produce side effects, since the above macros may evaluate the argument more than once.
The first available CPU on the system corresponds to a cpu value of 0, the next CPU corresponds to a cpu value of 1, and so on. The constant CPU_SETSIZE (currently 1024) specifies a value one greater than the maximum CPU number that can be stored in cpu_set_t.
The following macros perform logical operations on CPU sets:
The following macros are used to allocate and deallocate CPU sets:
The macros whose names end with "_S" are the analogs of the similarly named macros without the suffix. These macros perform the same tasks as their analogs, but operate on the dynamically allocated CPU set(s) whose size is setsize bytes.
CPU_COUNT() and CPU_COUNT_S() return the number of CPUs in set.
CPU_EQUAL() and CPU_EQUAL_S() return nonzero if the two CPU sets are equal; otherwise it returns 0.
CPU_ALLOC() returns a pointer on success, or NULL on failure. (Errors are as for malloc(3).)
CPU_ALLOC_SIZE() returns the number of bytes required to store a CPU set of the specified cardinality.
The other functions do not return a value.
CPU_COUNT() first appeared in glibc 2.6.
CPU_AND(), CPU_OR(), CPU_XOR(), CPU_EQUAL(), CPU_ALLOC(), CPU_ALLOC_SIZE(), CPU_FREE(), CPU_ZERO_S(), CPU_SET_S(), CPU_CLR_S(), CPU_ISSET_S(), CPU_AND_S(), CPU_OR_S(), CPU_XOR_S(), and CPU_EQUAL_S() first appeared in glibc 2.7.
Since CPU sets are bit sets allocated in units of long words, the actual number of CPUs in a dynamically allocated CPU set will be rounded up to the next multiple of sizeof(unsigned long). An application should consider the contents of these extra bits to be undefined.
Notwithstanding the similarity in the names, note that the constant CPU_SETSIZE indicates the number of CPUs in the cpu_set_t data type (thus, it is effectively a count of bits in the bit set), while the setsize argument of the CPU_*_S() macros is a size in bytes.
The data types for arguments and return values shown in the SYNOPSIS are hints what about is expected in each case. However, since these interfaces are implemented as macros, the compiler won't necessarily catch all type errors if you violate the suggestions.
#define _GNU_SOURCE #include <sched.h> #include <stdlib.h> #include <unistd.h> #include <stdio.h> #include <assert.h> int main(int argc, char *argv[]) { cpu_set_t *cpusetp; size_t size; int num_cpus, cpu; if (argc < 2) { fprintf(stderr, "Usage: %s <num-cpus>\n", argv[0]); exit(EXIT_FAILURE); } num_cpus = atoi(argv[1]); cpusetp = CPU_ALLOC(num_cpus); if (cpusetp == NULL) { perror("CPU_ALLOC"); exit(EXIT_FAILURE); } size = CPU_ALLOC_SIZE(num_cpus); CPU_ZERO_S(size, cpusetp); for (cpu = 0; cpu < num_cpus; cpu += 2) CPU_SET_S(cpu, size, cpusetp); printf("CPU_COUNT() of set: %d\n", CPU_COUNT_S(size, cpusetp)); CPU_FREE(cpusetp); exit(EXIT_SUCCESS); }


From the Death Certificate of
Jefferson Davis Staley
West Virginia State
Department of Health # 13566
place of death: Wetzel County, Green District, Portersfalls,
W. Va.
PERSONAL AND STATISTICAL
residence: Portersfalls, Wetzel County, W. Va.
veteran: no
personal: male, white, married to Jennie Staley age 74
birth: May 13, 1863, Doolin, Wetzel Co.
age at death: 79 years 5 months 7 days
occupation: farmer; own farm
father: Samuel Staley born "don't know"
mother: Elizabeth Romeberg born Germany
informant: Jennie Staley,* Portersfalls, W.Va.
burial: 10-23-42, Middle Fork, Portersfalls, W.Va.
funeral director: W.E. Wharton, New Martinsville, W. Va.
MEDICAL CERTIFICATION
date of death: Oct. 20, 1942, 11:30 p.m.
statement of physician: I certify that death occurred on the date
stated above, that I attended deceased from 1941 to Oct. 20, 1942, and that I
last saw him alive on Sept. 1, 1942
cause of death: congestive heart failure; duration, sudden
due to: bursting valvular lesion; duration, 20 years
signed: F.E. Martin, M.D., New Martinsville, W. Va.,
10-26-42
*Submitter's Note: JENNIE is the nickname of his wife, Virginia
Elizabeth Staley.
Provided by Betty Latta Kitchen
Click here for the Short-Cut Table of Contents


| Cake | Recomend | Decription |
| Napoleon | ✅ | teasty, good with english tea! |
| Red velvet | ✅ | Deep red, moist cake lightly flavored with cocoa, filled & topped with traditional cream cheese frosting. Our best seller! |
| CARROT CAKE | ✅ | Baked with pecans & golden raisins, layered with our unique “praline filling” & topped with traditional cream cheese frosting. |
| TROPICAL COCONUT CAKE | ✅ | Vanilla cake layered with pineapple accented coconut filling & topped with fluffy coconut buttercream & shredded coconut. |
| LUSCIOUS LEMON CAKE | ✅ | Four layers of vanilla cake filled with fresh lemon curd, frosted with vanilla buttercream. |


The nickname that the bot will be addressable by.
The nickname that the bot will be addressable by.
Outgoing webhook integration token used to check if queries really come from slack. If you're logged into slack, you can add one here.
On creation, set channels to any, trigger word(s) to {{ bot.name }} and URL(s) to {{ thisdomain }}.
Can be created here. Used to send private messages.
Emoji avatar for the bot.
Password for the bot to identify itself with. Leave blank if the nickname is not registered.
Port to connect to the irc server. 6697 is default for most servers.


Select Options
Resizable and collapsible.
Items / center pane
Resizable only.
extras / right pane
Resizable and collapsible.
Outer splitter / middle pane
Resizable only.
Confirm with Payment
Pay here::


--- layout: post title: 'Web design shift: read "Responsive Web Design"' date: 2012-01-24 23:18:54.000000000 +01:00 type: post published: true status: publish categories: - Books tags: [] meta: _edit_last: '1' _thumbnail_id: '1693' dsq_thread_id: '551422557' _wp_old_slug: interesting-read-responsive-web-design snap_MYURL: '' snapEdIT: '1' snapDL: s:99:"a:1:{i:0;a:3:{s:4:"doDL";s:1:"1";s:11:"SNAPformatT";s:7:"%TITLE%";s:10:"SNAPformat";s:6:"%TEXT%";}}"; snapFB: 's:221:"a:1:{i:0;a:8:{s:4:"doFB";s:1:"1";s:8:"PostType";s:1:"A";s:10:"AttachPost";s:1:"1";s:10:"SNAPformat";s:25:"Blogged: %TITLE% - %SURL%";s:9:"isAutoImg";s:1:"A";s:8:"imgToUse";b:0;s:9:"isAutoURL";s:1:"A";s:8:"urlToUse";b:0;}}";' snapLI: 's:217:"a:1:{i:0;a:8:{s:4:"doLI";i:0;s:10:"AttachPost";s:1:"1";s:10:"SNAPformat";s:25:"Blogged: %TITLE% - %SURL%";s:11:"SNAPformatT";b:0;s:9:"isAutoImg";s:1:"A";s:8:"imgToUse";b:0;s:9:"isAutoURL";s:1:"A";s:8:"urlToUse";b:0;}}";' snapTW: 's:159:"a:1:{i:0;a:5:{s:4:"doTW";s:1:"1";s:10:"SNAPformat";s:32:"Blogged: %TITLE% - %SURL% %CATS%";s:8:"attchImg";s:1:"0";s:9:"isAutoImg";s:1:"A";s:8:"imgToUse";b:0;}}";' featured_posts_widget_flag: 'false' author: login: bbWebdesign email<EMAIL_ADDRESS>display_name: Bob first_name: Bob last_name: Belderbos ---
With an increasing amount of web devices (mobile, tablets, higher resolution screens), web designers are faced with a challenge: how to respond well to all? Ethan Marcotte's book "Responsive Web Design" provides a potential shift in how we design for the web!
When I started to design for the web some years ago, I loved fixed width designs. But most fixed width pages aren't easily readable on a mobile device. New devices are invented every year and the number of pages accessed through mobile browsers keeps increasing rapidly! So I think this book is a must read for each web designer. The book is well written, with clear examples, and you can probably digest the 141 pages in one or two days.
Print and web are inherently different media, yet up until recently a lot of sites were build as if they were for the print medium. I like the approach Marcotte introduces: one responsive web design instead of different designs for different devices. According to Marcotte the following 3 elements make up for responsive web designs:
Chapters 2,3 and 4 deal with these. The last chapter provides additional info on the responsive design cycle and progressive enhancement.
Before touching the grid design, we should set up the font-size to 100% as a base and use "ems" to size text up or down. What the grid is concerned Marcotte explains how to go from pixels to percentages based on the width values. You can start with pixels and calculate the percentages with the formula "target / context = result", so if a .blog div is 900px (target) and lives in a body of 960px (context), the .blog div should be 900/ 960 = 0.9375 = 93.75%. Then for the divs that live in .blog, .blog is the context so a left column would be 530/900, etc. The same applies for flexible margins (gutters between blocks).
A neat trick is to give the img a max-width of 100% to never cross the width of the div it lives in. There are some issues (distorted images) with IE < 7, so you can use AlphaImageLoader to correct this. The author further explains interesting techniques with "overflow: hidden".
As of CSS2 you could define media types: all, screen, print, handheld, etc. As this was very generic ("handheld" for iphone and older phones), W3C came up with something better in the CSS3 spec: media queries.
Apart from the media type, media queries also detect the physical characteristics of the devices or browsers that render our content. A typical media query is "@media screen and (min-width: 1024px) { .. css rules .. }": this not only requires the screen medium type, but also a viewport of at least 1024px wide, for the CSS rules to be applied.
This is awesome, because now we can target very specific conditions. You can use the min-width and max-width conditions on a variety of features, for example: width, height, aspect-ratio, resolution, grid and more (see page 76-78). And they can be chained together! For example: "@media screen and (min-device-width: 480px) and (orientation: landscape) { ... }"
The most important point is that media queries are useful if you have the groundwork set up well: a liquid layout, flexible fonts and images. The best way is to follow the book step-by-step applying the examples on your own "responsive web design".
Four sites worth studying (just resize your browser window to see the amazing effect - wow) :
A good approach these days is to start designing for the smaller mobile canvas and progressively enhance with media queries targeting higher resolutions with "min-width" ("resolution breakpoints"). I probably will experiment with this approach designing future sites (Ethan convinced me!).
What about you? Let me know what experiences you have designing "responsive web designs" ...


--- layout: page title: About header-img: "img/about-bg.png" ---
35 year old dude who still says dude a lot.
I grew up in a time and place with a lot of go-karts and porch accidents and listening to the Armageddon soundtrack a lot.
I have a lifelong dream to recreate the "Step In Time" scene from Mary Poppins, and to meet Dolly Parton.
Live a little, its the nineties


| When a new murder victim is discovered with all the signs of Jigsaw's hand, Detective Eric Matthews begins a full investigation and apprehends Jigsaw with little effort. But for Jigsaw, getting caught is just another part of his plan. Eight more of his victims are already fighting for their lives and now it's time for Matthews to join the game... | |
| Genres: | Horror, Mystery |
| Director: | Darren Lynn Bousman |
| Writer: | Leigh Whannell, Darren Lynn Bousman |
Cast: | Jigsaw / John Kramer - Tobin Bell Amanda Young - Shawnee Smith Eric Matthews - Donnie Wahlberg Daniel Matthews - Erik Knudsen Xavier Chavez - Franky G Jonas Singer - Glenn Plummer Addison Corday - Emmanuelle Vaugier Laura Hunter - Beverley Mitchell Obi Tate - Timothy Burd Detective Allison Kerry - Dina Meyer Daniel Rigg - Lyriq Bent Michael Marks - Noam Jenkins Gus Colyard - Tony Nappo SWAT Member Pete - Kelly Jones SWAT Member Joe - Vincent Rother Mother in Cancer Ward - Linette Doherty Nurse in Cancer Ward - Gretchen Helbig Boy in Cancer Ward - Kofi Payton Video Techie - John Fallon Security Officer - Ho Chow Additional Voice Talent - Conrad Coates Additional Voice Talent - James Gallanders Additional Voice Talent - Sam Malkin Additional Voice Talent - Robin Ward |


Twitter tackles 'Grinch' Ndlozi after tweet about Springboks
by Jan GerberAs South Africans celebrate the Springboks third Rugby World Cup win, a tweet by EFF spokesperson Mbuyiseni Ndlozi has proved about as successful as the English scrum on Saturday.
Even before the game, Ndlozi was disparaging to the Springboks and their supporters.
"Aggg please, today is England vs. England. I mean during 2010 World Cup the settlers had both flags in their homes & cars. It's a win win for them because they are still England at heart! You should be focused on removing apartheid statues," he responded to a tweet by Sports, Arts and Culture Minister Nathi Mthethwa wishing the Boks well.
But it was Ndlozi's tweet only congratulating victorious Bok captain Siya Kolisi, and saying "the rest" should be congratulated by British Prince Harry Mountbatten-Windsor, that got called offside by many South African Twitter users - who were still very much in a "wear only your flag-coloured underpants while kissing the cup" mood.
 Shame (sic)," responded FF Plus MP Corné Mulder in a tweet.
"What an idiot!" responded former DA federal chairperson Athol Trollip.
Rugby writer Antoinette Muller responded by posting a clip of Springbok winger Cheslin Kolbe stepping past English captain Owen Farrell on his way to the try line, leaving Farrell sprawled on the Yokohama-pitch as he dotted down to seal South Africa's win.
Twitter users Karabo and Ati responded by tweeting Kolisi's post-match words to Ndlozi: "We came together from different races from different backgrounds and pulled together. I hope we can show the country we can do it when we pull together.... we can do anything if we work together."
Several others also tweeted the photo of Kolisi shaking Prince Harry's hand in the Boks dressing room after the match.
Others simply didn't want the party pooped.
DA parliamentary leader John Steenhuisen, in a radio interview with Jacaranda FM, described Ndlozi as the "Grinch who stole Christmas", adding that the EFF got upset when South Africans pulled together because it didn't fit into their divisive narrative.
"I think what gives the parties like the EFF and people like Mr Ndlozi chest pains is when they see South Africans of all cultures, all races celebrating something together because the EFF speaks to the haters," Steenhuisen said.
Other Twitter users questioned Ndlozi's academic credentials, while some figured his account must have been hacked.
There was some support for Ndlozi, notably from his "commander-in-chief", Julius Malema, who clearly put a lot of thought into the matter, while other Twitter users pointed to the prevailing inequality in South Africa.
However, EFF chairperson Dali Mpofu congratulated Bok winger Makazole Mapimpi and tweeted a picture of the scorer of South Africa's first try in a final holding the Mpofu Easter Rugby Tournament Trophy in 2013 and, six years later, the golden William Webb Ellis trophy.


3D Line¶
Line-like geometrical entities.
Contains¶
LinearEntity3D Line3D Ray3D Segment3D
-
class
sympy.geometry.line3d.
Line3D
[source]¶ An infinite 3D line in space.
A line is declared with two distinct points or a point and direction_ratio as defined using keyword \(direction_ratio\).
Parameters: p1 : Point3D
pt : Point3D
direction_ratio : list
See also
Examples
>>> import sympy >>> from sympy import Point3D >>> from sympy.abc import L >>> from sympy.geometry import Line3D, Segment3D >>> L = Line3D(Point3D(2, 3, 4), Point3D(3, 5, 1)) >>> L Line3D(Point3D(2, 3, 4), Point3D(3, 5, 1)) >>> L.points (Point3D(2, 3, 4), Point3D(3, 5, 1))
-
contains
(o)[source]¶ Return True if o is on this Line, or False otherwise.
Examples
>>> from sympy import Line3D >>> a = (0, 0, 0) >>> b = (1, 1, 1) >>> c = (2, 2, 2) >>> l1 = Line3D(a, b) >>> l2 = Line3D(b, a) >>> l1 == l2 False >>> l1 in l2 True
-
distance
(o)[source]¶ Finds the shortest distance between a line and a point.
Raises: NotImplementedError is raised if o is not an instance of Point3D Examples
>>> from sympy import Point3D, Line3D >>> p1, p2 = Point3D(0, 0, 0), Point3D(1, 1, 1) >>> s = Line3D(p1, p2) >>> s.distance(Point3D(-1, 1, 1)) 2*sqrt(6)/3 >>> s.distance((-1, 1, 1)) 2*sqrt(6)/3
-
equation
(x='x', y='y', z='z', k='k')[source]¶ The equation of the line in 3D
Parameters: x : str, optional
The name to use for the x-axis, default value is ‘x’.
y : str, optional
The name to use for the y-axis, default value is ‘y’.
z : str, optional
The name to use for the x-axis, default value is ‘z’.
Returns: equation : tuple
Examples
>>> from sympy import Point3D, Line3D >>> p1, p2 = Point3D(1, 0, 0), Point3D(5, 3, 0) >>> l1 = Line3D(p1, p2) >>> l1.equation() (x/4 - 1/4, y/3, zoo*z, k)
-
plot_interval
(parameter='t')[source]¶ The plot interval for the default geometric plot of line. Gives values that will produce a line that is +/- 5 units long (where a unit is the distance between the two points that define the line).
Parameters: parameter : str, optional
Default value is ‘t’.
Returns: plot_interval : list (plot interval)
[parameter, lower_bound, upper_bound]
Examples
>>> from sympy import Point3D, Line3D >>> p1, p2 = Point3D(0, 0, 0), Point3D(5, 3, 1) >>> l1 = Line3D(p1, p2) >>> l1.plot_interval() [t, -5, 5]
-
-
class
sympy.geometry.line3d.
LinearEntity3D
[source]¶ An base class for all linear entities (line, ray and segment) in a 3-dimensional Euclidean space.
Notes
This is a base class and is not meant to be instantiated.
Attributes
p1 p2 direction_ratio direction_cosine points -
angle_between
(l1, l2)[source]¶ The angle formed between the two linear entities.
Parameters: l1 : LinearEntity
l2 : LinearEntity
Returns: angle : angle in radians
See also
Notes
From the dot product of vectors v1 and v2 it is known that:
dot(v1, v2) = |v1|*|v2|*cos(A)
where A is the angle formed between the two vectors. We can get the directional vectors of the two lines and readily find the angle between the two using the above formula.
Examples
>>> from sympy import Point3D, Line3D >>> p1, p2, p3 = Point3D(0, 0, 0), Point3D(1, 1, 1), Point3D(-1, 2, 0) >>> l1, l2 = Line3D(p1, p2), Line3D(p2, p3) >>> l1.angle_between(l2) acos(-sqrt(2)/3)
-
arbitrary_point
(parameter='t')[source]¶ A parameterized point on the Line.
Parameters: parameter : str, optional
The name of the parameter which will be used for the parametric point. The default value is ‘t’. When this parameter is 0, the first point used to define the line will be returned, and when it is 1 the second point will be returned.
Returns: point : Point3D
Raises: ValueError
When
parameter
already appears in the Line’s definition.See also
Examples
>>> from sympy import Point3D, Line3D >>> p1, p2 = Point3D(1, 0, 0), Point3D(5, 3, 1) >>> l1 = Line3D(p1, p2) >>> l1.arbitrary_point() Point3D(4*t + 1, 3*t, t)
-
static
are_concurrent
(*lines)[source]¶ Is a sequence of linear entities concurrent?
Two or more linear entities are concurrent if they all intersect at a single point.
Parameters: lines : a sequence of linear entities.
Returns: True : if the set of linear entities are concurrent,
False : otherwise.
See also
Notes
Simply take the first two lines and find their intersection. If there is no intersection, then the first two lines were parallel and had no intersection so concurrency is impossible amongst the whole set. Otherwise, check to see if the intersection point of the first two lines is a member on the rest of the lines. If so, the lines are concurrent.
Examples
>>> from sympy import Point3D, Line3D >>> p1, p2 = Point3D(0, 0, 0), Point3D(3, 5, 2) >>> p3, p4 = Point3D(-2, -2, -2), Point3D(0, 2, 1) >>> l1, l2, l3 = Line3D(p1, p2), Line3D(p1, p3), Line3D(p1, p4) >>> Line3D.are_concurrent(l1, l2, l3) True
>>> l4 = Line3D(p2, p3) >>> Line3D.are_concurrent(l2, l3, l4) False
-
contains
(other)[source]¶ Subclasses should implement this method and should return True if other is on the boundaries of self; False if not on the boundaries of self; None if a determination cannot be made.
-
direction_cosine
¶ The normalized direction ratio of a given line in 3D.
See also
Examples
>>> from sympy import Point3D, Line3D >>> p1, p2 = Point3D(0, 0, 0), Point3D(5, 3, 1) >>> l = Line3D(p1, p2) >>> l.direction_cosine [sqrt(35)/7, 3*sqrt(35)/35, sqrt(35)/35] >>> sum(i**2 for i in _) 1
-
direction_ratio
¶ The direction ratio of a given line in 3D.
See also
Examples
>>> from sympy import Point3D, Line3D >>> p1, p2 = Point3D(0, 0, 0), Point3D(5, 3, 1) >>> l = Line3D(p1, p2) >>> l.direction_ratio [5, 3, 1]
-
intersection
(o)[source]¶ The intersection with another geometrical entity.
Parameters: o : Point or LinearEntity3D Returns: intersection : list of geometrical entities See also
Examples
>>> from sympy import Point3D, Line3D, Segment3D >>> p1, p2, p3 = Point3D(0, 0, 0), Point3D(1, 1, 1), Point3D(7, 7, 7) >>> l1 = Line3D(p1, p2) >>> l1.intersection(p3) [Point3D(7, 7, 7)]
>>> l1 = Line3D(Point3D(4,19,12), Point3D(5,25,17)) >>> l2 = Line3D(Point3D(-3, -15, -19), direction_ratio=[2,8,8]) >>> l1.intersection(l2) [Point3D(1, 1, -3)]
>>> p6, p7 = Point3D(0, 5, 2), Point3D(2, 6, 3) >>> s1 = Segment3D(p6, p7) >>> l1.intersection(s1) []
-
is_parallel
(l1, l2)[source]¶ Are two linear entities parallel?
Parameters: l1 : LinearEntity
l2 : LinearEntity
Returns: True : if l1 and l2 are parallel,
False : otherwise.
Examples
>>> from sympy import Point3D, Line3D >>> p1, p2 = Point3D(0, 0, 0), Point3D(3, 4, 5) >>> p3, p4 = Point3D(2, 1, 1), Point3D(8, 9, 11) >>> l1, l2 = Line3D(p1, p2), Line3D(p3, p4) >>> Line3D.is_parallel(l1, l2) True
>>> p5 = Point3D(6, 6, 6) >>> l3 = Line3D(p3, p5) >>> Line3D.is_parallel(l1, l3) False
-
is_perpendicular
(l1, l2)[source]¶ Are two linear entities perpendicular?
Parameters: l1 : LinearEntity
l2 : LinearEntity
Returns: True : if l1 and l2 are perpendicular,
False : otherwise.
See also
Examples
>>> from sympy import Point3D, Line3D >>> p1, p2, p3 = Point3D(0, 0, 0), Point3D(1, 1, 1), Point3D(-1, 2, 0) >>> l1, l2 = Line3D(p1, p2), Line3D(p2, p3) >>> l1.is_perpendicular(l2) False
>>> p4 = Point3D(5, 3, 7) >>> l3 = Line3D(p1, p4) >>> l1.is_perpendicular(l3) False
-
is_similar
(other)[source]¶ Return True if self and other are contained in the same line.
Examples
>>> from sympy import Point3D, Line3D >>> p1, p2, p3 = Point3D(0, 0, 0), Point3D(1, 1, 1), Point3D(2, 2, 2) >>> l1 = Line3D(p1, p2) >>> l2 = Line3D(p1, p3) >>> l1.is_similar(l2) True
-
length
¶ The length of the line.
Examples
>>> from sympy import Point3D, Line3D >>> p1, p2 = Point3D(0, 0, 0), Point3D(3, 5, 1) >>> l1 = Line3D(p1, p2) >>> l1.length oo
-
p1
¶ The first defining point of a linear entity.
See also
Examples
>>> from sympy import Point3D, Line3D >>> p1, p2 = Point3D(0, 0, 0), Point3D(5, 3, 1) >>> l = Line3D(p1, p2) >>> l.p1 Point3D(0, 0, 0)
-
p2
¶ The second defining point of a linear entity.
See also
Examples
>>> from sympy import Point3D, Line3D >>> p1, p2 = Point3D(0, 0, 0), Point3D(5, 3, 1) >>> l = Line3D(p1, p2) >>> l.p2 Point3D(5, 3, 1)
-
parallel_line
(p)[source]¶ Create a new Line parallel to this linear entity which passes through the point \(p\).
Parameters: p : Point3D Returns: line : Line3D See also
Examples
>>> from sympy import Point3D, Line3D >>> p1, p2, p3 = Point3D(0, 0, 0), Point3D(2, 3, 4), Point3D(-2, 2, 0) >>> l1 = Line3D(p1, p2) >>> l2 = l1.parallel_line(p3) >>> p3 in l2 True >>> l1.is_parallel(l2) True
-
perpendicular_line
(p)[source]¶ Create a new Line perpendicular to this linear entity which passes through the point \(p\).
Parameters: p : Point3D Returns: line : Line3D See also
Examples
>>> from sympy import Point3D, Line3D >>> p1, p2, p3 = Point3D(0, 0, 0), Point3D(2, 3, 4), Point3D(-2, 2, 0) >>> l1 = Line3D(p1, p2) >>> l2 = l1.perpendicular_line(p3) >>> p3 in l2 True >>> l1.is_perpendicular(l2) True
-
perpendicular_segment
(p)[source]¶ Create a perpendicular line segment from \(p\) to this line.
The enpoints of the segment are
p
and the closest point in the line containing self. (If self is not a line, the point might not be in self.)Parameters: p : Point3D Returns: segment : Segment3D See also
Notes
Returns \(p\) itself if \(p\) is on this linear entity.
Examples
>>> from sympy import Point3D, Line3D >>> p1, p2, p3 = Point3D(0, 0, 0), Point3D(1, 1, 1), Point3D(0, 2, 0) >>> l1 = Line3D(p1, p2) >>> s1 = l1.perpendicular_segment(p3) >>> l1.is_perpendicular(s1) True >>> p3 in s1 True >>> l1.perpendicular_segment(Point3D(4, 0, 0)) Segment3D(Point3D(4/3, 4/3, 4/3), Point3D(4, 0, 0))
-
points
¶ The two points used to define this linear entity.
Returns: points : tuple of Points See also
Examples
>>> from sympy import Point3D, Line3D >>> p1, p2 = Point3D(0, 0, 0), Point3D(5, 11, 1) >>> l1 = Line3D(p1, p2) >>> l1.points (Point3D(0, 0, 0), Point3D(5, 11, 1))
-
projection
(o)[source]¶ Project a point, line, ray, or segment onto this linear entity.
Parameters: other : Point or LinearEntity (Line, Ray, Segment)
Returns: projection : Point or LinearEntity (Line, Ray, Segment)
The return type matches the type of the parameter
other
.Raises: GeometryError
When method is unable to perform projection.
Notes
A projection involves taking the two points that define the linear entity and projecting those points onto a Line and then reforming the linear entity using these projections. A point P is projected onto a line L by finding the point on L that is closest to P. This point is the intersection of L and the line perpendicular to L that passes through P.
Examples
>>> from sympy import Point3D, Line3D, Segment3D, Rational >>> p1, p2, p3 = Point3D(0, 0, 1), Point3D(1, 1, 2), Point3D(2, 0, 1) >>> l1 = Line3D(p1, p2) >>> l1.projection(p3) Point3D(2/3, 2/3, 5/3)
>>> p4, p5 = Point3D(10, 0, 1), Point3D(12, 1, 3) >>> s1 = Segment3D(p4, p5) >>> l1.projection(s1) [Segment3D(Point3D(10/3, 10/3, 13/3), Point3D(5, 5, 6))]
-
-
class
sympy.geometry.line3d.
Ray3D
[source]¶ A Ray is a semi-line in the space with a source point and a direction.
Parameters: p1 : Point3D
The source of the Ray
p2 : Point or a direction vector
direction_ratio: Determines the direction in which the Ray propagates.
See also
Examples
>>> import sympy >>> from sympy import Point3D, pi >>> from sympy.abc import r >>> from sympy.geometry import Ray3D >>> r = Ray3D(Point3D(2, 3, 4), Point3D(3, 5, 0)) >>> r Ray3D(Point3D(2, 3, 4), Point3D(3, 5, 0)) >>> r.points (Point3D(2, 3, 4), Point3D(3, 5, 0)) >>> r.source Point3D(2, 3, 4) >>> r.xdirection oo >>> r.ydirection oo >>> r.direction_ratio [1, 2, -4]
Attributes
source xdirection ydirection zdirection -
distance
(o)[source]¶ Finds the shortest distance between the ray and a point.
Raises: NotImplementedError is raised if o is not a Point Examples
>>> from sympy import Point3D, Ray3D >>> p1, p2 = Point3D(0, 0, 0), Point3D(1, 1, 2) >>> s = Ray3D(p1, p2) >>> s.distance(Point3D(-1, -1, 2)) sqrt(6) >>> s.distance((-1, -1, 2)) sqrt(6)
-
plot_interval
(parameter='t')[source]¶ The plot interval for the default geometric plot of the Ray. Gives values that will produce a ray that is 10 units long (where a unit is the distance between the two points that define the ray).
Parameters: parameter : str, optional
Default value is ‘t’.
Returns: plot_interval : list
[parameter, lower_bound, upper_bound]
Examples
>>> from sympy import Point3D, Ray3D, pi >>> r = Ray3D(Point3D(0, 0, 0), Point3D(1, 1, 1)) >>> r.plot_interval() [t, 0, 10]
-
source
¶ The point from which the ray emanates.
See also
Examples
>>> from sympy import Point3D, Ray3D >>> p1, p2 = Point3D(0, 0, 0), Point3D(4, 1, 5) >>> r1 = Ray3D(p1, p2) >>> r1.source Point3D(0, 0, 0)
-
xdirection
¶ The x direction of the ray.
Positive infinity if the ray points in the positive x direction, negative infinity if the ray points in the negative x direction, or 0 if the ray is vertical.
See also
Examples
>>> from sympy import Point3D, Ray3D >>> p1, p2, p3 = Point3D(0, 0, 0), Point3D(1, 1, 1), Point3D(0, -1, 0) >>> r1, r2 = Ray3D(p1, p2), Ray3D(p1, p3) >>> r1.xdirection oo >>> r2.xdirection 0
-
ydirection
¶ The y direction of the ray.
Positive infinity if the ray points in the positive y direction, negative infinity if the ray points in the negative y direction, or 0 if the ray is horizontal.
See also
Examples
>>> from sympy import Point3D, Ray3D >>> p1, p2, p3 = Point3D(0, 0, 0), Point3D(-1, -1, -1), Point3D(-1, 0, 0) >>> r1, r2 = Ray3D(p1, p2), Ray3D(p1, p3) >>> r1.ydirection -oo >>> r2.ydirection 0
-
zdirection
¶ The z direction of the ray.
Positive infinity if the ray points in the positive z direction, negative infinity if the ray points in the negative z direction, or 0 if the ray is horizontal.
See also
Examples
>>> from sympy import Point3D, Ray3D >>> p1, p2, p3 = Point3D(0, 0, 0), Point3D(-1, -1, -1), Point3D(-1, 0, 0) >>> r1, r2 = Ray3D(p1, p2), Ray3D(p1, p3) >>> r1.ydirection -oo >>> r2.ydirection 0 >>> r2.zdirection 0
-
-
class
sympy.geometry.line3d.
Segment3D
[source]¶ A undirected line segment in a 3D space.
Parameters: p1 : Point3D
p2 : Point3D
See also
Examples
>>> import sympy >>> from sympy import Point3D >>> from sympy.abc import s >>> from sympy.geometry import Segment3D >>> Segment3D((1, 0, 0), (1, 1, 1)) # tuples are interpreted as pts Segment3D(Point3D(1, 0, 0), Point3D(1, 1, 1)) >>> s = Segment3D(Point3D(4, 3, 9), Point3D(1, 1, 7)) >>> s Segment3D(Point3D(1, 1, 7), Point3D(4, 3, 9)) >>> s.points (Point3D(1, 1, 7), Point3D(4, 3, 9)) >>> s.length sqrt(17) >>> s.midpoint Point3D(5/2, 2, 8)
Attributes
length (number or sympy expression) midpoint (Point3D) -
contains
(other)[source]¶ Is the other GeometryEntity contained within this Segment?
Examples
>>> from sympy import Point3D, Segment3D >>> p1, p2 = Point3D(0, 1, 1), Point3D(3, 4, 5) >>> s = Segment3D(p1, p2) >>> s2 = Segment3D(p2, p1) >>> s.contains(s2) True
-
distance
(o)[source]¶ Finds the shortest distance between a line segment and a point.
Raises: NotImplementedError is raised if o is not a Point3D Examples
>>> from sympy import Point3D, Segment3D >>> p1, p2 = Point3D(0, 0, 3), Point3D(1, 1, 4) >>> s = Segment3D(p1, p2) >>> s.distance(Point3D(10, 15, 12)) sqrt(341) >>> s.distance((10, 15, 12)) sqrt(341)
-
length
¶ The length of the line segment.
See also
sympy.geometry.point.Point3D.distance
Examples
>>> from sympy import Point3D, Segment3D >>> p1, p2 = Point3D(0, 0, 0), Point3D(4, 3, 3) >>> s1 = Segment3D(p1, p2) >>> s1.length sqrt(34)
-
midpoint
¶ The midpoint of the line segment.
See also
sympy.geometry.point.Point3D.midpoint
Examples
>>> from sympy import Point3D, Segment3D >>> p1, p2 = Point3D(0, 0, 0), Point3D(4, 3, 3) >>> s1 = Segment3D(p1, p2) >>> s1.midpoint Point3D(2, 3/2, 3/2)
-
plot_interval
(parameter='t')[source]¶ The plot interval for the default geometric plot of the Segment gives values that will produce the full segment in a plot.
Parameters: parameter : str, optional
Default value is ‘t’.
Returns: plot_interval : list
[parameter, lower_bound, upper_bound]
Examples
>>> from sympy import Point3D, Segment3D >>> p1, p2 = Point3D(0, 0, 0), Point3D(5, 3, 0) >>> s1 = Segment3D(p1, p2) >>> s1.plot_interval() [t, 0, 1]
-


Start Bootstrap
9+
Action
Another action
Something else here
7
Action
Another action
Something else here
Settings
Activity Log
Logout
Dashboard
Pages
Login Screens:
Login
Register
Forgot Password
Other Pages:
404 Page
Blank Page
Charts
Tables
Change Photo
Kshiti Ghelani
12th PCM CBSE
Profile
Summary
Favourite Subjects
Chemistry
English
Hobbies
Reading
Web Surfing
User Id
Email
School
College
Prep Year
Class
School
Year
Course
College
Submit
About me
Ready to Leave?
×
Select "Logout" below if you are ready to end your current session.


Sridhama Prakhya
IAST: śrī-dhā-ma pra-khya
I’m a computer science graduate student at the University of Massachusetts Amherst and a student researcher in the Connectomics group at Google Research. Before grad school, I spent a couple of years developing machine learning algorithms for neuroscience in the Turaga Lab at HHMI Janelia Research Campus. At Janelia, I mainly worked on building connectome-constrained latent variable models for simulating whole-brain neural dynamics. In the past, I’ve also worked on variational spike inference from calcium fluorescence imaging and some research in natural language processing.
news
| Jan 20, 2022 | Our paper titled “Connectome-constrained latent variable model of whole-brain neural activity” has been accepted at ICLR 2022. [Paper] |
| Feb 25, 2021 | We presented our poster titled “Connectome-constrained latent variable model of C. elegans chemosensation” at COSYNE 2021. [Poster] [PDF] [Slides] |


'He is a victim of his own addiction' - Man caught with €3.5k of heroin gets 18 months
by By Liam HeylinGardaí caught a man with €3,500 worth of heroin at his home in Cork city and today he was jailed for 18 months.
Robert Lennon was sentenced by Judge Brian O’Callaghan to four years with the last two-and-a-half years suspended at Cork Circuit Criminal Court, where he pleaded guilty to a charge of having heroin for sale or supply to others at his home at 60 Upper John Street, Cork.
Detective Sergeant Kieran O’Sullivan said Lennon, 37, had been a drug addict for the past 17 years but was unusual in committing no other offences except drug dealing in order to pay for his drugs and not resorting to theft or any other crimes to pay for them.
The detective said the accused had made a lot of money from selling drugs but had none of the trappings of wealth in terms of his home or even his clothing and he did not have a car.
“He is involved in drugs as long as I have known him. He does not do thefts to pay for his drugs habit," Detective Sergeant O’Sullivan said.
“He has always been sociable with gardaí. He is a man who is easy to deal with. He does not give the guards any trouble whatsoever."
“He has not been in custody for nearly three years,” the detective sergeant said.
Mr Lennon was convicted eight times for having drugs for his own use and twice before for drug-dealing – all of which were dealt with at district court level.
Defence barrister, Sinead Behan said the accused had engaged recently with Arbour House in dealing with his addiction difficulty.
Ms Behan said: “He is a victim of his own addiction.”
Judge O’Callaghan said: “Unfortunately, there are other victims as well. That is the problem. He is creating other drug users.”
Ms Behan accepted this was so but said in respect of Lennon: “He is a pity in some respects.”
Imposing sentence on Lennon, Judge O’Callaghan said: “The court fully accepts his involvement in the criminality of dealing is 100% motivated by feeding his habit."
READ MORE
Cork teenager settles case over birth for €23m - the State's largest such award to date


--- layout: post title: 'MWI day: Mobile Web Potential and Challenges, Rhys Lewis of Volantis' date: 2005-11-15 00:00:00 categories: interfaces-&-interaction mobile ---
Mobile Web Potential and Challenges, Rhys Lewis of Volantis
Pre-processing of web (as opposed to browser-style post-processing)
Potential:
- more users
- more geographies
- mobile use of existing applications
- innovative new applications
Not everyone is using the great networks that we have here.
Discovery:
- finding sites that work
- finding sites that are interesting
Trust:
- secure access
- secure applications
- trusted for payment
Technical challenges:
- accelerating diversity
- the way people think about the web embodies some assumptions which mobile challenges
- even the 1:1 relationship between what an author writes and a user sees


--- template: page.html title: Eclipse Vert.x Downloads heading: Download ---
On this page, you can download the vert.x distributions. Alternatively, you can browse available packages from Bintray.
The distributions are providing the vertx
command line tool. To modify the content of the distribution once downloaded, use the stack manager.
If you are using Apache Maven or Gradle, you don't need to download anything, as the required artifacts are retrieved by your dependency manager.
Low-level distribution containing only Vert.x core components and language interfaces for Java, JavaScript, Groovy and Ruby.
{% for d in distribution_info.min %}
Vert.x {{ d.version }} min ({{ d.ext }})
{{ d.date }} | {{ d.size }}
{% endfor %}
This package encompasses the minimum distribution plus all components from the official Vert.x stack.
{% for d in distribution_info.full %}
Vert.x {{ d.version }} full ({{ d.ext }})
{{ d.date }} | {{ d.size }}
{% endfor %}
You can download the vert.x distributions from NPM:
npm install vertx3-min
npm install vertx3-full
You can install the full vert.x distribution in a Docker container:
docker run -i -t vertx/vertx3-exec
More details here.
We have continuous integration builds for all the Vert.x components on CloudBees. We also publish shapshots to the Sonatype OSS Snapshot repository.
Older Vert.x releases (including 2.x) can still be downloaded from our Bintray repository.


Steps into being a Web Developer
Welcome to my blog. On this blog I will be posting my work from EDA and my individual projects in the future. Still needing a lot of tweaks and rework. Will be updating regularly :)


--- layout: post title: 'Blessing Iserhienrhien in the news: International Conference of Graduate Students Invades Nation’s Capital #uwophysastro' date: '2012-01-09T11:46:00.001-05:00' author: Bob Sica tags: - meeting - grad_students modified_time: '2012-01-09T11:46:15.600-05:00' blogger_id: tag:blogger.com,1999:blog-736339229338318027.post-6106339496518608645 blogger_orig_url: http://blog.purplecrowlidar.ca/2012/01/blessing-iserhienrhien-in-news.html ---
PCL MSc graduate Blessing Iserhienrhien, now working on her PhD at University of Saskatchewan recently presented her work at the Canadian-American-Mexican Graduate Student Physics Conference in Washington, DC. Well done Blessing!


Created by Mickaël Floc'hlay / @dirtyhenry
Q3 2012 - Source: IDC via TechCrunch
Mobile browsing: 13% of global browsing
March 2013 - Source: ArsTechnica
Mobile browsing: 10% of global browsing
December 2012 - Source: ArsTechnica
Mobile browsing: 10% of global browsing
October 2012 - Source: ArsTechnica
25% of adults American own a tablet
44% of Android tablets are Kindle Fire tablets
iPad share was 81% in 2011
October 2012 - Source: ArsTechnica
Tim Cook: when comparing the tablet market share (iPad 68%) with the tablet web traffic share (iPad 91%)
I don't know what these other tablets are doing
TNW Magazine stopped publishing on Android after noticing a "80:1 ratio of iOS to Android downloads".
Marco Ament, commenting on this:
Installed base isn’t everything — if it was, we’d all be writing Windows apps.
For every 1 iOS version we’ve sold, 5 were sold on Android. The Android version also costs $1 more, so we’re making more per transaction as well. (...) it’s a fact.
- Russell Ivanovic on shiftyjelly's blog
iOS Screens:
| 01/2007 | iPhone + 3G + 3GS | 480 × 320 px | 163 dpi |
| 01/2010 | iPad + 2 + Mini | 1,024 × 768 px | 132/163 dpi |
| 06/2010 | iPhone 4 + 4S | 960 × 640 px | 326 dpi |
| 03/2010 | iPad 3 + 4 | 2,048 × 1536 px | 264 dpi |
| 09/2012 | iPhone5 | 1136 × 640 px | 326 dpi |
Android screens:
Source : developer.android.com
October 2012 - Source: developer.android.com
Source: developer.android.com
if ([device isIpad]) {
image.name = @"image~pad.png";
} else if ([device isIphone5]) {
image.name = @"image-568h~phone.png";
} else {
image.name = @"image~phone.png";
}
Interesting but...
Quick list of UX mobile brought
I believe when properly done, a visceral app actually causes your body to release endorphins.
I would call this designing for feel, or maybe even designing for affection.
Creating apps for both platforms is difficult; I have huge respect for the companies that nail it. Nailing it means not taking a reductionist approach but instead being intimately familiar with the platform so that you can build something that feels meant to be there.Jack Groetzinger
| Technology | + | - |
|---|---|---|
| Web App | Full online | Offline needs Performance Browser Fragmentation Monetization |
| Multiplatform App | Tests Maintenance | Customization Innovation TTM |
| Native App | Full Control Performance | Tests V1 TTM |
Cf. Wikipedia for a maintained list of tools
but...
Better stuff than Java/MySQL is coming...
A good story can be found here.
When users search from a mobile device, United automatically redirects links from Google to its mobile website—without checking to see if the content is available on mobile. If the content doesn’t exist on mobile, the user gets unceremoniously dumped on the homepage of the mobile website. Mobile redirects that break search—how is that ever a good user experience?
A good joke from the Oatmeal inspired Josh Lehman these motivation rules:
Go develop your apps!


| CharacterInfoPage() |
| CharacterInfoPage(const CharacterInfoPage&) delete |
| CharacterInfo& | GetCharacterInfo(int index) |
| const CharacterInfo& | GetCharacterInfo(int index) const |
| void | Read(BinaryReader& reader) |
| void | Write(BinaryWriter& writer) |
| CharacterInfoPage& | operator=(const CharacterInfoPage&) delete |
| std::vector<CharacterInfo> | characterInfos |


EMC
Our story began with two companies and one shared vision: to provide greater access to technology for people around the world. Dell Technologies is instrumental in changing the digital landscape the world over, fuelled by the desire to drive human progress through technology.


--- layout: post title: Confusing coupons published: true ---
A commenter at Hacker News noted that there have been a lot (perhaps too many) Rails Tutorial coupon codes recently. I may have gotten carried away with this last one, but I hate DRM so much that I really wanted to do something about it. Please email me directly<EMAIL_ADDRESS>if you have any complaints and I'll do what it takes to make things right.


|
Splitting
Your Program into Separate Files
When
writing programs, splitting the code into separate files makes it more
readable and easier to organize.
The most common way to split a program with one class is into 3 files:
-
A
main program file
-
A
class header file
-
A
file containing the source code of your class functions
|
In
the main class program file (often named main.cc), you should
have your main functions:
|
//main.cc
#include(s) . . .
#include "classname.h"
void main()
{
// . . . your code . . .
}
|
|
main.cc
must include the class header file name within double quotations because
it is located in the directory with main.cc
|
|
In
the class header file (classname.h) the class and its members
are declared.
|
//classname.h
#include(s) . . .
class class_name
{
private:
int private_variable_1();
char private_variable_2();
void private_function()
public:
int public_variable;
void public_function_1();
int public_function_2();
};
|
|
Thirdly,
the source code of the class functions are located here (classname.cc).
|
//classname.cc
#include(s) . . .
#include "classname.h"
void class_name::private_function()
{
. . .
. . .
. . .
}
void class_name::public_function_1()
{
. . .
. . .
. . .
}
// . . . etc . . .
|
Now that the code is
split intro three files; how is compilation supposed to be done?
Makefiles!
This
is a fourth file that tells the compiler which files to compile with what.
Two examples are below:
A
Simple MakeFile
An
example of a makefile (named makefile) which has the following
3 files:
-
main.cc
-
classname.cc
-
classname.h
The
executable will be called main.
|
main: main.o classname.o
g++ -g -o main main.o classname.o
main.o: main.cc classname.h
g++ -g -Wall -c main.cc
classname.o: classname.cc classname.h
g++ -g -Wall -c classname.cc
|
Generalized
MakeFile
A
different example of a makefile (named makefile) which has
the following 3 files:
-
main.cc
-
list.cc
-
list.h
The
executable will be called mylist.
|
OBJS
= list.o main.o
CC = g++ # C++ Compiler
CFLAGS = -g -Wall # -g : in order to use debug
mylist: $(OBJS)
$(CC) $(CFLAGS) -o mylist $(OBJS)
list.o: list.h list.cc
$(CC) $(CFLAGS) -c list.cc
main.o: list.h main.cc
$(CC) $(CFLAGS) -c main.cc
clean:
rm -f mylist *.o core
|
To compile, type "make".
IMPORTANT
NOTE: Each indented line must be indented with a TAB.
|


THE PRINCESS BRIDE A film review by Mark R. Leeper Copyright 1987 Mark R. Leeper
Capsule review: William Goldman expertly wrote a twisted fairy-tale novel and Rob reiner did a great job of bringing it to the screen. Fun and unpretentious.
One of the advantages of being a proficient and successful writer is that you can write what you like and do not have to worry that this idea is too silly and readers will laugh at it. One of the advantages of being a proficient and successful director is that you can make the kind of films you like and do not have to worry that the idea is too silly for audiences. William Goldman has written such successful books as NO WAY TO TREAT A LADY, MAGIC, MARATHON MAN, and SOLDIER IN THE RAIN. So when he decides to write a book-length fairy tale, his publisher knows he can pull it off. And when Rob Reiner, who was not much of an actor but as a director of three films-- the worst of which was as good as THE SURE THING--wants to direct it, he isn't going to have too much trouble getting up the mazuma to make a fairy- tale movie.
Princess--are you ready for this?--Buttercup (played by Robin Wright) is to be the unfortunate bride of Prince Humperdinck (played by FRIGHT NIGHT's Chris Sarandon). But the only man she has ever loved was the callow youth Westley (played by Cary Elwes of LADY JANE) who was killed off-screen by a notorious pirate. Buttercup would like revenge on the pirate and she isn't too fond of her fiance either. And speaking of revenge, Inigo Montoya (played by Mandy Patinkin) would like some against the six-fingered man who killed his father. They could get revenge together but unfortunately Inigo's current job involves him and two friends, including Fezzik the giant (played by Andre the also Giant) kidnapping and murdering Buttercup.  Yeah, well, he's in there too.
It is hard to find fault with as well-meaning and enjoyable a film as this offbeat fairy tale. The real problem is that the characters are flat so that one is never really drawn into the story. Reiner can create characters we like and believe, and had he done it here the film would have been just about perfect. As it is, the story feels a little thin and too short for its material. Something is wrong when the only one likable character is played by a quarter-ton of professional wrestler.
Beyond that all I can say is this is the most fun you will have in a film for quite a while. I could tell you why this fractured fairy tale is fun, but most of what is fun catches you off-guard. I couldn't convey the fun and I'd probably ruin the gags. Rate the movie a +2 on the -4 to +4 scale.
Mark R. Leeper ihnp4!mtgzz!leeper<EMAIL_ADDRESS>The review above was posted to the
rec.arts.movies.reviews newsgroup (de.rec.film.kritiken for German reviews).
The Internet Movie Database accepts no responsibility for the contents of the
review and has no editorial control. Unless stated otherwise, the copyright
belongs to the author.
Please direct comments/criticisms of the review to relevant newsgroups.
Broken URLs inthe reviews are the responsibility of the author.
The formatting of the review is likely to differ from the original due
to ASCII to HTML conversion.
Related links: index of all rec.arts.movies.reviews reviews


Provides implementation of various authentication schemes as well as utility classes that can be used to authenticate HTTP requests. @since 2.0


import json
print('Loading function')
def lambda_handler(event, context):
#print("Received event: " + json.dumps(event, indent=2))
print("value1 = " + event['key1'])
print("value2 = " + event['key2'])
print("value3 = " + event['key3'])
return event['key1'] # Echo back the first key value
import json
print('Loading function')
def lambda_handler(event, context):
print("Received event: " + json.dumps(event, indent=2))
response = {
'statusCode': 200,
'headers':{'x-hello-world':'some-header/value'},
'body': event['body']
}
return response # return the request body
chtompki@Robs-MacBook-Pro ~ % curl \
-X POST https://jnvg8rtlt8.execute-api.us-east-1.amazonaws.com/prod \
-d '{"key1":"value1", "key2":"value2", "key3":"value3"}' && echo ""
{"key1":"value1", "key2":"value2", "key3":"value3"}
Queue the Serverless Application Framework
serverless.yml
service: chtompki-serverless-example-api
frameworkVersion: '2'
provider:
name: aws
runtime: python3.8
lambdaHashingVersion: '20201221'
## IMPORTANT: Serverless makes too many buckets
deploymentBucket:
name: chtompki-serverless-deployments
serverSideEncryption: AES256
functions:
hello:
handler: lambda_function.lambda_handler
events:
- http:
path: /
method: post
sls deploy
We get a cloudformation deployment looking like this
chtompki@Robs-MacBook-Pro ~ % curl \
-X POST https://cckfhngf25.execute-api.us-east-1.amazonaws.com/dev \
-d '{"key1":"value1", "key2":"value2", "key3":"value3"}' && echo ""
{"key1":"value1", "key2":"value2", "key3":"value3"}
serverless.yml
can declare all parts of CFT under resources
sectionplugins
seciton of the serverless.yml
allows importing other node modules that accommodate more customizations


2046-01-01T00:00:00
until New Year’s Day, 2046
2000-01-01T00:00:00Z
since we partied like it was 1999
2021-02-07T18:30:00-04:00
until Super Bowl LV (2/7/2021 @ 6:30pm EST)


The HIDEOBJ record stores options selected in the Options dialog box, View tab.
Record Data
|
Offset |
Flag Name |
Size |
Contents |
|
4 |
fHideObj |
2 |
=2 if the Hide
All
option is turned on |