How to check if a block has alignfull using a conditional?

Are there any conditional queries to check if a block has an alignfull class for example?

I’m using the below which when part of another function adds the color overlay class to my body classes, but ideally this should only happen if the block is set to alignfull.

if ( 'core/cover' === $blocks(0)('blockName') ) {

    // Would like to check if this block is set to alignfull before adding the below.
    if ( isset( $blocks(0)('attrs')('overlayColor') ) ) {
        $classes() = 'has-' . $blocks(0)('attrs')('overlayColor') . '-header';
    }


}

Thanks in advance πŸ™‚

7 – Check if the user has flagged content with any flag

It is possible with the following code to check if a content has been flagged by the current user with a certain flag:

$flag = flag_get_flag('flag_name');
if ($flag && $flag->is_flagged($node->nid, $GLOBALS('user')->uid)) {
  print "This node is flagged";
}

But, how to check if the user has flagged content with any flag ?

How do i do this in Notepad++ ? (Please check the post)

So i have thousands of lines that look like this:
Username | Password | Account Status | Region | Email | Summoner Name | BE | RP | RP Refunds | Level | Curr Rank | Prev Rank | Champs | Skins | Last Played

How do i make it look like this:
Email | Password

Thanks in advance!

ip – Why http microsoft connection in netstat check?

I checked established connections with “netstat” command in command prompt, and I found that there are some connections with ip’s of microsoft (I checked ip online) that have http (and not https) connection established, they bring to some svchost.exe in a Win32 folder of the system. I know that http connections are not safe, but I guess they are safe since they have microsoft ip, but why these connections are not encrypted (http)? Is it normal?

dnd 3.5e – Is a concentration check required for each of my following spells if I buff myself with Mage Armor

What the question quotes is a subsection of the section Concentration that, in part, says, “If something interrupts your concentration while you’re casting, you must make a Concentration check or lose the spell” (Player’s Handbook 170 and emphasis mine). Typically, turn 1’s casting of the mage armor spell can’t interrupt turn 2’s casting of the magic missile spell.

That is, when a wizard finishes casting the mage armor spell, the wizard is, indeed, affected by the mage armor spell, but on the wizard’s next turn that same now-ongoing and already-been-cast mage armor spell doesn’t interrupt the wizard’s casting of another spell. Getting a new spell on him in the middle of casting the magic missile spell would be a concern because then that’s an interruption, but no interruption is typically caused by the spells that are already present on the caster.

For instance, if the mage armor spell were cast on the wizard at the same time as the wizard was casting a magic missile spell then a Concentration skill check (DC = the mage armor spell’s saving throw DC) would be required. (Doing this typically requires the caster of the mage armor spell to ready an action.)

The Concentration subsection Spells is telling casters that it’s not only weapon damage and the environment that can interrupt casting spells but also that spells can interrupt the casting spells, too.

checkboxes – Are round check boxes confusing or an accepted standard?

If I saw that in an interface – I would assume only one item can be checked, especially before any had been selected. Only the wording of the title would indicate to me that multiple selection is possible. I think this design would lead to a greater than normal number of people choosing a single item rather than a selection of items.

I don’t see the benefit here in bucking accepted trends other than to make it all curvy everywhere, but pretty rounded rectangles would do the job just as well, be more intuitive and more standard.

I don’t dislike the appearance from a pure graphical perspective – I just don’t think it’s right from the affordance perspective.

— edit update —

I redesigned it with rounded squares:

enter image description here

— further update —

As an interesting addendum – I found this (below) on a Google spreadsheets viewform survey (from UXPin) recently. It combines the outer shape of a checkbox, so that multiple-answer questions and single-answer questions have options that look quite similar in appearance, but the single-answer options have the inner circular shape of a radio button.

I had no confusion as to how it might be used, but I found this representation very unusual – in fact this was the first time I’d seen it. I find this quite interesting.

enter image description here

authentication authorization – Where do I check whether logged in user in administrator, moderator or just authenticated user in Drupal 7?

I have 2 separate login pages for users and administrators userslogin and backendlogin.

I have created a new function in my custom theme as follows,

  function customtheme_theme() {

  $items = array(); 

  $items('user_login') = array(

    'render element' => 'form',

    'path' => drupal_get_path('theme', 'customtheme') . '/templates/user',

    'template' => 'user-login',

  );

  $items('user_pass') = array(

    'render element' => 'form',

    'path' => drupal_get_path('theme', 'customtheme') . '/templates/user',

    'template' => 'user-pass',

  );

  return $items;
}

and in /sites/all/themes/customtheme/templates/user I have created 2 files, user-login.tpl.php and user-pass.tpl.php.

Now in the user-login.tpl.php, I have put the following code,

<?php $login_form = drupal_get_form("user_login"); ?>

<?php print $messages; ?>

<input autocomplete="off" type="text" 
value="<?php echo $login_form('name')('#value'); ?>" 
id="<?php echo $login_form('name')('#id'); ?>" 
name="<?php echo $login_form('name')('#name'); ?>" 
placeholder="Enter your username" required="" 
oninvalid="this.setCustomValidity('Username id is required')" 
oninput="setCustomValidity('')"/>

// password field..
// actions ..

So, I used the same setup for the admin login as well.

Created a new template at /sites/all/themes/customtheme/templates/page/page--backend.tpl.php

So in that page, I just called the user_loin form as below,

$elements = drupal_get_form("user_login"); 

$form = drupal_render($elements);   
echo ($form);

Now, both pages are working fine, But I need to show some message saying you are not allowed here if normal users logged in through backend form.

Am not able to figure out at which place/file/path I need to check for the user role and display the message(push to $mesages).

calculus – Triple integral with non-constant bounds knowledge check

I recently made a post on triple integrals with cylindrical/spherical coordinates, and that lead me to a breakthrough in my own understanding of double and triple integrals with variable bounds of integration in the iterated integrals. I wanted to check to make sure if this logic is correct, and if it’s not, please correct me!

Define a function $ M(x, y, z) $ on region Q in space with bounds $alphale{x}le{beta}, h_1(x)le{y}le{h_2(x)}, g_1(x,y)le{z}le{g_2(x,y)}$ upon which we would like to integrate. Now construct a rectangular prism that completely surrounds Q, which we will call P, with bounds $ale{x}le{b}, cle{y}le{d}, ele{z}le{f}$ where $$ale{alpha}le{beta}le{b}$$ $$cle{h_1(x)}le{h_2(x)}le{d}$$ $$ele{g_1(x,y)}le{g_2(x,y)}le{f}$$ Define the following function:

$$N(x, y, z)=
begin{cases}
M(x, y, z), &text{(x, y, z) ∈ Q} \
0, &text{(x, y, z) ∈ P and (x, y, z) βˆ‰ Q}
end{cases}$$

Now, partition P and construct the triple integral on the region P:

$$lim_{maxDelta{x} to 0, maxDelta{y} to 0, maxDelta{z} to 0}sum_{i=1}^thetasum_{j=1}^{phi}sum_{k=1}^{rho}N(x_i, y_j, z_k)Delta{z_k}Delta{y_j}Delta{x_i} = intint_Pint{N(x, y, z)dzdydx}$$

Use Fubini’s Theorem:

$$intint_Pint{N(x, y, z)dzdydx} = int_a^bint_c^dint_e^fN(x, y, z)dzdydz$$

Notice, however, that when integrating upon any fixed $(x, y)$, the inside z-integral would become:
$$int_e^fN(x, y, z)dz = int_e^{g_1(x, y)}N(x, y, z)dz + int_{g_1(x,y)}^{g_2(x,y)}N(x, y, z)dz + int_{g_2(x,y)}^fN(x, y, z)dz$$

$$int_e^fN(x, y, z)dz = 0 + int_{g_1(x,y)}^{g_2(x,y)}N(x, y, z)dz + 0$$

$$int_e^fN(x, y, z)dz =int_{g_1(x,y)}^{g_2(x,y)}M(x, y, z)dz$$

The change from $N$ to $M$ is significant but can be done because on $g_1(x,y)le{z}le{g_2(x,y)}$, $N=M$.

All the steps up to this point seem logical. However, these next parts are where I feel slightly iffy, so it could be wrong:

Now apply a somewhat similar logic to y: use any fixed x and break up the iterated integrals as such:

$$int_c^dint_e^fN(x, y, z)dzdy = int_c^{h_1(x)}int_e^fN(x,y,z)dzdy + int_{h_1(x)}^{h_2(x)}int_e^fN(x,y,z)dydz+int_{h_2(x)}^dint_e^fN(x,y,z)dydz$$

With the outer two iterated integrals, only y values that lie in P would be evaluated, which would thus make them equal 0. The middle iterated integral stays and the variable bounds of the z-integral can be added using the previous analysis:

$$int_c^dint_e^fN(x,y,z)dzdy = int_{h_1(x)}^{h_2(x)}int_{g_1(x,y)}^{g_2(x,y)}M(x,y,z)dzdy$$

Again, a similar logic can be applied to x (except no variables need to be fixed now): break the iterated integral up into 3 iterated integrals (with constants as bounds on the inner integrals), realize that the outer 2 iterated integral expressions are 0 because only x-values in P are evaluated, and thus only the middle integral remains with the bounds of $alpha$ and $beta$. Plug in the variable-bounded, doubly-iterated integral discussed earlier, and we finally have our solution:

$$int_a^bint_c^dint_e^fN(x,y,z)dzdydx = int_{alpha}^{beta}int_{h_1(x)}^{h_2(x)}int_{g_1(x,y)}^{g_2(x,y)}M(x,y,z)dzdydx = intint_Qint M(x,y,z)dzdydx$$

I feel very strong about the work up until after the discussion of the inner-most iterated integral. Is all of this logic sound? If not, what should I change to make this valid? I mainly want to stick with the triple Reimann sum definition of a triple integral here, so if you see an error, try to keep the correction within that definition (but if that cannot be done, that is perfectly ok!) Thank you for reading!

check if a string is an element of a list of strings

I have a list of strings called words. I’m writing:

"cat" [Element] words

I was hoping to get a True/False output, but I just get the input returned to me. This is the output regardless of whether the word I check is in the list.

powershell – Check who has given permission to a user in sharepoint online

Stack Exchange Network


Stack Exchange network consists of 177 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange