c – Calculate firing angle and maximum horizontal distance from max height and initial velocity

So, I’m writing a C program that asks the user to input a max height and an initial velocity. The program then outputs a desired firing angle for an object, and the maximum horizontal distance. My code runs fine and lets me input numbers, but the output it gives is incorrect. This makes me think the formulas I put in to define the variables theta and maxd aren’t formatted correctly, but no matter how I format them I can’t get the right output. This is my code:


#include <stdio.h>

#include <math.h>

int main(void) {

    double h, g, v, theta, maxd;
    g = 9.8;
    printf("Enter a maximum height (in m):");
    scanf("%lf", &h);
    printf("Enter an initial velocity (in m/s):");
    scanf("%lf", &v);

    theta = asin(sqrt((2 *g *h) / pow(v, 2)));
    printf("We should fire the ball at an angle of: %lfn", theta);

    maxd = (pow(v, 2) * sin(2 * theta)) / g;
    printf("The maximum horizontal distance is: %lf", maxd);

    return 0;

flash – Why is my Canon 155A Speedlite not firing from the hotshoe of my Canon AE-1?

The AE-1’s hotshoe won’t fire the flash from some reason. I have the shutter speed set to 1/60s and my aperture is set to A (auto). The test button on the 155A fires the flash as does shorting two of the hot shoe connectors, but the shutter button won’t for whatever reason. I can see that the camera senses the the flash because the light meter is locked on the appropriate f-stop. But I have no luck getting it to fire the flash. Using the sync port on a different, non-hotshoe flash unit works but I have no way of testing a sync port on the 155A. I’ve also tried cleaning the hot shoe connections.

Any help would be appreciated.

film – 155a Speedlite Flash not firing from hotshoe on Canon AE-1

Like the title says the hot shoe won’t fire the flash from some reason. I have the shutter speed set to 60 and the f stop on auto as I should. The test button on the 155a fires and shorting two of the hot shoe connectors fires the flash but the shutter button won’t for whatever reason. I can see that the camera picks up the the flash unit because the light meter is locked on the appropriate f stop but I have no luck getting it to fire the flash. Using the sync port on a different, non-hot shoe flash unit works but I have no way of testing sync port on the 155a. I’ve also tried cleaning the hot shoe connections.

Any help would be appreciated.

hooks – drupal ajax callback is firing only once

i have apply button in my drupal node edit form , i am using the form alter hook to add that button , when ever the user clicks on that button i am making an ajax callback to replace the text field value , it is working fine for the first time , but the second time it is not replacing the value .

   function course_form_node_items_edit_form_alter(&$form, FormStateInterface $form_state) {

  $form('apply') = array(
      '#type' => 'submit',
      '#value' => t('Apply'),
      '#weight' => '38',
      '#executes_submit_callback' => FALSE,
      '#limit_validation_errors' => array(),
      '#ajax'                     => array(
        'callback' => 'button_test_callback',
        'wrapper' => 'edit-field-text-plain-0-value',


function button_test_callback(&$form, FormStateInterface $form_state) {

  $item_id = $form('field_item_id')('widget')(0)('value')('#value');

  $sql = "SELECT  item_name
          FROM items
          WHERE  field_item_id = '".$item_id."'";

  $location = Drupal::database()->query($sql)->fetchAssoc();

 $form('field_text_plain')('widget')(0)('value')('#value') =   $location   ;
  return $form('field_text_plain');

I see the after the first click the form_text_plain id changes to some random value like edit-field-text-plain-0-value-xhfjwos , it looks like that is the issue , is there any way we can stop it from changing ?

troubleshooting – Panasonic DMW-FL360L flashgun not firing, blinking Auto Check and Test/Reset lights even after replacing batteries

My Panasonic DMW-FL360L has stopped working. I get the blinking Auto Check and Test/Charge lights, which normally indicate that the batteries are depleted; however, even after installing a fully-charged set of batteries, I still get the blinking lights and the flash will not fire. The zoom head on the flash also will not move.

Is there a way I can fix this without having to send the flashgun in for repair?

(The same steps should also apply to the Olympus FL-600R, which is functionally identical.)

sharepoint online – SPO Event Receiver is not firing

So, finally figured this one out. It seems like modern authetication is not supported when adding eventrecivers. So using legacy cookie based authentication when connecting using pnp (-UseWebLogin) and everything works fine.

I have not made a deep dive into the issue, so i can not tell if the issue is with PnP or SharePoint..

c# – Animation is inconsistent when firing

When the joystick value is 0.7 and above, it is constantly firing and animation plays at the same time. (Gun recoil) It’s okay.
However, when I fire only once, the animation plays 2 times. (until transition from firing animation to “idle” animation)

In short, I’m trying to make a way of working like in a “shooter” game that fires rapidly when the joystick is pressed, works once when pressed once, and fires one by one when continuously pressed and released. (My attempt is for 2D)

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class pistolAttacking : MonoBehaviour
public Transform firepoint;
public GameObject bulletPrefab;

public float bulletForce;

public Rigidbody2D rbp;
public Joystick AttackJoystick;

bool isShooting;
public Animator pistolShoot;

void Start()
    isShooting = true;

void Update()
    if (Mathf.Abs(AttackJoystick.Horizontal) > 0.1f || Mathf.Abs(AttackJoystick.Vertical) > 0.1f)
        float x = AttackJoystick.Horizontal;
        float y = AttackJoystick.Vertical;
        float z = Mathf.Atan2(y, x) * Mathf.Rad2Deg;
        rbp.transform.eulerAngles = new Vector3(0, 0, z);                


void FixedUpdate()
    if (Mathf.Abs(AttackJoystick.Horizontal) > 0.7f || Mathf.Abs(AttackJoystick.Vertical) > 0.7f)
        pistolShoot.SetBool("pistolShooting", true);
        if (isShooting)
            isShooting = false;
        pistolShoot.SetBool("pistolShooting", false);

IEnumerator Shoot()
    GameObject bullet = Instantiate(bulletPrefab, firepoint.position, firepoint.rotation);
    Rigidbody2D rbb = bullet.GetComponent<Rigidbody2D>();
    rbb.AddForce(firepoint.up * bulletForce, ForceMode2D.Impulse);

    yield return new WaitForSeconds(0.3f);

    isShooting = true;


javascript – Unobtrusive client validation only firing on first property in collection

I’m wrote a custom ValidationAttribute that also implements IClientValidatable so that I can perform client-side validation using the Jquery.Unobtrusive library.

The issue I have is that even though I have multiple items in the EditLeadViewMode.AssociatedUsers collection, the GetClientValidationRules method only fires once, for the first item in the collectio and only the first item on the form is validated on the client. I can’t figure out why it won’t fire/validate for all of the items in my collection.

Sample HTML from the form. You can see that the data-val-requiredassignedto attribute is not set on the second box

<select id="AssociatedUsers(1).UserId" name="AssociatedUsers(1).UserId" class="form-control valid" data-val-requiredassignedto="ErrorMessage" aria-describedby="AssociatedUsers(1).UserId-error" aria-invalid="false"><option value="">-- Assign To --</option>
<option selected="selected" value="2">A.Carlie Predovic</option>
<option value="4">A.Earline Pfeffer</option>
<option value="10">F.Dorris Dare</option>
<option value="7">I.Alexandrea Hane</option>
<option value="8">I.Alexandrea Rogahn</option>
<option value="6">I.Heber Greenfelder</option>
<option value="9">I.Maeve Koepp</option>

<select id="AssociatedUsers(2).UserId" name="AssociatedUsers(2).UserId" class="form-control" ><option value="">-- Assign To --</option>
<option value="2">A.Carlie Predovic</option>
<option value="4">A.Earline Pfeffer</option>
<option value="5">A.Jarrod Breitenberg</option>
<option selected="selected" value="3">A.Sheridan Maggio</option>
<option value="10">F.Dorris Dare</option>

ViewModel bound to the view

public sealed class EditLeadViewModel : IHelperSetup
        public EditLeadViewModel()

        public IEnumerable<UserInLeadRole> AssociatedUsers { get; set; }

public class UserInLeadRole
        public int? UserId { get; set; }

Custom Attribute

 public class AssignToUserValidationAttribute : ValidationAttribute, IClientValidatable
        protected override ValidationResult IsValid(object value, ValidationContext validationContext)
            //Server side validation here
        public IEnumerable<ModelClientValidationRule> GetClientValidationRules(ModelMetadata metadata, ControllerContext context)
            return new List<ModelClientValidationRule>
                new ModelClientValidationRule{
                    ValidationType = "requiredassignedto",
                    ErrorMessage = "This field is required"


Javascript for wiring up my custom unobtrusive adapter

 function addRule(name, params, ruleFn)
        $.validator.addMethod(name, ruleFn);
        $.validator.unobtrusive.adapters.add(name, params,
            function (options)
                options.rules(name) = options.params;
                options.messages(name) = options.message;
        function (value, el, params) {
            ///Client side validation logic here


I can’t find any documentation saying that a custom validator will only fire once on a collection, but I’m obviously missing something.

9 – Drupal commerce 2 custom state event subscriber not firing

I added a new order state called ‘refunded’. I’m trying to have an event get triggered when the order state transitions to ‘refund’, but I can’t get the event to fire.


  id: order_default
  group: commerce_order
  label: 'Default'
      label: Draft
      label: Completed
      label: Canceled
      label: Refunded
      label: 'Place order'
      from: (draft)
      to: completed
      label: 'Cancel order'
      from: (draft)
      to:   canceled
      label: 'Refund order'
      from: (completed)
      to: refunded


This is my module services yml file:

    class: 'Drupalmy_moduleEventSubscriberOrderRefundSubscriber'
      - { name: 'event_subscriber' }

And finally the event subscriber class in my_module/src/EventSubscriber/OrderRefundSubscriber.php


namespace Drupalmy_moduleEventSubscriber;

use SymfonyComponentEventDispatcherEventSubscriberInterface;
use Drupalstate_machineEventWorkflowTransitionEvent;
use DrupalCoreEntityEntityTypeManager;

class OrderRefundSubscriber implements EventSubscriberInterface {
   * DrupalCoreEntityEntityTypeManager definition.
   * @var DrupalCoreEntityEntityTypeManager
  protected $entityTypeManager;

   * Constructor.
  public function __construct(EntityTypeManager $entity_type_manager) {
    $this->entityTypeManager = $entity_type_manager;

   * {@inheritdoc}
  static function getSubscribedEvents() {
    $events('commerce_order.refund.post_transition') = ('orderRefundHandler');
    return $events;

   * This method is called whenever the commerce_order.refund.post_transition event is
   * dispatched.
   * @param WorkflowTransitionEvent $event
  public function orderRefundHandler(WorkflowTransitionEvent $event) {
    // Do something here ...

This is the part of the code that is supposed to trigger the event:

    $order_state = $order->getState();
    $order_state_transitions = $order_state->getTransitions();
    if (isset($order_state_transitions('refund'))) {

Any ideas why my event subscriber code is not firing?

References: https://git.drupalcode.org/project/state_machine/blob/8.x-1.x/README.md

development – SharePoint 2019 remote event receiver is not firing when receiver service is https enabled

From c# application using CSOM, I have registered events on a particular document repository. Also hosted a RemoteEventService a WCF service which implements IRemoteEventService and implemented ProcessOneWayEvent() as per our business logic.

Above application is working if that RemoteEventService is http enabled, and it is not working if I enabled https.

I have installed self signed certificate correctly, but handshake is not working if I have added any item or delete any item, event is not fired.

Any help is greatly appreciated.