How to calculate values in Zapier - zapier

Hello Trying to calculate values in Zapier and would like some help please. Sorry I'm not a developer.
Image 1:
Image 2:

David here, from the Zapier Platform team.
The code you posted looks a lot like Python code. The error is that "float is not defined", which is true in Javascript. I'd copy your code, change the step from Javascript -> Python, paste it, and see if that works.
Also, though it may work as written, you should change input to input_data. The former is deprecated.

Related

changing a global variabile inside a fucntion in Python code step by Zapier

I have this simple python code:
x = 10
def myfunc():
global x
x=15
myfunc()
output = [{'id': x, 'hello': ""}]
The output is 10 instead of 15. Any idea on how can I change a global variable inside a function when using a python Code step by Zapier
No, you can't do that.
This issue also took me a lot of time to debug my codes that run well locally but fail in Zapier. I guess Zapier actually wrap our codes in some way - maybe put our codes inside a big function and Zapier calls this function to run our codes. So those global variables are no longer really global in this environment.
I tried a few ways and all of them didn’t work.
I got a conclusion that “We can NOT modify a global variable in our Zapier codes. We can only read a “global” variable – which is not really global
in Zapier's environment”.
I have found that the best way to deal with this is to use a Webhook Step to pass the info out to Google Cloud Functions (or an AWS/Azure equivalent). This will let you run whatever you like + import Python libraries that Zapier will not let you use.
Cloud Functions is pretty simple, I was able to figure it out as a marketing dude with no coding background beyond the Zapier code steps.
This way you can just pass the result back to Zapier. I also find it makes debugging easier as the Zapier interface can be a bit cumbersome when you are repeatidly retesting something.

Getting "chunk write below min size" when trying to write to Google Cloud using gcsfs

I have a script which uses gcsfs to write data to Google Cloud. Most of the time it works, but fairly regularly I get the following error:
ValueError: Non-final chunk write below min size.
This error seems to come from GCSFile._upload_chunk.
I can't really find anything in the docs that explains what might be going wrong here. I read this thread which suggests it might be related to how the data is committed (should I disable autocommit?) but I'm not sure it's entirely relevant. I read through the source of that function but that didn't help too much either. Would appreciate any guidance!
My code looks like this:
with gcs.open(file_path, mode='w') as f:
f.write('\n'.join(output_data))
output_data here is a list of strings. gcs is an instance of gcsfs.GCSFileSystem.
This issue apparently no longer happens in v0.7.0. Anyone facing it should upgrade.

Line control statement in swift

i am reading swift from apple docs and learning about statements. but couldnot find any information about the Line Control Statements.
According to the docs
A line control statement is used to specify a line number and filename
that can be different from the line number and filename of the source
code being compiled. Use a line control statement to change the source
code location used by Swift for diagnostic and debugging purposes.
A line control statement has the following forms:
#sourceLocation(file: filename, line: line number)
#sourceLocation()
My question is when should i use it? The docs lags an example about the topic.Any links or some hints would be helpful.
This isn't the sort of thing you'd ever need as a beginner, and you could probably go through an entire career without using it. It seems to be meant for use in tools that generate source code. See the comments in the original feature proposal for the complete story.
TL/DR: Don't worry about it, you'll never need it.

How do I add a wireshark column that will display the value of an HTTP Request Query Parameter?

For example :
If I had http://somepage.com/somefolder/someresouce?p1=value&p2=value&p3=value
I would like to see a column that would display the value of p2 if it existed in the request.
I googled, asked people around but can't find a good answer.
If think creating a dissector might help, but I don't want to write a new dissector for http.. that's an overkill.
And there is no http.request.queryParams["p2"] syntax for use of Custom Column type.
Thanks in advance!
Edit : I solved my own Question, adding the best implementation so far in my own answer below.
Well, the solution was indeed in dissectors.
Wireshark help is not very good, the examples are ok though.
The main problem was that wireshark help defines that you can write your lua script, and place it in the plugins directory, which is searched recursively for lua files.
I did place my lua there and nothing worked, After almost 2 hours of fiddling, I found out instead of putting it in the plugins directory, it had to be in plugins//myScript.lua in order to work...
Now just to share my work :
To answer my own question :
http://pastebin.com/eANEut92

ZF2 BBCode Parser

Hiho,
I use the ckeditor on my website for special textareas like forum
or signatures.
But I have a problem with the output. I use ZF2 and would like to
use ZendMarkup to render the output bbcode back in html.
But at every time I call
$bbcode->render(...)
I got the error
There is no Zend_Markup_Root markup.
The ZendMarkup is an extension inspired by the Zend_Markup from ZF1.
But I can't find any thing on API or other guides.
Does someone has any idea what as the problem is?
The ZendMarkup library is very old (last update is 10 months ago!) so I wouldn't use such library. If you would like, I think I traced the error down.
On this line there is a reference to Zend_Markup_Root while that should be ZendMarkup\Renderer\Markup\Html\Root. Try to change that line and see what happens.
Another way is to replace the ZendMarkup library with another library which does work and is updated regularly. An example is Decoda. If you load mjohnson/decoda in your composer.json, you can use Decoda in your Zend Framework 2 application:
<?php
use Decoda\Decoda;
$parser = new Decoda($bbcode);
$html = $parser->parse();
With tools like composer, there is no need to use solely Zend* components when there are better alternatives.

Resources