A Leaflet control that search markers/features location by custom property.
Support ajax/jsonp autocompletion and JSON data filter/remapping.
Licensed under the MIT license.
Copyright Stefano Cudini
Tested in Leaflet 0.7.x and 1.3.x
Demo:
labs.easyblog.it/maps/leaflet-search
npm install --save leaflet-search
| Option | Default | Description | |
|---|---|---|---|
| url | '' | url for search by ajax request, ex: "search.php?q={s}". Can be function to returns string for dynamic parameter setting | |
| layer | null | layer where search markers(is a L.LayerGroup) | |
| sourceData | null | function to fill _recordsCache, passed searching text by first param and callback in second | |
| jsonpParam | null | jsonp param name for search by jsonp service, ex: "callback" | |
| propertyLoc | 'loc' | field for remapping location, using array: ['latname','lonname'] for select double fields(ex. ['lat','lon'] ) support dotted format: 'prop.subprop.title' | |
| propertyName | 'title' | property in marker.options(or feature.properties for vector layer) trough filter elements in layer, | |
| formatData | null | callback for reformat all data from source to indexed data object | |
| filterData | null | callback for filtering data from text searched, params: textSearch, allRecords | |
| moveToLocation | null | callback run on location found, params: latlng, title, map | |
| buildTip | null | function to return row tip html node(or html string), receive text tooltip in first param | |
| container | '' | container id to insert Search Control | |
| zoom | null | default zoom level for move to location | |
| minLength | 1 | minimal text length for autocomplete | |
| initial | true | search elements only by initial text | |
| casesensitive | false | search elements in case sensitive text | |
| autoType | true | complete input with first suggested result and select this filled-in text. | |
| delayType | 400 | delay while typing for show tooltip | |
| tooltipLimit | -1 | limit max results to show in tooltip. -1 for no limit, 0 for no results | |
| tipAutoSubmit | true | auto map panTo when click on tooltip | |
| firstTipSubmit | false | auto select first result con enter click | |
| autoResize | true | autoresize on input change | |
| collapsed | true | collapse search control at startup | |
| autoCollapse | false | collapse search control after submit(on button or on tips if enabled tipAutoSubmit) | |
| autoCollapseTime | 1200 | delay for autoclosing alert and collapse after blur | |
| textErr | 'Location not found' | error message | |
| textCancel | 'Cancel | title in cancel button | |
| textPlaceholder | 'Search' | placeholder value | |
| hideMarkerOnCollapse | false | remove circle and marker on search control collapsed | |
| position | 'topleft' | position in the map | |
| marker | {} | custom L.Marker or false for hide | |
| marker.icon | false | custom L.Icon for maker location or false for hide | |
| marker.animate | true | animate a circle over location found | |
| marker.circle | L.CircleMarker options | draw a circle in location found |
| Event | Data | Description |
|---|---|---|
| 'search:locationfound' | {latlng, title, layer} | fired after moved and show markerLocation |
| 'search:expanded' | {} | fired after control was expanded |
| 'search:collapsed' | {} | fired after control was collapsed |
| Method | Arguments | Description |
|---|---|---|
| setLayer() | L.LayerGroup() | set layer search at runtime |
| showAlert() | 'Text message' | show alert message |
| searchText() | 'Text searched' | search text by external code |
(require src/leaflet-search.css)
Adding the search control to the map:
var searchLayer = L.layerGroup().addTo(map);
//... adding data in searchLayer ...
map.addControl( new L.Control.Search({layer: searchLayer}) );
//searchLayer is a L.LayerGroup contains searched markers
Short way:
var searchLayer = L.geoJson().addTo(map);
//... adding data in searchLayer ...
L.map('map', { searchControl: {layer: searchLayer} });
AMD module:
require(["leaflet", "leafletSearch"],function(L, LeafletSearch) {
//... initialize leaflet map and dataLayer ...
map.addControl( new LeafletSearch({
layer: dataLayer
}) );
});
Therefore the deployment require npm installed in your system.
npm install
grunt
This list is intended to be of utility for all developers who are looking web mapping sample code to solve complex problems of integration with other systems using Leaflet Control Search.
Anyone can add the link of your website
(spamming urls will be automatically deleted)


The National Chiang Kai-shek Memorial Hall is a famous national monument, landmark and tourist attraction erected in memory of Generalissimo Chiang Kai-shek, former President of the Republic of China. It is located in Zhongzheng District, Taipei.
The National Palace Museum,located in Taipei, Taiwan, has a permanent collection of nearly 700,000 pieces of ancient Chinese imperial artifacts and artworks, making it one of the largest of its type in the world. The collection encompasses 8,000 years of history of Chinese art from the Neolithic age to the modern
The Taipei Zoo, sometimes referred to as the "Muzha Zoo", is a public zoological garden in Wenshan District, Taipei, Taiwan. It is the most famous zoological garden in Taiwan and a leader in conservation, research and education, and recreation. It is one of the largest zoos in Asia, with a total area of 165 hectares, of which more than 90 ha are developed
This building was officially classified as the world's tallest from its opening in 2004 until the 2010 completion of the Burj Khalifa in Dubai, UAE. The observatory is spread over 4 floors where visitors can enjoy the fantastic scenery and learn about the engineering marvel that is Taipei 101, the tallest green building the world.
North Gate is also known as Cheng-en Gate, because above the rounded archways of the outer wall there is a horizontal panel inscribed with the words “Cheng-en Gate”, facing the north, and meaning “accepting imperial favor”. In the past, local officials dispatched by the Qing Dynasty all used Cheng-en Gate to enter and exit Taipei City, differing from the practice of the general population, which entered from South Gate..
Treasure Hill is a community in Taipei, Taiwan. Originally an illegal settlement, it was founded by the Kuomintang military veterans at the end of the 1940s and served originally as an anti-aircraft position.The small community of Treasure Hill overlooks the Xindian River in Taipei City. Located in Gongguan District but secluded from the area’s bustling markets and streets, it was once home to more than 200 families.
The most well known temple in Taiwan, the Mengjia Longshan Temple was built in 1738 by settlers from Fujian as a gathering place for Chinese settlers. Located in the old village part of Taipei, Wanhua District, this temple has stood the test of time and lasted through several natural disasters and wars.
Address & contact information :
No1, Shuangcheng Street, Zhongshan District, Taipei City, Taiwan 104
+886 2 7743 9999
Check-in time 15:00
Check-out time: 12:00
Price : Rs. 7,607
Address & contact information :
No. 167號, Bangka Blvd, Wanhua District,Taipei City,
Taiwan 10851
+886 2 2306 6777
Check-in time 15:00
Check-out time: 12:00
Price : Rs. 5,685
Address & contact information :
No. 2, Songshou Road, Xinyi District, Taipei City, Taiwan 110060
+886 2 2720 1234
Check-in time 15:00
Check-out time: 12:00
Price : Rs. 12,264
Address & contact information :
528 Zhongxiao East Road, Nangang District, Taipei City, Taiwan 115
+886 2 2789 3009
Check-in time 15:00
Check-out time: 12:00
Price : Rs. 6,785
Address & contact information :
No. 428789 Taiyuan Road, Datong District, Taipei City,Taiwan 103
+886 2 2558 8812
Check-in time 12:00
Check-out time: 11:00
Price : Rs. 5,034
Address & contact information :
103, Taiwan, Taipei City, Datong District, Huayin Street, 50號4F
+886 2 2556 2015
Check-in time 15:00
Check-out time: 11:00
Price : Rs. 7,151


Use this form to report an app. Please let us know why you are reporting it and we will look into it as quickly as we can.
The app you are going to report is:


---
layout: theorems
---
Sum of Subspaces
Let $W_1, \dots, W_m\subseteq V$, we write $W_1+\dots + W_m=\{x_1 + \dots + x_m:x_i\in W_i\}$, and $W=W_1+\dots + W_m$ is a subspace.
Concepts
Coming soon
Hypothesis
Coming soon
Results
Coming soon
Proof
Coming soon


| CONTENTS |
As we've said, the shell is just another program. It's responsible for interpreting the commands you type. There are several commonly used shells, primarily based on two or three major families and a wide variety of other projects:
The Bourne shell (sh) and its derivatives and progeny (including bash, ash, and even the Korn shell ksh)
The C shell (csh) and its progeny (including tcsh)
The Korn shell (ksh) and variants (including pdksh and zsh[1])
Specialized shells based on languages such as Python, TCL, perl, and so on.
Shells invented to meet specific needs such as restricted command access (rsh), recovery after a system failure (sash), and downloading, installing, and configuring software libraries.
If you can think of a reason to have a specialized shell, someone probably has already written one to meet that need.
Interpreting your commands might seem simple enough, but a lot of things happen between the time you press RETURN and the time the computer actually does what you want. The process of interpretation is very complex: the shell has to break the command into words and expand aliases (Section 29.2), history operators (Section 30.8), and shell and environment variables (Section 35.3, Section 35.9). It also sets up standard input and output streams (Section 43.1) and performs a lot of other tasks. Indeed, if a command looks right but doesn't work right, the cause is probably either one of the following:
File permissions are set incorrectly.
You don't understand how the shell is processing your command line.
I'd say that file permission problems are more common, but it's a close call. File permission problems are usually easy to understand, once you know what to look for, but the rules by which a shell interprets your command line are another thing altogether. Lest I scare you, we'll try to go slow with this material. Although it's difficult, understanding how the shell parses your commands is important to becoming a power user.
In this chapter, we'll look at how a Unix shell interprets commands. Shells have similar interpretation rules. The C shell can be tricky at times, mostly because its behavior isn't as well defined as the others. And zsh has some twists that others don't they're included by design, but they can surprise users of other shells. However, there's nothing "magical" about these rules. Tomorrow morning, you may grab some new shell from the Net and find out that it has a new and different way of interpreting commands. For better or worse, that's what Unix is all about.
As part of this discussion, we'll cover quoting, which is the mechanism by which you can turn off the special meanings that the shell assigns to some characters. Quoting is an integral part of command-line processing; it allows you to control what the shell will do to your commands.
ML and SJC
When the shell executes an external command (Section 1.9), what happens?
Unix programs are executed through a combination of two system calls (low-level requests to the operating system) called fork and exec.
The exec system call tells the kernel to execute another program. However, the kernel replaces the calling program with the new one being called. This doesn't work too well if you want to return to the original program after the new one has done its job.
To get around this problem, programs that want to stick around first copy themselves with the fork system call. Then the copied program execs the new program, terminating itself in the process.
You don't really need to know this little tidbit about what goes on behind the scenes, but it sure helps to know about fork and exec when reading some Unix manuals. Section 24.2 has more information.
TOR and SJC
A shell is a program that interprets your command lines and runs other programs. Another name for the shell is "command interpreter." This article covers the two major Unix shell families, including discussion about how shells run, search for programs, and read shell script files.
For each command it runs, a shell performs a series of steps. First, if the shell is reading commands from a terminal (interactively), it prints a prompt (such as % or $) and waits for you to type something. Next, the shell reads the command line (like cat -v afile bfile > cfile), interprets it (Section 27.1), and runs the result. When the command finishes running (unless the command is in the background (Section 23.2)), the shell is ready to read another command line.
A shell can read command lines from a terminal or it can read them from a file. When you put command lines into a file, that file is called a shell script (Section 35.1) or shell program. The shell handles the shell script just as it handles the commands you type from a terminal (though the shell uses its non-interactive mode (Section 3.4), which means, basically, that it doesn't print the % or $ prompts, among other things). With this information, you already know how to write simple shell scripts just put commands in a file and feed them to the shell!
In addition, though, there are a number of programming constructs that make it possible to write shell programs that are much more powerful than just a list of commands.
There are two main shell families in Unix:
The C shell and its derivatives (csh, tcsh) are considered very powerful for situations where you are interactively working on a terminal. csh will read shell scripts and has some useful features for programmers. Unfortunately, it has some quirks that can make shell programming tough.
The Bourne shell (sh) and shells like it are probably used more often for shell programming. (Some newer sh-like shells, including ksh, zsh, and bash (Section 1.6), combine handy interactive C shell-like features with Bourne shell syntax.)
As Section 26.6 explains, if the shell is trying to run a command, and the command isn't built-in to the shell itself, the shell looks in a list of directories called a search path. Unix systems have standard directories with names like /bin and /usr/bin that hold standard Unix programs. Almost everyone's search path includes these directories.
If you do much shell programming, you should make a directory on your account for executable files. Most people name theirs bin and put it under their home directory. See Section 7.4.
Most serious shell programmers write their scripts for the Bourne shell or its variants, such as bash or ksh. So do we.
Newer Bourne shells have features such as shell functions (Section 29.11), an unset command for shell variables, and others that the earlier Version 7 Bourne shell didn't. Most scripts in this book are written to work on all Bourne shells for the sake of portability, some scripts don't use these new features. It's pretty rare to find such old shells around nowadays, though, so use your own judgment. It is pretty unlikely that if you're writing a shell script for your own use on a new system you will ever need to back-port it to run on a V7 system.
For the rest of these introductory articles, it may be easier if you have a terminal close by so you can try the examples. If your account uses the Bourne shell or one of its relatives (ksh, bash, etc.), your prompt probably has a dollar sign ($) in it somewhere, unless you've modified the prompt yourself (Section 4.1). If your account isn't running the Bourne shell, start one by typing sh. Your prompt should change to a dollar sign ($). You'll be using the Bourne shell until you type CTRL-d at the start of a line:
% sh $ $ ...Enter commands... $ CTRL-d %
One more thing to note is that when dealing with shell scripts, which store sequences of commands that you want to be able to run at one time, you will likely need to specify the shell or other program that will run the commands by default. This is normally done using the special #! notation (Section 36.2) in the first line of the script.
#!/bin/sh # everything in this script will be run under the Bourne shell ... #!/bin/tcsh # everything in this script will be run under tcsh ... #!/usr/bin/perl # everything in this script will be interpreted as a perl command ...
JP and SJC
Before getting into the details of command interpretation, I thought I'd give a very simple example of why it's important. Here's an error that occurs all the time. Let's say you have two files, called file1 and file2. You want to create a new version of file1 that has file2 added to the end of it. That's what cat is all about, so you give the command:
% cat file1 file2 > file1 ...wrong
This looks like it should work. If you've ever tried it, you know it doesn't; it erases file1, and then dumps file2 into it. Why? The shell (not cat) handles standard input and output:
As the shell is processing the command, it sees that you're redirecting standard output into file1, so it opens the file for writing, destroying the data that's already in it.
Later, after it's finished interpreting the command line, the shell executes cat, passing file1 and file2 as arguments. But file1 is already empty.
cat reads file1 (which is empty) and writes it on standard output (which goes into file1).
cat reads file2 (which also goes into file1). At this point, cat is finished, so it exits.
file1 and file2 are identical, which isn't what you wanted. But it's what you got.
Some versions of cat give you a warning message in this situation (cat: file1: input file is output file). This might lead you to believe that somehow cat was smart and managed to protect you. Sadly, that's not true. By the time cat figures out that an input file and an output file are the same, it's too late: file1 is already gone. This bit of catty cleverness does have a function, though: it prevents commands like the following from creating infinitely long files:
% cat file1 file2 >> file2
ML
Go to http://examples.oreilly.com/upt3 for more information on: showargs
When you're experimenting with shell quoting, it's nice to be able to see how arguments on a command line are quoted. Here's a demo of a simple bash script[2] named showargs; you might want to save it in a file and run it yourself (Section 35.1). The script shows how many arguments were passed to it. Then it lists the arguments, one per line, surrounded by >> << to show leading or trailing spaces.
cat Section 12.2, && Section 35.14, $# Section 35.20, path Section 35.7
% cat showargs #!/bin/bash test $# -ne 1 && s=s echo "I got $# argument$s:" for arg do echo -E ">>$arg<<" done % showargs "Start of path:" $path[1-3] " that's it! " I got 5 arguments: >>Start of path:<< >>/u/jpeek/bin<< >>/bin<< >>/usr/bin<< >> that's it! <<
The output from your shell may differ from that shown above, which is the result of running showargs in tcsh. bash doesn't have a $path variable, for example. And zsh expects a comma, rather than a hyphen, to separate the range. But as long as the arguments to showargs are quoted properly, you should get the result you're looking for, with a little tweaking, of course!
JP and SJC
Your search path (Section 35.6, Section 35.7) controls what directories and in what order the shell searches for external (Section 1.9) commands. You can set a search path that takes effect every time you log in by editing your shell setup file (Section 3.3). You might also want to change the path temporarily. Most shells also keep quick-reference lists of command locations that bypass the search path, so you'll want to know how to manage these.
Changing the path set when you log in is simple: just add the new directory to the appropriate line in your shell's startup files (Section 3.3). It's not recommended to redefine the path completely, though, as some packages rely on their PATH being set correctly. Usually, it is best simply to add the new directory's absolute path (Section 31.2) to the end of the existing PATH variable:
PATH=$PATH:$HOME/bin zsh, sh, ksh, bash set path=($path ~/bin) zsh (omit the set), csh, tcsh
|
For Bourne-type shells, load the updated PATH by typing a command like:
$ .' .profile sh $ .' .bash_profile bash
For the C shell, type one of these commands, depending on which file you changed:
% source' .cshrc % source' .tcshrc % source' .login
Sometimes you'll want to change the path in just your current shell, though, which is as easy as modifying any other shell or environment variable. Let's assume that for the current session, you want to be able to execute commands being tested before deployment, and that those commands are in your $HOME/someprog/bin directory. Simply add that directory to the front of your existing path:
$ PATH=$HOME/someprog/bin:$PATH Bourne shells $ export PATH $ export PATH=$HOME/someprog/bin:$PATH bash, ksh % set path=(~/xxx/alpha-test $path) C shells
Searching the path (Section 27.6) takes time, especially if it's long or if some filesytems are slow or mounted by a slow network link. Most shells have shortcuts to help them remember the locations of commands.
When the C shell starts, it builds a hash table of all the commands in its path: each command name and its absolute pathname. So, after you start a csh running, if new programs are added to directories along the path, you need to use the shell's rehash command to rebuild its hash table. (The hash table is internal. If you have multiple csh shells running say, in multiple windows type rehash in each one.)
In bash, the command location is automatically stored the first time you use it. This means you don't need a rehash-type command. If a program is moved to a new directory while bash is running, however, you'll need to use the internal command hash -r to make bash "forget" the old location.
|
The Korn shell uses tracked aliases to speed up command locating. When it is turned on with set -o trackall, every time that ksh finds a new command by doing a path search, it creates an alias for the command name whose value is the full pathname. In ksh88, you can turn alias tracking on and off, and you can mark a command to have an alias defined for it the first time it's executed by using:
$ alias -t COMMAND
In ksh93, even though you can run the command set +o trackall, which turns off alias tracking in ksh88, the shell ignores the command, and alias tracking is always in effect.
All tracked aliases are cleared when a new value is assigned to the PATH variable. If all you wish to do is remove tracked aliases, use PATH=$PATH.
As you can see, shells' command tracking varies! Check your shell's manual page.
JP and SJC
Here's another example in which command-line parsing is important. Consider this shell alias for counting the number of words in all files:
wc Section 16.6
% alias words "wc -w *" csh, tcsh $ alias words="wc -w *" ksh, bash
Right away, we can see one effect of command-line parsing. The shell sees the quotation marks and knows not to expand wildcards inside them. Therefore, words is aliased to wc -w *; the * isn't evaluated when you create the alias. (If wildcards were processed before quotes, this wouldn't work.)
Now, think about what happens when you execute the alias. You type:
% words
The shell starts working through its steps and eventually performs alias substitution. When this happens, it converts your command into:
wc -w *
Now, watch carefully. The shell continues working through the process of interpretation (redirection, variable substitution, command substitution) and eventually gets to filename expansion. At this point, the shell sees the * on the command line, expands it, and substitutes the files in the current directory. Seems simple enough. But think: you didn't type this *; the shell put it there when it expanded the wildcard. What would have happened if the shell expanded wildcards before substituting aliases? The * would never have been expanded; by the time the shell put it on the command line, the wildcard expansion stage would be over, and you'd just count the words in a file named * (which probably doesn't exist).
To me, the amazing thing is that all this works and works well! The workings of the command line are intricate and complex, but the shell almost always does what you want and without a lot of thought.
ML
If you read the previous article (Section 27.7), you saw that, most of the time, the shell evaluates the command line "in the right order." But what about when it doesn't? Here's a situation that the shell can't handle. It's admittedly contrived, but it's not too different from what you might find in a shell program (Section 1.8):
% set b=\$a % set a=foo % echo $b $a
When we use the variable $b, we'd like to get the variable $a, read it, and use its value. But that doesn't happen. Variable substitution happens once, and it isn't recursive. The value of $b is $a, and that's it. You don't go any further.
But there's a loophole. The eval command says, in essence, "Give me another chance. Re-evaluate this line and execute it." Here's what happens if we stick eval before the echo:
% eval echo $b foo
The shell converts $b into $a; then eval runs through the command-line evaluation process again, converting echo $a into echo foo which is what we wanted in the first place!
Here's a more realistic example; you see code like this fairly often in Bourne shell scripts:
... command='grep $grepopts $searchstring $file' for opt do case "$opt" in file) output=' > $ofile' ;; read) output=' | more' ;; sort) postproc=' | sort $sortopts';; esac done ... eval $command $postproc $output
Do you see what's happening? We're constructing a command that will look something like:
grep $grepopts $searchstring $file | sort $sortopts > $ofile
But the entire command is "hidden" in shell variables, including the I/O redirectors and various options. If the eval isn't there, this command will blow up in all sorts of bizarre ways. You'll see messages like | not found, because variable expansion occurs after output redirection. The "nested" variables (like $ofile, which is used inside $output) won't be expanded either, so you'll also see $ofile not found. Putting an eval in front of the command forces the shell to process the line again, guaranteeing that the variables will be expanded properly and that I/O redirection will take place.
eval is incredibly useful if you have shell variables that include other shell variables, aliases, I/O redirectors, or all sorts of perversities. It's commonly used within shell scripts to "evaluate" commands that are built during execution. There are more examples of eval in Section 5.3 and others.
ML
bash, like all shells, performs a series of steps when evaluating a command line. (Sorry, we don't cover all of the Unix shells; we explain bash because it's one of the most common. For other shells, check their manual pages.) This article takes a closer look at how you can control one part of those steps in bash: whether the shell will choose a shell function (Section 29.11), a built-in command ( Section 1.9), or an external command (Section 1.9).
Let's say that you want to write shell functions named cd, pushd, and popd. They will run the shell's built-in cd, pushd, or popd command, respectively, each using the command-line arguments that were passed (via the $@ array reference). Next they execute another shell function named setvars to do some setup in the new directory:
cd( ) { pushd( ) { popd( ) { cd "$@" pushd "$@" popd "$@" setvars setvars setvars } } }
But which cd will bash use when you type cd: the built-in cd or your cd function? (The same question goes for pushd and popd.) Worse, what if the cd <">$@<"> command inside the function makes bash call your cd function again, and that starts an endless loop? Well, that actually will start a loop and you need to know how to prevent it.
Typing command before the name of a command disables shell function lookup. bash will execute only a built-in command or an external command with that name. So, you could keep the functions from re-executing themselves by defining them this way:
cd( ) { pushd( ) { popd( ) { command cd "$@" command pushd "$@" command popd "$@" setvars setvars setvars } } }
In the same way, if you don't want to run your new pushd function for some reason, here's how to use the built-in pushd once:
bash$ command pushd somewhere
The command command still allows bash to run an external command (from your PATH (Section 35.6)) with the name you give. To force bash to use a built-in command but not a shell function or an external command type builtin before the command name. Although bash will always choose a built-in command before an external command, you can specify the built-in echo unambiguously with:
builtin echo -n 'What next? '
What if you want the external echo command? The easiest way is probably to type its absolute pathname. For example, once I wanted to test four (!) different external versions of echo on a System V machine and not get the built-in bash version. So I typed commands like this:
bash$ /bin/echo hi \\ there
Finally, you can enable or disable specific built-in bash commands with the enable command. Unlike command and builtin, the effect of enable lasts until you exit the shell. The command enable -n disables one or more built-in commands; give the command names as arguments. For example, in my experiments mentioned above, I could have made sure that I'd get an external echo every time by typing this first command once:
bash$ enable -n echo bash$ type echo echo is hashed (/bin/echo)
The -n disables the built-in command named as the following argument. The bash type command confirms that I'll now be using the external echo. You can re-enable a disabled built-in with enable command-name. And enable -a lists the status of all bash built-ins.
JP
[Section 27.9 shows how to control whether bash uses a built-in command, a shell function, or an external command. The way you do that in the C shell is a little, errr, different. Chris Torek explains why, for example, \rm disables an alias for rm and \cd disables the built-in cd command. He starts with a fairly complex explanation, then gives some practical guidelines. At the end is a "review" that's easy to follow and fun too. JP]
The C shell first breaks each input line into a word vector. It then matches against aliases. Since \rm does not match rm, any alias is ignored. Eventually the C shell fully applies any quoting (since an alias can include quotes, some of this work must be deferred; since an alias can include multiple words, more word vector work must be done as well; it all gets rather hairy).
The C shell implements quoting by setting the eighth bit (bit 7) of each byte of a quoted character. Since '*'|0x80 [a character ORed with 80 hex, a.k.a. 10000000 binary JP] is not the same character as '*', this prevents filename expansion, further word breaking, and so on.
Eventually, the shell has a fully "parsed" line. It then compares word[0] [the first word on the command line JP] against all the built-ins. If there is a match, it runs the corresponding built-in command (and it is up to that command to expand any remaining words; for instance, ls * in a directory containing only the file -l produces a long listing, but jobs * produces a usage message). If not, the shell performs globbing on the current word list, producing a new word list, and then:
Strips the eighth bit of each byte of each word
exec( )s the resulting command.
This means that \cd not only bypasses any alias, but also reaches the built-in scanner as:
'c'|0x80, 'd', '\0'
which does not match the built-in command:
'c', 'd', '\0'
and so does not run the cd builtin. It is later stripped, and the shell looks for an external program called cd.
If you want to avoid alias substitution but not built-in matching, you can replace:
\cd foo or \rm foo
with:
''cd foo or ""rm foo
These do not match the aliases during alias scanning they have quote pairs in front of them but they do match any builtin because the quotes have by then been stripped (setting bit 7 of all the characters contained between the two quotes, here none).
Incidentally, since alias expansion occurs early, you can do some peculiar things with it:
% [ Missing ]. . . . on some systems, there is a command named [, sometimes standalone, and sometimes symlinked to test. % alias [ echo foo % [ foo . . . alias expansion occurs before globbing % unalias [ unalias: Missing ]. . . . unalias globs its arguments! % unalias \[ % alias unalias echo foo unalias: Too dangerous to alias that. . . . the C shell attempts caution... % alias \unalias echo foo % alias unalias (echo foo) % unalias unalias foo unalias . . . but fails! % ''unalias unalias % alias % . . . Fortunately, there is an exit.
|
CT
One of the common questions about Bourne-type shells is why only the second command shown below will redirect both stdout and stderr ( Section 43.1) to a file:
$ cat food 2>&1 >file cat: can't open food $ cat food >file 2>&1 $
Although some manual pages don't mention this, the shell processes I/O redirections from left to right:
On the first command line, the shell sees 2>&1 first. That means "make the standard error (file descriptor 2) go to the same place that the standard output (fd1) is going." There's no effect because both fd2 and fd1 are already going to the terminal. Then >file redirects fd1 (stdout) to file. But fd2 (stderr) is still going to the terminal.
On the second command line, the shell sees >file first and redirects stdout to file. Next 2>&1 sends fd2 (stderr) to the same place fd1 is going that's to the file. And that's what you want.
Section 36.16 has much more about the m>&n operator.
JP
I can't understand why some people see Bourne shell quoting as a scary, mysterious set of many rules. Quoting on Bourne-type shells is simple. (C shell quoting is slightly more complicated. See Section 27.13.)
The overall idea is this: quoting turns off (disables) the special meaning of characters. There are three quoting characters: single quote ('), double quote ("), and backslash (\). Note that a backquote (`) is not a quoting character it does command substitution (Section 28.14).
Listed below are the characters that are special to the Bourne shell. You've probably already used some of them. Quoting these characters turns off their special meaning. (Yes, the last three characters are quoting characters. You can quote quoting characters; more on that later.)
# & * ? [ ] ( ) = | ^ ; < > ` $ " ' \
Space, tab, and newline also have special meaning as argument separators. A slash (/) has special meaning to Unix itself, but not to the shell, so quoting doesn't change the meaning of slashes.
Newer shells have a few other special characters. For instance, bash has ! for history substitution (Section 30.8). It's similar to the C shell ! (Section 27.13) except that, in bash, ! loses its special meaning inside single quotes. To find particular differences in your Bourne-type shell, see the quoting section of its manual page. In general, though, the rules below apply to all Bourne-type shells.
Table 27-1 summarizes the rules; you might want to look back at it while you read the examples.
|
Quoting character |
Explanation |
|---|---|
|
'xxx' |
Disable all special characters in xxx. |
|
"xxx" |
Disable all special characters in xxx except $, ', and \. |
|
\x |
Disable the special meaning of character x. At end of line, a \ removes the newline character (continues line). |
To understand which characters will be quoted, imagine this: the Bourne shell reads what you type at a prompt, or the lines in a shell script, character by character from first to last. (It's actually more complicated than that, but not for the purposes of quoting.)
When the shell reads one of the three quoting characters, it does the following:
Strips away that quoting character
Turns off (disables) the special meaning of some or all other character(s) until the end of the quoted section, by the rules in Table 27-1
You also need to know how many characters will be quoted. The next few sections have examples to demonstrate those rules. Try typing the examples at a Bourne shell prompt, if you'd like. (Don't use C shell; it's different (Section 27.13).) If you need to start a Bourne-type shell, type sh; type exit when you're done.
A backslash (\) turns off the special meaning (if any) of the next character. For example, \* is a literal asterisk, not a filename wildcard (Section 1.13). So, the first expr (Section 36.21) command gets the three arguments 79 * 45 and multiplies those two numbers:
$ expr 79 \* 45 3555 $ expr 79 * 45 expr: syntax error
In the second example, without the backslash, the shell expanded * into a list of filenames which confused expr. (If you want to see what I mean, repeat those two examples using echo (Section 27.5) instead of expr.)
A single quote (') turns off the special meaning of all characters until the next single quote is found. So, in the command line below, the words between the two single quotes are quoted. The quotes themselves are removed by the shell. Although this mess is probably not what you want, it's a good demonstration of what quoting does:
$ echo Hey! What's next? Mike's #1 friend has $$. Hey! Whats next? Mikes
Let's take a close look at what happened. Spaces outside the quotes are treated as argument separators; the shell ignores the multiple spaces. echo prints a single space between each argument it gets. Spaces inside the quotes are passed on to echo literally. The question mark (?) is quoted; it's given to echo as is, not used as a wildcard.
So, echo printed its first argument Hey! and a single space. The second argument to echo is Whats next? Mikes; it's all a single argument because the single quotes surrounded the spaces (notice that echo prints the two spaces after the question mark: ? ). The next argument, #1, starts with a hash mark, which is a comment character (Section 35.1). That means the shell will ignore the rest of the string; it isn't passed to echo.
(zsh users: The # isn't treated as a comment character at a shell prompt unless you've run setopt interactive_comments first.)
Double quotes (") work almost like single quotes. The difference is that double quoting allows the characters $ (dollar sign), ' (backquote), and \ (backslash) to keep their special meanings. That lets you do variable substitution (Section 35.9, Section 35.3) and command substitution (Section 28.14) inside double quotes and also stop that substitution where you need to.
For now, let's repeat the example above. This time, put double quotes around the single quotes (actually, around the whole string):
$ echo "Hey! What's next? Mike's #1 friend has $$." Hey! What's next? Mike's #1 friend has 18437.
The opening double quote isn't matched until the end of the string. So, all the spaces between the double quotes lose their special meaning, and the shell passes the whole string to echo as one argument. The single quotes also lose their special meaning because double quotes turn off the special meaning of single quotes! Thus, the single quotes aren't stripped off as they were in the previous example; echo prints them.
What else lost its special meaning? The hash mark (#) did; notice that the rest of the string was passed to echo this time because it wasn't "commented out." But the dollar sign ($) didn't lose its meaning; the $$ was expanded into the shell's process ID number (Section 24.3) (in this shell, 18437).
In the previous example, what would happen if you put the $ inside the single quotes? (Single quotes turn off the meaning of $, remember.) Would the shell still expand $$ to its value? Yes, it would: the single quotes have lost their special meaning, so they don't affect any characters between them:
$ echo "What's next? How many $$ did Mike's friend bring?" What's next? How many 18437 did Mike's friend bring?
How can you make both the $$ and the single quotes print literally? The easiest way is with a backslash, which still works inside double quotes:
$ echo "What's next? How many \$\$ did Mike's friend bring?" What's next? How many $$ did Mike's friend bring?
Here's another way to solve the problem. A careful look at this will show a lot about shell quoting:
$ echo "What's next? How many "'$$'" did Mike's friend bring?" What's next? How many $$ did Mike's friend bring?
To read that example, remember that a double quote quotes characters until the next double quote is found. The same is true for single quotes. So, the string What's next? How many (including the space at the end) is inside a pair of double quotes. The $$ is inside a pair of single quotes. The rest of the line is inside another pair of double quotes. Both of the double-quoted strings contain a single quote; the double quotes turn off its special meaning and the single quote is printed literally.
You can't put single quotes inside single quotes. A single quote turns off all special meaning until the next single quote. Use double quotes and backslashes.
Once you type a single quote or double quote, everything is quoted. The quoting can stretch across many lines. (The C shell doesn't work this way.)
For example, in the short script shown in Figure 27-1, you might think that the $1 is inside quotes, but it isn't.
Actually, all argument text except $1 is in quotes. The gray shaded area shows the quoted parts. So $1 is expanded by the Bourne shell, not by awk.
Here's another example. Let's store a shell variable (Section 35.9) with a multiline message, the kind that might be used in a shell program. A shell variable must be stored as a single argument; any argument separators (spaces, etc.) must be quoted. Inside double quotes, $ and ' are interpreted (before the variable is stored, by the way). The opening double quote isn't closed by the end of the first line; the Bourne shell prints secondary prompts (Section 28.12) (>) until all quotes are closed:
$ greeting="Hi, $USER. > The date and time now > are: `date`." $ echo "$greeting" Hi, jerry. The date and time now are: Fri Sep 1 13:48:12 EDT 2000. $ echo $greeting Hi, jerry. The date and time now are: Fri Sep 1 13:48:12 EDT 2000. $
The first echo command line uses double quotes, so the shell variable is expanded, but the shell doesn't use the spaces and newlines in the variable as argument separators. (Look at the extra spaces after the word are:.) The second echo doesn't use double quotes. The spaces and newlines are treated as argument separators; the shell passes 14 arguments to echo, which prints them with single spaces between.
A backslash has a quirk you should know about. If you use it outside quotes, at the end of a line (just before the newline), the newline will be deleted. Inside single quotes, though, a backslash at the end of a line is copied as is. Here are examples. I've numbered the prompts (1$, 2$, and so on):
1$ echo "a long long long long long long > line or two" a long long long long long long line or two 2$ echo a long long long long long long\ > line a long long long long long longline 3$ echo a long long long long long long \ > line a long long long long long long line 4$ echo "a long long long long long long\ > line" a long long long long long longline 5$ echo 'a long long long long long long\ > line' a long long long long long long\ line
You've seen an example like example 1 before. The newline is in quotes, so it isn't an argument separator; echo prints it with the rest of the (single, two-line) argument. In example 2, the backslash before the newline tells the shell to delete the newline; the words long and line are passed to echo as one argument. Example 3 is usually what you want when you're typing long lists of command-line arguments: Type a space (an argument separator) before the backslash and newline. In example 4, the backslash inside the double quotes is ignored (compare to example 1). Inside single quotes, as in example 5, the backslash has no special meaning; it's passed on to echo.
JP
This article explains quoting in C-type shells by comparing them to Bourne-type shell quoting. If you haven't read Section 27.12 about Bourne shell quoting, please do so now.
As in the Bourne shell, the overall idea of C shell quoting is this: quoting turns off (disables) the special meaning of characters. There are three quoting characters: a single quote ('), a double quote ("), and a backslash (\).
The C shell has a few more special characters in addition to the original Bourne shell:
! { } ~
Table 27-2 summarizes the rules; you might want to look back at it while you read the examples.
|
Quoting character |
Explanation |
|---|---|
|
'xxx' |
Disable all special characters in xxx except !. |
|
"xxx" |
Disable all special characters in xxx except $, ', and !. |
|
\x |
Disable special meaning of character x. At end of line, a \ treats the newline character like a space (continues line). |
The major differences between C and Bourne shell quoting are the following:
The exclamation point (!) character can be quoted only with a backslash. That's true inside and outside single or double quotes. So you can use history substitution (Section 30.8) inside quotes. For example:
% grep intelligent engineering file*.txt grep: engineering: No such file or directory % grep '!:1-2' !:3 grep 'intelligent engineering' file*.txt ...
In the Bourne shell, inside double quotes, a backslash (\) stops variable and command substitution (it turns off the special meaning of $ and ').
In the C shell, you can't disable the special meaning of $ or ' inside double quotes. You'll need a mixture of single and double quotes. For example, searching for the string use the `-c' switch takes some work:
% fgrep "use the \`-c' switch" *.txt Unmatched \`. % fgrep 'use the \`-c\' switch' *.txt Unmatched '. % fgrep "use the "'`-c'"' switch" *.txt hints.txt:Be sure to use the `-c' switch.
Section 29.10 shows an amazing pair of aliases that automate complicated C shell quoting problems like this.
In the Bourne shell, single and double quotes include newline characters. Once you open a single or double quote, you can type multiple lines before the closing quote.
In the C shell, if the quotes on a command line don't match, the shell will print an error unless the line ends with a backslash. In other words, to quote more than one line, type a backslash at the end of each line before the last line. Inside single or double quotes, the backslash-newline becomes a newline. Unquoted, backslash-newline is an argument separator:
% echo "one\ ? two" three\ ? four one two three four
JP
If you want to work with files that have spaces or special characters in the filenames, you may have to use quotes. For instance, if you wanted to create a file that has a space in the name, you could use the following:
/dev/null Section 43.12
% cp /dev/null 'a file with spaces in the name'
Normally, the shell uses spaces to determine the end of each argument. Quoting (Section 27.12, Section 27.13) changes that for example, the cp command above has only two arguments. You can also use a backslash (\) before a special character. The example below will rename a file with a space in the name, changing the space to an underscore ( _ ):
% mv a\ file a_file
Using the same techniques, you can deal with any character in a filename:
% mv '$a' a
At worst, a space in a filename makes the filename difficult to use as an argument. Other characters are dangerous to use in a filename. In particular, using ? and * in a filename is playing with fire. If you want to delete the file a?, you may end up deleting more than the single file.
BB
C-type shells have two variables that, when set, will help you follow the convoluted trail of variable and metacharacter expansion. This command will echo every command line before shell variables have been evaluated:
set Section 35.9
% set verbose
This command will display each line after the variables and metacharacters have been substituted:
% set echo
If you wish to turn the options off, use unset (Section 35.9) instead of set.
Bourne-type shell syntax is different. To turn on the verbose flag, use:
$ set -v
The command set -x turns on the echo flag. You can also type them together: set -xv.
If your version of Unix understands scripts that start with #!, and nearly all do, here's a convenient way to turn these variables on from the first line of a script:
#!/bin/sh -xv
It is not necessary to modify the program. You can enable variable tracing in Bourne shell scripts by typing the shell name and options on the command line:
$ sh -v script $ sh -x script
Not all Bourne shells let you turn these options off. If yours does (and it probably does), you can do it by using a plus sign instead of a minus sign:
set +xv
BB
So far, we've talked about three different kinds of quoting: backslashes (\), single quotes ('), and double quotes ("). The shells support yet one more kind of quoting, called here documents. A here document is useful when you need to read something from standard input, but you don't want to create a file to provide that input; you want to put that input right into your shell script (or type it directly on the command line). To do so, use the << operator, followed by a special word:
sort >file <<EndOfSort zygote abacus EndOfSort
This is very useful because variables (Section 35.9, Section 35.3) are evaluated during this operation. Here is a way to transfer a file using anonymous ftp (Section 1.21)[3] from a shell script:
Go to http://examples.oreilly.com/upt3 for more information on: ftpfile
#!/bin/sh # Usage: # ftpfile machine file # set -x SOURCE=$1 FILE=$2 GETHOST="uname -n" BFILE=`basename $FILE` ftp -n $SOURCE <<EndFTP ascii user anonymous $USER@`$GETHOST` get $FILE /tmp/$BFILE EndFTP
As you can see, variable and command substitutions (Section 28.14) are done.  This is done because it is very unlikely that I will want to put that particular combination of characters in any file. You should be warned that the C shell expects the matching word (at the end of the list) to be escaped the same way, i.e., \FunkyStriNG, while the Bourne shell does not. See Section 36.19.
Most Bourne shells also have the <<- operator. The dash (-) at the end tells the shell to strip any TAB characters from the beginning of each line. Use this in shell scripts to indent a section of text without passing those TABs to the command's standard input.
Other shells, notably zsh and later versions of ksh, but in the future possibly also bash, support a method for taking input from a string:
$ tr ... <<< "$xyzzy" | ...
BB
Before you learn about regular expressions (Section 32.1), you should understand how quoting (Section 27.12) works in Unix.
Regular expressions use metacharacters. The shells also have metacharacters. Metacharacters are simply characters that have a special meaning. The problem occurs when you want to use a regular expression in a shell script. Will the shell do something special with the character? Or will it be passed unchanged to the program? The $ character is a good example of a regular expression metacharacter that is also used by the shell, but whose meaning is different depending upon who interprets it, the shell or other programs. It could be the beginning of a variable name or it could be part of a regular expression (Section 32.2). If you need a regular expression, you must know whether any of the characters of the expression are metacharacters, and must know the right way to quote that character so that it is passed to the program without being modified by the shell.
Table 27-3 is a table of special characters and operators in the shells covered by this book. (Because zsh acts basically like both C-type and Bourne-type shells, its name would show up in every entry. So we don't list it here unless an entry applies only to zsh or one or two other shells.) The chart also includes several combinations of characters just to be complete. But, to keep things simple, it doesn't include:
Arithmetic operators like +, -, and so on; see the articles on built-in arithmetic for a list.
History substitution like !!, !$, and so on; see Section 30.8 instead.
As in other parts of this book, the sh entries apply to ksh and bash; the csh entries apply to tcsh.
|
Character |
Where |
Meaning |
Articles |
|---|---|---|---|
ESC |
csh |
Filename completion. |
|
RETURN |
csh, sh |
Execute command. |
|
space |
csh, sh |
Argument separator. |
|
TAB |
csh, sh |
Argument separator. |
|
TAB |
bash |
Completion (in interactive shells). |
|
# |
csh, sh |
Start a comment. |
|
` |
csh, sh |
Command substitution (backquotes). |
|
" |
sh |
Weak quotes. |
|
" |
csh |
Weak quotes. |
|
$var |
csh, sh |
Expand variable var. |
|
${var} |
csh, sh |
Same as $var. |
|
$var:mod |
csh |
Edit var with modifier mod |
|
${var-default} |
sh |
If var not set, use default. |
|
${var:-default} |
bash |
If var not set or null, use default. |
|
${var=default} |
sh |
If var not set, set it to default and use that value. |
|
${var:=default} |
bash |
If var not set or null, set it to default and use that value. |
|
${var+instead} |
sh |
If var set, use instead. Otherwise, null string. |
|
${var:+instead} |
bash |
If var set or not null, use instead. Otherwise, null string. |
|
${var?message} |
sh |
If var set, use its value. Else print message (or default) and exit. |
|
${var:?message} |
bash |
If var set or not null, use its value. Else print message (or default) and exit. |
|
${var#pat} |
ksh, bash |
Value of var with smallest pat deleted from start. |
|
${var##pat} |
ksh, bash |
Value of var with largest pat deleted from start. |
|
${var%pat} |
ksh, bash |
Value of var with smallest pat deleted from end. |
|
${var%%pat} |
ksh, bash |
Value of var with largest pat deleted from end. |
|
${^array} |
zsh |
Expand array in place, like rc_expand_param option. |
|
${=spec} |
zsh |
Turn on sh_word_split option while evaluating spec. |
|
${~array} |
zsh |
Turn on glob_subst option while evaluating spec. |
|
| |
csh, sh |
Pipe standard output. |
|
|& |
csh |
Pipe standard output and standard error. |
|
|& |
ksh |
Coroutine. |
|
^ |
sh only |
Pipe character (obsolete). |
|
^ |
csh, bash |
Edit previous command line. |
|
& |
csh, sh |
Run program in background. |
|
&! |
zsh |
Run program in background without job control. |
|
&| |
zsh |
Run program in background without job control. |
|
? |
csh, sh |
Match one character. |
|
* |
csh, sh |
Match zero or more characters. |
|
; |
csh, sh |
Command separator. |
|
;; |
sh |
End of case element. |
|
~ |
csh, ksh, bash |
Home directory. |
|
~user |
csh, ksh, bash |
Home directory of user. |
|
! |
csh, bash |
Command history. |
|
! |
bash, ksh93, zsh |
Toggle exit status. |
|
- |
zsh |
Make a login shell. |
|
= |
csh, sh |
Assignment. |
|
$# |
csh, sh |
Number of shell arguments or words in an array. |
|
"$@" |
sh |
Original script arguments. |
|
$* |
csh, sh |
Original script arguments, broken into words. |
|
$? |
sh |
Status of previous command. |
|
$$ |
csh, sh |
Process identification number. |
|
$! |
sh |
Process identification number of last background job. |
|
$< |
csh |
Read input from terminal. |
|
$_ |
bash, ksh, zsh |
Last argument of previous command. |
|
$n |
sh |
Argument n. 1 <= n <= 9 for most shells; bash and ksh93 support ${n} for n >= 10. |
|
$0 |
sh |
Name of the shell or shell script. |
|
cmd1 && cmd2 |
csh, sh |
Execute cmd2 if cmd1 succeeds. |
|
cmd1 || cmd2 |
csh, sh |
Execute cmd2 if cmd1 fails. |
|
$(..) |
ksh, bash |
Command substitution. |
|
. file |
sh |
Execute commands from file in this shell. |
|
: |
sh |
Evaluate arguments, return true. |
|
: |
sh |
Separate values in paths. |
|
: |
csh |
Variable modifier. |
|
[ ] |
csh, sh |
Match range of characters. |
|
[ ] |
sh |
Test. |
|
%n |
csh, ksh, bash, zsh |
Job number n. |
|
(cmd;cmd) |
csh, sh |
Run cmd;cmd in a subshell. |
|
{ } |
csh, bash |
In-line expansions. |
|
>file |
csh, sh |
Redirect standard output. |
|
>! file |
csh |
Output to file, even if noclobber set and file exists. |
|
>| file |
ksh, bash |
Output to file, even if noclobber set and file exists. |
|
>>file |
csh, sh |
Append standard output. |
|
>>! file |
csh |
Append to file, even if noclobber set and file doesn't exist. |
|
<file |
csh, sh |
Redirect standard input. |
|
<<word |
csh, sh |
Read until word, do command and variable substitution. |
|
<<\word |
csh, sh |
Read until word, no substitution. |
|
<<-word |
sh |
Read until word, ignoring leading TABs. |
|
<> file |
ksh, bash, zsh |
Open file for writing and reading. |
|
>& file |
csh, bash |
Redirect standard output and standard error to file. |
|
m> file |
sh |
Redirect output file descriptor m to file. |
|
m>> file |
sh |
Append output file descriptor m to file. |
|
m< file |
sh |
Redirect input file descriptor m from file. |
|
<&m |
sh |
Take standard input from file descriptor m. |
|
>&m |
sh |
Use file descriptor m as standard output. |
|
>& - |
sh |
Close standard output. |
|
m<& - |
sh |
Close input file descriptor m. |
|
n>&m |
sh |
Connect output file descriptor n to file descriptor m. |
|
m>& - |
sh |
Close output file descriptor m. |
BB and JP
The problem with backslashes is that many different programs use them as quoting characters. As a result, it's difficult to figure out how many backslashes you need in any situation.
Here's an example, taken from System V Release 4. (Notice that I'm using the standard System V version of echo from /bin/echo. SVR4 has four versions of echo!)
% /bin/echo hi \ there hi there % /bin/echo hi \\ there hi \ there % /bin/echo hi \ there hi \ there
In the first case, the shell uses the backslash to quote (Section 27.12) the following space character. The space before the backslash is a word separator. So echo gets two arguments: "hi" and "·there" (without the quotes) where · is the space character that was quoted by the backslash. As always, echo prints a single space between each argument. The first space you see in the output is echo's argument-separating space, and the second space came along with the second argument (thanks to the backslash).
In the second case, the shell converts \\ to \; the first backslash tells the shell to quote (Section 27.12) (turn off the special meaning of) the second backslash. The echo command gets three arguments, "hi", "\", and "there", and it echoes those arguments with a single space between each. (I've heard claims that, on some systems, this command wouldn't print any backslashes, but I wasn't able to reconstruct that situation.)
In the third case, the shell converts each pair of backslashes into a backslash, and runs the command echo hi \\ there. But this is System V, and System V's echo interprets backslashes as special characters. So when echo sees the remaining two backslashes, it converts them into a single backslash. So you see only a single backslash, even though you typed four. On BSD systems and on Linux, echo doesn't do this; you'd see two backslashes. For that matter, if you're using SVR4's C shell, with its built-in echo command, you'll see the BSD/Linux behavior. You'll also see the BSD/Linux behavior if you're using SVR4's /usr/ucb/echo.
The terminal driver is also capable of "eating" backslashes if they appear before special characters. If a backslash precedes the "erase" character (normally CTRL-h) or the "kill" character (normally CTRL-u), the terminal driver will pass the control character to the shell, rather than interpreting it as an editing character. In the process, it "eats" the backslash. So if you type:
% echo \CTRL-u
The shell receives the line echo CTRL-u. There are certainly system-dependent variations, though. If your system has the termio(7) manual page, read it for more information.
What's the point of this article? Well, backslashes are messy. The shell, the terminal driver, echo (sometimes), and several other utilities use them. If you think very carefully, you can figure out exactly what's consuming them. If you're not of a rigorous frame of mind, you can just add backslashes until you get what you want. (But, obviously, the nonrigorous approach has pitfalls.) I've seen situations in troff (which is another story altogether) where you need eight backslashes in order to have a single backslash left at the point where you want it!
(Extra credit: What happens when you put quotes (" or ') around the strings in the echo commands above? Especially, should quotes affect the way \CTRL-u is interpreted?)
ML and JP
[1] It's difficult to trace the development of all these shells in a simple manner. Their authors have borrowed ideas and syntax from the others and sometimes code and sometimes a shell starts out trying to emulate another but evolves away from its original inspiration (or the inspiration evolves away from the aspirant).
[2] The script uses bash because, as this article explains later, its built-in echo (Section 27.5) command has the -E option to prevent interpretation of special characters.
[3] You might be better off using wget or curl for downloads, but this method can be useful for automated uploads.
| CONTENTS |


Please note that in order for the game to be saved, you must use the save feature in-game (unless of course the game itself autosaves), then press the save button here (Or autosave must happen). These saves are only for in-game save files. If you want to be able to save at any time, use save states. Saves and states are saved in your browser's indexedDB and are automatically readied every time you visit the page. You only need to use export and import for backups.


What is Rails?
So what is Rails anyway? Rails is a web application development framework written in Ruby, that is useful for quickly building complex websites. In other words, Rails is a Ruby Gem that provides a framework for the development of websites. One aspect of Rails is a "convention over configuration" perspective that means that Rails has a default configuration rather than requiring the developer to configure everything from scratch. While these defaults can be overridden, the defaults keep initial development simple.


public final class RemotePDBFile
extends totalcross.lang.Object
| Modifier and Type | Field and Description |
|---|---|
protected int |
lastSearchedRec |
protected int |
mode |
protected String |
name |
protected boolean |
open |
protected int |
recIndex |
static int |
RECORD_SIZE_AUTO |
protected int |
wRecordSize |
| Constructor and Description |
|---|
RemotePDBFile(String name)
Opens a remote PDBFile in READ_WRITE mode.
|
RemotePDBFile(String name,
int mode)
Opens a remote PDBFile in the given mode.
|
RemotePDBFile(String name,
int mode,
int recordSize)
Opens a remote PDBFile with the given name.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Closes this PDBFile.
|
void |
delete()
Completely deletes this database, closing it first.
|
void |
deleteRecord(int index)
Deletes the given record index.
|
protected void |
finalize() |
int |
getNextModifiedRecordIndex()
Returns the next modified record index.
|
int |
getRecordCount()
Returns the number of records inside this database
|
int |
getRecordPos()
Returns the current record position or -1 if there is no current record.
|
static String[] |
listPDBs(int crtr,
int type)
Lists the available PDBFiles on the device that has the given creator id
and type.
|
boolean |
readRecord(int index,
RemotePDBRecord rec)
Fetches the given index, passing to the rec a DataStream to read the
record information.
|
int |
skipBytes(int n)
Moves the cursor n bytes from the current position, moving backwards if n is negative, or forward if n is
positive.
|
boolean |
writeRecord(int index,
RemotePDBRecord rec)
Write the record at the given index.
|
protected String name
protected int mode
protected boolean open
protected int recIndex
protected int wRecordSize
protected int lastSearchedRec
public static int RECORD_SIZE_AUTO
public RemotePDBFile(String name, int mode, int recordSize) throws IllegalArgumentIOException, FileNotFoundException, IOException
name
- The PDBFile name on the form name.crtr.type
mode
- Can be PDBFile.READ_WRITE, PDBFile.CREATE (this one is non
destructive: if the PDBFile don't exists, it will be created and
it will remain open on READ_WRITE mode; if it exists, it will
stay open on READ_WRITE mode). You can also or the mode with
PDBFile.DB_ATTR_BACKUP or PDBFile.DB_ATTR_STREAM to set these
attributes when creating a database (do NOT use the other
attributes!)recordSize
- Used only when writing records. If you plan to write records
with fixed size, pass in the desired size. Otherwise, pass
RemotePDBFile.RECORD_SIZE_AUTO to automatically expand or shrink
the record.IOException
FileNotFoundException
IllegalArgumentIOException
public RemotePDBFile(String name) throws IllegalArgumentIOException, FileNotFoundException, IOException
public RemotePDBFile(String name, int mode) throws IllegalArgumentIOException, FileNotFoundException, IOException
public final void delete() throws IOException
IOException
public final int getRecordCount() throws IOException
IOException
public boolean readRecord(int index, RemotePDBRecord rec) throws IllegalArgumentIOException, IOException
public boolean writeRecord(int index, RemotePDBRecord rec) throws IllegalArgumentIOException, IOException
public int getRecordPos()
public final void deleteRecord(int index) throws IllegalArgumentIOException, IOException
delete
and then create it again.public int skipBytes(int n)
n
- the number of bytes to move.public final int getNextModifiedRecordIndex() throws IOException
IOException
public final void close() throws IOException
IOException
public static String[] listPDBs(int crtr, int type)
protected void finalize()
finalize
in class totalcross.lang.Object


When the road disappears into the clouds or under the snow, that's when you need a bike with special qualities. Keen riders who want to keep the pedals turning whatever the conditions will find a perfect accomplice in the Nutrail Pro. So we have designed a new, innovative frame and included a special feature bundle for this trail-ready Fatbike. Fat tyres alone don't make a Fatbike, but our brand new NUTRAIL PRO guarantees unlimited fun.


001/* 002 * Units of Measurement API 003 * Copyright (c) 2014-2023, Jean-Marie Dautelle, Werner Keil, Otavio Santana. 004 * 005 * All rights reserved. 006 * 007 * Redistribution and use in source and binary forms, with or without modification, 008 * are permitted provided that the following conditions are met: 009 * 010 * 1. Redistributions of source code must retain the above copyright notice, 011 * this list of conditions and the following disclaimer. 012 * 013 * 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions 014 * and the following disclaimer in the documentation and/or other materials provided with the distribution. 015 * 016 * 3. Neither the name of JSR-385 nor the names of its contributors may be used to endorse or promote products 017 * derived from this software without specific prior written permission. 018 * 019 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 020 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 021 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 022 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 023 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 024 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 025 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 026 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 027 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 028 * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 029 */ 030package javax.measure.format; 031 032import java.io.IOException; 033import java.text.ParsePosition; 034 035import javax.measure.Unit; 036 037/** 038 * Formats instances of {@link Unit} to a {@link String} or {@link Appendable} and parses a {@link CharSequence} to a {@link Unit}. 039 * 040 *
 041 *
Synchronization
 042 *
 043 *
 044 * Instances of this class are not required to be thread-safe. It is recommended to use separate format instances for each thread. If multiple threads 045 * access a format concurrently, it must be synchronized externally. 046 *
 047 * 048 * @author <a<EMAIL_ADDRESS>Dautelle 049 * @author <a<EMAIL_ADDRESS>Keil 050 * 051 * @version 2.2, May 20, 2023 052 * @since 1.0 053 * 054 * @see Unit 055 */ 056public interface UnitFormat { 057 /** 058 * Formats the specified {@link Unit}. 059 * 060 * @param unit 061 * the {@link Unit} to format, not {@code null} 062 * @param appendable 063 * the appendable destination. 064 * @return the appendable destination passed in with formatted text appended. 065 * @throws IOException 066 * if an error occurs while writing to the destination. 067 */ 068 Appendable format(Unit<?> unit, Appendable appendable) throws IOException; 069 070 /** 071 * Formats the specified {@link Unit}. 072 * 073 * @param unit 074 * the {@link Unit} to format, not {@code null} 075 * @return the string representation using the settings of this {@link UnitFormat}. 076 */ 077 String format(Unit<?> unit); 078 079 /** 080 * Attaches a system-wide label to the specified {@link Unit}. 081 *
 082 * This method overrides the previous unit's label (e.g. label from unit database or unit system) as units may only have one label. Depending on the 083 * {@link UnitFormat} implementation, this call may be ignored if the particular unit already has a label. 084 *
 085 * If a {@link UnitFormat} implementation is explicitly immutable, similar to e.g. the result of Collections.unmodifiableList(), 086 * then an {@linkplain UnsupportedOperationException} may be thrown upon this call. 087 *
 088 * Since UnitFormat implementations often apply the Singleton pattern, system-wide means, the label applies to every instance of 089 * UnitFormatA implementing UnitFormat in this case, but not every instance of UnitFormatB or UnitFormatC both 090 * also implementing UnitFormat. If a UnitFormat #isLocaleSensitive() it is up to the implementation, whether the label is 091 * ignored, applied in a local-neutral manner (in addition to its local-sensitive information) or locale-specific. 092 *
 093 * 094 * @param unit 095 * the unit being labeled. 096 * @param label 097 * the new label for this unit. 098 * @throws IllegalArgumentException 099 * if the label is not a valid identifier. This may include characters not supported by a particular {@link UnitFormat} implementation 100 * (e.g. only ASCII characters for certain devices) 101 * @throws UnsupportedOperationException 102 * if the label operation is not supported by this {@link UnitFormat} 103 */ 104 void label(Unit<?> unit, String label); 105 106 /** 107 * Returns true if this {@link UnitFormat} depends on a Locale to perform its tasks. 108 *
 109 * In environments that do not support a Locale, e.g. Java ME, this usually returns false. 110 *
 111 * 112 * @return Whether this format depends on a locale. 113 */ 114 default boolean isLocaleSensitive() { 115 return false; 116 } 117 118 /** 119 * Parses a portion of the specified CharSequence from the specified position to produce a {@link Unit}. 120 * If parsing succeeds, then the index of the pos argument is updated to the index after the last character used. 121 * 122 * @param csq 123 * the CharSequence to parse. 124 * @param pos 125 * a ParsePosition object holding the current parsing index and error parsing index information as described above. 126 * @return the unit parsed from the specified character sub-sequence. 127 * @throws MeasurementParseException 128 * if any problem occurs while parsing the specified character sequence (e.g. illegal syntax). 129 * @since 2.0 130 */ 131 Unit<?> parse(CharSequence csq, ParsePosition pos) throws MeasurementParseException; 132 133 /** 134 * Parses the text into an instance of {@link Unit}. 135 *
 136 * The parse must complete normally and parse the entire text. If the parse completes without reading the entire length of the text, an exception 137 * is thrown. If any other problem occurs during parsing, an exception is thrown. 138 *
 139 * 140 * @param csq 141 * the {@code CharSequence} to parse. 142 * @return the unit parsed from the specified character sequence. 143 * @throws MeasurementParseException 144 * if any problem occurs while parsing the specified character sequence (e.g. illegal syntax). 145 * @throws UnsupportedOperationException 146 * if the {@link UnitFormat} is unable to parse. 147 * @since 2.0 148 */ 149 Unit<?> parse(CharSequence csq) throws MeasurementParseException; 150}


Welcome {{user}}! Member Since: {{user.date_joined|date:"F Y"}}
Logout
Love
Me
Tenders
{% block content %}
Create New Review
A Place to Appreciate Chicken Tenders
{% for tender_review in tenders_review %}
{{tender_review.business_name}}
{{tender_review.city}}, {{tender_review.state}}
Rating: {{tender_review.rating}}/10
Submitted by {{tender_review.first_name}} {{tender_review.last_initial}} on {{tender_review.date_published|date:"F d,Y"}}
{% endfor %}
{% endblock %}


If you could buy a home with crypto at a significant discount of what current real estate listings are going for, would you? If yes, then you should load up on @OfficialEQL while it’s cheap. Houses are going up regardless, just figured you all should know.


Guard Stan:
I'll need at least 100 of
Full Barrels of Soup
. But, if you bring more, I can offer more and greater rewards. The more, the better.


class Hook extends AbstractSmartyPlugin
Plugin for smarty defining blocks and functions for using Hooks.
Class Hook
Methods
| mixed |
getNormalizedParam(array $params, mixed $name, mixed $default = null)
Get a function or block parameter value, and normalize it, trimming balnks and making it lowercase |
from AbstractSmartyPlugin |
| mixed |
getParam(array $params, mixed $name, mixed $default = null)
Get a function or block parameter value |
from AbstractSmartyPlugin |
| array |
getPluginDescriptors()
Define the various smarty plugins handled by this class |
|
|
__construct($debug, ContainerAwareEventDispatcher $dispatcher)
|
||
| string |
processHookFunction(array $params, SmartyParser $smarty)
Generates the content of the hook |
|
| string |
processHookBlock(array $params, string $content, SmartyParser $smarty, bool $repeat)
Process the content of the hook block. |
|
| string |
processForHookBlock(array $params, string $content, SmartyParser $smarty, bool $repeat)
Process a {forhook rel="hookname"} ... |
|
| string |
elseHook(array $params, string $content, Smarty_Internal_Template $template, boolean $repeat)
Process {elsehook rel="hookname"} ... |
|
| string |
ifHook(array $params, string $content, Smarty_Internal_Template $template, boolean $repeat)
Process {ifhook rel="hookname"} ... |
|
| EventDispatcher |
getDispatcher()
Return the event dispatcher, |
Details
in AbstractSmartyPlugin at line 59
public mixed
getNormalizedParam(array $params, mixed $name, mixed $default = null)
Get a function or block parameter value, and normalize it, trimming balnks and making it lowercase
in AbstractSmartyPlugin at line 77
public mixed
getParam(array $params, mixed $name, mixed $default = null)
Get a function or block parameter value
at line 416
public array
getPluginDescriptors()
Define the various smarty plugins handled by this class
at line 53
public
__construct($debug, ContainerAwareEventDispatcher $dispatcher)
at line 81
public string
processHookFunction(array $params, SmartyParser $smarty)
Generates the content of the hook
{hook name="hook_code" var1="value1" var2="value2" ... }
This function create an event, feed it with the custom variables passed to the function (var1, var2, ...) and dispatch it to the hooks that respond to it.
The name of the event is hook.{context}.{hook_code}
where :
* context : the id of the context of the smarty render : 1: frontoffice, 2: backoffice, 3: email, 4: pdf
* hook_code : the code of the hook
The event collects all the fragments of text rendered in each modules functions that listen to this event. Finally, this fragments are concatenated and injected in the template
at line 180
public string
processHookBlock(array $params, string $content, SmartyParser $smarty, bool $repeat)
Process the content of the hook block.
{hookblock name="hook_code" var1="value1" var2="value2" ... }
This function create an event, feed it with the custom variables passed to the function (var1, var2, ...) and dispatch it to the hooks that respond to it.
The name of the event is hook.{context}.{hook_code}
where :
* context : the id of the context of the smarty render : 1: frontoffice, 2: backoffice, 3: email, 4: pdf
* hook_code : the code of the hook
The event collects all the fragments generated by modules that listen to this event and add it to a fragmentBag. This fragmentBag is not used directly. This is the forhook block that iterates over the fragmentBag to inject data in the template.
at line 235
public string
processForHookBlock(array $params, string $content, SmartyParser $smarty, bool $repeat)
Process a {forhook rel="hookname"} ...
{/forhook}
The forhook iterates over the results return by a hookblock :
{hookblock name="product.additional"} {forhook rel="product.additional"}
{$title}
{$content}
at line 323
public string
elseHook(array $params, string $content, Smarty_Internal_Template $template, boolean $repeat)
Process {elsehook rel="hookname"} ...
{/elsehook} block
at line 347
public string
ifHook(array $params, string $content, Smarty_Internal_Template $template, boolean $repeat)
Process {ifhook rel="hookname"} ...
{/ifhook} block
at line 432
public EventDispatcher
getDispatcher()
Return the event dispatcher,


Sales engineer with full-stack expertise, I’ve transitioned from solving specific customer challenges by presenting them with custom solutions, to now having the skills necessary to develop these same solutions from scratch.

Full-stack application designed to make it easier to find & create local pickup games or leagues. Users are able to search through a database of games created by other users, add their own, and edit or delete games. They are also able to see the exact location of the game using a Google Map plugin. User login and sign up is authenticated with JWT.
Built with:
Full-stack application that allows users browse local events by name or genre, see their location and details, add, edit, and delete local events, and receive an email for event tickets. Backend API built with MongoDB.
Built with:
Shred is an informative app that allows users to search through nearly all of the ski resorts in the world, and get updated details about each resort. Users are able to see a recent ski map image as well as current weather for the resort's location.
Built with:


- A week off! I'd originally taken this week off in March, to celebrate finishing my 3 months of Covid recovery only to have to cancel it from hospital because it would turn out I wasn't quite done recovering. I worried about jinxing myself but booked the same trip and week off further out.
 I took the train to Totnes in Devon, the southwest of England.
- I walked, I read, I thought, I photo'd. I had some unavoidably awkward solo dining.
- Back in London and with another day off I went to 3 (small) museums conveniently on my list and co-located.
- I did another bookbinding workshop! Surprisingly exhausting: many steps, lots of focus and lots of standing. But the result pleases me so!
- I don't want to go back to work.
Published on — Mon May 29 2023


Greetings world! My name, is Emilio, a prospective programmer who will take any advice and help I can get to reach my goal. Over the last few years I have been working as a medical scribe, but have learned that I am not as passionate as I once was. I have always been intrigued by the world of computers, specifically programming. I applied to DevBootcamp after deciding I wanted to make the switch and I am so grateful to have been given this chance to learn.
What are the benefits of version control? Version control is a type of system in which one can easily track their past changes. This is important when you are working on the same files with other developers. Version Control helps manage workflow so no one steps on anyone’s else’s toes, and if something does go wrong you can always just go back to anearlier version. The two popular version control systems are Subversion and Git.
What is Git? It is an open-source version control system (free) that allows developers to track changes made on their code files throughout the lifetime of a project. It is designed such that it views your code files like a “tree”.
Why use GitHub? GitHub is like a cloud-based service for programmers. It is an open source for sharing and distributing(if you please) code amongst other developers. This makes it quite useful in terms of allowing someone in your project to edit the code without disrupting the master code.


|
document2html
1.0
Documents to HTML converter
|
Helper functions (strings, files, etc.) More...
Typedefs | |
| using | LOCK = std::unique_lock< std::mutex > |
Functions | |
Files | |
| std::string | absolutePath (const std::string &fileName) |
| Get absolute file path. More... | |
| void | os_rmdir (const char *dir) |
| Rmdir realisation depending on OS. More... | |
| void | os_mkdir (const char *dir) |
| Mkdir realisation depending on OS. More... | |
| std::string | os_mkdtemp (char *dir) |
| Mkdtemp realisation depending on OS. More... | |
| std::string | getProgramPath () |
| Get current executable file directory to make absolute path. More... | |
| bool | isDirectory (const std::string &path) |
| Check if path is directory. More... | |
| void | createDir (const std::string &name) |
| Recursively create directory. More... | |
| std::string | createTempDir () |
| Create temp directory. More... | |
| void | deleteDir (const std::string &name, bool deleteSelf=true) |
| Recursively delete directory. More... | |
| bool | fileExists (const std::string &name) |
| Check if file exists. More... | |
| void | moveFile (const std::string &oldDir, const std::string &oldName, const std::string &newDir, const std::string &newName) |
| Move file. More... | |
| std::string | getFileNameFromPath (const std::string &path) |
| Get file name from path (without extension) More... | |
| std::string | getBaseDir (std::string str1, std::string str2) |
| Get get base directory for 2 files. More... | |
| int | getFileCount (const std::string &name) |
| Get amount of files in directory. More... | |
Strings | |
| std::string | trim (const std::string &str, const std::string &delimiter=" \\\\\0B") |
| Remove whitespaces and other characters from both sides of string (std::string) More... | |
| std::wstring | trim (const std::wstring &str, const std::wstring &delimiter=L" \\\\\0B") |
| Remove whitespaces and other characters from both sides of string (std::wstring) More... | |
| std::string | ltrim (const std::string &str, const std::string &delimiter=" \\\\\0B") |
| Remove whitespaces and other characters from begining of string. More... | |
| std::string | rtrim (const std::string &str, const std::string &delimiter=" \\\\\0B") |
| Remove whitespaces and other characters from end of string. More... | |
| std::string | lpad (const std::string &str, size_t length, char filler) |
| Pad string to a certain length with another string (from left) More... | |
| std::string | rpad (const std::string &str, size_t length, char filler) |
| Pad string to a certain length with another string (from right) More... | |
| std::string | replace (const std::string &str, const std::string &to, int offset, int length) |
Replace subtring which starts at offset and has size of length More... | |
| void | replaceAll (std::string &str, const std::string &from, const std::string &to) |
| Replace all occurrences of substring (std::string) More... | |
| void | replaceAll (std::wstring &str, const std::wstring &from, const std::wstring &to) |
| Replace all occurrences of substring (std::wstring) More... | |
| std::string | replaceAll2 (std::string str, const std::string &from, const std::string &to) |
| Replace all occurrences of substring. More... | |
| int | findNth (const std::string &str, const char delimiter, const int occurrence) |
| Find nth occurrence of symbol in string (std::string) More... | |
| int | findNth (const std::wstring &str, const wchar_t delimiter, const int occurrence) |
| Find nth occurrence of symbol in string (std::wstring) More... | |
| int | findNth (const std::wstring &str, const std::wstring &delimiter, const int occurrence) |
| Find nth occurrence of substring in string (std::wstring) More... | |
| int | rfindNth (const std::string &str, const char delimiter, const int occurrence) |
| Find nth from right occurrence of symbol in string (std::string) More... | |
| int | rfindNth (const std::wstring &str, const wchar_t delimiter, const int occurrence) |
| Find nth from right occurrence of symbol in string (std::wstring) More... | |
| int | rfindNth (const std::wstring &str, const std::wstring &delimiter, const int occurrence) |
| Find nth from right occurrence of substring in string (std::wstring) More... | |
| std::string | repeatString (const std::string &str, int times) |
| Repeat string several times. More... | |
| std::vector< std::string > | explode (const std::string &str, const char delimiter) |
| Split string by delimiter. More... | |
| std::vector< std::string > | explode (std::string str, const std::string &delimiterList, bool skipEmpty=false) |
| Split string by delimiter. More... | |
| std::string | join (const std::vector< std::string > &strList, const std::string &delimiter="") |
| Split string by delimiter. More... | |
| bool | endsWith (const std::string &str, const std::string &ending) |
| Check if string ends with substring. More... | |
| std::string | xorEncrypt (const std::string &str, const std::string &key) |
| Encrypted / decrypted string with XOR method. More... | |
XML | |
| int | xmlChildrenCount (const pugi::xml_node &node, const std::string &childName="") |
| Get XML-node count of children with specific name. More... | |
| void | xmlDeleteAllChildren (pugi::xml_node &node) |
| Delete all children. More... | |
Other | |
| void | sleep (int time) |
| Sleep for N sec. More... | |
| std::string | getTime (const char *format="%d.%m.%Y %H:%M:%S") |
| Get system current time. More... | |
| std::string | intToHex (int number, size_t length) |
| Convert number to hex string. More... | |
| char | hexCharToDec (char c) |
| Convert hex char to dec number. More... | |
Variables | |
| std::mutex | MUTEX |
| const bool | IS_WINDOWS = false |
| const bool | IS_MAC = false |
| const std::string | PROGRAM_PATH = getProgramPath() |
| const std::string | TEMP_DIR = PROGRAM_PATH + "/files/temp" |
| const char | HEX_DATA [] = "0123456789ABCDEF" |
Helper functions (strings, files, etc.)
| std::string tools::absolutePath | ( | const std::string & | fileName | ) |
Get absolute file path.
| [in] | fileName | File name |
| void tools::createDir | ( | const std::string & | name | ) |
Recursively create directory.
| [in] | name | Directory name |
| std::string tools::createTempDir | ( | ) |
Create temp directory.
| void tools::deleteDir | ( | const std::string & | name, |
| bool | deleteSelf = true |
||
| ) |
Recursively delete directory.
| [in] | name | Directory name |
| [in] | deleteSelf | False if should clear directory only |
| bool tools::endsWith | ( | const std::string & | str, |
| const std::string & | ending | ||
| ) |
Check if string ends with substring.
| [in] | str | Input string |
| [in] | ending | Ending substring |
| std::vector< std::string > tools::explode | ( | const std::string & | str, |
| const char | delimiter | ||
| ) |
Split string by delimiter.
| [in] | str | Input string |
| [in] | delimiter | Boundary symbol |
| std::vector< std::string > tools::explode | ( | std::string | str, |
| const std::string & | delimiterList, | ||
| bool | skipEmpty = false |
||
| ) |
Split string by delimiter.
| [in] | str | Input string |
| [in] | delimiterList | Boundary symbols |
| [in] | skipEmpty | True if should skip empty substrings |
| bool tools::fileExists | ( | const std::string & | name | ) |
Check if file exists.
| [in] | name | File name |
| int tools::findNth | ( | const std::string & | str, |
| const char | delimiter, | ||
| const int | occurrence | ||
| ) |
Find nth occurrence of symbol in string (std::string)
| [in] | str | Input string |
| [in] | delimiter | Symbol that should be found |
| [in] | occurrence | Occurrence number |
| int tools::findNth | ( | const std::wstring & | str, |
| const wchar_t | delimiter, | ||
| const int | occurrence | ||
| ) |
Find nth occurrence of symbol in string (std::wstring)
| [in] | str | Input string |
| [in] | delimiter | Symbol that should be found |
| [in] | occurrence | Occurrence number |
| int tools::findNth | ( | const std::wstring & | str, |
| const std::wstring & | delimiter, | ||
| const int | occurrence | ||
| ) |
Find nth occurrence of substring in string (std::wstring)
| [in] | str | Input string |
| [in] | delimiter | Substring that should be found |
| [in] | occurrence | Occurrence number |
| std::string tools::getBaseDir | ( | std::string | str1, |
| std::string | str2 | ||
| ) |
Get get base directory for 2 files.
| [in] | str1 | First file name |
| [in] | str2 | Second file name |
| int tools::getFileCount | ( | const std::string & | name | ) |
Get amount of files in directory.
| [in] | name | Directory name |
| std::string tools::getFileNameFromPath | ( | const std::string & | path | ) |
Get file name from path (without extension)
| [in] | path | File path |
| std::string tools::getProgramPath | ( | ) |
Get current executable file directory to make absolute path.
| std::string tools::getTime | ( | const char * | format = "%d.%m.%Y %H:%M:%S" | ) |
Get system current time.
| [in] | format | Date format |
| char tools::hexCharToDec | ( | char | c | ) |
Convert hex char to dec number.
| [in] | c | Hex char |
| std::string tools::intToHex | ( | int | number, |
| size_t | length | ||
| ) |
Convert number to hex string.
| [in] | number | Input number |
| [in] | length | Length of result string |
| bool tools::isDirectory | ( | const std::string & | path | ) |
Check if path is directory.
| [in] | path | Directory name |
| std::string tools::join | ( | const std::vector< std::string > & | strList, |
| const std::string & | delimiter = "" |
||
| ) |
Split string by delimiter.
| [in] | strList | Array of strings |
| [in] | delimiter | Delimiter between strings |
| std::string tools::lpad | ( | const std::string & | str, |
| size_t | length, | ||
| char | filler | ||
| ) |
Pad string to a certain length with another string (from left)
| [in] | str | Input string |
| [in] | length | Length of padded string |
| [in] | filler | Padding symbol |
| std::string tools::ltrim | ( | const std::string & | str, |
| const std::string & | delimiter = " \\\\\0B" |
||
| ) |
Remove whitespaces and other characters from begining of string.
| [in] | str | Input string |
| [in] | delimiter | Symbols that should be deleted |
| void tools::moveFile | ( | const std::string & | oldDir, |
| const std::string & | oldName, | ||
| const std::string & | newDir, | ||
| const std::string & | newName | ||
| ) |
Move file.
| [in] | oldDir | Old directory name |
| [in] | oldName | Old file name |
| [in] | newDir | New directory name |
| [in] | newName | New file name |
| void tools::os_mkdir | ( | const char * | dir | ) |
Mkdir realisation depending on OS.
| [in] | dir | Directory name |
| std::string tools::os_mkdtemp | ( | char * | dir | ) |
Mkdtemp realisation depending on OS.
| [in] | dir | Directory name |
| void tools::os_rmdir | ( | const char * | dir | ) |
Rmdir realisation depending on OS.
| [in] | dir | Directory name |
| std::string tools::repeatString | ( | const std::string & | str, |
| int | times | ||
| ) |
Repeat string several times.
| [in] | str | Input string |
| [in] | times | How many times string should be repeated |
| std::string tools::replace | ( | const std::string & | str, |
| const std::string & | to, | ||
| int | offset, | ||
| int | length | ||
| ) |
Replace subtring which starts at offset
and has size of length
| [in] | str | Input string |
| [in] | to | String to replace the search string with |
| [in] | offset | Substring start position |
| [in] | length | Length of substring to be replaced |
| void tools::replaceAll | ( | std::string & | str, |
| const std::string & | from, | ||
| const std::string & | to | ||
| ) |
Replace all occurrences of substring (std::string)
| [in,out] | str | Input string |
| [in] | from | String to search for |
| [in] | to | String to replace the search string with |
| void tools::replaceAll | ( | std::wstring & | str, |
| const std::wstring & | from, | ||
| const std::wstring & | to | ||
| ) |
Replace all occurrences of substring (std::wstring)
| [in,out] | str | Input string |
| [in] | from | String to search for |
| [in] | to | String to replace the search string with |
| std::string tools::replaceAll2 | ( | std::string | str, |
| const std::string & | from, | ||
| const std::string & | to | ||
| ) |
Replace all occurrences of substring.
| [in] | str | Input string |
| [in] | from | String to search for |
| [in] | to | String to replace the search string with |
| int tools::rfindNth | ( | const std::string & | str, |
| const char | delimiter, | ||
| const int | occurrence | ||
| ) |
Find nth from right occurrence of symbol in string (std::string)
| [in] | str | Input string |
| [in] | delimiter | Symbol that should be found |
| [in] | occurrence | Occurrence number |
| int tools::rfindNth | ( | const std::wstring & | str, |
| const wchar_t | delimiter, | ||
| const int | occurrence | ||
| ) |
Find nth from right occurrence of symbol in string (std::wstring)
| [in] | str | Input string |
| [in] | delimiter | Symbol that should be found |
| [in] | occurrence | Occurrence number |
| int tools::rfindNth | ( | const std::wstring & | str, |
| const std::wstring & | delimiter, | ||
| const int | occurrence | ||
| ) |
Find nth from right occurrence of substring in string (std::wstring)
| [in] | str | Input string |
| [in] | delimiter | Substring that should be found |
| [in] | occurrence | Occurrence number |
| std::string tools::rpad | ( | const std::string & | str, |
| size_t | length, | ||
| char | filler | ||
| ) |
Pad string to a certain length with another string (from right)
| [in] | str | Input string |
| [in] | length | Length of padded string |
| [in] | filler | Padding symbol |
| std::string tools::rtrim | ( | const std::string & | str, |
| const std::string & | delimiter = " \\\\\0B" |
||
| ) |
Remove whitespaces and other characters from end of string.
| [in] | str | Input string |
| [in] | delimiter | Symbols that should be deleted |
| void tools::sleep | ( | int | time | ) |
Sleep for N sec.
| [in] | time | Time (in msec) |
| std::string tools::trim | ( | const std::string & | str, |
| const std::string & | delimiter = " \\\\\0B" |
||
| ) |
Remove whitespaces and other characters from both sides of string (std::string)
| [in] | str | Input string |
| [in] | delimiter | Symbols that should be deleted |
| std::wstring tools::trim | ( | const std::wstring & | str, |
| const std::wstring & | delimiter = L" \\\\\0B" |
||
| ) |
Remove whitespaces and other characters from both sides of string (std::wstring)
| [in] | str | Input string |
| [in] | delimiter | Symbols that should be deleted |
| int tools::xmlChildrenCount | ( | const pugi::xml_node & | node, |
| const std::string & | childName = "" |
||
| ) |
Get XML-node count of children with specific name.
| [in] | node | Input XML-node |
| [in] | childName | Child name |
| void tools::xmlDeleteAllChildren | ( | pugi::xml_node & | node | ) |
Delete all children.
| [in,out] | node | Input XML-node |
| std::string tools::xorEncrypt | ( | const std::string & | str, |
| const std::string & | key | ||
| ) |
Encrypted / decrypted string with XOR method.
| [in] | str | Input string |
| [in] | key | Cypher key |
| const char tools::HEX_DATA[] = "0123456789ABCDEF" |
Hex string char list
| const bool tools::IS_MAC = false |
If current OS is macOS
| const bool tools::IS_WINDOWS = false |
If current OS is Windows
| const std::string tools::PROGRAM_PATH = getProgramPath() |
Current executable file absolute path
| const std::string tools::TEMP_DIR = PROGRAM_PATH + "/files/temp" |
Temp directory path


Dump1090
Present beam directions are as follows:
1 - 355.5
2 - 355.5
3 - 175.5
4 - 61.1
5 - 293.999
6 - 121.1
Beam Direction (w.r.t. true North):
Preset Runways
Click on a plane for info.