sábado, julho 24, 2004

Capito de um livro de uml

rferrante.tripod.com/blogg/ch03.pdf
O link não deve funcionar direto precisa copiar e colar na url do browser

Link UML

http://www.smartdraw.com/resources/centers/uml/uml.htm

quinta-feira, julho 22, 2004

Tabela de caracteres especiais de HTML

18. Tabela de caracteres especiais

O conjunto completo de cracteres iso-8859-1 (comimente chamado de latin-1) é suportado pelo html. Esses caracteres são usados em varias línguas latinas. Entretanto, em função de diferenças nos caracteres suportados por cada teclado, a maioria não pode ser digitada diretamente no documento html. Porisso o html suporta dois mecanismos para a inserção destes caracteres especiais. Todos os caracteres podem ser inseridos em um documento html, referenciando através de seu número no conjunto iso-8859-1 ou usando um nome mais fácil de ser lembrado :

Ó and ó

both reference the same character - Ó - but generally the ó would be easier to remember.

the table below lists all of the iso-8859-1 character set, together with their numeric entity reference and where supported, the named entity reference.

numbernamedescriptionappearance
�--unused-
	-horizontal tabspace

-line feedspace
--unused-
 -spacespace
!-exclamation mark!
""quotation mark"
#-number sign#
$-dollar sign$
%-percent sign%
&&ampersand&
'-apostrophe'
(-left parenthesis(
)-right parenthesis)
*-asterisk*
+-plus sign+
,-comma,
--hyphen-
.-period (full stop).
/-solidus (slash)/
0-9-digits (0-9)0 - 9
:-colon:
&#59;-semi-colon;
&#60;&lt;less than<
&#61;-equals sign=
&#62;&gt;greater than>
&#63;-question mark?
&#64;-commercial at@
&#65;-&#90;-upper case a-za - z
&#91;-left square bracket[
&#92;-reverse solidus (backslash)\
&#93;-right square bracket]
&#94;-caret^
&#95;-horizontal bar_
&#96;-acute accent`
&#97;-&#122;-lower case a-za - z
&#123;-left curly brace{
&#124;-vertical bar|
&#125;-right curly brace}
&#126;-tilde~
&#127;-&#159;-unused-
&#160;&nbsp;non-breaking space 
&#161;&iexcl;inverted exclamation¡
&#162;&cent;cent sign¢
&#163;&pound;pound sterling sign£
&#164;&curren;general currency sign¤
&#165;&yen;yen sign¥
&#166;&brvbar;broken vertical bar¦
&#167;&sect;section sign§
&#168;&uml;umlaut (dierisis)¨
&#169;&copy;copyright©
&#170;&ordf;feminine ordinalª
&#171;&laquo;left angle quote, guillemot left«
&#172;&not;not sign¬
&#173;&shy;soft hyphen­
&#174;&reg;registered trademark®
&#175;&macr;macron accent¯
&#176;&deg;degree sign°
&#177;&plusmn;plus or minus±
&#178;&sup2;superscript two²
&#179;&sup3;superscript three³
&#180;&acute;acute accent´
&#181;&micro;micro signµ
&#182;&para;paragraph sign¶
&#183;&middot;middle dot·
&#184;&cedil;cedilla¸
&#185;&sup1;superscript one¹
&#186;&ordm;masculine ordinalº
&#187;&raquo;right angle quote, guillemot right»
&#188;&frac14;fraction (one quarter)¼
&#189;&frac12;fraction (one half)½
&#190;&frac34;fraction (three quarters)¾
&#191;&iquest;inverted question mark¿
&#192;&agrave;capital a, grave accentÀ
&#193;&aacute;capital a, acute accent�
&#194;&acirc;capital a, circumflex accentÂ
&#195;&atilde;capital a, tildeÃ
&#196;&auml;capital a, umlaut (dierisis)Ä
&#197;&aring;capital a, ringÃ…
&#198;&aelig;capital ae dipthong (ligature)Æ
&#199;&ccedil;capital c, cedillaÇ
&#200;&egrave;capital e, grave accentÈ
&#201;&eacute;capita e, acute accentÉ
&#202;&eirc;capital e, circumflex accentÊ
&#203;&euml;capital e, umlaut (dierisis)Ë
&#204;&igrave;capital i, grave accentÌ
&#205;&iacute;capital i, acute accent�
&#206;&icirc;capital i, circumflex accentÃŽ
&#207;&iuml;capital i, umlaut (dierisis)�
&#208;&eth;capital eth, icelandic�
&#209;&ntilde;capital n, tildeÑ
&#210;&ograve;capital o, grave accentÃ’
&#211;&oacutecapital o, acute accentÓ
&#212;&ocirc;capital o, circumflex accentÔ
&#213;&otilde;capital o, tildeÕ
&#214;&ouml;capital o, umlaut (dierisis)Ö
&#215;&times;multiply sign×
&#216;&oslash;capital o, slashØ
&#217;&ugravecapital u, grave accentÙ
&#218;&uacute;capital u, acute accentÚ
&#219;&ucirc;capital u, circumflex accentÛ
&#220;&uuml;capital u, umlaut (dierisis)Ü
&#221;&yacute;capital y, acute accent�
&#222;&thorn;capital thorn, icelandicÞ
&#223;&szlig;small sharp s, german (sz ligature)ß
&#224;&agrave;small a, grave accentà
&#225;&aacute;small a, acute accentá
&#226;&acirc;small a, circumflex accentâ
&#227;&atilde;small a, tildeã
&#228;&aumlsmall a, umlaut (dierisis)ä
&#229;&aring;small a, ringå
&#230;&aelig;small ae dipthong (ligature)æ
&#231;&ccedil;small c, cedillaç
&#232;&egrave;small e, grave accentè
&#233;&eacute;small e, acute accenté
&#234;&ecirc;small e, circumflex accentê
&#235;&euml;small e, umlaut (dierisis)ë
&#236;&igrave;small i, grave accentì
&#237;&iacute;small i, acute accentí
&#238;&icirc;small i, circumflex accentî
&#239;&iuml;small i, umlaut (dierisis)ï
&#240;&eth;small eth, icelandicð
&#241;&ntilde;small n, tildeñ
&#242;&ograve;small o, grave accentò
&#243;&oacute;small o, acute accentó
&#244;&ocirc;small o, circumflex accentô
&#245;&otilde;small o, tildeõ
&#246;&ouml;small o, umlaut (dierisis)ö
&#247;&divide;division sign÷
&#248;&oslash;small o, slashø
&#249;&ugrave;small u, grave accentù
&#250;&uacute;small u, acute accentú
&#251;&ucirc;small u, circumflex accentû
&#252;&uuml;small u, umlaut (dierisis)ü
&#253;&yacute;small y, acute accentý
&#254;&thorn;small thorn, icelandicþ
&#255;&yuml;small y, umlaut (dierisis)ÿ
&#338;&oelig;latin capital oe (ligature)Œ
&#339;&oelig;latin small oe (ligature)œ
&#352;&scaron;capital s with caronŠ
&#353;&scaron;small s with caronš
&#376;&yuml;capital y with dierisisŸ
&#710;&circ;circumflex accentˆ
&#732;&tilde;small tilde˜
&#8211;&ndash;en dash–
&#8212;&mdash;em dash—
&#8216;&lsquo;left single quotation mark‘
&#8217;&rsquo;right single quotation markÂ’
&#8218;&sbquo;single low-9 quotation mark‚
&#8220;&ldquo;left double quotation mark“
&#8221;&rdquo;right double quotation mark”
&#8222;&bdquo;double low-9 quotation mark„
&#8224;&dagger;dagger†
&#8225;&dagger;double dagger‡
&#8240;&permil;per mille (thousand) sign‰
&#8249;&lsaquo;single left-pointing angle quotation mark‹
&#8250;&rsaquo;single right-pointing angle quotation mark›
&#8364;&euro;euro sign*€

* = only the numeric character reference (i.e. &#8364;) is supported at the time of writing.

the following character references are largely unsupported at the time of writing, but are included in the html 4.0 specification. as both netscape and microsoft have pledged to support the full html 4.0 standard, their support can be expected.

numbernamedescriptionappearance
&#402;&fnof;florin (latin small f with hook)ƒ
&#913;&alpha;greek capital alphaΑ
&#914;&beta;greek capital betaΒ
&#915;&gamma;greek capital gammaΓ
&#916;&delta;greek capital deltaΔ
&#917;&epsilon;greek capital epsilonΕ
&#918;&zeta;greek capital zetaΖ
&#919;&eta;greek capital etaΗ
&#920;&theta;greek capital thetaΘ
&#921;&iota;greek capital iotaΙ
&#922;&kappa;greek capital kappaΚ
&#923;&lambda;greek capital lambdaΛ
&#924;&mu;greek capital muΜ
&#925;&nu;greek capital nuΝ
&#926;&xi;greek capital xiΞ
&#927;&omicron;greek capital omicronΟ
&#928;&pi;greek capital piΠ
&#929;&rho;greek capital rhoΡ
&#931;&sigma;greek capital sigmaΣ
&#932;&tau;greek capital tauΤ
&#933;&upsilon;greek capital upsilonΥ
&#934;&phi;greek capital phiΦ
&#935;&chi;greek capital chiΧ
&#936;&psi;greek capital psiΨ
&#937;&omega;greek capital omegaΩ
&#945;&alpha;greek small alphaα
&#946;&beta;greek small betaβ
&#947;&gamma;greek small gammaγ
&#948;&delta;greek small deltaδ
&#949;&epsilon;greek small epsilonε
&#950;&zeta;greek small zetaζ
&#951;&eta;greek small etaη
&#952;&theta;greek small thetaθ
&#953;&iota;greek small iotaι
&#954;&kappa;greek small kappaκ
&#955;&lambda;greek small lambdaλ
&#956;&mu;greek small muμ
&#957;&nu;greek small nuν
&#958;&xi;greek small xiξ
&#959;&omicron;greek small omicronο
&#960;&pi;greek small piπ
&#961;&rho;greek small rhoρ
&#962;&sigma;greek small final sigmaς
&#963;&sigma;greek small sigmaσ
&#964;&tau;greek small tauτ
&#965;&upsilon;greek small upsilonυ
&#966;&phi;greek small phiφ
&#967;&chi;greek small chiχ
&#968;&psi;greek small psiψ
&#969;&omega;greek small omegaω
&#977;&thetasym;greek theta symbolϑ
&#978;&upsih;greek upsilon with hookϒ
&#982;&piv;greek pi symbolϖ
&#8194;&ensp;en space
&#8195;&emsp;em space
&#8201;&thinsp;thin space
&#8204;&zwnj;zero width non-joiner
&#8205;&zwj;zero width joiner
&#8206;&lrm;left-to-right mark
&#8207;&rlm;right-to-left mark
&#8226;&bull;small black circle•
&#8230;&hellip;horizontal ellipsisÂ…
&#8242;&prime;prime = minutes = feet
&#8254;&oline;overline = spacing overscore
&#8260;&frasl;fraction slash
&#8472;&weierp;script capital p = weierstrass p
&#8465;&image;blackletter capital i (imaginary part)
&#8476;&real;blackletter capital r (real part)
&#8482;&trade;trademark symbol™
&#8501;&alefsym;alef symbol = first transfinite
&#8592;&larr;leftwards arrow
&#8593;&uarr;upwards arrow
&#8594;&rarr;rightwards arrow
&#8595;&darr;downwards arrow
&#8596;&harr;left right arrow
&#8629;&crarr;donwards arrow with corner leftwards
&#8656;&larr;leftwards double arrow
&#8657;&uarr;upwards double arrow
&#8658;&rarr;rightwards double arrow
&#8659;&darr;downwards double arrow
&#8660;&harr;left right double arrow
&#8704;&forall;for all
&#8706;&part;partial differential
&#8707;&exist;there exists
&#8709;&empty;empty set
&#8711;&nabla;nabla = backward difference
&#8712;&isn;element of...
&#8713;&notin;not an elementof
&#8715;&ni;contains as member
&#8719;&prod;n-ary product = product sign
&#8721;&sum;n-ary summation
&#8722;&minus;minus sign
&#8730;&radic;square root = radical sign
&#8733;&prop;proportional to
&#8734;&infin;infinity symbol
&#8736;&ang;angle
&#8743;&and;logical and = wedge
&#8744;&or;logical or = vee
&#8745;&cap;intersection
&#8746;&cup;union = cup
&#8747;&int;integral
&#8756;&there4;therefore
&#8764;&sim;tilde operator
&#8773;&cong;approximately equal to
&#8776;&asymp;almost equal to = asymptotic
&#8800;&ne;not equal to
&#8801;&equiv;identical to
&#8804;&le;less than or euqal to
&#8805;&ge;greater than or equal to
&#8834;&sub;subset of
&#8835;&sup;superset of
&#8836;&nsub;not a subset of
&#8838;&sube;subset of or equal to
&#8839;&supe;superset of or equal to
&#8853;&oplus;circle plus
&#8855;&otimes;circled times
&#8869;&perp;othogonal = perpendicular to
&#8901;&sdot;dot operator
&#8968;&lceil;left ceiling
&#8969;&rceil;right ceiling
&#8970;&lfloor;left floor
&#8971;&rfloor;right floor
&#9001;&lang;left pointing angle bracket
&#9002;&rang;right pointing angle bracket
&#9674;&loz;lozenge
&#9824;&spades;black spade suit
&#9827;&clubs;black clubs suit
&#9829;&hearts;black hearts suit
&#9830;&diams;black diamonds suit


domingo, julho 18, 2004

como desligar o hd no linux... (standby) hdparm

hrparm -Y /dev/hda por exemplo faz o hd morrer existem outros parametros de economia de energia, tipo hrparm -S1 /dev/hda faz ele entrar em standby em 5 segs...

sábado, julho 10, 2004

Artigo que trata de como balancear o tamanho das maquinas

Linux Load Average
Not Your Average Average1

Dr. Neil J. Gunther
Performance Dynamics Company SM
Castro Valley, California, USA
www.perfdynamics.com
Originally presented Sep 4, 2002
Updated by NJG Feb 21, 2003


In order to view the mathematical notations correctly, check here before continuing.



--------------------------------------------------------------------------------

What's This Talk About?

--------------------------------------------------------------------------------

Averages are important for performance analysis and capacity planning. There are many manifestations of averages e.g., arithmetic average (the usual one), moving average (used in financial forecasting), geometric average (used in the SPEC benchmarks), harmonic average (not used enough), and so on.

Other averages are taken over time i.e., time-dependent averages. A particular example of such a time-dependent average is the load average metric that appears in certain UNIX (and therefore Linux) commands. Have you ever wondered how those three little numbers are produced?

In this presentation, I shall start at the surface (the shell) and gradually submerge into the depths of the Linux kernel to find out how the Linux load average gets calculated.

Finally, I'll compare the load average with other averaging techniques used in performance analysis and capacity planning.



--------------------------------------------------------------------------------

What is the Load Average?

--------------------------------------------------------------------------------

Appears in the ASCII output of certain UNIX commands ...

[pax:~]% uptime
9:40am up 9 days, 10:36, 4 users, load average: 0.02, 0.01, 0.00
And on Linux systems ...

[pax:~]% procinfo
Linux 2.0.36 (root@pax) (gcc 2.7.2.3) #1 Wed Jul 25 21:40:16 EST 2001 [pax]

Memory: Total Used Free Shared Buffers Cached
Mem: 95564 90252 5312 31412 33104 26412
Swap: 68508 0 68508

Bootup: Sun Jul 21 15:21:15 2002 Load average: 0.15 0.03 0.01 2/58 8557
...
Three numbers: 1-, 5-, and 15-, minute averages of .... ?



--------------------------------------------------------------------------------

How the Guru's Define LOAD ...

--------------------------------------------------------------------------------

Man Pages (oops!)

[pax:~]% man "load average"
No manual entry for load average
Tim O'Reilly and Crew, p.726
The load average tries to measure the number of active processes at any time. As a measure of CPU utilization, the load average is simplistic, poorly defined, but far from useless.

Adrian Cockcroft, p.229

The load average is the sum of the run queue length and the number of jobs currently running on the CPUs. In Solaris 2.0 and 2.2 the load average did not include the running jobs but this bug was fixed in Solaris 2.3.



--------------------------------------------------------------------------------

Graphical Display of Load Average

--------------------------------------------------------------------------------

Can be displayed as a time series



like that produced by ORCA.



--------------------------------------------------------------------------------

What is an ``Average'' Load?

--------------------------------------------------------------------------------

Tim O'Reilly and Crew

What's high? ... Ideally, you'd like a load average under, say, 3, ... Ultimately, 'high' means high enough so that you don't need uptime to tell you that the system is overloaded.

... different systems will behave differently under the same load average. ... running a single cpu-bound background job .... can bring response to a crawl even though the load avg remains quite low.

Blair Zajac (ORCA Author)

If long term trends indicate increasing figures, more or faster CPUs will eventually be necessary unless load can be displaced. For ideal utilization of your CPU, the maximum value here should be equal to the number of CPUs in the box.

Some hedging because the load average is not your average kind of average. It's a time-dependent average ... a damped time-dependent average.

But you're a Linux expert and you knew this already. Right?
Let's find out ...




--------------------------------------------------------------------------------


``The LA Triplets'' Quiz

--------------------------------------------------------------------------------

Random Samples
In each of these samples:

A. load average: 6.85, 7.37, 7.83
B. load average: 8.50, 10.93, 8.61
C. load average: 37.34, 9.47, 3.30
is the load:

Increasing
Decreasing
Stationary
Can't decide
Sequential Samples
Here are some load averages monitored in sequence by sampling them over a 5 hour period (e.g., using the uptime command) at each of the times shown in the left-most column.

8:00am load average: 1.21 0.81 0.13
8:10am load average: 37.34 9.47 3.30
8:50am load average: 19.21 16.02 7.40
9:15am load average: 13.92 15.13 8.18
9:40am load average: 10.51 13.50 8.47
10:30am load average: 8.50 10.93 8.61
11:00am load average: 8.15 9.84 8.55
11:20am load average: 7.72 9.20 8.44
1:00pm load average: 6.85 7.37 7.83
Imagine a sysadm running the uptime command at those wall-clock times.
In which LA sample does maximum load occur?

LA sample taken at 9:15am
LA sample taken at 8:50am
LA sample taken at 11:00am
LA sample taken at 10:30am
Excluding the first LA sample at 8am, in which sample does least load occur?:

LA sample taken at 8:10am
LA sample taken at 11:20am
LA sample taken at 1:00pm
Visual Hints
Numeric triples are convenient for computers but hard on sysam's.
The following diagram shows the 10-minute load averages above graphically.




The 3 dots correspond to the 3 numeric LA values. The y-axis shows the load values and the x-axis shows a range of time between 1 and 15 minutes. The left-most point represents the 1-minute load average, the middle point represents the 5-minute load average and the right-most the 15-minute load average.

Here is an animation of the above sequence.



End of Quiz





--------------------------------------------------------------------------------

Simple Experiment

--------------------------------------------------------------------------------

Two hot-loops initiated in background on single-CPU Linux box. Two phases in the test over the course of 1 hour:

CPU pegged for 2100 seconds then processes killed.
CPU quiescent for the remaining 1500 seconds.
Perl script sampled load average every 5 minutes using uptime



--------------------------------------------------------------------------------

Experimental Results 2

--------------------------------------------------------------------------------




1-minute LA reaches a value of 2.0 after 300 seconds into the test
5-minute LA reaches 2.0 around 1200 seconds
15-minute LA would reach 2.0 at 4500 seconds (but processes killed at 2100 seconds)
(Resembles the charging/discharging of an RC circuit)



--------------------------------------------------------------------------------

Into the Depths ...

--------------------------------------------------------------------------------


http://lxr.linux.no/source/kernel/...

unsigned long avenrun[3];
624
625 static inline void calc_load(unsigned long ticks)
626 {
627 unsigned long active_tasks; /* fixed-point */
628 static int count = LOAD_FREQ;
629
630 count -= ticks;
631 if (count < 0) {
632 count += LOAD_FREQ;
633 active_tasks = count_active_tasks();
634 CALC_LOAD(avenrun[0], EXP_1, active_tasks);
635 CALC_LOAD(avenrun[1], EXP_5, active_tasks);
636 CALC_LOAD(avenrun[2], EXP_15, active_tasks);
637 }
638 }
The sampling interval of LOAD_FREQ is once every 5 HZ. How often is that?



--------------------------------------------------------------------------------

LA Sampling Interval

--------------------------------------------------------------------------------

Recall that:

1 HZ = 100 ticks
5 HZ = 500 ticks
Therefore:

1 tick = 10 milliseconds
500 ticks = 5000 milliseconds (or 5 seconds)
So 5 HZ means that CALC_LOAD is called every 5 seconds.

Don't confuse this period with the reporting periods {1-, 5-, 15-} minutes.



--------------------------------------------------------------------------------

LA Calculations

--------------------------------------------------------------------------------

CALC_LOAD is a C macro defined in this code fragment:

58 extern unsigned long avenrun[ ]; /* Load averages */
59
60 #define FSHIFT 11 /* nr of bits of precision */
61 #define FIXED_1 (1< 62 #define LOAD_FREQ (5*HZ) /* 5 sec intervals */
63 #define EXP_1 1884 /* 1/exp(5sec/1min) as fixed-point */
64 #define EXP_5 2014 /* 1/exp(5sec/5min) */
65 #define EXP_15 2037 /* 1/exp(5sec/15min) */
66
67 #define CALC_LOAD(load,exp,n) 68 load *= exp; 69 load += n*(FIXED_1-exp); 70 load >>= FSHIFT;
There are two points of interest here:

What does CALC_LOAD actually do?
What are the magic numbers: 1884, 2014, 2037?


--------------------------------------------------------------------------------

Fixed Point Factors

--------------------------------------------------------------------------------

Use 1-minute sampling as example. Conversion of exp(5/60) into base-2 with 11 bits of precision can be calculated as:

e5 / 60 ® e5 / 60
--------------------------------------------------------------------------------
211



But EXP_R represents the inverse function exp( - 5/60R).
Calculate magic numbers directly from the formula:

EXP_R = 211
--------------------------------------------------------------------------------
2 [(5 log2(e))/ 60R]



where R = {1-, 5-, 15-} minute reporting periods.


--------------------------------------------------------------------------------

Magic Numbers

--------------------------------------------------------------------------------

Magic numbers for 5-second sampling rate.

R
EXP_R
Rnd

1
1884.25
1884

5
2014.15
2014

15
2036.65
2037






which agree with the kernel comments ...
63 #define EXP_1 1884 /* 1/exp(5sec/1min) */
64 #define EXP_5 2014 /* 1/exp(5sec/5min) */
65 #define EXP_15 2037 /* 1/exp(5sec/15min) */
If the sampling rate was decreased to 2 second intervals...

R
EXP_R
Rnd

1
1980.86
1981

5
2034.39
2034

15
2043.45
2043








--------------------------------------------------------------------------------

What does CALC_LOAD do?

--------------------------------------------------------------------------------

Consider the 1-minute CALC_LOAD function:

67 #define CALC_LOAD(load,exp,n) 68 load *= exp; 69 load += n*(FIXED_1-exp); It's the fixed-point arithmetic version of:
load(t) = load(t-1) e-5/60R + n(t) (1 - e-5/60R)
(1)

where n(t) is number of active processes.


--------------------------------------------------------------------------------

Special Case: n(t) = 0

--------------------------------------------------------------------------------

Subsituting into eqn.(1) ...

load(t) = load(t-1) e-5t/60R
(2)





Eqn.(2) represents exponential decay of the type we saw in the experiments after 2100 seconds.


--------------------------------------------------------------------------------

Special Case: n(t) = 2



--------------------------------------------------------------------------------
Here, the second term dominates in eqn.(2):
load(t) = 2 load(t-1) (1 - e-5t/60R)
(3)




Eqn.(3) is monotonically increasing. Decay constant tRC_1 = 1 minute. Rise Time » 5 tRC_1 = 5 minutes (300 seconds).



--------------------------------------------------------------------------------

Exponential Smoothing/Filtering



--------------------------------------------------------------------------------
A general purpose way for prepping highly variable data.
Available in tools like EXCEL, R/S+, Mathematica.
General form of smoothed data is:



Y(t)
--------------------------------------------------------------------------------
smoothed
= Y(t-1) +

a
--------------------------------------------------------------------------------
damping
é
ë

X(t)
--------------------------------------------------------------------------------
raw
- Y(t-1) ù
û
(4)

By comparison the LA form is:

load(t) = load(t-1) + EXP_R [ n(t) - load(t-1) ]
(5)

Eqn.(5) is equivalent to (4) if EXP_R = 1 - a.


--------------------------------------------------------------------------------

Relation to Other Averages



--------------------------------------------------------------------------------
So, EXP_R plays the role of a damping factor in the UNIX LA.
Moving Average (MA) º Arithmetic average with lag-k (see shortly).

Load Average(LA) º Exponentially-damped MA (Exp-MA)


EXP_R
aR (damping)
1 - aR

EXP_1
0.0800 ( » 8%)
0.9200

EXP_5
0.0165 ( » 2%)
0.9835

EXP_15
0.0055 ( » 1%)
0.9945






where a = 1 - exp(-5/60R).



--------------------------------------------------------------------------------

Steady-State Averages



--------------------------------------------------------------------------------




Look at load over a long time (t ® ¥) and break the time series into set of columns.

Dt ¼ column width
Q(Dt) x Dt ¼ sub-area
åQ(Dt) x Dt ¼ total area
The time-averaged queue length: [(åQ(Dt) x Dt)/ T] ® Q



--------------------------------------------------------------------------------

Model of Run-Queue



--------------------------------------------------------------------------------
Steady-state averages:
N: running processes
Z: sleeping processes
X: thoughput
D: CPU service time (in Ticks)
R: total execution time



R
=
N
--------------------------------------------------------------------------------
X
- S (Response time)

Q
=
X R (Little¢s law)




This is the kind of model I used in my previous LUV talk (July 11,2000) in which I analyzed the average performance metrics associated with a fair-share scheduler.

The same kind of averages are used in my performance analyzer tool called Pretty Damn Quick.



--------------------------------------------------------------------------------

Hyper-growth Website Planning



--------------------------------------------------------------------------------
The problem:
What is the growth rate?
Forecast back-end capacity requirements
Published in: Performance Engineering: State of the Art and Current Trends, Springer Lecture Notes in Computer Science, 2001.

Download a copy from www.perfdynamics.com/papers.html



--------------------------------------------------------------------------------

The General Approach



--------------------------------------------------------------------------------

Sample time series data
Apply MA (or Exp-MA) to remove variance effects
Forecast using nonlinear regression
Scalability projections (See Refs. 1 & 2)


--------------------------------------------------------------------------------

Sample Time Series



--------------------------------------------------------------------------------
Total CPU utlilization on back-end server (E10K).



Data was collected using SE Toolkit/Percolator. Similar to OCRAlator.



--------------------------------------------------------------------------------

Apply Moving Averages



--------------------------------------------------------------------------------




--------------------------------------------------------------------------------

Projected Growth Rate



--------------------------------------------------------------------------------




Doubling time » 6 months!
Week 20 was Y2K.



--------------------------------------------------------------------------------

Quiz Solutions



--------------------------------------------------------------------------------

Here are the solutions to the quiz given earlier.
Time Series This is the original time series during the 300 minutes in which the samples were collected.




Load Averages A plot of the load averages over 300 minutes.




An Easier Way?
Just reverse the time axis. As described in the Visual Hints section of the quiz, the 3 dots correspond to the 3 numeric LA values and the y-axis shows the load values. But here, the x-axis shows a range of time between -15 and 0 minutes. The left-most point now represents the 15-minute load average, the middle point represents the 5-minute load average and the right-most the 1-minute load average. This representation more closely represents the trend in time.





Random Samples
Sample A: Decreasing
Sample B: Stationary
Sample C: Increasing

Sequential Samples
Maximum: 8:50 am
Minimum: 1:00 pm






--------------------------------------------------------------------------------

Further Reading

--------------------------------------------------------------------------------


N. J. Gunther, The Practical Performance Analyst, Print-On-Demand, iUniverse.com, Inc., Lincoln, Nebraska, 2000
N. J. Gunther, Performance and Scalability Models for a Hypergrowth e-Commerce Web Site, Performance Engineering: State of the Art and Current Trends, R. Dumke and C. Rautenstrauch and A. Schmietendorf and A. Scholz, # 2047, 267-282, Springer-Verlag, Heidelberg, 2001
J. Peek and T. O'Reilly and M. Loukides, UNIX Power Tools, 2nd edn., O'Reilly & Assoc. Inc., Sebastopol, California, 1997
D. P. Bovet and M. Cesati, Understanding the Linux Kernel, O'Reilly & Assoc. Inc., Sebastopol, California, 2001
A. Cockcroft and R. Pettit, Sun Performance and Tuning, 2nd., SunSoft Press, Mountain View, California, 1998


--------------------------------------------------------------------------------

Want to Know More?
--------------------------------------------------------------------------------

Guerrilla Capacity Planning

May, August 2003

Guerrilla Capacity Tools

November 2003

Then ... Go forth and Kong-ka!




--------------------------------------------------------------------------------

Footnotes:
1 Copyright © 2002 - 2003 Performance Dynamics Company. All Rights Reserved.

2 Thanks to Mirko Fluher for letting me use pax.apana.org.au



--------------------------------------------------------------------------------
File translated from TEX by TTH, version 2.25.
On 21 Feb 2003, 11:51.

sexta-feira, julho 09, 2004

datas

How to calculate date diferences.
 
import
java.util.Calendar;
import java.util.Date;

/*
* Filename: Test.java
* Creation date: 14-mar-2004
* Author: Kevin Pors
*/


/**
*
@author Kevin Pors
* @version 1.0
*/

public class Test
{
    public static void main(String[] args) {
        Date
now = new Date(); // right now.

      
Calendar c = Calendar.getInstance();
        c.setTime(now);
      
c.add(Calendar.HOUR, 1092);

        Date someDate = c.getTime();

  
    getDaysBetween(now, someDate);
    }

    public static
int getDaysBetween(Date dateOne, Date dateTwo) {
        long
milliseconds = dateTwo.getTime() - dateOne.getTime();
        if (milliseconds
< 0) {
            milliseconds = -milliseconds;
        }
       
        long seconds = milliseconds / 1000L;
        long minutes =
seconds / 60L;
        long hours = minutes / 60L;
        long
days = hours / 24L;

        System.out.println("Difference in milliseconds: " + milliseconds);
   
   System.out.println("Difference in seconds: " +
seconds);
        System.out.println("Difference in
minutes: "
+ minutes);
        System.out.println("Difference in hours: " + hours);
      
System.out.println("Difference in days: " +
days);

        return 0;
    }
}

dica struts checkbox

Answer

Many applications need to use a large number of checkboxes to track options or selected items. To help with this, Struts provides the multibox control. It's quite handy but a little tricky to understand at first.

The multibox leverages the way HTML handles checkboxes. If the box is not checked, the browser does not submit a value for the control. If the box is checked, then the name of the control and its value are submitted. This behavior is the reason there is a reset() method on the ActionForm. Since the browser will never signal that a box has been un-checked, the only solution is to reset all the boxes, and then check the ones that are now present in the request.

The multibox control is designed to use an array of Strings. Each element in the array represents a checked box. To check a box, add a String to the array with the box's value. To uncheck a box, remove the element from the array. (Sound familiar?)

When passed a value, the multibox control scans the elements of its array to see if there is a match. If so, the box is checked. If not, the box is left unchecked. If the user checks the box and submits the form, the box's value will be included in the request. The controller will then add that box to the "checked" array. If a box is unchecked, nothing is submitted, and nothing is added to the array. If the ActionForm bean is kept in the session context, in between requests, the reset() method needs to reduce the array to zero length (but not null).

In this example,

<logic:iterate id="item" property="items">
  <html:multibox property="selectedItems">
   <bean:write name="item"/> 
  </html:multibox> 
   <bean:write name="item"/> 
</logic:iterate>

The labels for the individual checkboxes is in the items property. The list of selected items is in an array named selectedItems. Items that are not selected are not present in the selectedItems array. The multibox checks the selectedItems array for the current item. If it is present, it writes a checked checkbox. If not, it writes an unchecked checkbox.

Given an ActionForm setup like this

private String[] selectedItems = {}; 
private String[] items = {"UPS","FedEx","Airborne"}; 
public String[] getSelectedItems() { 
  return this.selectedItems; 

public void setSelectedItems(String[] selectedItems) { 
  this.selectedItems = selectedItems; 
}

The markup in the example would generate three checkboxes, labeled UPS, FedEx, and Airborne.

<input type="checkbox" name="selectedItems" value="UPS">UPS 
<input type="checkbox" name="selectedItems" value="FedEx">FedEx 
<input type="checkbox" name="selectedItems" value="AirBorne">AirBorne

Initially, the selectedItems array would be empty. If UPS were checked and submitted, it would become the equivalent of

private String[] selectedItems = {"UPS"};

If UPS and Airborne were both checked, it would become the equivalent of

private String[] selectedItems = {"UPS","Airborne"};

And when the checkboxes are rendered, the appropriate elements are automagically checked by the multibox tag.

<input type="checkbox" name="selectedItems" value="UPS" checked="checked">UPS 
<input type="checkbox" name="selectedItems" value="FedEx">FedEx 
<input type="checkbox" name="selectedItems" value="AirBorne" checked="checked">AirBorne

To provide different sets of labels and values, the standard LabelValueBean class [org.apache.struts.util.LabelValueBean] (since 1.1) can be used with the multibox control.

<logic:iterate id="item" property="items">
  <html:multibox property="selectedItems"> 
    <bean:write name="item" property="value"/> 
  </html:multibox> 
    <bean:write name="item" property="label"/> 
</logic:iterate>

HTH, Ted.

-----

Struts Tips are excerpts from the book Java Web Development with Struts. The tips released twice weekly on the MVC-Programmers List. To subscribe, visit BaseBean Engineering.

About Ted. Ted Husted is an active Struts Committer and co-author of Java Web Development with Struts and Professional JSP Site Design. Ted also moderates the Struts mailing list and the JGuru Struts FAQ.

Copyright Ted Husted 2002. All rights reserved.

---

MVC-Programmers mailing list
MVC-Programmers@basebeans.com
http://www.basebeans.com:8081/mailman/listinfo/mvc-programmers

ebooks

ftp://ftp.runnet.ru/BOOKS/

Segue um link com alguns GB de livros em formato eletrônico, dos mais diversos assunto.

ftp://ftp.runnet.ru/BOOKS/

chave do registro pro cmd ficar igual ao bash do linux

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Command Processor]
"CompletionChar"=dword:00000009

Calculation of date diferences

import
java.util.Calendar;import java.util.Date;/* * Filename: Test.java * Creation date: 14-mar-2004 * Author: Kevin Pors *//** *
@author Kevin Pors * @version 1.0 */public class Test
{ public static void main(String[] args) { Date
now = new Date(); // right now.
Calendar c = Calendar.getInstance(); c.setTime(now);
c.add(Calendar.HOUR, 1092); Date someDate = c.getTime();
getDaysBetween(now, someDate); } public static
int getDaysBetween(Date dateOne, Date dateTwo) { long
milliseconds = dateTwo.getTime() - dateOne.getTime(); if (milliseconds
< 0) { milliseconds = -milliseconds; } long seconds = milliseconds / 1000L; long minutes =
seconds / 60L; long hours = minutes / 60L; long
days = hours / 24L; System.out.println("Difference in milliseconds: " + milliseconds);
System.out.println("Difference in seconds: " +
seconds); System.out.println("Difference in
minutes: " + minutes); System.out.println("Difference in hours: " + hours);
System.out.println("Difference in days: " +
days); return 0; }}

Regular expression dummy example

public static void main(String[] args) throws Exception {
// Create a pattern to match breaks
Pattern p = Pattern.compile("[\",\\s]+");
// Split input with the pattern
String[] result = p.split("\"one\",\"two\",\"three\" , \"four\" , \"five\"");
for (int i=0; iSystem.out.println(result[i]);
}
}

Redhat Linux 6.1 on a Compaq Presario 1621 Laptop

http://www.academ.com/presario1621.html
Redhat Linux 6.1 on a Compaq Presario 1621 Laptop
Stan Barber, sob@academ.com
http://www.academ.com/~sob
--------------------------------------------------------------------------------

This document is designed as a technical reference for the configuration of hardware using Redhat Linux 6.1 on a Compaq Presario 1621 laptop. Keep in mind that all of the information here pertains to my particular laptop and that your machine may differ slightly. Much of the information comes from '/proc/pci', '/proc/ioports' and '/proc/interrupts' all of which can be viewed using the 'more' command. Many of the nitty-gritty details involved are beyond the scope of this document and can be found at Linux with Laptop Computers, Linux on Laptops and the Linux Documentation Project.

Disclaimer: I am sorry but I cannot offer any assistance beyond this webpage. Remember that incorrectly configuring software or hardware can damage your system beyond repair. I am not responsible for damaged software/hardware and I cannot help repair a damaged system.

This document was last updated on April 22, 2000.

Internal Hardware
Audio
Battery and Advanced Power Management
BIOS
CD-ROM Drive
Display and Video Adapter
Floppy Drive
Hard Drive
Modem
PCI Bridges and Interfaces
PCMCIA Cardbus
Ports
Processor and Memory
Touchpad
Third Party Hardware
Ethernet LAN PC Card
Mouse
Configuration Files
fstab
rc.local
XF86Config



--------------------------------------------------------------------------------
Internal Hardware
Audio
Compaq lists the audio device as a 'Presario ESS 1887/1888/1869 Custom Proshare Audio'. Run 'sndconfig' and configure the device with the 'ESS1868 AudioDrive' module. On my machine I/O Port 0x220, IRQ 5, DMA 0, MPU I/O 0x330. You can control these parameters at the BIOS level if desired.
Back to the top

Battery and Advanced Power Management
I selected APM as a startup service during the Redhat install and I have APM activated in the BIOS. The APM daemon starts and stops normally. You can add '/sbin/hdparm -S 240 /dev/hda' as the last line of '/etc/rc.d/rc.local' to switch the hard drive to low power mode after 20 minutes. Consult the hdparm man page and rc.local for more information.
Back to the top

BIOS
Open your computer's BIOS setup utility by pressing F10 when the white cursor appears in the upper-right corner of the Compaq startup screen. Go to the 'Advanced Configurations' section of the BIOS. Under the 'Large Disk Access' you can choose 'DOS' or 'Other'. If you are running a Linux only system, selecting 'Other' seems to increase performance a little bit. You can also change the configuration of the audio system if desired in the BIOS.
Back to the top

CD-ROM
The ATAPI 20x CD-ROM drive (128kB cache) is detected as '/dev/hdc' and '/dev/cdrom'. The drive is bootable. See fstab for more information.
Back to the top

Display and Video Adapter
12.1" LCD Laptop Display Panel
Resolution 800x600, Horizontal Synch Range 31.5-37.9, Vertical Refresh Range 50-70.
Display Adapter
Neomagic MagicGraph NM2160.
See the XF86Config file for more information. Feel free to use that file for your own needs although I cannot guarantee that it will work. Remember that improperly configuring X can seriously damage your hardware.
Back to the top

Floppy Drive
1.44mb standard floppy drive detected as '/dev/fd0'. See fstab for more information.
Back to the top

Hard Drive
HITACHI DK226A-21U ATA Disk Drive. The device is detected as '/dev/hda'. Add '/sbin/hdparm -S 240 /dev/hda' as the last line in '/etc/rc.d/rc.local' and reboot the machine. This will make the hard drive switch to low power mode after 20 minutes. For more information consult rc.local, the hdparm man page and fstab.
Back to the top

Modem
Lucent Technologies Winmodem (aka Compaq 56K-DF). This can be accessed using a version of the Lucent Winmodem driver. This modem is on IRQ 3 and port 0xEC. It's important that the configuration options for PCMCIA be set to exclude IRQ 3 as a usable IRQ for PCMCIA cards, otherwise this modem will not be usable. The driver zip file is available here. After installing this driver (see the readme file), edit the /etc/rc.d/rc.local file to add this line:
/bin/setserial /dev/modem uart 16550A port 0x00ec irq 3 spd_normal skip_test
Back to the top

PCI Bridges and Interfaces
Host Bridge: OPTi 82C701 FireStar Plus (rev 50)
IDE Interface: OPTi 82C825 Firebridge 2 (rev 48)
ISA Bridge: OPTi 82C700 (rev 49)
Back to the top

PCMCIA Cardbus
PCMCIA Cardbus Bridge: Texas Instruments PCI1131 (rev 1)
During the install, select pcmcia as one of the services to start up automatically. Then it should just be a matter of inserting a pc card and booting the machine. Keep in mind that the pc card must be supported by Linux as well. For more information look in '/var/run/stab' and '/var/log/messages'. You can use 'cardctl' and 'cardmgr' to manage PCMCIA devices. Consult the man pages for more information.
Back to the top

Ports
The following ports are available on the back of this particular 1621; keyboard/mouse port, parallel printer port, port replicator port, 1 serial port, and an external monitor port.
Back to the top

Processor and Memory
233 MHz AMD-K6 MMX 64Mb.
Back to the top

Touchpad
The Synaptics PS/2 Touchpad configures the same way as any other 2 button PS/2 mouse. The Redhat installer should detect it for use by 'gpm' and when you run 'xconf' to configure X simply select the PS/2 mouse protocol.
Back to the top





--------------------------------------------------------------------------------
Third Party Hardware
Ethernet LAN PC Card
3Com Etherlink III LAN PC Card 3c590-TP 10Base-T
Insert the card and boot the computer. Run 'kernelcfg' and add the 3c509 kernel module.
Back to the top

Mouse
I use the Logitech three button mouse when I don't use the Synaptics pad. It works just fine. Turn the computer off, plug the mouse into the PS/2 port and boot the computer. Linux should take care of the rest. Plugging a PS/2 mouse into a computer that is already on can seriously damage your hardware.
Back to the top


Jogo simples de corrida mas mto interessante

http://www.nitto1320.com/

sexta-feira, julho 02, 2004

Exception por initcause

Interessante se usar esse tipo de throw qdo temos beans ... ele faz um "track" completo da exception vc não perder as pilhas da exception

throw (SQLException) new SQLException().initCause(e);

Sun training center no brasil 0800.55.7863

Para comprar os vouchers ou agendar as provas ... 0800.55.7863

Descobrir o ip address

 public void getInterfaces() {
  try {
   Enumeration e = NetworkInterface.getNetworkInterfaces();

   while (e.hasMoreElements()) {
    NetworkInterface netface = (NetworkInterface) e.nextElement();
    System.out.println("Net interface: " + netface.getName());

    Enumeration e2 = netface.getInetAddresses();

    while (e2.hasMoreElements()) {
     InetAddress ip = (InetAddress) e2.nextElement();
     System.out.println("IP address: " + ip.toString());
    }
   }
  } catch (Exception e) {
   System.out.println("e: " + e);
  }
 }