Difference between revisions of "Rosetta Stone"

From Free Pascal wiki
Jump to navigationJump to search
m (→‎Operating systems: Active Directory, ldap stuff, formatting)
(→‎Operating systems: List drives/partitions)
Line 29: Line 29:
 
|-
 
|-
 
| dir||ls||Find files in a directory||Lazarus FindAllFiles  
 
| dir||ls||Find files in a directory||Lazarus FindAllFiles  
 +
|-
 +
| diskpart list volume||mount||Show partitions/volumes/drives on a computer||Windows: see [[Windows_Programming_Tips#Listing_all_available_drives]]
 +
 +
Linux: see [[Linux_Programming_Tips#Get_the_list_of_mounted_partitions]]
 +
 +
Unix: you'll have to parse some files (e.g. /etc/mtab) yourself, depending on Unix flavour; see [http://lazarus.freepascal.org/index.php/topic,15943.msg86569.html#msg86569 Forum post]
 
|-
 
|-
 
|ldifde||ldapsearch||Search through Active Directory/LDAP||Use Synapse ldapsend unit to work with LDAP queries; see e.g. [http://leonardorame.blogspot.com/2007_02_01_archive.html example code on Leonardo Ramé's blog]
 
|ldifde||ldapsearch||Search through Active Directory/LDAP||Use Synapse ldapsend unit to work with LDAP queries; see e.g. [http://leonardorame.blogspot.com/2007_02_01_archive.html example code on Leonardo Ramé's blog]

Revision as of 14:24, 14 February 2012

Introduction

Often, people new to a programming language/library have trouble mapping the things they know how to do in other environments to the new environments.

It can be handy to have a sort of "Rosetta stone" that roughly translates tasks from one environment/language into another.

Programming languages

If you have experience in other programming languages (such as C++, Visual Basic), there are some Rosetta stone web pages that might help you. As FreePascal/Lazarus syntax and library is fairly consistent with Delphi's, sites that "translate" to Delphi are also a valuable resource.

Some useful pages:

Operating systems

If you know how to do something in an operating system, chances are you can do the same using FPC/Lazarus.

The table below gives a rough mapping of some tasks:

Windows/DOS Unix/Linux Description FreePascal/Lazarus
copy cp Copy file Lazarus fileutil.copyfile; roll your own with filestreams
del, erase rm, rm -f Delete file sysutils.deletefile, erase
deltree, rmdir /s rm -r,rm -rf Remove directories with subdirectories Lazarus fileutil.deletedirectory
dir ls Find files in a directory Lazarus FindAllFiles
diskpart list volume mount Show partitions/volumes/drives on a computer Windows: see Windows_Programming_Tips#Listing_all_available_drives

Linux: see Linux_Programming_Tips#Get_the_list_of_mounted_partitions

Unix: you'll have to parse some files (e.g. /etc/mtab) yourself, depending on Unix flavour; see Forum post

ldifde ldapsearch Search through Active Directory/LDAP Use Synapse ldapsend unit to work with LDAP queries; see e.g. example code on Leonardo Ramé's blog
mkdir mkdir Create directory mkdir; forcedirectories (creates entire path, if necessary)
move mv Move file to another directory Within partition/disk: sysutils.renamefile; otherwise copy and delete original
rename, ren mv Rename file sysutils.renamefile (can also "move" a file between directories, but only on same partition/disk
shutdown shutdown Shut down computer ?
wget, curl wget, curl Download file from HTTP/FTP Multiple options, e.g. use synapse httpsend or ftpsend units