2013 Workflow – Sending email to multiple users from People Picker in InfoPath form

I have set up a workflow that will email a person or persons in a People Picker field that allows multiple values. However, the Workflow doesn’t work and shows this error:

RequestorId: 64fb8be0-4f83-3135-0000-000000000000. Details: An unhandled exception occurred during the execution of the workflow instance. Exception details: System.InvalidCastException: The value 'd/results(0)/residentsId' cannot be read as type 'String'. at Microsoft.Activities.GetDynamicValueProperty`1.CheckedRead(String propertyName, DynamicItem value) at Microsoft.Activities.GetDynamicValueProperty`1.Execute(CodeActivityContext context) at System.Activities.CodeActivity`1.InternalExecute(ActivityInstance instance, ActivityExecutor executor, BookmarkManager bookmarkManager) at System.Activities.Runtime.ActivityExecutor.ExecuteActivityWorkItem.ExecuteBody(ActivityExecutor executor, BookmarkManager bookmarkManager, Location resultLocation) 

With some research, I saw that it was related to how the email addresses get formatted for People Picker fields that allow multiple users. I implemented the fix of changing the Return field as to Display Names, semicolon delimited and Login Names, semicolon delimited, but neither of them work still. Images below are of my workflow and list settings.

Workflow

email setup

List

People picker settings

Picture Upload Form didnt show a image upload column

I have a CreateView for Post where I have a title and content columns, I tried to add image upload column for that post and it wont works, but it wont shows an error, so I don’t know what I’m doing wrong… I migrated it and it wont show an column for upload picture. Here are my codes.

views.py

class PostListView(ListView):     model = Post      template_name = 'blog/home.html'      context_object_name = 'posts'      ordering = ['-date_posted']      paginate_by = 5  class UserPostListView(ListView):      model = Post     template_name = 'blog/user_posts.html'     context_object_name = 'posts'     paginate_by = 5      def get_queryset(self):          user = get_object_or_404(User, username=self.kwargs.get('username'))         return Post.objects.filter(author=user).order_by('-date_posted')   class PostDetailView(LoginRequiredMixin, DetailView):      model = Post    class PostCreateView(LoginRequiredMixin, CreateView):      form_class = PostUpdateForm     model = Post     fields = ['title', 'content', 'image'] 

forms.py

class PostUpdateForm(forms.ModelForm):     class Meta:         model = Post         fields = ['image']  

models.py

class Post(models.Model):     title = models.CharField(max_length=100, verbose_name='タイトル')     content = models.TextField(verbose_name='内容')     date_posted = models.DateTimeField(default=timezone.now)     author = models.ForeignKey(User, on_delete=models.CASCADE)     image = models.ImageField(default='default.jpg', upload_to='uploaded_pic')      def __str__(self):         return self.title     def get_absolute_url(self):         return reverse('Post-detail', kwargs={'pk': self.pk}) 

post_form.html

{% extends "blog/base.html" %} {% load crispy_forms_tags %} {% block content %}   <div class="content-section">     <form enctype="multipart/form-data method="POST">       {% csrf_token %}       <fieldset class="form-group">         <legend class="border-bottom mb-4">ブログ投稿</legend>         {{ form|crispy }}       </fieldset>       <div class="form-group">         <button class="btn btn-outline-info" type="submit">投稿</button>       </div>     </form>   </div> {% endblock content %}  

Picture Upload Form didnt show a image upload column

I have a CreateView for Post where I have a title and content columns, I tried to add image upload column for that post and it wont works, but it wont shows an error, so I don’t know what I’m doing wrong… I migrated it and it wont show an column for upload picture. Here are my codes.

views.py

class PostListView(ListView):     model = Post      template_name = 'blog/home.html'      context_object_name = 'posts'      ordering = ['-date_posted']      paginate_by = 5  class UserPostListView(ListView):      model = Post     template_name = 'blog/user_posts.html'     context_object_name = 'posts'     paginate_by = 5      def get_queryset(self):          user = get_object_or_404(User, username=self.kwargs.get('username'))         return Post.objects.filter(author=user).order_by('-date_posted')   class PostDetailView(LoginRequiredMixin, DetailView):      model = Post    class PostCreateView(LoginRequiredMixin, CreateView):      form_class = PostUpdateForm     model = Post     fields = ['title', 'content', 'image'] 

forms.py

class PostUpdateForm(forms.ModelForm):     class Meta:         model = Post         fields = ['image']  

models.py

class Post(models.Model):     title = models.CharField(max_length=100, verbose_name='タイトル')     content = models.TextField(verbose_name='内容')     date_posted = models.DateTimeField(default=timezone.now)     author = models.ForeignKey(User, on_delete=models.CASCADE)     image = models.ImageField(default='default.jpg', upload_to='uploaded_pic')      def __str__(self):         return self.title     def get_absolute_url(self):         return reverse('Post-detail', kwargs={'pk': self.pk}) 

post_form.html

{% extends "blog/base.html" %} {% load crispy_forms_tags %} {% block content %}   <div class="content-section">     <form enctype="multipart/form-data method="POST">       {% csrf_token %}       <fieldset class="form-group">         <legend class="border-bottom mb-4">ブログ投稿</legend>         {{ form|crispy }}       </fieldset>       <div class="form-group">         <button class="btn btn-outline-info" type="submit">投稿</button>       </div>     </form>   </div> {% endblock content %}  

How can I round a Google Form input to nearest .5?

I’m trying to write a script that will calculate based on user input from a Google Form and then send a customized email based on the input provided.

I’ve written an apps script bound to the response spreadsheet that sends the form data in an html email back to the user.

I have all my calculations working in the response spreadsheet (I used an array formula to add them across the spreadsheet following the form data, but I could not figure out how to call them into the script.) So I moved on to doing the calculations in the script, (even though I had no idea how to do that, and just kinda winged it), and it’s working and sending the email.

However, several of the calculations do not match what is in the spreadsheet, so I know my script isn’t calculating right.

Here are the two calculations I need to add to my script in the correct way.

  1. sC = sH *.9, rounded to nearest .5
  2. sSt = sC * sG, rounded to nearest multiple of 4

And after much reading of posted Q&As, here’s where I landed in my script, still lost:

 var sG= e.values[3];  var sH= e.values[6];   var sC= (Math.round(sH * .9)).toFixed(1); //sC should be .0 or .5  var sSt= (Math.round((sG*sC) /4)*4).toFixed(0) ; //sSt should be a whole number, nearest multiple of 4 

For #1, I thought it’d be possible to round at submission when the user inputs the measurement. Then it’d be a simple *.9 in the script. Hence, the title of my question. But I can’t find a way to do that that I understand how to replicate. And, that would only solve part of #2–I’d still have to deal with the multiple of 4 rounding.

For #2, the hard part is that sC is calculated, then multiplied, then rounded to a multiple. I can’t understand how to do all three of those in a script.

All the calculations below these two cascade, so if I can get these two right, everything else works.

Node form that defines fields based on another node

I have two content types (Unit and Scheme of Works). In Unit, I have a field (field_lo) that allows the user to create an unlimited number of entries.

In Scheme of Works, I need to associate other field values related to the field_lo entries from Unit. Effectively, in Scheme of Works, I need to be able to dynamically add a number of fields to match the quantity of the field_lo entries in Unit.

Is this possible? If so, how?

Thanks

Shortest way to form a string out of subsequence of a string

The task

is taken from LeetCode

From any string, we can form a subsequence of that string by deleting some number of characters (possibly no deletions).

Given two strings source and target, return the minimum number of subsequences of source such that their concatenation equals target. If the task is impossible, return -1.

Example 1:

Input: source = "abc", target = "abcbc" Output: 2 // Explanation: The target "abcbc" can be formed by "abc" and "bc", which are subsequences of source "abc". 

Example 2:

Input: source = "abc", target = "acdbc" Output: -1 // Explanation: The target string cannot be constructed from the subsequences of source string due to the character "d" in target // string. 

Example 3:

Input: source = "xyz", target = "xzyxz" Output: 3 // Explanation: The target string can be constructed as follows "xz" + "y" + "xz". 

Note:

Both the source and target strings consist of only lowercase English letters from “a”-“z”. The lengths of source and target string are between 1 and 1000.

My solution

has time and space complexity of O(n) (I think…)

/**  * @param {string} source  * @param {string} target  * @return {number}  */ var shortestWay = function(source, target) {     const map = new Map();     for (let i = 0; i < source.length; i++) {         if (map.get(source[i])) {             const arr = map.get(source[i]);             arr.push(i);             map.set(source[i], arr);                     } else {             map.set(source[i], [i]);         }     }     let occurrences = 0;     for (let i = 0; i < target.length; i++) {         const indexes = map.get(target[i]);         if (indexes === void 0) return -1;         occurrences++;         let max = 0;         indexes.forEach(index => {             let j = 0;             let ignore = 0;             while(source[index + j + ignore] !== void 0) {                 if(target[i + j] !== source[index + j + ignore]) {                     ignore++                 } else {                     max = Math.max(max, j++);                 }             }         });         i += max;     }     return occurrences; }; 

Find 4 points which form a square with the biggest area

I have set of points on the coordinate plane. I need to find the 4 points which form a square with the biggest area.

I’m new in JavaScript so I’d like to get any suggestions about code style, patterns, code idioms, etc. Thank you in advance!

"use strict";  /*  * Point  */  (function() {     function numbersEqual(a, b) {         return Math.abs(a - b) < Number.EPSILON;     }      function Point(x, y) {         this.x = x;         this.y = y;     }      Point.distance = function(a, b) {         return Math.sqrt((a.x - b.x) ** 2 + (a.y - b.y) ** 2);     }      Point.equal = function(a, b) {         return numbersEqual(a.x, b.x) && numbersEqual(a.y, b.y);     }      Point.pointsFormsQuadrangle = function(a, b, c, d) {         if (Point.equal(a, b) || Point.equal(a, c) || Point.equal(a, d))             return false;          if (Point.equal(b, c) || Point.equal(b, d))             return false;          if (Point.equal(c, d))             return false;          const center = new Point((a.x + b.x + c.x + d.x) / 4, (a.y + b.y + c.y + d.y) / 4);          const ac = Point.distance(a, center);         const bc = Point.distance(b, center);         const cc = Point.distance(c, center);         const dc = Point.distance(d, center);          return numbersEqual(ac, bc) && numbersEqual(bc, cc) && numbersEqual(cc, dc);     }      Point.pointsFormsSquare = function(a, b, c, d) {         if (!Point.pointsFormsQuadrangle(a, b, c, d))             return false;             const ab = Point.distance(a, b)         const ac = Point.distance(a, c);         const ad = Point.distance(a, d);         const triangle = [ab, ac, ad].sort((a, b) => a - b);          return numbersEqual(triangle[0], triangle[1]);     }      window.Point = Point; })();  /*  * Square  */  (function () {     function Square(a, b, c, d) {         this.a = a;         this.b = b;         this.c = c;         this.d = d;     }      Square.prototype.area = function() {         const findSquareDiagonalLength = (a, b, c, d) => {             const ab = Point.distance(a, b);             const ac = Point.distance(a, c);             const ad = Point.distance(a, d);              return Math.max(ab, ac, ad);         };          const d = findSquareDiagonalLength(this.a, this.b, this.c, this.d);         return d * d / 2;     }      window.Square = Square; })();  /*  * Solution  */  function formSquaresFromPoints(points) {     let squares = [];      for (let a = 0; a < points.length; a++)         for (let b = a + 1; b < points.length; b++)             for (let c = b + 1; c < points.length; c++)                 for (let d = c + 1; d < points.length; d++)                     if (Point.pointsFormsSquare(points[a], points[b], points[c], points[d]))                         squares.push(new Square(points[a], points[b], points[c], points[d]));      return squares; }  function sortSquaresByArea(squares) {     squares.sort((a, b) => {         if (a.area() > b.area())             return 1;         else if (a.area() < b.area())             return -1;         else             return 0;     });      return squares; }  const POINTS = [     new Point(1, 1),     new Point(1, 3),     new Point(3, 1),     new Point(3, 3),     new Point(1, 6),     new Point(6, 1),     new Point(6, 6),     new Point(1, 9),     new Point(9, 1),     new Point(9, 9),     new Point(4, 5),     new Point(4, 8),     new Point(7, 8),     new Point(7, 5),     new Point(6, 3),     new Point(5, 3),     new Point(5, 1) ];  const sortedSquares = sortSquaresByArea(formSquaresFromPoints(POINTS)); const squareWithBiggestArea = sortedSquares[sortedSquares.length - 1];  console.log(squareWithBiggestArea); // Gives: {(1, 1), (1, 9), (9, 1), (9, 9)} 

Várias imagens em um form – Consumo de memória elevado

Estou montando um formulário em tempo de execução que exibirá várias imagens (TImage).
Muitas vezes a mesma.
Carrego as imagens que são do tipo .JPG por meio do LoadFromFile().
Como já devem imaginar isso esgota toda a memória do meu computador. Além de ser quase impossível navegar na tela por meio da barra de rolagem.

Como posso melhorar a forma de carregar a imagem ou mesmo de manipular sua qualidade?

How do you input inverted form field controls?

I’m referring to the Windows OS equivalent of, e.g., Shift + Tab, etc.

At first I wanted to find out how to do so on the keyboard I use (refer to my other post), but I realized after some testing and further searching that I may be misunderstanding how the virtual keyboard inputs are even processed on Android; hoping to get a more general explanation on how form field controls are sent/handled, and proceed from there.