Академический Документы
Профессиональный Документы
Культура Документы
fruitfulness,
Agenda
Mostly this:
Agenda
And this:
Agenda
And this:
stackoverflow.com/users/402053
What Frog?
What Frog?
What Frog?
What Frog?
CONCURRENT DOWNLOADS
Y U NO SUPPORT THEM?!
Requirements
EMBED JDM
1. No traceable license
2. No website or docs
3. No traceable sources
4. Its an app, not a lib
WRITE IT YOURSELF
USE URLCONNECTION?
Java.net.urlconnection
1. Memory wasteful
(buffering)
2. Minimal API
3. Blocking streams
1. Async/non-blocking
2. Event callbacks
1. Reactor
2. nio
Original pattern
http://www.dre.vanderbilt.edu/~schmidt/PDF/rea
ctor-siemens.pdf
http://gee.cs.oswego.edu/dl/cpjs
In Java,
Reactor means
NIO
Selector as a multiplexer
InetSocketAddress("http://remote.com
",80));
...
Selectorselector=Selector.open();
channel.configureBlocking(false);
SelectionKeyk=
Nio libraries
Apache Mina
Apache HTTP components
asyncclient
Ning http client
Nio libraries
Apache Mina
Apache HTTP components
asyncclient
Ning http client
Here it is!
HAC Concepts
Request producer
Response consumer
}, null);
HttpResponse response = future.get();
WAIT A SECOND
Head to head
Feature/Librar Ning client
y
Maturity
Good
Download
cancelation
Progress
hooks
Easy
Events not
granular
enough
Documentatio A bit sparse
n
Minimal
Performance?
900
800
700
600
500
Ning
AHAC
400
300
200
100
0
Small file
Medium file
Large file
http://blogs.atlassian.com/2013/07/http-client-p
Confused?
for
discovering
that range
header is
lost on
redirect
Question!
What should
be contentlength when
using
compression?
https://github.com/http2/http2-spec/issues/46
Question!
Question!
How many
simultaneous
connections should
I open?
BROWSERS GO LIKE:
URL ENCODING?
Question!
Whats
wrong
with the
following
code?
Dont use
java.net.URLEncoder
Utility class for HTML form
encoding. This class contains static
methods for converting a String to
the application/xwwwform
urlencodedMIME format.
For more information about HTML
form encoding, consult the HTML
specification.
AHC Alternatives
org.apache.http.client.utils.U RIBuilder
org.apache.http.client.utils.U RLEncode
dU tils
Question!
How do I
close a
socket
correctly
?
http://www.safaribooksonline.com/library/view/http-the-
Half-closed: no new
customers
I ALWAYS CLOSE
CONNECTIONS
Remember?
Question!
How can I
write file
parts
concurrent
ly?
JAVA.IO.RANDOMACCESSFILE?!
USE FileChannel
Implements SeekableByteChannel
* FilePartProgressI
nfo
PersistentFileProgressInfo
Save the total size, sha1, number of parts
State of each part (offset, size, completed...)
File Locking
VM level
OS level
IF YOU WRITE TO
DIFFERENT PARTS OF
Whats next?
http/2
Mostly standardizing Google's spdy
Header compression
multiplexing
Prioritization
Server push
Links!
RTFM: RFC 2616
Ultimate book: HTTP: The
Definitive Guide
Amazon
Safari
Reactor pattern
Doug Lea on NIO
A Quick Tour
of Logos
Come
on.
What
could
possibly
WHAT?
Pair off into groups of four. Each group will receive an examp
of a poor argument (these may be either inductive or deduct
Some examples:
John Keats
Poem
Or on a half-reapd furrow
sound asleep,
Or by a cyder-press, with
patient look,
Or by a cyder-press, with
patient look,
Trusses
At element level, Ue = We
Ue = virtual strain energy of internal
stresses
We = virtual work of external forces
acting through virtual displacements
letting xi = 0, xj = L, we get
a1 = u i
a2 = (uj-ui)/L
We can write
x x ui
u 1
[N ]{d}
L L u j
N N1
N2
x
N1 1 ,
L
x
N2
L
Pr operties
N i 1 at node i and zero at all other nodes
Ni 1
N1=1
Variation of N1
N2=1
Variation of N2
Strain is given by
du
d[N]
{d} [B]{d}
dx
dx
1
B 1 1
L
Now
= E(= E[B]{d}-E
Stress and strain are constant in a
member
- = virtual strain
- = stress level at equilibrium
dV = volume
dv d
T
E[B]{d} Eo dV {d}T {f }
1
F f EAo
1
For thermal problem
o T
F1 , u1
F 2, u2
2
Boundary Conditions
u1=0, u 2=0
F3 , u3
2A, L, E
KG
2 -2
AE
-2 2+1 -1
L
-1
1
A, L, E
Reactions
0
AE
PL
2P
F1 2 -2 0
1
L
3AE
3
0
0
AE
PL
P
F3 0 -1 1
1
L
3AE
3
0
Element Forces
Element 1
f1
2AE 1 -1 u1
L -1 1 u 2
f 2
2p / 3
2AE 1 -1 PL 0
2p / 3
L -1 1 3AE 1
Element 2
f1
AE 1 -1 u 2
L -1 1 u 3
f 2
p / 3
AE 1 -1 PL 1
=
p / 3
L -1 1 3AE 0
f2
f1
A, L, E
2P
3
2P
3
2A, L, E
P
3
A, L, E
P
3
Element 1
Element 2
u1
u2
u2
AE 1 1
K1
L 1 1
K2
u3
AE
1 1
L 1 1
Stress in element 1
u1
1 1 u1
1 E1 EB E
L L u 2
u2
u 2 u1
4 1.5 0
=E
2.0 10
200N / mm 2
L
150
Stress in element 2
u2
1 1 u 2
2 E2 EB E
L L u 3
u 3
u3 u2
4 1.2 1.5
=E
2.0 10
40N / mm 2
L
150
AE
k
L
A = cross section area
E = modulus of elasticity
L = length
qj
qi
vi
pi
ui
vj
AE
Pj
ui
L
x
k
0
st
1 column
k
0
k
0
rd
3 column
k
0
qi = 0
pi = k=AE / L
ui=1
qi = 0
pi = k=AE / L u
i=1
qj = 0
pj = k = AE / L
qj = 0
0
0
th
4 column
0
0
0
0
2 nd column
0
0
qi = 0
qj = 0
pj = 0
vj =1
pi = 0
qi = 0
vi =1
pi = 0
qj = 0
pj = 0
k
0
0
0
0
0
u ' i
v '
u
'
j
v ' j
p 'i
q'
i
p'j
q ' j
or {k}{d}={f}
Note that y equations are all zero
qj
vj
x
pj
uj
pi
ui
x
vi
qi
at node i
u 'i u i cos( ) v i sin( )
At node i
u ' i
cos
sin
v ' i
sin u i
cos v i
p ' i
cos
sin
q ' i
u ' i
cos
v '
sin
i
u '
0
j
v ' j
0
sin
cos
0
0
cos
sin
0 u i
v
0
i
sin u j
cos v j
sin pi
cos q i
0
cos sin 0
0
0
0
0
sin
cos
s 0
c 0
0 c
0 s
0
0
s
c
c2
cs
[k] k 2
c
cs
cs c cs
2
2
s cs s
2
cs c
cs
2
2
s cs s
2
-1
E
L
u i
u i
v
v
1 c s 0 0 i
E
i
u c -s c s u
L 0 0 c s j
L
j
vj
v j
for a truss
each member is modeled as 1 truss
element
truss members or elements are
connected at nodes
node connections behave like pin joints
truss element behaves in exact
agreement with assumptions
no need to divide a member into more
than 1 element
Analysis Step
mostly transparent to user
small truss models have enough
accuracy and performance for an
accurate solution
a large model has a large number of
elements and nodes