What Is the Meaning of "H" in "<%=H [ ...] %>"

What is the meaning of h in %=h [ ...] %?

html escape. It's a method that converts things like < and > into numerical character references so that rendering won't break your html.

What is the meaning of $H in Javascript/JQuery?

$H is to do with mootools, not jQuery. You find the doc here (pg 67). Excerpt below:

$H is a shortcut to initialize an
instance of Hash . Usage :

$H(object) Example :
var fooHash = $H({foo: 'bar'}); When you’ll use it : This is just a
shortcut for new Hash(obj) , which
returns an instance of Hash

raw vs. html_safe vs. h to unescape html

Considering Rails 3:

html_safe actually "sets the string" as HTML Safe (it's a little more complicated than that, but it's basically it). This way, you can return HTML Safe strings from helpers or models at will.

h can only be used from within a controller or view, since it's from a helper. It will force the output to be escaped. It's not really deprecated, but you most likely won't use it anymore: the only usage is to "revert" an html_safe declaration, pretty unusual.

Prepending your expression with raw is actually equivalent to calling to_s chained with html_safe on it, but is declared on a helper, just like h, so it can only be used on controllers and views.

"SafeBuffers and Rails 3.0" is a nice explanation on how the SafeBuffers (the class that does the html_safe magic) work.

Meaning of H/5 in cron Jenkins

The H will take a numeric hash of the Job name and use this to ensure that different jobs with the same cron settings do not all trigger at the same time. This is a form of Scheduling Jitter

H/5 in the first field means Every five minutes starting at some time between 0 and 4 minutes past the hour

So H/5 3,21 * * 1-5

is Every five minutes between 03:00 and 03:59 and then between 21:00 and 21:59 on Mon -> Fri but starting at some 'random' time between 03:00 and 03:04 and then the same number of minutes after 21:00

If you want to run once per hour between 03:00-03:59 and 21:00-21:59 on Mon -> Fri, you can use H 3,21 * * 1-5 where H will be replaced by some number between 0-59 depending on job name.

The user interface will tell you when the job will last have triggered and will next trigger

How does the preprocessor know to translate HEADER_H to header.h?

header.h is not a valid identifier. You cannot have a period in a macro name.

That said, the name you pick for your include guard macros is completely arbitrary. After all, it's just another variable. It is purely convention (and reasonable in order to avoid clashes) to name them after the file.

I encourage you to phrase the header structure out aloud to see what the preprocessor does.

#ifndef MY_HEADER_H    /* If the macro MY_HEADER_H is not defined (yet)... */
#define MY_HEADER_H /* ... then define it now ... */

... /* ... and deal with all this stuff ... */

#endif /* ... otherwise, skip all over it and go here. */

You see that this mechanism works equally well if you substitute MY_HEADER_H with I_REALLY_LIKE_BANANAS or whatever. The only requirement is that it be a valid macro identifier and not clash with the name of any other include guard.

In the above example, the macro is defined empty. That's fine, but it is not the only option. The second line could equally well read

#define MY_HEADER_H 1

which would then define the macro to 1. Some people do this but it doesn't really add anything and the value 1 is rather arbitrary. I generally don't do this. The only advantage is that if you define it to 1, you can also use #if in addition to #ifdef.

A final word of caution: Identifiers that start with an underscore or contain two or more consecutive underscore characters are reserved for the implementation and should not be used in user-code. Hence, _MY_HEADER_H and __MY_HEADER__H__ are both unfortunate choices.

The logic by which the preprocessor finds the correct header file if you say

#include <myheader.h>

is completely unrelated. Here, myheader.h names a file and the preprocessor will search for it in a number of directories (that usually can e configured via the -I command line option). Only after it has found and opened the file it will go ahead parsing it and thereby, it will eventually find the include guards that will cause it to essentially skip over the file if it has already parsed it before (and the include guard macro is therefore already defined so the first check evaluates to false).

Is there a special meaning of \h?

When storing strings in JavaScript you should always escape the \ character, by replacing \ with \\. Just imagine when someone has the username DOMAIN\noel. That will end up like

DOMAIN
oel

What mean file with extension h.in?

These files are usually the input for autoconf which will generate final .h files.

Here's an example from PCRE:

#define PCRE_MAJOR          @PCRE_MAJOR@
#define PCRE_MINOR @PCRE_MINOR@
#define PCRE_PRERELEASE @PCRE_PRERELEASE@
#define PCRE_DATE @PCRE_DATE@

Autoconf will replace all variables (@…@) with the respective values and the result will be a .h file.

What does h represent in rabin karp algorithm?

You should first look at an easier case where d is 10 and the text only contains numbers between 0 and 9.

h is value you use for shifting left the high-order digit. For example, let's assume that m is 3 and T = 2345. From 234, you can calculate 345 as follows:

345 = 10*(234 - 2*100) + 5

You can see in this case h = 100 is used for shifting 2 by 2 digits before subtracting it from 234. Note that the value of h is h = 103-1

Now, you can generalize the idea for any d, and get h = dm-1.

Then, by doing modulo operations, you just add mod q every time you calculate any values.



Related Topics



Leave a reply



Submit