0% found this document useful (0 votes)
148 views20 pages

SL 1,2,4

Uploaded by

Vinay naidu Kola
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
0% found this document useful (0 votes)
148 views20 pages

SL 1,2,4

Uploaded by

Vinay naidu Kola
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
You are on page 1/ 20
5 |_ Mid 1aQ0's. in Japan Pee res 9 — BeRubyis designed. E.devteloped oy Yurihiv Javts" Matsumoto i9 Pee uis A dynamic open Source Object Oviented andy NeFlecbute re Progamming lanquager | AN Uevsions OF ONIX: VS AN Object In Ruby: Astonishment)- > each and eilery Cocke has-theiv properties Anal actions - > Ruby is Considered to Fotlour-ne OF POLA (Principle OF least > Hvuns on alt -types OF “plat-Fowns Wie “Windows, macoay Pelt is funy Object Oviented Oviented Proqrornming language. each eyntax: — Aplications: — =begio f> Ruby is Used —to Create Welo Applications Of dil fevent Statement 4 Sorts: Statements — L-> Ruby offers AQveat Feature Cailed Ruby on Statement Roasls (RoR) [| eend L | features: - sae ie (Class and every class has a Super Class - FON alveady ini "Ruby tanquage has many: some of —themare explained belo. i) Object oviented !- Ruby is Purely Object Oviented programming Janguage - each and Clery Ualue is aM Sbjeck-eurery Object hata ii) Plexibiliey: = Ruby is o Flexible anquage as you can gastlyvemate —iedefine Ov add existing ports “toil lt Qos is Osers to-Freely Qitev id's parts as they Wish: ! IN) Waviabble Constants:— [hn Ruby, Constants are nok Vealty Constant ualined conckant uatit be noodihied ina Script Narning Conuen-tone: -Ruloy clefines some naming Contention YS \artable, methodand constant & Class: isin method : - eothe lost method: Cas e ethod- is ins Mame } —. | M) Ke : 2 iS ree ererIN. RUWbY tase ale Apmoximately 42 KeyWords | whieh can ee > Rails ave Sever side Cod Backend: Be . e_USecl Fox Other Purposes They One cae ext Words. Saher Senseiuer~ Ruby is’ a cate-senitiue language {ower PSOE Lec bers and Uppercase labters one different: programming : Inoplemented by David Heine meier-tanscoo > OS- commana line * Worker face * Pockage lilsvaxy f>—fame work For butidiag Website > Combina-tion oF HTML Css, Tatascnpe: “Types of Uaviabtes Suro bots DY locat uaviables §) instance uanables W) class WN) Global" ROR CRuby On Rails): - > 1 Supports Mure Cmodetuiews comtrot) Cg: ¥Me Rails | Dexelopenent Testing Procketion ; Inthy Rulby on Rail: = he i 2 It Allows Yyou-to lanch atastey Web applications 4 [> Sater Your money by Using —the vuby On ‘Rails Fame work > we Cad easily Opdate Our APP With the larkese Fun cbonality > LEoses ba Testeke Anata rkeehoiques to Uorite Proquams. TM™e lexical Scouetu Knovon as - ofa SENGEG Language: The rules For Forming aid tokens ov lexical onits jn Ane Language. mer — ATokens Are ~the Smaitest Meaningful Units of a program eA] Such As Keywords, | . | bots + atfere Ane Some common elements oF the lexical Souctuve in [2 teeupordss- Keywords are vesewued Words inthe tang. E | hate Spectal meaning g cannot be Used as [deo-tefiers <4 fit) \dentificrs ~ Identifiers ave ames Use dl to vepretent War atkee Function , Classes, OY Othe embties in a Progam i) Operators: Cpevartors ave Symbols Osed=to perform OPevattions | om Uariabtes , expression, Ov values: | fu) Constants := Constants vepretent Fixed ualues ina progam “They Can | be OF dit ferent ~types: : J 1) Delinniters +— Delimmiters One Symbols Used to Seperate token ov | indicate -~the boundaries OF expression orblocks OF code: IM) comments:- Coramnents are Used to add explanatory notes ov dicable portions of code: Iathite space: — thitespace Vefevs tO Space. tabs.and line that ave red For formatting and readlateiity: a Soe eee. pests = the lexical ov Aoken Souths ek, OPerakoue, Comsants ¢, Pune tucrtion vets sping language abe. en a a TNe: wun ana wouceiee Fox forning Walid statements EL A EXPESSIOW INEhE Lan, “ALeNe Ove some common elements of -the syntetc Houck F [to Scripting languages: - abst Slt De 14) Statements: A statement isa Combine DOI DF Code ~t% | Perform On aCe OV A Sequente OF QCkoON HNC Chepte soem Sate Cxpression 1S A Combination OF Walurs, | Navialsles, operators and Function calls that Produces a | sre sn tioq ia S is) Conbol Ftous:— Combot Ftouy Stakenned ts detewmine -tn Ovdey In _tobielh Statements Ave executed based OM Certain Condiks iv) function s: = Functions OlWous “Ke Grouping oF code Into | I | Néusable blocks -that Can be Called aNd execuked Worth | Specefe argument + 0) Baka ti pest=s ¢ GORE WEROUES Weuiein OX Predefined datalye | Such as integeu «Hooking =point numloers, Aaings hoolens » Oxxays, objecks Gnd rove . | NA) Scoping & Blocks: - Syntax sOties! Hous blocks grepde ave | dened G94 Scoped Loithin the language. Ni) Comments: - Similar to the lexical Stouckive 1 Scripting lanquage s Prouidesuntay -fov Adding Comments ko ene | | | | eas Cow eohy athe Quie kset+ ne eee O00 = COI ctandava is Genevauy othe n Pe | browses. Mag tages | 22 eee > Quick umn le Mention SS ert plone [> EMSy to Ose EXISHiNg Code Scalability Se See UE 9 = = SR pee —— > Eatin, eae sec iis * ili Ol i gz © Cookies In Ruby ATT NotoCal is q Stateless Website. AiFFevent Pages. aa. N Cookies ONE 2 plain text date FEKPINeS ~The date Me Cookie wr y_Writeeg in) anquag Sto Wwrterdae: arr = Aenevertion Faw web pages. CGI isthe: bestimeshoui-to Eveate A counter | Necovd OF Hue Haniable -lergth ee RL FareJis standard that HAL peavi,c, MAbling 2 With TMG, @ Si Pn E MOSE Compatible With Today), Di Acuan tage: > Security ML _@xPWVe- LE-this ic low, the COOKie WIKI expire the visitoy Quies the byoutey- e Domain — Th, domain name oFY * path= “The path -to -the divector COoKies- THis Many be blank fF Ouy Site 4 OY Webpage that Sets the 4 You UWwant rho Vetieue. Protocal = But -Fov a Commeric ficl ee i ©) SoAp tae 8 et ——___|_ =o application» |} —_|_ Proarnming tanquage a pplication $1 ____ Hee Oh language Welependent es fea LIS AKML ‘a icople Object Access protecal based Protocal foraccessing Wweb Sevuites fe bi JF SOAP 18 @ Loge vecommencetion-for communication blu FP SONP is XML based Protocal+ (41s plattorwn (depeacent 7) Bywstng SOAP Youvortl be able be to (mbevact Loreh Other + Advantage: i C i Disadvantage Ale Security sous nS > Language and platform (ndepenctent —> UOSBL dle pendent SOAP Nequest Message throug, i _[ soap AMA oAP | _letieon FrSeAp veiponte message through tip | Sextice @) | Ruby TK: = > Ruby fT is olitmary-that prouides 0 Ruby nterfaceto-the | TK Graphical oser ntarrace (Gui) toolkit [SoHE Gl ctorel= platform cosine that Allouss dewelopers to | Create Gul Applications With a native look and Feel on didteveot Operating ey stem + +> “Toure Ruby ftk 1 you Need +o haute the TK (ib mavy |__Instated ON Youv System: [peddeeds Pcogxarg »— [ FPeveake the main Windows Nook =TKRook Newfie * HeuomTk|"} +F cveate atabel Widgek ; label <1 Lalee! . new Croot) do tert “Hello, Ruby [TK 1” Pack feadKk IS; pacty 53 side tere’} end pais 0 butte pons Tk Button NewsWoodado Here click met” command TK: me essage G on Chile atk {PAIK 15) PAady ts; sé pant “the TA ere eet (OOP maialoop LK Aipplicahoo! = A typical Soueture Fox Buby Ada widgers £0 14-0. 4 idup =the _USev (Neevfete and Cae s Main event oop by Calling “TK: Maio (oop: dgek == ATeke Widget Provides sews with an area Sorthat-they cag nkei Muttiple lines OF exe “Tert widgets ave pare OF the classi Tie Agets, NOt the themed TH Widgets « Kind s oF Annote-tons :— = Allow ciFFevenk Portions OF -the text 0 lee displayed sith ven kk FONES ANd COIDYS- ANKE I= “The Second hom of annotation Consists oF mavics, Which ME Floorbing Moy keys in) the bext: LEmbeclecl Windows: - The -thiva hom of annotetion Gitows avbibary Windows +o be embedededin atext Widgets: a Terk. Newlvoot) ¢ += = Standovd options - - - . Widget ~Specitic op bons — phi A eepe bincteg pene tS User sy hranalle -khe elents vaised by the | button CLICK MOUSE Mote ments Keystrokes eke = Specifrea Method in -the Particular Consponenks —— | the corn —{-Pux poses SSS BE n9 2 Element (event) = funetiond)> _ Canuas. - ~~ ——{SSOLes displays any number of thems, uohich may be thi i} v Nectangles, Cincte lines ANd text- Associated With jtemsin Much the came Uday thatthe bind method attows calthacks to be hoon da to Widgets: E> Ushen he DOM euent happens at an element tt calls the CSG CLEA E Binding we cag bind date fom 06m to ponent ana hence Can use that date for -furtren AY Canvas udidget troplements Sthuctuved qvaphis- Acanias — ogs fit a] (kKems may be Maniputated AOA call backs moybe Syntax: - Tk Cantar . news ~ = = = Staodard options. _ pReAE wee Udidgel~Cpecifi copttions ~ Sees Bevollivg te A Scrouhar ne(ps the USev to see alt Paveso ie. Another Widget Chose Content ¢< ty Ushat canbe shonin the Noli PEED AN este TKS erolibar- newg 7 -- — Standard Options Olle Scveen coace. ~-- — Widge - Specific Options - - - ~ & Picauy much lager thao 2 Aes eae eis easy eo extend Ruby with new Featured by voritin Nee YOU Stave Adding iM LO 1eUel Code Lov * e nee The Object is O! gyntaxi- vue ees Obyect_ Nam: sciasnos S = 6 qoKebox Sxtenscon! = @. ec -infacing ¢ code with quby and TJore box example = q sharing data and behauiow Ble “the woo Worlds: il * Loyopping C Stouc tures! = 1) Uaiue pata - wrap-Stwuck: 2) Value Data - mate -Shuce 3) Paka Get- struck: Object Creation: = i tasting —> Creating On Obieck ofclass CD Player ion one Ruby program - =] ru ed = CD player: now» wane lementaton OF New (D class is simple Ce quoca #204 Object Si -then Catled ~Ehe object tnitialize — memory For New ck & then Call Qnethod —to iniMiolineeehambeRmony es = ; ee ae Sa | Dllocation Functions: - ee ae = —Tie_attocartion-Function is vecponsstote for Cre MeMOY Used _by Object: a. IF the obleck (noplemented cloein't Use couciets oe a Ruby instances covtte Uariablee, thea you = a ee bY a | 09 anocaton function Ruby's detautt atlocat At —{— W20V Kjuse—Fine: | Cloning Objects. - eT ee AN Nuby objects can be Copied Ustng One OF - ec ae aep ana clone. Both Produce CSTE SEES 0 Fe a Yecer “as by Calling -the Allocation Functor STO Hest ~the Oviginal Object cade check: s Hac O-type of data + Has a Rree-Rinetion wsith Same Address a¢-free-Runcton Necetues clas | Menary aitocartion s= > memory attoca-kon vefevs sto -the | Portion OF a Computer's Memory +o Stove da | cliving the @xeCUL0 OFA programm. f=? 19 many Proqvanmin: t o languages, IMW¢luding Ru iMenoory |__ Allocation is handled BuPammaticatiye biases langu | Ov Uivtuat machine « 210 Ruby, Memory aliocation-foy Objects Is managed by the Ruby interpreter u OG technique caiied * hock is No t This velieues the Process OF Nt Serting & Age Yuntme v lange: in Use Freeing fLo, ev-Fom manuatt eee Ls mraantog the ee Ruby type Suskeno += A | Rubs l= Ruby (> Koouon For its " f S Fo: ynarnic ANd Flexible type Siystemn It is nsicleved_ A Synarmeatiy “typed _ language, ak Variable types ave Metermined ot Wurbione vath ae) Eme: LT. beteg expleity deste: —Tp pyromictaping = 10 Ruby, You don't need ~to declave “that -type of A eT yaviable explicrty perth Qe HS a) Se, 1 F a q [) Qucestapiog SS siiuws the principle oF “duck typing “Uohich Fe | poennerenat the Suitability of an Object For a particular operation is a [dletewninee by tsb brhauion “2 uhevthan its clace ov-types [_hise2 ing - Although Ruby is dynannicaiy Ewipedii tis Glsom 1 [| strongest — EE obycks and class!= 1D Ruby, eUerything is a0 object eluding _ ad impaue ky pe such a8 Nurbers and boolean’ la | | \ > Ruby is adynamic proqra > Ruloy provi tables ~Featuye oF Ruloy is the ability “to U wy) open classes = ONE NO modify Suse classes OX yurtme: nen (ANguage . ~ cht ieee conn ng language it doesnot hatte hard TEAS Uewy Close to Spoken langues Embedding yuo Vules on how-to louild Features and eles Small, etegant and _powvrerful Code: ce public, private & protected do similar jobs: ae fo - Ruby c have heathy aymbiotic Yelactonship __ Sree thon:- Ruy can be Mevy hava —to debug at time ogists er plicity and easy—to Fe eee ites nies El p thon is Uery Expl is unorganized, mess (because Fits Free Native evi. - Des tcccas ued 1s Oe nied (an 7 aga cerpreteed ed a Joue: by fase progam vans chvectly Os E00 T led then executed youla= based Codes aQre—first COMPY EJ st been’ Pup: - webciertetopment and deployment is Very Sim te with _ ae compared to Ru! UD pelea Sti “pert language is ct loosely typed ak ques sete Chooses the data type. Hence 4 2pectty date type 10 Pert Progvamming GUAGE the Petl okerpree wthereiS No Need 4 There ave lasicaty three datatype in pen i Byscnlrs = Pert Scalevs ove a single data item -mn 416 - eA We 4 ariables, Preceded by a(t) sign. A scalar can ge Sienpte = 4 Turn ference address of atiaviable) OVA String. Ourloce,a PpaNS = PEN Onvors Ove AM Ordered list OF scatays “They a . | preceded by (@) sign” A Accessed | meee: icy a i (ith Stats with 0» Aw) saashes: > Pevl has axe an Lnovdeved collection of peal Reports iheghOwe preceded by Gy) Sign and accedsed Using Keys reine it ek Dummloe, pest Mtaviables A wariable is aplace to store Udlues “They can he Noa cuIated xoughnout the Program when Uaviable ove Created they vesewte me Memory pace: There Ave three types oF Uavialole * _tseatar defined by 4 Anays * *@ Hashes % a ® Rien points | [>> pew Pee fo thevaige OE Looping: - lo Ai aed OPIS alk Known as ¢ style fot \00P-The Fo the Statement ovo Pork OF the prograrn Seu Part Ie evecuted it and ony once A_OAA WE declares \OoPp_Uaviable ee for \oop execution “tl the Conclitionss-truc, Bon ts falee 100p execution SOPs ANd ekecution —teveninates Out OF the tnittalires Increment /dlecrernent: ~The For lop tiaviable WMevement Ordecren, 08 tong as ‘ Fox Cinitialization; Condition; inv (dec ee {ode +0 be executed eG ROR OB EAE MECH | Flowchart: J dotalhileioop:- | __[Meitatnation unlitte Fov and while oop the | S se | do while 100p Checws it's i | Sere Condition at the boltom oF | | Statemed athe loop + So do while NO0p wait! ———Titev deer €kecute AMESt ONce- | £ =a | Albile toop! — Lorre pert Waibile\op 13 usedt-to | flouschart:- / |. (eevaner et peVEBE program ov V do ! Statement Many -times: Statement Syntax: ~_Iathile (cond ition) { | ; Ste | WI COde 0 be € Lecuted =| | 5 <<, : Nictine ‘pack’ % fs Sepa) Pew Set “Unpack "Function a: —T dara bls bio. Rte Ktual vepws entertons Tea these Fuchs ave COMMONLY Lsed UY ~ (8 template sing and al MoE Pierdoeetne Netors 0 binory string Neprerentajon athe packed [ik contists OF ove ov nox BU Epectfiens that define ae an : — 1a) packs = “The Uppack Function takes a template Shing and ae | binary String ANd Unpacks the binor date INtO Alist oF uate | The template String specifies the AOIMALOE -the packed da ae usbich should Match -the format used -to pack the daig. = my (I stu doum) = Unpack (\Ag N", dloinary — data): File handling: = t file handling is the most important part in any programming la quage: A Filehandle 1s an fnteinal perl Structure thot associate with ole name: i = Feri File handling is (mportant asitis helpful in accessing File Such as textiles: log Files ox Comfiguration Files: Wt -Flehandlers Ave capablepF Cveoting sveading Opening and Losing Fie. Yeate File: + Copying a-file pen File. * file test Operators id Single tineatatime ° id Mult line at a—Kene s Drie File lose File handle Opeator handle print ()-Functioo ee | Gurq). - TR function elatuates Ex preesion me ASIF EXPR Were QS Ceperate PEW ceript: Fe hy onotasug deep ond Separate ; peshaps User -Supglid, b—e he prere OF PAN Sexipe within Your program: > Py eval EXPNUKOD Akekement (s elaluated Separately each, HMe he Rincon is catted« fi psctiestuecndster eUialuates BLOCK When the Vest OF, Semipe is Govsed) beanie ~{Suntexs= eval Expretion, eval BOCK = This function vetwin Ualue OF (ase evaluat WA _Expretsion o Block i “Tew ave -tww0 data souctue seal in perl Script A) Two-dimensional aviay data § Guctere a) Complen data Structure O, 20 oway canbe defined as an Owoy OF Oways. The 19 ray t$ Ovganired as matices Which can be Yepresented Qi the Collecboo OFrouss and cotums. 7 20OmaY Ore Created -to Implement _avelational databate took { z A like data structure: r Lt provides each OF holding bulk of date AL O0¢e hich i Can be passed to any noo Functions wWheevey required: Syntax: - ine aw (max vows] (Max ~columns]s 2) Complex Nata soucture fe | > Pert (You can Create Compler data Sthuchwes by combina Oways and hashes into _muts~ dimensional Sou cture: | These complex datastuctue aliaw You to vepresent and MAnipulate more soghistcated data hievarchies: Sa owey* ov Ba Gashex; anoys 6b Maier — et ss OF Washes y ete. Way {Sana pace: = ‘ae is a package dehacd in ale hi oF the package and hauiing extension. puso different Macules May Contain oo Uaviable ova function OF came name ANY Variable Which is NOt Contained in any eked belongs tothe main Package. les 1M Pert is a Collection OF «lated subroutines and ro —that perform A See OF paeQnacnming asks - A modules Ave Keusable « Various Pert Mrectales, aie autaila ble e Comprchensive pert Arichieve Networs (epan). Mvddules Cour A Wide vange OF categories Such Ai Network PML 1 Processing »dabehases Inkewkercing eke, oe jottides US some tools to build Object Oriented System cok Orlentecd CONce pts AX based ON Ye ferenles, AonyMoens —_ d hashes+ As the class Name to which it betongs: Ina scalar Variables Maviable can hold disfercat Obiec ONY holds @ Vefe rence “ty the objects tH ty Stored ata in different eae a Ste gi MPY_O package: It Conteris methods that “Sake on Obieck s+ segs We] ethoa is a tucouaine ahs eipectean abieck Yelevence «~ Package name a1 Lhe Bas Sates eke S28 £_Cppplecetine veep : cs 7 SSSracing tO—the Operating Systerm in p ; -———_F 210 Best you con interrate With the Operation Systenn LSing USviour butie=insFunetons ane Modules. This _atiows you tO CXecule Sycte —Sutvonment Variable, hanide File Opewrtion And per foun -—___|_ Other 0s ~yetateet taste First Ovqument: Commands, a ae Below ave some Common ways to (Nlevtace with ihe Operating System in perl — * Bonding system commands:-To execute Syster Commands, You __ Con Use the ‘system function ov backticks (*') to Captuve fee DUEPUESThe cy sters Function is Used For wwuMHing Commands doesnt capul- * Aceecsing enunooment vaviablet’- you can acters enutvooment Maviables using they ENU’ hash: (+ contains the _enutvoament —Noviahles , With ~the Vaviable name asthe Key Goal tks uatue _ OS +he Covres ponding value+ .* File OPevation! ~ Perl prouides avich set OF bulit~ Ad Modules Fortile Operation. 24! te work with Files a Divectory handling:-“To handle dive ‘Opendin! and eadldiy directory : Bil + Owor and ling and Status code: - eShen Yun ROG System Commands ov etecieting: Other ote Nelated asics, Sts essential bo Check for Cvr1os ANd cterturs Codes to handle that May avise- | aa ‘in Functions ‘Open’ close wead “and ‘writ ctovies, You @an ose the ‘-Funetioa-to vead the Contents of a Ony [csues Pe

You might also like