How do I calculate limit of Substitutions per personalization block in SendGrid? - sendgrid

I'm trying to send an email with SendGrid using a transaction template, and see a problem with substitution limited.
Substitutions are limited to 10000 bytes per personalization block.
SendGrid Docs
I will resolved this problem by get the template from SendGrid and replace all placeholders inside it. But I need to check when I can do it, I think will check limited of substitutions and I don't know How SendGrid calculate it? maybe length of all string in substitutions?
Any help?
Thanks!

I resolved my problem and share the solution for the people who care ;)
Solution:
You need to optimize Substitutions by using it together with Sections
/**
* When you have the $variables too big, SendGrid will reject the message because
* SendGrid's Substitution is limited(10000 bytes)
*
* Before that, the format of substitution as below:
*
* {
* "to": [
* "example#example.com"
* ],
* "sub": {
* "%FirstName%": "This string maybe too long",
* "%LastName%": "This string maybe too long",
* ....
* ....
* more and limited
* }
* }
*
* To resolved this problem we will use the Section with Substitution as below:
*
* {
* "to": [
* "example#example.com"
* ],
* "sub": {
* "%FirstName%": "%FirstName%",
* "%LastName%": "%LastName%",
* ....
* ....
* more and more
* },
* "section": {
* "%FirstName%": "This string maybe too long",
* "%LastName%": "This string maybe too long",
* ....
* ....
* }
* }
*
* We will optimize the strings in Substitutions and let Section in SendGrid to contain that strings.
*/

As per sendgrid documentation they are going to remove support for Section. As they says Substitution is alternative for Section. Do you have any other alternative for large content (> 10000 bytes).

Related

Use #remark inside #retval section

Is it possible to use the #remark Special Command inside a #retval block without leaving the #retval paragraph?
Example:
...
* #retval res #li Some text
* #li Some text
* #remark Try often if res = false
* <!-----------------------------------------------------------------------------> */

How do you make an equation in swift with multiple variables? [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 1 year ago.
Improve this question
I am trying to make something and I am trying to use an equation in Swift. This is the equation:
((((((((((calculation.d/100)/2) * Int(0.98) * (sqrt(calculation.vbottle * 1005.967 * (calculation.psi + (calculation.psi * (calculation.vbottle - (calculation.vol/1000))/2)/2) * ((((calculation.d/100)/2) * Int(0.98) * (sqrt(calculation.vbottle * 1005.967 * (calculation.psi + (calculation.psi * (calculation.vbottle - (calculation.vol/1000))/2)/2) /1005.967 * (3.14159 * ((d / 100)/2) * ((d / 100)/2)))) - (((calculation.mempty/1000) + ((calculation.vol * 0.972)/1000))/2) * calculation.g) / (((calculation.mempty/1000) + ((calculation.vol * 0.972)/1000))/2)) * ((1005.967 * (calculation.vol / 1000000) / (((calculation.d/100)/2) * Int(0.98) * (sqrt(calculation.vbottle * 1005.967 * (calculation.psi + (calculation.psi * (calculation.vbottle - (calculation.vol/1000))/2)/2) * 6894.76))))) * 2) sin 2(calculation.theta) / calculation.g) * (1 - calculation.dc))
This might seem complicated but if you understand it, it isn't (for a computer). All the variables have been defined and the error message says:
Missing argument for parameter 'verbatim' in call and another error that says: Unterminated string literal
I am unsure why and whenever I google it up, an actual result never comes up and when one does, it's always about Playgrounds, not the actual Swift that is used to make apps and stuff.
EDIT:
Here is the reproducible example:
'''
//
// ContentView.swift
// MRE File
//
// Created by Go Peter on 2021/06/18.
//
import SwiftUI
struct Calculation {
var vbottle:Int = 2
var g:Int = Int(9.807)
var vol:Int = 250
var d:Int = 2
var theta:Int = 90
var psi:Int = 40
var mempty:Int = 70
}
struct ContentView: View {
var body: some View {
Text("\(((((((((((calculation.d/100)/2) * Int(0.98) * (sqrt(calculation.vbottle * 1005.967 * (calculation.psi + (calculation.psi * (calculation.vbottle - (calculation.vol/1000))/2)/2) * ((((calculation.d/100)/2) * Int(0.98) * (sqrt(calculation.vbottle * 1005.967 * (calculation.psi + (calculation.psi * (calculation.vbottle - (calculation.vol/1000))/2)/2) /1005.967 * (3.14159 * ((d / 100)/2) * ((d / 100)/2)))) - (((calculation.mempty/1000) + ((calculation.vol * 0.972)/1000))/2) * calculation.g) / (((calculation.mempty/1000) + ((calculation.vol * 0.972)/1000))/2)) * ((1005.967 * (calculation.vol / 1000000) / (((calculation.d/100)/2) * Int(0.98) * (sqrt(calculation.vbottle * 1005.967 * (calculation.psi + (calculation.psi * (calculation.vbottle - (calculation.vol/1000))/2)/2) * 6894.76))))) * 2) sin 2(calculation.theta) / calculation.g) * (1 - calculation.dc)))m")
}
}
struct ContentView_Previews: PreviewProvider {
static var previews: some View {
ContentView()
}
}
'''
There are a few errors I see:
You need a space in /1005.967 after the / operator -- there are likely other spots like this as well.
Near the end of the expression, you have a floating sin that doesn't have an operator before it and isn't followed with parenthesis at all
There are many spots where you refer to just d, but probably mean calculation.d
You have a mismatched number of open and closed parenthesis.
You don't actually have a Calculation property defined on your view, so there's nothing to do the calculations on yet.
Because I don't know the intent of some of this stuff, I can't actually fix it for you. But, I'd recommend trying to clean up the code a little -- at the least, it'll make it easier to debug.
To start, move this out of the interpolated String and into a computed property:
var calc : Int { //Int? -- see comment about this
//your calculation here
}
var body: some View {
Text("\(calc)m")
}
Then, I'd break the calculation up into much smaller expressions that are more readable and would let you find your errors more easily than trying to sift through so many parenthesis, etc. Even a computer can theoretically handle a long, tough-to-read expression, it makes it a challenging debugging issue for us humans.
I'd also be really surprised if you truly want Int for these properties. You have a bunch of spots where you're doing things like Int(0.98), which doesn't make sense, because it'll get rounded to 1. Perhaps you instead want to use Double or Float for everything? You'll see as you start breaking the instructions up and the compiler starts to find more errors once it can parse everything correctly that you're going to end up with type mismatches between things like Int and Double in the existing expressions.

How do I manually add the changes of a rejected patch?

I have a bunch of rejected patches; I want to make sure I am reading them correctly. Here is the .rej file:
--- frameworks/base/telephony/java/com/android/internal/telephony/ITelephony.aidl
+++ frameworks/base/telephony/java/com/android/internal/telephony/ITelephony.aidl
## -304,5 +304,40 ##
* Sets minimum time in milli-seconds between onCellInfoChanged
*/
void setCellInfoListRate(int rateInMillis);
+
+ /**
+ * Returns the response APDU for a command APDU sent to a logical channel
+ */
+ String transmitIccLogicalChannel(int cla, int command, int channel,
+ int p1, int p2, int p3, String data);
+
+ /**
+ * Returns the response APDU for a command APDU sent to the basic channel
+ */
+ String transmitIccBasicChannel(int cla, int command,
+ int p1, int p2, int p3, String data);
+
+ /**
+ * Returns the channel id of the logical channel,
+ * Returns 0 on error.
+ */
+ int openIccLogicalChannel(String AID);
+
+ /**
+ * Return true if logical channel was closed successfully
+ */
+ boolean closeIccLogicalChannel(int channel);
+
+ /**
+ * Returns the error code of the last error occured.
+ * Currently only used for openIccLogicalChannel
+ */
+ int getLastError();
+
+ /**
+ * Returns the response APDU for a command APDU sent through SIM_IO
+ */
+ byte[] transmitIccSimIO(int fileID, int command,
+ int p1, int p2, int p3, String filePath);
}
Seems the patch utility creates an original file also. From looking at the original file I see that there is only one method implemented for the interface setCellInfoListRate, and that makes sense with what I understand about patch, diff, and what the .rej file is telling me. Seems I just have to add the lines with + sign next to them under the setCellInfoListRate interface. Would you agree? Am I missing something?
Regarding your question: Yes, the + lines are lines added by the patch. Removed lines would have a - in front.
Regarding the general problem, depending on how many patches you have, and depending on the amount of errors you get, one of the following could work for you:
If you have any chance to get the version on which a patch is based upon (e.g. from your CVS), apply the patch to this version. Then try your luck by comparing against the current version you have and incorporate the changes.
If it is only a few files out of a set of significantly more files to be patched (e.g. 1 out of 10) make a copy of the patch file, remove the changes that cause errors and apply the rest. Then try to apply the changes removed from the patch file in another way. This will work for few rejections, but becomes a PITA with large or lots of rejected patch sections.
Have the patch creator rebasing the patch (assumed it is someone else).

Multiple 'nth' weekday of month in a single quartz cron expression

I'm trying to write a cron expression for quartz that runs hourly everyday except every second Saturday of the month.
So, by using the '#' notation, I was trying to write the expression like:
0 0 * ? * SUN-FRI,SAT#1,SAT#3,SAT#4,SAT#5
This expression is not working properly. Also, quartz is not complaining about the cron format (quartz usually complains about cron expressions when they are wrong).
So I did some other experiments today. So, today is the third Thursday of the month, I was playing around with THU#N notation, and that's what I've found so far (I changed my expression to minute to make it easier for experimenting):
0 * * ? * SUN-FRI,SAT#1,SAT#3,SAT#4,SAT#5: not triggered
0 * * ? * THU#3: triggered
0 * * ? * THU#3,THU#4: not triggered
0 * * ? * THU#2,THU#3: triggered
I know I can simply split this into 4 additional expression but in my real scenario I have tons of expressions to change and this would increase my expression list to something 5 times longer.
In a brief: Does anyone knows how to condense these:
0 0 * ? * SUN-FRI / 0 0 * ? * SAT#1 / 0 0 * ? * SAT#3 / 0 0 * ? * SAT#4 / 0 0 * ? * SAT#5
...into a single cron expression?
Note: I'm using quartz scheduler 1.5 (I know, I know... pretty outdated)

Need help in usage of Login volume with iscsi

Need a command line argument to login the volume with persistent login i tried with follwing command. but not working.
iscsicli persistentlogintarget iqn.2003-10.com.lefthandnetworks:mg-test:51:volume " T * * * * * * * * * * * * * * * 0"
Please help
Regards
NewDev
cmd>iscsicli persistentlogintarget
TargetName T * * * * * * * * * * * * * * * 0
The output was:
Microsoft iSCSI Initiator Version 6.0 Build 6000
The operation completed successfully.
To confirm that the operation was successful, I entered:
cmd>iscsicli listpersistenttargets
Id it doesnt list the targets then there is some problem.Try qlogintarget to check if it is succesfull.