Chapter36: SystemUtilities
785
[Command]
ls
[Command]
ls filenames
[Command]
ls options
[Command]
ls optionsfilenames
[FunctionFile]
list = ls
(...)
Listdirectorycontents.
Thelscommandisimplementedbycallingthenativeoperatingsystem’s directory
listingcommand—availableoptionswillvaryfromsystemtosystem.
Filenamesaresubjecttoshellexpansioniftheycontainanywildcardcharacters‘*’,
‘?’, ‘[]’. . To o find a literal example of f a a wildcard character r the e wildcard must t be
escapedusingthebackslashoperator‘\’.
Iftheoptionaloutputlistisrequestedthenlsreturnsacharacterarraywithonerow
foreachfile/directoryname.
ExampleusageonaUNIX-likesystem:
ls -l
a
total 12
a
-rw-r--r--
1 jwe e users 4488 8 Aug 19 9 04:02 foo.m
a -rw-r--r--
1 jwe e users 1315 5 Aug 17 7 23:14 bar.m
Seealso: [dir],page785,[readdir],page766,[glob],page766,[what],page134,[stat],
page763,[filesep],page767,[ls
command],page785.
[FunctionFile]
val = = ls_command
()
[FunctionFile]
old_val = ls_command
(
new_val
)
QueryorsettheshellcommandusedbyOctave’slscommand.
Seealso: [ls],page785.
[FunctionFile]
dir
[FunctionFile]
dir
(
directory
)
[FunctionFile]
[list] = = dir
(
directory
)
Displayfilelistingfordirectorydirectory.
Ifdirectory isnotspecifiedthenlistthepresentworkingdirectory.
Ifareturnvalueisrequested,returnastructurearraywiththefields
name
Fileordirectoryname.
date
Timestampoffilemodification(stringvalue).
bytes
Filesizeinbytes.
isdir
Trueifnameisadirectory.
datenum
Timestampoffilemodificationasserialdatenumber(double).
statinfo
Informationstructurereturnedfromstat.
Ifdirectory isafilename,ratherthanadirectory,thenreturninformationaboutthe
namedfile.directory mayalsobealistratherthanasingledirectoryorfile.
directory issubjecttoshellexpansionifitcontainsanywildcardcharacters‘*’,‘?’,
‘[]’. Tofindaliteralexampleofawildcardcharacterthewildcardmustbeescaped
usingthebackslashoperator‘\’.
Pdf will no pages selected - 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
a pdf page cut; break pdf password
Pdf will no pages selected - 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
pdf split pages in half; cannot select text in pdf
786
GNUOctave
Notethatforsymboliclinks,dirreturnsinformationaboutthefilethatthesymbolic
linkpointstoratherthanthelinkitself.However,ifthelinkpointstoanonexistent
file,dirreturnsinformationaboutthelink.
Seealso: [ls],page785,[readdir],page766,[glob],page766,[what],page134,[stat],
page763,[lstat],page763.
[Built-inFunction]
pwd
()
[Built-inFunction]
dir = = pwd
()
Returnthecurrentworkingdirectory.
See also: [cd], page 784,[dir], page 785,[ls], page 785,[mkdir], page 762,[rmdir],
page762.
36.9 PasswordDatabaseFunctions
Octave’spassworddatabasefunctionsreturninformationinastructurewiththefollowing
fields.
name
Theusername.
passwd
Theencryptedpassword,ifavailable.
uid
Thenumericuserid.
gid
Thenumericgroupid.
gecos
TheGECOSfield.
dir
Thehomedirectory.
shell
Theinitialshell.
In the descriptions s of f the e following functions, this data structure is s referred to o as a
pw
struct.
[Built-inFunction]
pw_struct = = getpwent
()
Return astructure containing anentry y from m the password database, opening it t if
necessary.
Oncetheendofthedatahasbeenreached,getpwentreturns0.
Seealso: [setpwent],page787,[endpwent],page787.
[Built-inFunction]
pw_struct = = getpwuid
(
uid
).
Returnastructure containingthe first entry fromthepassworddatabasewiththe
userIDuid.
IftheuserIDdoesnotexistinthedatabase,getpwuidreturns0.
Seealso: [getpwnam],page786.
[Built-inFunction]
pw_struct = = getpwnam
(
name
)
Returnastructure containingthe first entry fromthepassworddatabasewiththe
usernamename.
Iftheusernamedoesnotexistinthedatabase,getpwnamereturns0.
Seealso: [getpwuid],page786.
VB.NET TWAIN: TWAIN Image Scanning in Console Application
First, there is no SelectSourceDialog in VB.NET TWAIN console Here we will illustrate the benefits of this VB.NET how to scan multiple pages to one PDF or TIFF
acrobat split pdf bookmark; pdf format specification
VB.NET PowerPoint: Convert & Render PPT into PDF Document
on and VB.NET PDF editing add-on will be used. As our VB.NET PowerPoint to PDF conversion add-on and edit .pptx document file independently, no other external
combine pages of pdf documents into one; break a pdf
Chapter36: SystemUtilities
787
[Built-inFunction]
setpwent
()
Returntheinternalpointertothebeginningofthepassworddatabase.
Seealso: [getpwent],page786,[endpwent],page787.
[Built-inFunction]
endpwent
()
Closethepassworddatabase.
Seealso: [getpwent],page786,[setpwent],page787.
36.10 GroupDatabaseFunctions
Octave’s group database functions return information in a a structure e with h the following
fields.
name
Theusername.
passwd
Theencryptedpassword,ifavailable.
gid
Thenumericgroupid.
mem
Themembersofthegroup.
In the descriptions s of f the e following functions, this data structure is s referred to o as a
grp
struct.
[Built-inFunction]
grp_struct = getgrent
()
Returnanentryfromthegroupdatabase,openingitifnecessary.
Oncetheendofdatahasbeenreached,getgrentreturns0.
Seealso: [setgrent],page787,[endgrent],page787.
[Built-inFunction]
grp_struct = getgrgid
(
gid
).
ReturnthefirstentryfromthegroupdatabasewiththegroupIDgid.
IfthegroupIDdoesnotexistinthedatabase,getgrgidreturns0.
Seealso: [getgrnam],page787.
[Built-inFunction]
grp_struct = getgrnam
(
name
)
Returnthefirstentryfromthegroupdatabasewiththegroupnamename.
Ifthegroupnamedoesnotexistinthedatabase,getgrnamreturns0.
Seealso: [getgrgid],page787.
[Built-inFunction]
setgrent
()
Returntheinternalpointertothebeginningofthegroupdatabase.
Seealso: [getgrent],page787,[endgrent],page787.
[Built-inFunction]
endgrent
()
Closethegroupdatabase.
Seealso: [getgrent],page787,[setgrent],page787.
C# Image: Create C#.NET Windows Document Image Viewer | Online
C# Windows Document Image Viewer Features. No need for viewing multiple document & image formats (PDF, MS Word The following list will give you a broad overview
pdf no pages selected to print; acrobat split pdf pages
VB.NET Word: Use VB.NET Code to Convert Word Document to TIFF
VB.NET Word to TIFF image converting application, no external Word free to contact us and we will offer you more user guides with RasteEdge .NET PDF SDK using
break up pdf into individual pages; can't select text in pdf file
788
GNUOctave
36.11 SystemInformation
[FunctionFile]
computer
()
[FunctionFile]
c = = computer
()
[FunctionFile]
[c, maxsize] ] = computer
()
[FunctionFile]
[c, maxsize, , endian] = = computer
()
[FunctionFile]
arch = computer
(
"
arch
"
)
Printorreturnastringoftheformcpu-vendor-osthatidentifiesthetypeofcomputer
thatOctaveisrunningon.
Ifinvokedwithanoutput argument, , the value is s returnedinsteadofprinted. . For
example:
computer ()
a
i586-pc-linux-gnu
mycomp = = computer r ()
)
mycomp = "i586-pc-linux-gnu"
Iftwooutputargumentsarerequested,alsoreturnthemaximumnumberofelements
foranarray. ThiswilldependonwhetherOctavehasbeencompiledwith32-bitor
64-bitindexvectors.
Ifthree output arguments arerequested,also returnthe byteorder ofthe current
systemasacharacter("B"forbig-endianor"L"forlittle-endian).
Iftheargument"arch"isspecified,returnastringindicatingthearchitectureofthe
computeronwhichOctaveisrunning.
Seealso: [isunix],page789,[ismac],page789,[ispc],page789.
[Built-inFunction]
[uts, err, msg] = uname
()
Returnsysteminformationinthestructure.
Forexample:
uname ()
) {
sysname = = x86_64
nodename = = segfault
release = = 2.6.15-1-amd64-k8-smp
version = = Linux
machine = = #2 SMP Thu Feb 23 04:57:49 UTC C 2006
}
Ifsuccessful,erris0andmsg isanemptystring. Otherwise,errisnonzeroandmsg
containsasystem-dependenterrormessage.
[Built-inFunction]
nproc
()
[Built-inFunction]
nproc
(
query
)
Returnthecurrentnumberofavailableprocessors.
Ifcalledwiththe optional argument query, modify howprocessors are counted as
follows:
all
totalnumberofprocessors.
C# HTML5 PDF Viewer SDK deployment on IIS in .NET
This page will navigate users how to deploy HTML5 PDF to the place where you store XDoc.PDF.HTML5 Viewer The site configured in IIS has no sufficient authority
break apart a pdf in reader; break apart pdf pages
VB.NET PDF - VB.NET HTML5 PDF Viewer Deployment on IIS
This page will navigate users how to deploy HTML5 PDF to the place where you store XDoc.PDF.HTML5 Viewer The site configured in IIS has no sufficient authority
acrobat separate pdf pages; pdf split pages
Chapter36: SystemUtilities
789
current
processorsavailabletothecurrentprocess.
overridable
same as s current, but t overridable through h the OMP_NUM_THREADS S envi-
ronmentvariable.
[FunctionFile]
ispc
()
ReturntrueifOctaveisrunningonaWindowssystemandfalseotherwise.
Seealso: [isunix],page789,[ismac],page789.
[FunctionFile]
isunix
()
ReturntrueifOctaveisrunningonaUnix-likesystemandfalseotherwise.
Seealso: [ismac],page789,[ispc],page789.
[FunctionFile]
ismac
()
ReturntrueifOctaveisrunningonaMacOSXsystemandfalseotherwise.
Seealso: [isunix],page789,[ispc],page789.
[Built-inFunction]
isieee
()
Returntrue ifyour computer claims s toconformto the e IEEEstandardforfloating
pointcalculations.
Noactualtestsareperformed.
[FunctionFile]
isdeployed
()
Returntrueifthecurrentprogramhasbeencompiledandisrunningseparatelyfrom
theOctaveinterpreterandfalseifitisrunningintheOctaveinterpreter.
Currently,thisfunctionalwaysreturnsfalseinOctave.
[Built-inFunction]
isstudent
()
Returntrueifrunninginthestudenteditionofmatlab.
isstudentalwaysreturnsfalseinOctave.
Seealso: [false],page61.
[Built-inFunction]
OCTAVE_HOME
()
Returnthenameofthetop-levelOctaveinstallationdirectory.
Seealso: [EXEC
PATH],page779,[IMAGE
PATH],page697.
[FunctionFile]
matlabroot
()
Returnthenameofthetop-levelOctaveinstallationdirectory.
ThisisanaliasforthefunctionOCTAVE_HOMEprovidedforcompatibility.
Seealso: [OCTAVE
HOME],page789.
[Built-inFunction]
OCTAVE_VERSION
()
ReturntheversionnumberofOctaveasastring.
Seealso: [ver],page790,[version],page790.
VB.NET TIFF: .NET TIFF Printer Control; Print TIFF Using VB.NET
TIFF document printing add-on has no limitation on VB.NET TIFF printing API will automatically send powerful & profession imaging controls, PDF document, image
break a pdf file into parts; break apart pdf
C# Word: C#.NET Word Rotator, How to Rotate and Reorient Word Page
Remarkably, no other external products, including Microsoft page rotation control SDK will integrate the & profession imaging controls, PDF document, image to
break a pdf password; add page break to pdf
790
GNUOctave
[FunctionFile]
version
()
ReturntheversionnumberofOctaveasastring.
ThisisanaliasforthefunctionOCTAVE_VERSIONprovidedforcompatibility.
Seealso: [OCTAVE
VERSION],page789,[ver],page790.
[FunctionFile]
ver
[FunctionFile]
ver
Octave
[FunctionFile]
verpackage
[FunctionFile]
v = = ver
(...)
Display aheadercontainingthe currentOctave versionnumber,licensestring,and
operatingsystem.Theheaderisfollowedbyalistofinstalledpackages,versions,and
installationdirectories.
UsethepackagenamepackageorOctavetolimitthelistingtoadesiredcomponent.
Whencalledwithanoutputargument,returnavectorofstructuresdescribingOctave
andeachinstalledpackage.Thestructureincludesthefollowingfields.
Name
Packagename.
Version
Versionofthepackage.
Revision Revisionofthepackage.
Date
Dateoftheversion/revision.
Seealso:[version],page790,[octave
config
info],page791,[usejava],page797,[pkg],
page807.
[FunctionFile]
compare_versions
(
v1
,
v2
,
operator
)
Comparetwoversionstringsusingthegivenoperator.
Thisfunctionassumesthatversions v1 andv2 arearbitrarilylongstringsmadeof
numericandperiodcharacterspossiblyfollowedbyanarbitrarystring(e.g.,"1.2.3",
"0.3","0.1.2+",or"1.2.3.4-test1").
Theversionisfirstsplitintonumericandcharacterportionsandthenthepartsare
paddedtobethesamelength(i.e.,"1.1"wouldbepaddedtobe"1.1.0"whenbeing
comparedwith"1.1.1",andseparately,thecharacterpartsofthestringsarepadded
withnulls).
Theoperatorcanbeanylogicaloperatorfromtheset
 "=="equal
 "<"lessthan
 "<="lessthanorequalto
 ">"greaterthan
 ">="greaterthanorequalto
 "!="notequal
 "~="notequal
Note that version"1.1-test2"willcompareas greater than"1.1-test10". . Also,
sincethenumericpart iscomparedfirst,"a" compares less than"1a"because the
secondstringstartswithanumericparteventhoughdouble("a")isgreaterthan
double("1").
Chapter36: SystemUtilities
791
[Command]
license
[Command]
license
inuse
[Command]
license
inuse
feature
[FunctionFile]
license
(
"
inuse
"
)
[FunctionFile]
retval = = license
(
"
inuse
"
)
[FunctionFile]
retval = = license
(
"
test
"
,
feature
)
[FunctionFile]
retval = = license
(
"
checkout
"
,
feature
)
[FunctionFile]
[retval, errmsg] = = license
(
"
checkout
"
,
feature
)
GetlicenseinformationforOctaveandOctavepackages.
GNU Octave is free e software e distributed d under the GNU General Public License
(GPL),andalicense manager makes no sense. . Thisfunction n is s providedonly for
matlabcompatibility.
Whencalledwithnoextrainputarguments,itreturnstheOctavelicense,otherwise
thefirstinputdefinestheoperationmodeandmustbeoneofthefollowingstrings:
inuse,test,andcheckout.Theoptionalfeatureargumentcaneitherbe"octave"
(core),oranOctavepackage.
"inuse"
Returnsalistofloadedfeatures,i.e.,octaveandthelistofloadedpack-
ages. Ifanoutput t isrequested,itreturns astructarraywiththefields
"feature",and"user".
"test"
Returntrueifthespecifiedfeatureisinstalled,falseotherwise.
Anoptionalthirdargument"enable"or"disable"isacceptedbutig-
nored.
"checkout"
Returntrueifthespecifiedfeature isinstalled,falseotherwise. . Anop-
tional secondoutputwillhave anerror r message ifa package is not in-
stalled.
Seealso: [pkg],page807,[ver],page790,[version],page790.
[Built-inFunction]
octave_config_info
()
[Built-inFunction]
octave_config_info
(
option
)
ReturnastructurecontainingconfigurationandinstallationinformationforOctave.
Ifoptionisastring,returntheconfigurationinformationforthespecifiedoption.
Seealso: [computer],page788.
[Built-inFunction]
getrusage
()
ReturnastructurecontaininganumberofstatisticsaboutthecurrentOctaveprocess.
Not all l fields are available e on n all systems. . If f it t is not t possible to get CPU U time
statistics, the CPUtime slots s are settozero. . Other r missing dataare replacedby
NaN. Thelistofpossiblefieldsis:
idrss
Unshareddatasize.
inblock
Numberofblockinputoperations.
isrss
Unsharedstacksize.
792
GNUOctave
ixrss
Sharedmemorysize.
majflt
Numberofmajorpagefaults.
maxrss
Maximumdatasize.
minflt
Numberofminorpagefaults.
msgrcv
Numberofmessagesreceived.
msgsnd
Numberofmessagessent.
nivcsw
Numberofinvoluntarycontextswitches.
nsignals Numberofsignalsreceived.
nswap
Numberofswaps.
nvcsw
Numberofvoluntarycontextswitches.
oublock
Numberofblockoutputoperations.
stime
AstructurecontainingthesystemCPUtimeused. Thestructurehasthe
elementssec(seconds)usec(microseconds).
utime
AstructurecontainingtheuserCPUtimeused. Thestructurehasthe
elementssec(seconds)usec(microseconds).
36.12 HashingFunctions
It is often n necessary y to find d iftwostrings s or files are identical. . This s might t be e done by
comparingthemcharacterby characterandlookingfordifferences. . However,thiscanbe
slow,andsocomparingahashofthestringorfilecanbearapidwayoffindingifthefiles
differ.
Anotheruseofthehashingfunctionistocheckforfileintegrity.Theusercancheckthe
hashofthefileagainstaknownvalueandfindifthefiletheyhaveisthesameastheone
thattheoriginalhashwasproducedwith.
Octave supplies the md5sumfunctiontoperformMD5 hashes onstrings andfiles. . An
exampleoftheuseofmd5sumfunctionmightbe
if exist (file, , "file")
hash = md5sum m (file);
else
# Treat t the e variable "file" as a a string
hash = md5sum m (file, , true);
endif
[Built-inFunction]
md5sum
(
file
)
[Built-inFunction]
md5sum
(
str
,
opt
)
CalculatetheMD5sumofthefilefile.
Ifthesecondparameteroptexists andistrue,thencalculatetheMD5sumofthe
stringstr.
Chapter37: JavaInterface
793
37 JavaInterface
TheJavaInterfaceisdesignedforcallingJavafunctionsfromwithinOctave.Ifyouwantto
dothereverse,andcallOctavefromwithinJava,tryalibrarylike javaOctave(http://
kenai.com/projects/javaOctave)orjoPas(http://jopas.sourceforge.net).
37.1 JavaInterfaceFunctions
Thefollowingfunctionsare thecoreoftheJavaInterface. . Theyprovide e awaytocreate
aJavaobject,get andsetits datafields, , andcallJava methods s whichreturnresults to
Octave.
[Built-inFunction]
jobj = javaObject
(
classname
)
[Built-inFunction]
jobj = javaObject
(
classname
,
arg1
,...)
Create aJava object of class classsname, by callingthe class constructor with the
argumentsarg1,...
The first example below creates s anuninitializedobject, whilethe e secondexample
suppliesaninitialargumenttotheconstructor.
x = javaObject ("java.lang.StringBuffer")
x = javaObject ("java.lang.StringBuffer", , "Initial l string")
Seealso: [javaMethod],page795,[javaArray],page793.
[FunctionFile]
jary = javaArray
(
classname
,
sz
)
[FunctionFile]
jary = javaArray
(
classname
,
m
,
n
,...)
CreateaJavaarrayofsizeszwithelementsofclassclassname.
classname maybeaJavaobjectrepresentingaclassorastringcontainingthefully
qualifiedclass name. . The e size of theobject may alsobe specified withindividual
integerargumentsm,n,etc.
Thegeneratedarray is uninitialized. . Allelements s areset tonullif classname is a
referencetype,ortoadefaultvalue(usually0)ifclassnameisaprimitivetype.
Samplecode:
jary = javaArray y ("java.lang.String", , 2, 2);
jary(1,1) = "Hello";
Seealso: [javaObject],page793.
There are e many different variable types in n Octave e but only ones created d through
javaObjectcanuseJavafunctions. BeforeusingJavawithanunknownobjectthetype
canbecheckedwithisjava.
[Built-inFunction]
isjava
(
x
)
Returntrueifx isaJavaobject.
Seealso: [class],page39,[typeinfo],page39,[isa],page39,[javaObject],page793.
Onceanobjecthasbeencreateditisnaturaltofindoutwhatfieldstheobjecthasand
toread(get)andwrite(set)them.
In Octave the fieldnames s function n for structures s has been n overloaded to returnthe
fieldsofaJavaobject. Forexample:
794
GNUOctave
dobj = = javaObject ("java.lang.Double", pi);
fieldnames (dobj)
)
{
[1,1] = = public c static c final l double java.lang.Double.POSITIVE_INFINITY
[1,2] = = public c static c final l double java.lang.Double.NEGATIVE_INFINITY
[1,3] = = public c static c final l double java.lang.Double.NaN
[1,4] = = public c static c final l double java.lang.Double.MAX_VALUE
[1,5] = = public c static c final l double java.lang.Double.MIN_NORMAL
[1,6] = = public c static c final l double java.lang.Double.MIN_VALUE
[1,7] = = public c static c final l int java.lang.Double.MAX_EXPONENT
[1,8] = = public c static c final l int java.lang.Double.MIN_EXPONENT
[1,9] = = public c static c final l int java.lang.Double.SIZE
[1,10] = public static final java.lang.Class java.lang.Double.TYPE
}
The analogyofobjectswithstructuresis carriedoverintoreadingandwritingobject
fields. Toreadafieldtheobject t is indexed d withthe‘.’operator r fromstructures. . This
isthepreferredmethodforreadingfields,butOctavealsoprovidesafunctioninterfaceto
readfieldswithjava_get.Anexampleofbothstylesisshownbelow.
dobj = = javaObject ("java.lang.Double", pi);
dobj.MAX_VALUE
)
1.7977e+308
java_get ("java.lang.Float", "MAX_VALUE")
)
3.4028e+38
[FunctionFile]
val = = java_get
(
obj
,
name
)
GetthevalueofthefieldnameoftheJavaobjectobj.
For static c fields, obj j can n be a string g representing g the fully qualified name e of f the
correspondingclass.
WhenobjisaregularJavaobject,structure-likeindexingcanbeusedasashortcut
syntax. Forinstance,thefollowingtwostatementsareequivalent
java_get (x, "field1")
x.field1
Seealso: [java
set],page794,[javaMethod],page795,[javaObject],page793.
[FunctionFile]
obj = = java_set
(
obj
,
name
,
val
)
SetthevalueofthefieldnameoftheJavaobjectobjtoval.
For static fields, , obj canbe astring representing the fully y qualified d namedofthe
correspondingJavaclass.
WhenobjisaregularJavaobject,structure-likeindexingcanbeusedasashortcut
syntax. Forinstance,thefollowingtwostatementsareequivalent
java_set (x, "field1", , val)
x.field1 = val
Seealso: [java
get],page794,[javaMethod],page795,[javaObject],page793.
Documents you may be interested
Documents you may be interested