Rivets unless statement not rendering correctly - rivets.js

I'm new to working with rivets and trying to write and unless statement to keep the text from rendering if two values are the same. I'm rendering out the two values to show that they're the same, but the statement doesn't seem to be evaluating correctly.
I tried writing it as an if statement and that didn't work either

Related

Using cy.get() in Cypress to search for selectors with one of two properties

I'm using Cypress to write automated tests. This is for a codebase I have no control over, so I can't make any changes to the app itself.
I'm attempting to run a .each loop to run through a set of collapsible fields to verify the data in each of them is correct. The fields list medical problems and associated data. The issue is that there are two lists of fields, one for active problems, and one for resolved problems, where the only difference between them is the data-cy tags. Those are the only unique identifiers for these elements, so I have to use the data-cy tags to select these without selecting other elements in the same container.
I'd be able to run the exact same .each function on both sets of elements, but I currently can't due to the elements not having the same data-cy tags. Is it possible for me to to have the Cypress .get call search for elements with one of two properties? Something like the following:
cy.get('[data-cy="problem-entry"]' OR '[data-cy="resolved-problem"]')
EDIT: Also, to clarify - I am currently able to get the test to behave by just duplicating the .each loop, once for each data-cy tag. Since the loop is several hundred lines of code, I want to remove the redundancy to clean this up a bit.
This answer is not perfect fix, but may work in your case: if these selectors are the only data-cy with the word "problem" in their value, you could do something like this:cy.get('[data-cy*="problem"]'). This will choose any data-cy which contains word "problem".
If that is not the case, I would like to address your "EDIT" message: you may put the whole code (several hundred lines) in a Cypress custom command and then call it, so instead of copying the code and calling it twice, you would just call your custom command twice (one line each).

Don't Render a table unless certain condition is true

I am running into grouping errors on my dataset and am looking to run a script on the beforeFactory such that if a certain value is null, it doesn't render the table+grouping at all.
I've found a related posted here, but don't think it fully addresses my use-case. Will preventing the table from rendering still produce the errors?
Dropping a table in beforeFactory script prevents any related datasets from being executed, therefore it prevents errors due to these datasets. Except of course if these datasets are also bound to further report elements.
The link you mentionned should address your use case. Though you don't mention how this "certain value" compared with null is computed: if it is computed from a report parameter or a context variable it is fine, otherwise it is probably wrong because "beforeFactory" is triggered before all datasets (therefore this script cannot use a value returned by a dataset...).
I hope it helps.

Excel for Mac - Cells containing user-defined functions won't update

I'm working on some VBA code that writes formulas containing user-defined functions (UDFs) into certain cells of my workbook, e.g.: H1004 = maxdd(H1:H1001).
When I run the code in Excel 2010 (for Windows) everything works as expected:
1) the formulas are written into the cells
2) each cell returns the correct result.
When I run the same code in Excel 2011 for Mac the formulas will also be written into the cells. However, the cells won't return any valid results - instead they display #value errors.
Note: I can't troubleshoot this issue because when I select one of these cells, put the cursor in the formula field, and press return (presumably forcing the cell to evaluate), the correct answer appears.
My question:
What needs to be done to keep Excel for Mac from returning #value errors instead of the plain results?
I finally figured out what caused this problem, although I have no idea why it caused the problem:
In order to make the vba code run faster, I had turned off automatic calculation at the beginning of the code and turned it back on at the end of the code, just like this -->
Application.Calculation = xlCalculationManual
'main part of vba code
Application.Calculation = xlCalculationAutomatic
For some reason, this kept the cells containing user-defined functions from being updated.
Without these two lines of code everything works fine now.

Modifying parameters with code in Microsoft Reporting Services

I made a report with about 30 different rectangles and textboxes that have different visibility expressions depending on the parameters. (It's a student invoice and many different messages have to appear depending on the semester) When I made all the expressions I coded in the parameters in all upper case. Now I have a problem when users enter lowercase letters, the SQL all works fine since it is not case sensitive, but the different rectangles and textboxes don't show. Is there a way in the report code to first capitalize all the parameters before running the SQL? Or do I actually have to go back to every visibility expression and add separate iif's for upper and lower case? (That seems incredibly silly to have to do). I can't change my parameters to numbers because I have been given strict requirements for input. Thanks.
I do not know if this is the most elegant solution, but you could accomplish this by following this procedure for every parameter on the Report Parameters page:
1)Re-name the parameter, leaving its prompt as that of the old parameter.
2)Add a new parameter with the same name as the old parameter.
3)Mark this new parameter as Hidden.
4)Make sure that the new parameter's available values are marked as non-queried(available values will never be actually used.)
5)Mark the Default Values as Non-queried, using the following syntax:
=ucase(Parameters!OldParameterName.Value)
Can't you just UCASE the params (do it in the xml view, it will be quicker and you might even be able to do a regex find/replace)

How to prevent injections in ASP/VBScript?

What are the best ways (or at least most common ways) in ASP (VBScript) for input handling? My main concerns are HTML/JavaScript injections & SQL injections. Is there some equivalent to PHP's htmlspecialchars or addslashes, et cetera? Or do I have to do it manually with something like string replace functions?
The bottom line is this:
Always HTML-encode user input before you write it to your page. Server.HTMLEncode() does that for you.
Always use parameterized queries to interface with a database. The ÀDODB.Command and ADODB.CommandParameter objects are the right choice here.
Always use the URLScan utility and IIS lockdown on the IIS server that renders the page, unless they are version 6 and up, which do not require these tools anymore.
If you stick to points 1 and 2 slavishly, I can't think of much that can go wrong.
Most vulnerabilities come from not properly encoding user input or building SQL strings from it. If you for some reason come to the point where HTML-encoding user input stands in your way, you have found a design flaw in your application.
I would add to Tomalaks list one other point.
Avoid using concatenation of field values in SQL code. That is, in some cases a stored procedure may build some SQL in a string to subsequently execute. This is fine unless a textual field value is used as part of its construction.
A command parameter can protect SQL code designed to input a value from being hijacked into executing unwanted SQL but it allows such unwanted SQL to become data in the database. This is a first-level vunerability. A second-level injection vunerability exists if the field's value is then used in some SQL string concatenation inside a stored procedure.
Another consideration is that this is just minimal protection. All its doing is rendering attack attempts harmless. However in many cases it may be better to add to this a system which prevents such data entry altogther and/or alters admins to a potential injection attack.
This is where input validation becomes important. I don't know of any tools that do this for you but a few simple Regular Expressions might help. For example, "<\w+" would detect the attempt to include a HTML tag in the field.

Resources