roschelle updated
Post on 01-Jun-2018
216 Views
Preview:
TRANSCRIPT
-
8/9/2019 Roschelle Updated
1/234
Season of mists and mellowfruitfulness ,
-
8/9/2019 Roschelle Updated
2/234
-
8/9/2019 Roschelle Updated
3/234
Agenda
#ostly this$
-
8/9/2019 Roschelle Updated
4/234
Agenda
And this$
-
8/9/2019 Roschelle Updated
5/234
Agenda
And this$
-
8/9/2019 Roschelle Updated
6/234
About your s!ea%er
& ' b a r uc hg i t h u b (c o m ) ' b a r u c h
lin%d(in)'baruch
stac%over*ow(com)users)+ - .
-
8/9/2019 Roschelle Updated
7/234
What 0rog1
-
8/9/2019 Roschelle Updated
8/234
What 0rog1
-
8/9/2019 Roschelle Updated
9/234
What 0rog1
-
8/9/2019 Roschelle Updated
10/234
What 0rog1
-
8/9/2019 Roschelle Updated
11/234
SERVE BINARIES FOR A L
-
8/9/2019 Roschelle Updated
12/234
CONCURRENT DOWNLOAD
Y U NO SUPPORT THEM?!
-
8/9/2019 Roschelle Updated
13/234
2e3uirements
4 !arallel 5le 6ownloads
4 arallel 5le !arts4 interru!t)!ause)resume
4 rogress events4 Chec%sums caching
-
8/9/2019 Roschelle Updated
14/234
-
8/9/2019 Roschelle Updated
15/234
-
8/9/2019 Roschelle Updated
16/234
9uc%y day$ 6ownload managerwritten in 'ava:
-
8/9/2019 Roschelle Updated
17/234
ONE DOES NOT SIMPLY
EMBED JDM
-
8/9/2019 Roschelle Updated
18/234
9et;s loo% if we can use it:
t;s an a!!, not a lib
-
8/9/2019 Roschelle Updated
19/234
WANT CONCURRENT DOW
WRITE IT YOURSELF
-
8/9/2019 Roschelle Updated
20/234
WHY WONT YOU JUST
USE URLCONNECTION?
-
8/9/2019 Roschelle Updated
21/234
"ava(net(urlconnection
/( Bloc%ing streams
-
8/9/2019 Roschelle Updated
22/234
-
8/9/2019 Roschelle Updated
23/234
What we;re loo%ing for
-
8/9/2019 Roschelle Updated
24/234
What is >T going to ta%e
-
8/9/2019 Roschelle Updated
25/234
Welcome to the reactor
-
8/9/2019 Roschelle Updated
26/234
4 !attern for lightweight
concurrency4 Event driven
4 Threads reuse
4 Dses non bloc%ing >o
-
8/9/2019 Roschelle Updated
27/234
riginal !attern
htt!$))www(dre(vanderbilt(edu)Fschmidt) 60)reactor siemens(!df
-
8/9/2019 Roschelle Updated
28/234
Guess the author by thediagram
htt!$))gee(cs(oswego(edu)dl)c!'
-
8/9/2019 Roschelle Updated
29/234
In Java,Reactor means
NIO
-
8/9/2019 Roschelle Updated
30/234
Selector as a multi!le er
-
8/9/2019 Roschelle Updated
31/234
"ava version 2egistering
SocketChannel channel=SocketChannel.open();
socketChannel.connect(new
InetSocketAddress("http://remote.com", 80));
...Selector selector = Selector.open();
channel.configureBlocking(false);
SelectionKey k =
-
8/9/2019 Roschelle Updated
32/234
"ava version 6is!atcher
while (!Thread.interrupted()) {
selector.select() ;
Set selected =selector.selectedKeys();
Iterator it =selected.iterator();
while (it.hasNext()) SelectionKey k = (SelectionKey)(it.next();
( (Runnable)
-
8/9/2019 Roschelle Updated
33/234
Handling reactor events is com!le
4=eed to maintain state
4Bu@ering 4 assemblingchun%s
4Coordinating async events
-
8/9/2019 Roschelle Updated
34/234
HTTP NIO FRAMWORKS
DO THE HEAVY LIFTING
-
8/9/2019 Roschelle Updated
35/234
=io libraries
4#ost of them are servers4=etty, griIIly, etc(
4A!ache #ina
4A!ache HTT com!onentsasyncclient
4=ing htt! client
-
8/9/2019 Roschelle Updated
36/234
4Client and server nio
library4Evolved from netty49atest release ctober
-
-
8/9/2019 Roschelle Updated
37/234
-
8/9/2019 Roschelle Updated
38/234
=io libraries
4#ost of them are servers4=etty, griIIly, etc
4A!ache #ina
4A!ache HTT com!onentsasyncclient
4=ing htt! client
-
8/9/2019 Roschelle Updated
39/234
-
8/9/2019 Roschelle Updated
40/234
=ing;s async htt! client
-
8/9/2019 Roschelle Updated
41/234
-
8/9/2019 Roschelle Updated
42/234
-
8/9/2019 Roschelle Updated
43/234
-
8/9/2019 Roschelle Updated
44/234
try ?AsyncHtt!Client asyncHtt!Client J newAsyncHtt!Client? 9istenable0utureL2es!onseM future J
asyncHtt!Client(!re!areGet? "http://oss.jfrog.org/api/system/ping" (e ecute? new AsyncCom!letionHandlerL2es!onseM? & verride public 2es!onse onCom!leted?2es!onseres!onse System( out (!rintln?res!onse(get2es!onseBody?
N return res!onse N
O & verride public void onThrowable?Throwable t t(!rintStac%Trace? N O
-
8/9/2019 Roschelle Updated
45/234
-
8/9/2019 Roschelle Updated
46/234
HAC Conce!ts
42e3uest !roducer4
2es!onse consumer
try (CloseableHttpAsyncClient asyncHttpClient = HttpAsyncClients. createDefault ()) {
-
8/9/2019 Roschelle Updated
47/234
asyncHttpClient.start();Future future = asyncHttpClient.execute(
HttpAsyncMethods.create et("http://oss.jfrog.org/api/system/ping" )!new AsyncByteConsumer() {
"#$errideprotected void onResponseRecei$ed(final HttpResponse response) {
%yste&.out .println(response.'et%tatus ine().'etReason hrase());*
"#$errideprotected void onByteReceived(final Char+u,,er bu,! final -#Control ioctrl) { *
"#$errideprotected void releaseResources() { *
"#$errideprotected HttpResponse buildResult( final HttpContext context) {return (HttpResponse) context.'etAttribute( "http.response" );
*
*! null );
HttpResponse response = future.get() ;*
-
8/9/2019 Roschelle Updated
48/234
-
8/9/2019 Roschelle Updated
49/234
Choosing between ning and htt!asyncclient
-
8/9/2019 Roschelle Updated
50/234
PAll !roblems in com!uterscience can be solved byanother level ofindirectionP 6avidWheeler
-
8/9/2019 Roschelle Updated
51/234
-
8/9/2019 Roschelle Updated
52/234
URL ENCODING?
-
8/9/2019 Roschelle Updated
53/234
Question:
What;s
wrongwith the
followingcode1
-
8/9/2019 Roschelle Updated
54/234
public static StringencodeDrl?String urlStr D29Encoder( encode ?urlStr, "UTF- " N
(((O
-
8/9/2019 Roschelle Updated
55/234
6ecoded D29s cannot bere encoded to the same form
http //exa& ple.co& /01uery= a2 b= = c
Cannot be decoded bac4 a,ter it 5 asencoded
http //exa& ple.co& /01uery= a6 78b= = c
6 t
http://example.com/?query=a&b==chttp://example.com/?query=a&b==chttp://example.com/?query=a&b==chttp://example.com/?query=a&b==chttp://example.com/?query=a&b==chttp://example.com/?query=a&b==chttp://example.com/?query=a&b==c -
8/9/2019 Roschelle Updated
56/234
6on;t use 'ava(net(D29Encoder
7Dtility class for HT#9 formencoding( This class contains static
methods for converting a String tothe application/x-www-form-urlencoded #>#E format(
0or more information about HT#9form encoding, consult the HT#9s!eci5cation(8
-
8/9/2019 Roschelle Updated
57/234
AHC Alternatives
or'.apache.http.client.utils.9 R-+uilder
or'.apache.http.client.utils.9 R :ncoded9 tils
-
8/9/2019 Roschelle Updated
58/234
-
8/9/2019 Roschelle Updated
59/234
Question:
How do >
close asoc%et
correctly1
H h d i b l
-
8/9/2019 Roschelle Updated
60/234
How hard can it be to close asoc%et1
-
8/9/2019 Roschelle Updated
61/234
The art of soc%et closing
htt!$))www(safariboo%sonline(com)library)view)htt! the
Half closed$ no new
-
8/9/2019 Roschelle Updated
62/234
Half closed$ no newcustomers
=ever bloc% in soc%et
-
8/9/2019 Roschelle Updated
63/234
=ever bloc% in soc%etclose?
The other side e !ects
you to clean u! nicely >t will give u! on time
out You will wait ?forever
I ALWAYS CLOSE
-
8/9/2019 Roschelle Updated
64/234
I ALWAYS CLOSE
CONNECTIONS
AND WHEN I DO IT, I USE
TRY-WITH-RESOURCES
-
8/9/2019 Roschelle Updated
65/234
2emember1
-
8/9/2019 Roschelle Updated
66/234
4 W i ! 5l
-
8/9/2019 Roschelle Updated
67/234
4 Write to se!arate 5les,
combine on 5nish4 Write to same 5le,
see%ing to the right!osition
WHY WONT YOU JUST U
-
8/9/2019 Roschelle Updated
68/234
WHY WON T YOU JUST U
JAVA IO RANDOMACCESSFIL
-
8/9/2019 Roschelle Updated
69/234
-
8/9/2019 Roschelle Updated
70/234
DSE 0ileChannel
>m!lements %ee4able+yteChannel
a$a.nio.channels. ileC hannel < w rite( a$a.nio.+yte+u,, er src! lon'position )
-
8/9/2019 Roschelle Updated
71/234
download !rogress trac%ing
!ersistent 0ile rogress>nfo Save the total siIe, shanfo
0ile art rogress>nfo
U
-
8/9/2019 Roschelle Updated
72/234
0ile 9oc%ing
-
8/9/2019 Roschelle Updated
73/234
0ile loc%ing 9evels
4V# level4 S level
-
8/9/2019 Roschelle Updated
74/234
S level 0ile loc%ing
#ulti!le downloader instanceswriting to the same 5le
=eeded for writing$ artial download 5le ersistent download !rogress
S 9evel 0ile 9oc%ing
-
8/9/2019 Roschelle Updated
75/234
File oc4 loc4 = ,i leChannel.try oc4(); // ! on"shared ( ! on'.M A>?@A 9 :!
false )if (loc4 = = null ) { throw new# $erlappin'File oc4:xception();
* return loc4;*
S 9evel 0ile 9oc%ing E clusive
S 9evel 0ile 9oc%ing 4
-
8/9/2019 Roschelle Updated
76/234
private File oc4 loc4(FileChannel ,i leChannel) throw s-# :xception {
File oc4 loc4 = ,i leChannel.try oc4( on'. M A X _VA LU EB! B! false );
if (loc4 = = null ) { throw new # $erlappin'File oc4:xception();
* return loc4;*
S 9evel 0ile 9oc%ing 4Advisory e clusive
WT01:
-
8/9/2019 Roschelle Updated
77/234
V# 9evel 0ile 9oc%ing
WHY DO YOU NEEDLOCKS
IF YOU WRITE TO
DIFFERENT PARTS OF
-
8/9/2019 Roschelle Updated
78/234
V# 9evel 0ile 9oc%ing
4 revent same V# threads writing tothe 5le when we started closing it
4Closing se3uence$42elease 5le loc%s4Close channels42ename a 5le to it s 5nal name
?remove (!art4Erase !rogress info
-
8/9/2019 Roschelle Updated
79/234
V# 9evel 0ile 9oc%ingReentrantRead rite oc4.Read oc4 w rite$o ile%oc& = r5 l.read oc4();ReentrantRead rite oc4. rite oc4 close ile%oc& =r5 l.5 rite oc4();
public $oid close() thro5 s -# :xception { this. close ile%oc&.loc& ();*
public int 5 rite(int part-ndex! +yte+u,, er bu,) { i, (Dthis. w rite$o ile%oc&.try%oc& ()) { thro5 ne5 -lle'al%tate:xception(EFile is bein'closedE); *
-
8/9/2019 Roschelle Updated
80/234
What;s ne t1
-
8/9/2019 Roschelle Updated
81/234
htt!)-
4 #ostly standardiIing Google s s!dy4 Header com!ression
4 multi!le ing4 rioritiIation4 Server !ush
4 n the way clear some stu@ 4 E(g( com!ressed content length
-
8/9/2019 Roschelle Updated
82/234
Ease the load
-
8/9/2019 Roschelle Updated
83/234
9in%s:
2T0#$ 20C -R
h
http://www.w3.org/Protocols/rfc2616http://www.amazon.com/HTTP-The-Definitive-Guide-Guides/dp/1565925092http://www.safaribooksonline.com/library/view/http-the-definitive/1565925092/http://jeewanthad.blogspot.co.il/2013/02/reactor-pattern-explained-part-1.htmlhttp://gee.cs.oswego.edu/dl/cpjslides/nio.pdfhttp://gee.cs.oswego.edu/dl/cpjslides/nio.pdfhttp://jeewanthad.blogspot.co.il/2013/02/reactor-pattern-explained-part-1.htmlhttp://www.safaribooksonline.com/library/view/http-the-definitive/1565925092/http://www.amazon.com/HTTP-The-Definitive-Guide-Guides/dp/1565925092http://www.w3.org/Protocols/rfc2616 -
8/9/2019 Roschelle Updated
84/234
=o, Than% you:
-
8/9/2019 Roschelle Updated
85/234
A Quic% Tourof Logos
The 9ogical A!!eal
-
8/9/2019 Roschelle Updated
86/234
So what e actly is logic1 Whocares1>nformally, logic is about saying things that ma&esense. You can thin% of it in that way if you li%e(
7>t s !retty sunny today, so you should wear sunscreen(8
0ormally, logic is the art of arguing 4not li%e a 5ght or debate, but by
using the information we already%now to draw new and usefulconclusions(7>f it s sunny today, you should wear sunscreen(
>ndeed it is sunny today( Therefore, you should wear sunscreen(8
-
8/9/2019 Roschelle Updated
87/234
7But wait( That 'ust loo%ed li%e the
e act same thing you said before,you hac%( 8
ell, yes( But that s how an argument loo%s in starm: You can brea% down any argument into thisat ma%es it easier to thin% about(
>f it s sunny today, you should wear sunscre
>t is sunny today( XXXXXXXXXXXXXXXXXXXXXXXXXXXX
Therefore, you should wear sunscreen(
remises)givens
Conclusion? remises always come 5rst, and the conclusion always come
-
8/9/2019 Roschelle Updated
88/234
How about a more com!leargument1
t also has seeds(
/( >f a fruit is fuIIy, it s either a %iwi or a !each(+( eaches have a !itN they don t have seeds(
.( So the fruit can t be a !each(R( So the fruit must be a %iwi(
Which of the above sentences is a conclusion
-
8/9/2019 Roschelle Updated
89/234
How about a more com!leargument1
t also has seeds(
/( >f a fruit is fuIIy, it s either a %iwi or a !each(+( eaches have a !itN they don t have seeds(
.( So the fruit can t be a !each(R( So the fruit must be a %iwi(
Good logic lets us cobble together lots of di@erent !ieces of information, and tell from
them what s probably or defnitely true.
-
8/9/2019 Roschelle Updated
90/234
-
8/9/2019 Roschelle Updated
91/234
But what counts as 7good logic81
Some !eo!le have fallen o@ cli@s and lived(
erefore, if > 'um! o@ this cli@, > will de5nitely be
7Comeon(Whatcould!ossibly
-
8/9/2019 Roschelle Updated
92/234
But what counts as 7good logic81
Some !eo!le have fallen o@ cli@s and lived(
erefore, if > 'um! o@ this cli@, > will de5nitely be
his argument is wea%( Although the !remise is ts easy to thin% of ways ?very !ainful ways that
nclusion could be false( The easiest way to s!ogic is to do 'ust that$ try to thin% of another wa
hiloso!hers call these counterexamples (
-
8/9/2019 Roschelle Updated
93/234
But what counts as 7good logic81
9et s loo% at two %inds ofarguments(
'. 6eductive reasoning$ All interns can breathe 5re( Sohili! can breathe 5re(
>s there a !iece of the !uIIle missing1
-
8/9/2019 Roschelle Updated
94/234
But what counts as 7good logic81
9et s loo% at two %inds of arguments('. 6eductive reasoning$
All interns can breathe 5re( hili!is an intern( So hili! canbreathe 5re(
ometimes you may encounter 7hidden8 statemnd ideas, which the writer snea%s in but doesn ty outright(
-
8/9/2019 Roschelle Updated
95/234
-
8/9/2019 Roschelle Updated
96/234
But what counts as 7good logic81
9et s loo% at two %inds of arguments((. >nductive reasoning$
> touched a stove and it burned me( > did this
5fty times, and the same thing ha!!ened( Sothene t time > touch the stove, it will burn me(
Are the !remises true1>f so, then the conclusion s
probably true( There mightstill be e ce!tions(
9>KE WHAT1
-
8/9/2019 Roschelle Updated
97/234
How is this useful to me1
9i%e #r( #organ said, the ability toma%e strong logical arguments willbecome more and more im!ortantlater on in high school and college(
athos and ethos are still valuable:But your audience will be a lot betterat 3uestioning them( 9ogos is handybecause, if you use it well, it can t
-
8/9/2019 Roschelle Updated
98/234
-
8/9/2019 Roschelle Updated
99/234
What time is it1Adven wait, no( Activity time:
air o@ into grou!s of four( Each grou! will receive an e amf a !oor argument ?these may be either inductive or deduc
ith your grou!, you will have . minutes to try to come u!ne countere)ample one way in which the argumentould be wrong, even if the !remises are de5nitely true(
o%e it full of holes:lso, choose a grou! re!resentative to tell us your reasonin
>t s K to imagine unli%ely or weird e !lanationsN
on t be afraid to thin% outside the bo (
-
8/9/2019 Roschelle Updated
100/234
-
8/9/2019 Roschelle Updated
101/234
*ohn +eats
-
8/9/2019 Roschelle Updated
102/234
PTo ,utumn P is a !oem by English2omantic !oet "ohn Keats ?/< ctober
< . 4 -/ 0ebruary < -< (
http://en.wikipedia.org/wiki/Poetryhttp://en.wikipedia.org/wiki/Romanticismhttp://en.wikipedia.org/wiki/John_Keatshttp://en.wikipedia.org/wiki/John_Keatshttp://en.wikipedia.org/wiki/Romanticismhttp://en.wikipedia.org/wiki/Poetry -
8/9/2019 Roschelle Updated
103/234
-
8/9/2019 Roschelle Updated
104/234
PTo AutumnP is a !oem of three stanIas, each of elevenlines( Written in < < , the structure is that of an odal hymn, having three clearly de5ned sections corres!onding to the
Classical divisions of stro!he , antistro!he , and e!ode
http://en.wikipedia.org/wiki/Ode#English_odehttp://en.wikipedia.org/wiki/Ode#English_odehttp://en.wikipedia.org/wiki/Strophehttp://en.wikipedia.org/wiki/Antistrophehttp://en.wikipedia.org/wiki/Epodehttp://en.wikipedia.org/wiki/Epodehttp://en.wikipedia.org/wiki/Antistrophehttp://en.wikipedia.org/wiki/Strophehttp://en.wikipedia.org/wiki/Ode#English_odehttp://en.wikipedia.org/wiki/Ode#English_ode -
8/9/2019 Roschelle Updated
105/234
The imagery is richly achieved throughthe !ersoni5cation of Autumn
http://en.wikipedia.org/wiki/Personificationhttp://en.wikipedia.org/wiki/Personification -
8/9/2019 Roschelle Updated
106/234
!oem
Season of mists and mellow
-
8/9/2019 Roschelle Updated
107/234
fruitfulness,
-
8/9/2019 Roschelle Updated
108/234
lose bosom-friend of thematuring sun
-
8/9/2019 Roschelle Updated
109/234
ith fruit the vines that roundthe thatch-eves run
-
8/9/2019 Roschelle Updated
110/234
To bend with a!!les the moss d
-
8/9/2019 Roschelle Updated
111/234
cottage trees ,
,nd $ll all fruit withripeness to the core
-
8/9/2019 Roschelle Updated
112/234
ripeness to the core
To swell the gourd, and !lum! thehaIel shells
-
8/9/2019 Roschelle Updated
113/234
haIel shells
With a sweet %ernelN to set
-
8/9/2019 Roschelle Updated
114/234
budding more,
And still more, later *owers for
-
8/9/2019 Roschelle Updated
115/234
the bees,
Dntil they thin% warm days will
-
8/9/2019 Roschelle Updated
116/234
never cease,
-
8/9/2019 Roschelle Updated
117/234
Who hath not seen thee oft amidh
-
8/9/2019 Roschelle Updated
118/234
thy store 1
Sometimes whoever see%sb d 5 d
-
8/9/2019 Roschelle Updated
119/234
abroad may 5nd
Thee sitting careless on a granary
-
8/9/2019 Roschelle Updated
120/234
*oor,
Thy hair soft lifted by thed
-
8/9/2019 Roschelle Updated
121/234
winnowing wind
-
8/9/2019 Roschelle Updated
122/234
6rowsed with the fume of !o!!ies, whileth h %
-
8/9/2019 Roschelle Updated
123/234
thy hoo%
-
8/9/2019 Roschelle Updated
124/234
And sometimes li%e a gleaner thoud % !
-
8/9/2019 Roschelle Updated
125/234
dost %ee!
Steady thy laden head across ab %N
-
8/9/2019 Roschelle Updated
126/234
broo%N
3patient loo&3
-
8/9/2019 Roschelle Updated
127/234
Thou watchest the last ooIings,hours by hours(
-
8/9/2019 Roschelle Updated
128/234
hours by hours(
Where are the songs of S!ring1 Ay,where are they1
-
8/9/2019 Roschelle Updated
129/234
where are they1
Thin% not of them, thou hast thyi t [
-
8/9/2019 Roschelle Updated
130/234
music too,[
While barrZd clouds bloom the softdying day
-
8/9/2019 Roschelle Updated
131/234
dying day
And touch the stubble !lains withrosy hueN
-
8/9/2019 Roschelle Updated
132/234
en n a wa u c o r e smagnats mourn
-
8/9/2019 Roschelle Updated
133/234
-sallows3 borne aloft
-
8/9/2019 Roschelle Updated
134/234
r sin&ing as the light windives or dies
-
8/9/2019 Roschelle Updated
135/234
ives or diessin%ing
-
8/9/2019 Roschelle Updated
136/234
edge cric%ets singN and now withreble soft
-
8/9/2019 Roschelle Updated
137/234
reble soft
The redbreast whistles from a gardencroftN
-
8/9/2019 Roschelle Updated
138/234
An gat er ng swa ows tw tter n t es%ies(
-
8/9/2019 Roschelle Updated
139/234
-
8/9/2019 Roschelle Updated
140/234
-
8/9/2019 Roschelle Updated
141/234
lose bosom-friend of thematuring sun
onspiring with him how to load andbless
-
8/9/2019 Roschelle Updated
142/234
ith fruit the vines that round the thatch-eves run
-
8/9/2019 Roschelle Updated
143/234
To bend with a!!les the moss d cottagetrees
-
8/9/2019 Roschelle Updated
144/234
trees ,
,nd $ll all fruit with ripeness to the core
-
8/9/2019 Roschelle Updated
145/234
To swell the gourd, and !lum! thehaIel shells
-
8/9/2019 Roschelle Updated
146/234
With a sweet %ernelN to set buddingmore
-
8/9/2019 Roschelle Updated
147/234
more,
And still more, later *owers for thebees
-
8/9/2019 Roschelle Updated
148/234
bees,
Dntil they thin% warm days will nevercease,
-
8/9/2019 Roschelle Updated
149/234
cease,
For 0ummer has o1er-brimm1d theirclammy cells.
-
8/9/2019 Roschelle Updated
150/234
Who hath not seen thee oft amid thystore 1
-
8/9/2019 Roschelle Updated
151/234
store 1
Sometimes whoever see%s abroadmay 5nd
-
8/9/2019 Roschelle Updated
152/234
Thee sitting careless on a granary*oor,
-
8/9/2019 Roschelle Updated
153/234
oor,
Thy hair soft lifted by the winnowingwind
-
8/9/2019 Roschelle Updated
154/234
w d
r on a half rea!;d furrow soundaslee!,
-
8/9/2019 Roschelle Updated
155/234
,
6rowsed with the fume of !o!!ies, while thyhoo%
-
8/9/2019 Roschelle Updated
156/234
S!ares the ne t swath and all itstwinZd *owers$
-
8/9/2019 Roschelle Updated
157/234
And sometimes li%e a gleaner thoudost %ee!
-
8/9/2019 Roschelle Updated
158/234
Steady thy laden head across abroo%N
-
8/9/2019 Roschelle Updated
159/234
- 3patient loo&3
-
8/9/2019 Roschelle Updated
160/234
Thou watchest the last ooIings, hoursby hours(
-
8/9/2019 Roschelle Updated
161/234
Where are the songs of S!ring1 Ay, whereare they1
-
8/9/2019 Roschelle Updated
162/234
Thin% not of them, thou hast thy musictoo,[
-
8/9/2019 Roschelle Updated
163/234
While barrZd clouds bloom the softdying day
-
8/9/2019 Roschelle Updated
164/234
And touch the stubble !lains withrosy hueN
-
8/9/2019 Roschelle Updated
165/234
en n a wa u c o r e sma gna smourn
-
8/9/2019 Roschelle Updated
166/234
-
8/9/2019 Roschelle Updated
167/234
r sin&ing as the light windives or dies
-
8/9/2019 Roschelle Updated
168/234
sin%ing
And full grown lambs loud bleat from hillybournN
-
8/9/2019 Roschelle Updated
169/234
edge cric%ets singN and now with trebloft
-
8/9/2019 Roschelle Updated
170/234
The redbreast whistles from a gardencroftN
-
8/9/2019 Roschelle Updated
171/234
-
8/9/2019 Roschelle Updated
172/234
-
8/9/2019 Roschelle Updated
173/234
-
8/9/2019 Roschelle Updated
174/234
Element 0ormulation by VirtualWor%
-
8/9/2019 Roschelle Updated
175/234
Dse virtual wor% to derive elementsti@ness matri based on assumeddis!lacements
rinci!le of virtual wor% states that if ageneral structure that is in e3uilibriumwith its a!!lied forces deforms due to aset of small com!atible virtual
dis!lacements, the virtual wor% done ise3ual to its virtual strain energy ofinternal stresses(
-
8/9/2019 Roschelle Updated
176/234
At element level, Ue J ' e Ue J virtual strain energy of internal
stresses
' e J virtual wor% of e ternal forcesacting through virtual dis!lacements
-
8/9/2019 Roschelle Updated
177/234
We now assume a sim!le dis!lacementfunction to de5ne the dis!lacement ofevery material !oint in the element(
Dsually use low order !olynomials Here
u J a < \ a - x u is a ial dis!lacement a
-
8/9/2019 Roschelle Updated
178/234
The constants are found by im!osingthe %nown nodal dis!lacements u i, u ( at nodes i and (
u i ) a < * a - x iu ( ) a < * a - x (
u i, u ( are nodal dis!lacements x i, ( are nodal coordinates
-
8/9/2019 Roschelle Updated
179/234
letting x i J , x ( J L, we get a < J u i a - J ? u ( u i +)L
We can write
]=^ J matri of element sha!e functionsor inter!olation functions
d O J nodal dis!lacements
u x
L x L
u
u d
i
j
= =1 [ ]{ } N
[ ] [ ]N N N=
-
8/9/2019 Roschelle Updated
180/234
=
-
8/9/2019 Roschelle Updated
181/234
Strain is given by
where ]B^ is a matri relating strainto nodal dis!lacement ?matri of
derivatives of sha!e function
[ ] [ ]
du d[N]{d} [B]{d}
dx dx1
B 1 1L
= = =
=
-
8/9/2019 Roschelle Updated
182/234
=ow ) !, ) ) ! ]B^ d O E
Stress and strain are constant in amember
6e5ne internal virtual strain energyfor a set of virtual dis!lacements
d O to beT
e! " # d =
-
8/9/2019 Roschelle Updated
183/234
- J virtual strain- J stress level at e3uilibrium d- J volume
Virtual wor% of nodal forces is ' e J d O# O
Then, virtual wor% is given by
( ) { } { }T Td$ d % =
Substituting and rearranging gives
-
8/9/2019 Roschelle Updated
184/234
Substituting and rearranging gives
Canceling d O# gives ]%^ d OJ / Owhere
0or thermal !roblem
( ) ( )T ToT T T T T
o
[B]{ d} &[B]{d} & d { d} {% }
{ d} [B] &[B]{d}d { d} [B] & d$ { d} {% }
= = +
[ ] [ ] [ ]' B B= T V E dV
{ } { } o 1( % &) 1 = +
oT =
-
8/9/2019 Roschelle Updated
185/234
for a truss we get
this formulation method also a!!liesto - d and / d elements
[ ]' =
EA
L
1 1
1 1
cedure for 6irect Sti@ness #ethod ?6is!lacement #eth
1. *is+retize into %inite elements, denti%y nodes, elements
-
8/9/2019 Roschelle Updated
186/234
and num-er them in order.
2. *e$elop element sti%%ness matri+es [ e] %or all theelements.
/. )ssem-le element sti%%ness matri+es to 0et the 0lo-alsti%%ness matrix "[ ] [ e]#. The size o% o% 0lo-alsti%%ness matrix total d.o.% o% the stru+ture in+ludin0 at
-oundary nodes. )ssem-ly is done -y mat+hin0 element
displa+ement 3ith 0lo-al displa+ements. )lso de$elopappropriate %or+e $e+tor "-y addin0 element %or+e $e+tors#su+h that e4uation o% the type [ ] {u} {(} is o-tained.
5. )pply 'inemati+ -oundary +onditions. 6ithout applyin0
rocedure for 6irect Sti@ness #ethod
-
8/9/2019 Roschelle Updated
187/234
)pp y y pp y -oundary +onditions, [ ] 3ill -e sin0ular. "minimumnum-er o% -oundary +onditions re4uired is to arrest 78i0idBody9 displa+ements#.
:. ;ol$e %or un'no3n displa+ements {u} " {u} [ ] n+e displa+ements are determined %ind
"a# rea+tions -y pi+'in0 up appropriate ro3s %rom thee4uation {(} [ ] {u}, "-# (ind element %or+es {%} [ e]{u e}, "+# &lement stresses 0i$en -y { e} [*][B]{u e}.
-
8/9/2019 Roschelle Updated
188/234
1 2 3
F1 , u 1F2, u 2 F
3, u
3
Boundary Conditionsu
1=0, u
2=0
-A, 9, E A, 9, E
-
8/9/2019 Roschelle Updated
189/234
[ ]2 ?2
)& ?2 2@1 ?1L
?1 1
=
-
8/9/2019 Roschelle Updated
190/234
-
8/9/2019 Roschelle Updated
191/234
2eactions
{ } [ ]
{ } [ ]
1
/
A)& PL 2P
( 2 ?2 A 1L /)& /
A
A)& PL P
( A ?1 1 1L /)& /
A
= =
= =
Element 0orces
f f&lement 1
-
8/9/2019 Roschelle Updated
192/234
A, 9, E
f < f -
-A, 9, E
A, 9, E
1 1
2 2
21
/2
% u1 ?12)&% ?1 1 uL
1 ?1 A 2p /2)& PL
?1 1 1 2p /L /)&&lement 2
u% 1 ?1)&u% ?1 1L
1 ?1)&
?1L
=
=
=
1 p /PL 1 A p //)&
=
2P/
2P/
P/
P/
-
8/9/2019 Roschelle Updated
193/234
-
8/9/2019 Roschelle Updated
194/234
-
8/9/2019 Roschelle Updated
195/234
-
8/9/2019 Roschelle Updated
196/234
u < u - u - u /
[ ] [ ]1 2
&lement 1 &lement 2
1 1 1 1)& )&
1 1 1 1L L = =
-
8/9/2019 Roschelle Updated
197/234
-
8/9/2019 Roschelle Updated
198/234
-
8/9/2019 Roschelle Updated
199/234
;tress in element 1
-
8/9/2019 Roschelle Updated
200/234
1 11 1
2 2
5 22 1
2 22 2
/ /
5/ 2
u u1 1& &B &u uL L
u u 1.: A & 2.A 1A 2AAN mm
L 1:A;tress in element 2
u u1 1& &B &
u uL Lu u 1.2 1.:
& 2.A 1AL 1:A
= = = = =
= = =
= = 25AN mm
6irect Element 0ormulation
-
8/9/2019 Roschelle Updated
201/234
truss element acts li%e < d s!ring l MM transverse dimensions !inned connection to other members
?only a ial loading ( usually constant cross section and
modulus of elasticity
-
8/9/2019 Roschelle Updated
202/234
A J cross section area ! J modulus of elasticity L J length
k AE
L=
-
8/9/2019 Roschelle Updated
203/234
Assume dis!lacements are muchsmaller than overall geometry vertical dis!lacements of horiIontal
member !roduce no vertical force Sti@ness matri is written in local
element coordinates aligned alongelement a is
want sti@ness matri for arbitraryorientation
-
8/9/2019 Roschelle Updated
204/234
rotate coordinate systems usingrotation matri ]2^ dis!lacement com!onents in global
coordinates are related todis!lacement com!onents in localcoordinates by d OJ]2^ d O d O J dis!lacement in global
coordinates d;O J dis!lacement in local elementcoordinates
AE
y
i jui ui
vi v j
pi
P j
i j
-
8/9/2019 Roschelle Updated
205/234
L
x
i u ip i
st
' A
1 +olumn '
A
=
rd
'
A/ +olumn
'
A
=
A
-
8/9/2019 Roschelle Updated
206/234
th A5 +olumnA
A
=
nd
A
A2 +olumn
A
A
=
-
8/9/2019 Roschelle Updated
207/234
start with member on x a is, elemente3uations are
or %;O d;OJ f;O =ote that y e3uations are all Iero
i i
i i
C C
C C
u D p D' A ' A$ D 4 DA A A A
u D pD' A ' A$ D 4 DA A A A
=
xy yp j u j
v j
j
-
8/9/2019 Roschelle Updated
208/234
pi ui
x
i
vi
i i i i i i
i i i i i i
at node iu D u +os" # $ sin" # p D p +os" # 4 sin" #$ D u sin" # $ +os" # 4 D 4 sin" # 4 +os" #
= + = + = + = +
At node i
-
8/9/2019 Roschelle Updated
209/234
A similar matri can be obtained at node '
i i
i i
u D u+os sin$ D sin +os $
= i i
i i
pD p+os sin4 D sin +os 4
=
i i
i i
C C
C
u D u+os sin A A$ D $sin +os A Au D u A A +os sin
A A sin +os$ D
= C$
-
8/9/2019 Roschelle Updated
210/234
#atri ]2^ is$+os sin
sin +os
+os sin
sin +os
A A
A A
A A
A A
A A
A A
A A
A A
=
c s
s c
c s
s c
-
8/9/2019 Roschelle Updated
211/234
Similarly , force com!onents arerelated by O J ]2^ O 9ocal force dis!lacement relation is
]%;^ d;O J f;O global force dis!lacement relation is]%^]2^ d O J ]2^ O
using fact that ]2^
top related