Best practice when checking multiple addresses for a Worksheet_Change () event?

I'm doing a code revision and I'm looking at this part of me Worksheet_Change() Event:

If Target.Address = "$A$4" Or _
       Target.Address = "$A$7" Or _
       Target.Address = "$A$10" Or _
       Target.Address = "$B$21" Or _
       Target.Address = "$B$22" Or _
       Target.Address = "$B$23" Or _
       Target.Address = "$B$24" Or _
       Target.Address = "$B$25" Or _
       Target.Address = "$B$26" Or _
       Target.Address = "$B$33" Or _
       Target.Address = "$B$35" Then

I'm thinking about it Union() and Intersect() to see if mine Target.Address is in the range – would this be a better solution than what I have above? I don't like the idea of ​​losing readability, but I also want to keep things clean and concise.

Event subscriber – How do you simulate Google registration with the Drupal 8 module for social authentication on a local server?

I am trying to test Google sign-in on my local computer to capture the event and automatically activate the user.

I was running code to simulate the triggering of the event, but that may not be authentic behavior and creating the actual code to simulate the event in the trigger.


use Drupalsocial_authEventSocialAuthEvents;
use Drupalsocial_authEventUserFieldsEvent;
use Drupalsocial_authUserSocialAuthUserInterface;
use DrupaluserEntityUser;


$user_social = new Drupalsocial_authUserSocialAuthUser('Test', "abcd@axl.com", "74",'adsfjdskljfskdlfj');


$fields = (
  'name' => "Krumo",
  'mail' => "kaaa@axl.com",
  'init' => "abcd@axl.com",
  'pass' => "sdfdsfsdf",
  'status' => '0',
  'langcode' => 'en',
  'preferred_langcode' => 'en',
  'preferred_admin_langcode' => 'en',
  'user_picture' => NULL,
);
$event = new UserFieldsEvent($fields, '15', $user_social);
Drupal::service('event_dispatcher')->dispatch(SocialAuthEvents::USER_FIELDS, $event);

The event is fired, but the user is not created, and adding the code appears to be a cumbersome way to test this event. I hope there is a better way to do this.

Excel VBA Chart Crosshair Cursor with Chart_Mousemove VBA event

MYSTERY

There is no problem with the code

Did you just want to know if it can be made more efficient?
Any advice?

I am trying to create a crosshair cursor for Excel chart sheets.
I have referred to many websites such as
https://stackoverflow.com/questions/26426358/calculating-datapoint-position-with-chart-mouseover-event

Everyone involved had the same problem as me – calculating the exact cursor position coordinates, since the diagram is measured in points and the cursor position (window element) in pixels. Somehow I was able to calculate it using the formula. (Very close)

The file can be downloaded from the OneDrive folder
https://1drv.ms/u/s!AsuW6BrzIqXQhh_F9mCrENWGvKjK?e=iqP7hJ

Please note that the margins are set to zero

YouTube link
https://www.youtube.com/watch?v=V0f-WGwd0_s

I understand that the cursor position coordinates are determined by the following factors.

  1. Windows zoom set by the "Make everything bigger" option in the control
    Panel / settings. This can be determined in Excel
    (ActiveWindow.Width)
  2. Page size of the diagram (ActiveChart.PageSetup.PaperSize)
  3. Page orientation of the chart sheet (ActiveChart.PageSetup.Orientation)
  4. Zoom percent of the chart sheet (ActiveWindow.Zoom)
  5. Size of the chart area (ChartArea.Width and ChartArea.Height)

The VBA code follows

Option Explicit

Private Sub Chart_MouseMove(ByVal Button As Long, ByVal Shift As Long, ByVal A As Long, ByVal B As Long)
' Instead of moving a line to a new cursor position, this macro deletes all the earlier lines and creates new lines on the new cursor position
' This deletion and addition of lines makes this macro inefficient causing a fraction of second lag.

Dim xPoint As Variant, yPoint As Variant, XMax As Variant, YMax As Variant, DispScale As Variant
Dim shp As Shape
Dim ChartPaperSize, PgWidPXL, PgHgtPXL, ChtAreaWid, ChtAreaHgt, ActWinZoom

'OK.. I have removed following lines deleting earlier lines.
'Also, I have removed code at the bottom for adding new lines.
'Instead, now I have added code at the bottom changing the attributes of the 
'present lines for their placement
'First delete all the line shapes added
'For Each shp In ActiveChart.Shapes
'If Not shp.Type = msoFormControl Then shp.Delete
'Next shp

'This macro is suitable for following 4 paper sizes only
'MsgBox ("Please set Chart Paper Size to Legal, Letter, A4 or A3")

'Debug.Print A & " " & B

ChartPaperSize = ActiveChart.PageSetup.PaperSize
Select Case ChartPaperSize
' I couldnt find better way to convert paper size number to inches and therafter to pixels
' I dont know why multiplying by 0.9745 or 0.9725 keeps the x, y coordinates more close to the diplayed cursor position
    Case 5 '"xlPaperLegal"
       If ActiveChart.PageSetup.Orientation = xlLandscape Then
       PgWidPXL = 14 * 220 * 0.9745 '220 PPI
       PgHgtPXL = 8.5 * 220 * 0.9725
       Else
       PgWidPXL = 8.5 * 220 * 0.9745
       PgHgtPXL = 14 * 220 * 0.9725
       End If
    Case 1 '"xlPaperLetter"
       If ActiveChart.PageSetup.Orientation = xlLandscape Then
       PgWidPXL = 11 * 220 * 0.9745
       PgHgtPXL = 8.5 * 220 * 0.9725
       Else
       PgWidPXL = 8.5 * 220 * 0.9745
       PgHgtPXL = 11 * 220 * 0.9725
       End If
    Case 9 '"xlPaperA4"
       If ActiveChart.PageSetup.Orientation = xlLandscape Then
       PgWidPXL = 11.69 * 220 * 0.9745
       PgHgtPXL = 8.27 * 220 * 0.9725
       Else
       PgWidPXL = 8.27 * 220 * 0.9745
       PgHgtPXL = 11.69 * 220 * 0.9725
       End If
    Case 8 ' "xlPaperA3"
       If ActiveChart.PageSetup.Orientation = xlLandscape Then
       PgWidPXL = 16.54 * 220 * 0.9745
       PgHgtPXL = 11.69 * 220 * 0.9725
       Else
       PgWidPXL = 11.69 * 220 * 0.9745
       PgHgtPXL = 16.54 * 220 * 0.9725
       End If
    'Case Else
    'End Sub
End Select

'If UserForm2.CommandButton10.BackColor = vbGreen Then

XMax = PgWidPXL * (100 / 125) ' for A4 2503 for legal 2999 '2395 'Max mousepointer width on 100% chart sheet zoom
YMax = PgHgtPXL * (100 / 125) ' for A4 1764 for legal 1814 '1450 ''Max mousepointer height on 100% chart sheet zoom

ChtAreaWid = ChartArea.Width
ChtAreaHgt = ChartArea.Height

DispScale = Round(1161 / ActiveWindow.Width, 2)
' 1161 is ActiveWindow.Width at Windows display recommended scale of 125%

ActWinZoom = ActiveWindow.Zoom

xPoint = (A * (ChtAreaWid * DispScale) / XMax) / (ActWinZoom / 100)
yPoint = (B * (ChtAreaHgt * DispScale) / YMax) / (ActWinZoom / 100)

'following code deleted
'With ActiveChart.Shapes.AddLine(1, yPoint, ChartArea.Width, yPoint).Line
'.ForeColor.RGB = RGB(0, 0, 0)
'End With
'With ActiveChart.Shapes.AddLine(xPoint, 1, xPoint, ChartArea.Height).Line
'.ForeColor.RGB = RGB(0, 0, 0)
'End With
'following new code added
With ActiveChart.Shapes(1) ' horizontal line
.Left = 1
.Top = yPoint
.Width = ChartArea.Width
.Height = 1
End With

With ActiveChart.Shapes(2) 'vertical line
.Top = 1
.Left = xPoint
.Height = ChartArea.Height
.Width = 1
End With



'End If

End Sub

The Excel file under the link will be replaced by the changed file.

Event Photography – Any Tips For Photographing A Political Rally?

Political rallies can be a mess.

Sometimes media with ID are placed in preferred areas that provide a good overview of the candidates and other speakers.

At other rallies, I've seen the press shut off in areas that limit what they can see and shoot.

In the long run, I think it would be beneficial for you to go through the process and apply for press passes. The worst thing you can do is reject your request. The experience of applying for credentials, then using them and going through the verification process to enter the venue, as well as collecting all the clues you can get by watching the press work, is worth more to you than any recordings you take could make point. If there is a local newspaper near you, contact the local photography department and ask about the day the rally is scheduled to take place. The worst thing they can say is no. You may even be able to apply for press cards through them, which will likely increase your chances of approval (unless the campaign limits the number of credentials that are issued to each news organization). You could also include a mentor in the deal. Most press photographers are very welcome to newbies and ready to help a bit as long as you don't overdo the questions or tie them at times when they need to take the pictures they were made for.

I have a friend who filmed a Trump rally for a local newspaper before the 2016 election. They drove all media into an area with limited visibility. She put her media ID in her clothes and worked her way through the crowd to a point much closer to the platform and got some shots that none of the other press photographers could get.

However, the question is whether she would have been allowed to enter the venue with this type of photographic equipment if she had not received any press passes issued by the campaign when entering the press gate. Although the Secret Service conducted screening at the press gate, after thorough inspection, they let cameras and lenses through the press gate that were larger than at the regular checkpoints. Leave your bag in your car. Even with press cards, you may not be allowed to enter with a backpack or bag that is not transparent.

magento2 – Define an event when selected with the event observer

My template is in src/app/design/frontend/MySite/default/Magento_Checkout/templates/cart/item/default.phtml

There is a selection and in this selection I add an event.