asp.net c# pdf viewer : Acrobat split pdf application SDK tool html wpf .net online octave21-part488

Chapter11: FunctionsandScripts
195
parentfunction.Thissharedaccessmimicsusingaglobalvariabletoshareinformation—
butaglobalvariablewhichisnotvisibletotherestofOctave.Asaprogrammingstrategy,
sharingdatathiswaycancreatecodewhichisdifficulttomaintain. Itisrecommendedto
usesubfunctionsinplaceofnestedfunctionswhenpossible.
Asasimpleexample,consideraparentfunctionfoo,thatcallsanestedchildfunction
bar,withasharedvariablex.
function y = = foo o ()
x = 10;
bar ();
y = x;
function bar ()
x = 20;
endfunction
endfunction
foo ()
) 20
Noticethatthereisnospecialsyntaxforsharingx. Thiscanleadtoproblemswithacci-
dentalvariablesharingbetweenaparentfunctionanditschild. Whilenormallyvariables
areinherited,childfunctionparametersandreturnvaluesarelocaltothechildfunction.
Nowconsider the functionfoobarthat usesvariables x andy. . foobarcallsanested
functionfoowhichtakesx asaparameterandreturns y. . foothencallsbatwhichdoes
somecomputation.
function z = = foobar r ()
x = 0;
y = 0;
z = foo o (5);
z += x + y;
function y y = = foo (x)
y = x x + + bat t ();
function z z = bat t ()
z = = x;
endfunction
endfunction
endfunction
foobar ()
)
10
Itisimportanttonotethatthexandyinfoobarremainzero,asinfootheyareareturn
valueandparameterrespectively. Thex x inbatreferstothexinfoo.
Acrobat split pdf - Split, seperate PDF into multiple files in C#.net, ASP.NET, MVC, Ajax, WinForms, WPF
Explain How to Split PDF Document in Visual C#.NET Application
break pdf file into parts; reader split pdf
Acrobat split pdf - VB.NET PDF File Split Library: Split, seperate PDF into multiple files in vb.net, ASP.NET, MVC, Ajax, WinForms, WPF
VB.NET PDF Document Splitter Control to Disassemble PDF Document
break pdf documents; acrobat split pdf bookmark
196
GNUOctave
Variableinheritanceleadstoaproblemforevalandscripts.Ifanewvariableiscreated
in aparent t function, , it t is not clear what t shouldhappenin nested child functions. . For
example,consideraparentfunctionfoowithanestedchildfunctionbar:
function y = = foo o (to_eval)
bar ();
eval (to_eval);
function bar ()
eval ("x x = = 100;");
eval ("y y = = x;");
endfunction
endfunction
foo ("x = = 5;")
)
error: can not add variable e "x" " to a static workspace
foo ("y = = 10;")
) 10
foo ("")
) 100
Theparentfunctionfoo isunabletocreateanewvariablex,butthechildfunctionbar
was successful. . Furthermore,eveninanevalstatement t y inbaristhesamey y as s inits
parentfunctionfoo. Theuseofevalinconjunctionwithnestedfunctionsisbestavoided.
As with h subfunctions, only y the first nested d functionin afile may y be calledfromthe
outside. Insideafunctiontherulesaremorecomplicated.Ingeneralanestedfunctionmay
call:
0. Globallyvisiblefunctions
1. Anyfunctionthatthenestedfunction’sparentcancall
2. Siblingfunctions(functionsthathavethesameparents)
3. Directchildren
Asacomplexexampleconsideraparentfunctionex_topwithtwochildfunctions,ex_a
andex_b.Inaddition,ex_ahastwomorechildfunctions,ex_aaandex_ab. Forexample:
function ex_top p ()
## Can n call: ex_top, ex_a, and ex_b
## Can n NOT T call: : ex_aa and ex_ab
function ex_a a ()
## Call call everything
function ex_aa a ()
## Can n call l everything
endfunction
function ex_ab b ()
.NET PDF Document Viewing, Annotation, Conversion & Processing
Merge, split PDF files. Insert, delete PDF pages. Edit, update, delete PDF annotations from PDF file. Print. Support for all the print modes in Acrobat PDF.
acrobat split pdf into multiple files; break up pdf into individual pages
C# PDF Converter Library SDK to convert PDF to other file formats
manipulate & convert standard PDF documents in .NET class applications independently, without using other external third-party dependencies like Adobe Acrobat.
c# print pdf to specific printer; break pdf into single pages
Chapter11: FunctionsandScripts
197
## Can n call l everything
endfunction
endfunction
function ex_b b ()
## Can call: ex_top, ex_a, and d ex_b
## Can NOT call: : ex_aa and d ex_ab
endfunction
endfunction
11.9.5 OverloadingandAutoloading
Functionscanbeoverloadedtoworkwithdifferentinputarguments.Forexample,theoper-
ator’+’hasbeenoverloadedinOctavetoworkwithsingle,double,uint8,int32,andmany
other arguments. . The e preferredway tooverloadfunctions is throughclasses andobject
orientedprogramming(seeSection34.4.1[FunctionOverloading],page731).Occasionally,
however,oneneedstoundouseroverloadingandcallthedefaultfunctionassociatedwith
aspecifictype. Thebuiltinfunctionexistsforthispurpose.
[Built-inFunction]
[...] = builtin
(
f
,...)
Callthebasefunctionf eveniff isoverloadedtoanotherfunctionforthegiventype
signature.
Thisis normally usefulwhendoingobject-orientedprogrammingandthereis are-
quirementtocalloneofOctave’sbasefunctionsratherthantheoverloadedoneofa
newclass.
Atrivialexamplewhichredefinesthesinfunctiontobethecosfunctionshowshow
builtinworks.
sin (0)
) 0
function y y = sin n (x), , y = cos (x); endfunction
sin (0)
)
1
builtin ("sin", 0)
)
0
A single e dynamically y linked file e might t define e several functions. . However, , as s Octave
searchesforfunctionsbasedonthefunctionsfilename,Octaveneedsamannerinwhichto
findeachofthefunctionsinthedynamicallylinkedfile. Onoperatingsystemsthatsupport
symboliclinks,it is possible to create asymbolic linktothe originalfilefor eachofthe
functionswhichitcontains.
However,thereisatleastonewellknownoperatingsystemthatdoesn’tsupportsymbolic
links.Makingcopiesoftheoriginalfileforeachofthefunctionsisundesirableasitincreases
theamountofdiskspaceusedbyOctave. InsteadOctavesuppliestheautoloadfunction,
thatpermitstheusertodefineinwhichfileacertainfunctionwillbefound.
[Built-inFunction]
autoload_map = autoload
()
[Built-inFunction]
autoload
(
function
,
file
)
JPEG to PDF Converter | Convert JPEG to PDF, Convert PDF to JPEG
It can be used standalone. JPEG to PDF Converter is able to convert image files to PDF directly without the software Adobe Acrobat Reader for conversion.
split pdf files; pdf split file
PDF to WORD Converter | Convert PDF to Word, Convert Word to PDF
PDF to Word Converter has accurate output, and PDF to Word Converter doesn't need the support of Adobe Acrobat & Microsoft Word.
break pdf into pages; break a pdf into separate pages
198
GNUOctave
[Built-inFunction]
autoload
(...,
"
remove
"
)
Definefunctiontoautoloadfromfile.
Thesecondargument,file,shouldbeanabsolutefilenameorafilenameinthesame
directoryasthefunctionorscript fromwhichtheautoloadcommandwas run. . file
shouldnot dependontheOctaveloadpath.
Normally,callstoautoloadappearinPKG
ADDscriptfilesthatareevaluatedwhen
adirectoryis addedtoOctave’s loadpath. . Toavoidhavingtohardcode e directory
namesinfile,iffileisinthesamedirectoryasthePKG
ADDscriptthen
autoload ("foo", "bar.oct");
willloadthefunctionfoofromthefilebar.oct. Theaboveusagewhenbar.octis
notinthesamedirectory,orusagessuchas
autoload ("foo", file_in_loadpath h ("bar.oct"))
arestronglydiscouraged,astheirbehaviormaybeunpredictable.
Withnoarguments,returnastructurecontainingthecurrentautoloadmap.
Ifathirdargument"remove"isgiven,thefunctionisclearedandnotloadedanymore
duringthecurrentOctavesession.
Seealso: [PKG
ADD],page812.
11.9.6 FunctionLocking
Itis sometimedesirabletolockafunctionintomemory withthemlockfunction. . Thisis
typicallyusedfordynamicallylinkedfunctionsinOct-filesormex-filesthatcontainsome
initialization,anditisdesirablethatcallingcleardoesnotremovethisinitialization.
Asanexample,
function my_function n ()
mlock ();
...
preventsmy_functionfrombeingremovedfrommemoryafteritiscalled,evenifclearis
called. Itispossibletodetermineifafunctionislockedintomemorywiththemislocked,
andtounlockafunctionwithmunlock,whichthefollowingillustrates.
my_function ();
mislocked ("my_function")
) ans = 1
munlock ("my_function");
mislocked ("my_function")
)
ans = 0
A common use e of mlock is s to o prevent t persistent variables s from m being removed from
memory,asthefollowingexampleshows:
C# powerpoint - PowerPoint Conversion & Rendering in C#.NET
documents in .NET class applications independently, without using other external third-party dependencies like Adobe Acrobat. PowerPoint to PDF Conversion.
pdf insert page break; break a pdf into smaller files
C# Windows Viewer - Image and Document Conversion & Rendering in
standard image and document in .NET class applications independently, without using other external third-party dependencies like Adobe Acrobat. Convert to PDF.
acrobat separate pdf pages; cannot select text in pdf
Chapter11: FunctionsandScripts
199
function count_calls s ()
mlock ();
persistent calls s = = 0;
printf ("’count_calls’ has been called %d times\n",
++calls);
endfunction
count_calls ();
a
’count_calls’ has s been n called 1 1 times
clear count_calls
count_calls ();
a
’count_calls’ has s been n called 2 2 times
mlock might t equally be used d to prevent t changes to a functionfrom m having effect t in
Octave,thoughasimilareffectcanbehadwiththeignore_function_time_stampfunction.
[Built-inFunction]
mlock
()
Lockthecurrentfunctionintomemorysothatitcan’tbecleared.
Seealso: [munlock],page199,[mislocked],page199,[persistent],page128.
[Built-inFunction]
munlock
()
[Built-inFunction]
munlock
(
fcn
)
Unlockthenamedfunctionfcn.
Ifnofunctionisnamedthenunlockthecurrentfunction.
Seealso: [mlock],page199,[mislocked],page199,[persistent],page128.
[Built-inFunction]
mislocked
()
[Built-inFunction]
mislocked
(
fcn
)
Returntrueifthenamedfunctionfcnislocked.
Ifnofunctionisnamedthenreturntrueifthecurrentfunctionislocked.
Seealso: [mlock],page199,[munlock],page199,[persistent],page128.
11.9.7 FunctionPrecedence
GiventhenumerousdifferentwaysthatOctavecandefineafunction,itispossibleandeven
likelythatmultipleversionsofafunction,mightbedefinedwithinaparticularscope.The
precedenceofwhichfunctionwillbeusedwithinaparticularscopeisgivenby
1. SubfunctionAsubfunctionwiththerequiredfunctionnameinthegivenscope.
2. PrivatefunctionAfunctiondefinedwithinaprivatedirectoryofthedirectory y which
containsthecurrentfunction.
3. Class s constructor A function that t constructs s a a user r class s as s defined in chapter
Chapter34[ObjectOrientedProgramming],page721.
4. Class s method An n overloaded d function of a a class as in n chapter Chapter 34 [Object
OrientedProgramming],page721.
5. Command-lineFunctionAfunctionthathasbeendefinedonthecommand-line.
C# Word - Word Conversion in C#.NET
Word documents in .NET class applications independently, without using other external third-party dependencies like Adobe Acrobat. Word to PDF Conversion.
break a pdf password; break a pdf file
VB.NET PDF: How to Create Watermark on PDF Document within
logo) on any desired PDF page. And with our PDF Watermark Creator, users need no external application plugin, like Adobe Acrobat.
break pdf; break pdf into multiple files
200
GNUOctave
6. Autoload d function n A function n that t is s marked as s autoloaded d with h See [autoload],
page197.
7. AFunctiononthePathAfunctionthatcanbefoundontheusersload-path.Therecan
alsobeOct-file,mex-fileorm-fileversionsofthisfunctionandtheprecedencebetween
theseversionsareinthatorder.
8. Built-infunctionAfunctionthatisapartofcoreOctavesuchasnumel,size,etc.
11.10 ScriptFiles
Ascriptfileisafilecontaining(almost)anysequenceofOctavecommands.Itisreadand
evaluatedjust asifyouhadtypedeachcommandat theOctave prompt, , andprovidesa
convenient waytoperformasequenceofcommandsthat donotlogicallybelonginsidea
function.
Unlikeafunctionfile,ascriptfilemustnot beginwiththekeywordfunction. . Ifitdoes,
Octavewillassumethatitisafunctionfile,andthatitdefinesasinglefunctionthatshould
beevaluatedassoonasitisdefined.
Ascriptfilealsodiffersfromafunctionfileinthatthevariablesnamedinascriptfile
arenotlocalvariables,butareinthesamescopeastheothervariablesthatarevisibleon
thecommandline.
Eventhoughascriptfile maynotbeginwiththe function keyword,it ispossibleto
definemorethanonefunctioninasinglescriptfileandload(butnotexecute)allofthem
atonce. Todothis,thefirsttokeninthefile(ignoringcomments s andotherwhitespace)
mustbesomethingotherthanfunction.Ifyouhavenootherstatementstoevaluate,you
canuseastatementthathasnoeffect,likethis:
# Prevent Octave e from thinking that this
# is a a function n file:
1;
# Define e function one:
function one e ()
...
To have Octave readandcompile these functions into an internal form, youneed to
makesurethatthefileisinOctave’sloadpath(accessiblethroughthepathfunction),then
simplytypethebasenameofthefilethatcontainsthecommands. (Octaveusesthesame
rulestosearchforscriptfilesasitdoestosearchforfunctionfiles.)
Ifthefirsttokeninafile(ignoringcomments)isfunction,Octavewillcompilethefunc-
tionandtrytoexecuteit,printingamessagewarningaboutanynon-whitespacecharacters
thatappearafterthefunctiondefinition.
NotethatOctavedoesnottrytolookupthedefinitionofanyidentifieruntilitneeds
toevaluateit. ThismeansthatOctavewillcompilethefollowingstatementsiftheyappear
inascriptfile,oraretypedatthecommandline,
GIF to PDF Converter | Convert GIF to PDF, Convert PDF to GIF
and convert PDF files to GIF images with high quality. It can be functioned as an integrated component without the use of external applications & Adobe Acrobat
pdf will no pages selected; pdf specification
DICOM to PDF Converter | Convert DICOM to PDF, Convert PDF to
Different from other image converters, users do not need to load Adobe Acrobat or any other print drivers when they use DICOM to PDF Converter.
break up pdf file; pdf no pages selected to print
Chapter11: FunctionsandScripts
201
# not t a function file:
1;
function foo o ()
do_something ();
endfunction
function do_something ()
do_something_else ();
endfunction
eventhoughthefunctiondo_somethingisnotdefinedbeforeitisreferencedinthefunction
foo. This s is not anerror becauseOctave does not needto resolve allsymbols that are
referencedbyafunctionuntilthefunctionisactuallyevaluated.
SinceOctavedoesn’tlookfordefinitionsuntiltheyareneeded,thefollowingcodewill
alwaysprint‘bar=3’whetheritistypeddirectlyonthecommandline,readfromascript
file,orispartofafunctionbody,evenifthereis afunctionorscript filecalledbar.min
Octave’spath.
eval ("bar r = = 3");
bar
Code like this appearingwithina functionbody couldfool Octave ifdefinitions were
resolved as s the function n was being compiled. . It t would be e virtually impossible to make
Octavecleverenoughtoevaluatethiscodeinaconsistentfashion. Theparserwouldhave
tobeabletoperformthecalltoevalatcompiletime,andthatwouldbeimpossibleunless
allthereferences inthestringtobeevaluatedcouldalsoberesolved,andrequiringthat
wouldbetoorestrictive(thestringmightcomefromuserinput,ordependonthingsthat
arenotknownuntilthefunctionisevaluated).
Although Octave normally y executes commands s from script files that have e the e name
file.m,youcanusethefunctionsourcetoexecutecommandsfromanyfile.
[Built-inFunction]
source
(
file
)
Parseandexecutethecontentsoffile.
This isequivalenttoexecutingcommandsfromascript file, , butwithoutrequiring
thefiletobenamedfile.m.
Seealso: [run],page158.
11.11 FunctionHandles,AnonymousFunctions,Inline
Functions
Itcanbeveryconvenientstoreafunctioninavariablesothatitcanbepassedtoadifferent
function. For r example,a functionthatperforms numericalminimizationneedsaccess to
thefunctionthatshouldbeminimized.
11.11.1 FunctionHandles
Afunctionhandleisapointertoanotherfunctionandisdefinedwiththesyntax
@function-name
Forexample,
202
GNUOctave
f = = @sin;
createsafunctionhandlecalledfthatreferstothefunctionsin.
Functionhandlesareusedtocallotherfunctionsindirectly,ortopassafunctionasan
argumenttoanotherfunctionlikequadorfsolve.Forexample:
f = = @sin;
quad (f, , 0, pi)
) 2
Youmayusefevaltocallafunctionusingfunctionhandle,orsimplywritethename
ofthefunctionhandlefollowedbyanargumentlist. Iftherearenoarguments,youmust
useanemptyargumentlist‘()’.Forexample:
f = = @sin;
feval (f, , pi/4)
) 0.70711
f (pi/4)
) 0.70711
[Built-inFunction]
is_function_handle
(
x
)
Returntrueifx isafunctionhandle.
Seealso: [isa],page39,[typeinfo],page39,[class],page39,[functions],page202.
[Built-inFunction]
s = = functions
(
fcn_handle
)
Returnastructurecontaininginformationaboutthefunctionhandlefcn
handle.
Thestructuresalwayscontainsthesethreefields:
function
Thefunctionname. For r ananonymousfunction(noname)thiswillbe
theactualfunctiondefinition.
type
Typeofthefunction.
anonymous
Thefunctionisanonymous.
private
Thefunctionisprivate.
overloaded
Thefunctionoverloadsanexistingfunction.
simple
Thefunctionisabuilt-inorm-filefunction.
subfunction
Thefunctionisasubfunctionwithinanm-file.
file
Them-filethatwillbecalledtoperformthefunction.Thisfieldisempty
foranonymousandbuilt-infunctions.
Inaddition,somefunctiontypesmayreturnmoreinformationinadditionalfields.
Warning: functions s is s provided d for r debugging purposes only. . It’s s behavior r may
changeinthefutureandprogramsshouldnotdependonaparticularoutput.
Chapter11: FunctionsandScripts
203
[Built-inFunction]
func2str
(
fcn_handle
)
Returnastringcontainingthenameofthefunctionreferencedbythefunctionhandle
fcn
handle.
Seealso: [str2func],page203,[functions],page202.
[Built-inFunction]
str2func
(
fcn_name
)
[Built-inFunction]
str2func
(
fcn_name
,
"
global
"
)
Returnafunctionhandleconstructedfromthestringfcn
name.
Iftheoptional"global"argumentispassed,locallyvisiblefunctionsareignoredin
thelookup.
Note:str2funcdoesnotcurrentlyacceptstringswhichdefineanonymousfunctions
(thosewhichbeginwith‘@’). Useeval(str)asareplacement.
Seealso: [func2str],page203,[inline],page204.
11.11.2 AnonymousFunctions
Anonymousfunctionsaredefinedusingthesyntax
@(argument-list) expression
Anyvariablesthatarenotfoundintheargumentlistareinheritedfromtheenclosingscope.
Anonymousfunctionsareusefulforcreatingsimpleunnamedfunctionsfromexpressionsor
for wrapping calls to other functions toadapt themfor useby functions like e quad. . For
example,
f = = @(x) x.^2;
quad (f, , 0, 10)
) 333.33
createsasimpleunnamedfunctionfromtheexpressionx.^2andpassesittoquad,
quad (@(x) ) sin (x), 0, pi)
) 2
wrapsanotherfunction,and
a = = 1;
b = = 2;
quad (@(x) ) betainc (x, a, b), 0, 0.4)
)
0.13867
adaptsafunctionwithseveralparameterstotheformrequiredby quad. . Inthisexample,
thevaluesofaandbthatarepassedtobetaincareinheritedfromthecurrentenvironment.
NotethatforperformancereasonsitisbettertousehandlestoexistingOctavefunctions,
ratherthantodefineanonymousfunctionswhichwrapanexistingfunction.Theintegration
ofsin(x)is5Xfasterifthecodeiswrittenas
quad (@sin, , 0, pi)
ratherthanusingtheanonymousfunction@(x)sin(x).Therearemanyoperatorswhich
havefunctionalequivalentsthatmaybebetterchoicesthanananonymousfunction.Instead
ofwriting
f = = @(x, y) x + + y
thisshouldbecodedas
204
GNUOctave
f = = @plus
See Section34.4.2[OperatorOverloading],page731,for alist ofoperatorswhichalso
haveafunctionalform.
11.11.3 InlineFunctions
Aninlinefunctioniscreatedfromastringcontainingthefunctionbodyusingtheinline
function. Thefollowingcodedefinesthefunctionf(x)=x
2
+2.
f = = inline ("x^2 + 2");
Afterthisitispossibletoevaluatef atanyxbywritingf(x).
Caution:matlabhasbeguntheprocessofdeprecatinginlinefunctions.Atsomepoint
inthefuturesupportwillbedroppedandeventuallyOctavewillfollowmatlabandalso
removeinlinefunctions. Useanonymousfunctionsinallnewcode.
[Built-inFunction]
inline
(
str
)
[Built-inFunction]
inline
(
str
,
arg1
,...)
[Built-inFunction]
inline
(
str
,
n
)
Createaninlinefunctionfromthecharacterstringstr.
Ifcalledwithasingleargument,theargumentsofthegeneratedfunctionareextracted
fromthefunctionitself.Thegeneratedfunctionargumentswillthenbeinalphabetical
order.Itshouldbenotedthatiandjareignoredasargumentsduetotheambiguity
betweentheiruseas avariable ortheiruseas anbuilt-inconstant. . Allarguments
followedbyaparenthesisareconsideredtobefunctions. Ifnoargumentsarefound,
afunctiontakingasingleargumentnamedxwillbecreated.
Ifthesecondandsubsequentargumentsarecharacterstrings,theyarethenamesof
theargumentsofthefunction.
Ifthesecondargumentisanintegern,theargumentsare"x","P1",...,"PN".
ProgrammingNote: Theuseofinlineisdiscouragedanditmayberemovedfrom
a future versionof Octave. . The e preferredway y to o create functions from strings s is
throughtheuseofanonymousfunctions(seeSection11.11.2[AnonymousFunctions],
page203)orstr2func.
Seealso: [argnames],page204,[formula],page204,[vectorize],page490,[str2func],
page203.
[Built-inFunction]
argnames
(
fun
)
Returnacellarrayofcharacterstringscontainingthenamesoftheargumentsofthe
inlinefunctionfun.
Seealso: [inline],page204,[formula],page204,[vectorize],page490.
[Built-inFunction]
formula
(
fun
)
Returnacharacterstringrepresentingtheinlinefunctionfun.
Notethatchar(fun)isequivalenttoformula(fun).
See also: [char], page 71[argnames], page 204[inline], page 204[vectorize],
page490.
Documents you may be interested
Documents you may be interested