LINQPad4 dump without showing number of results - linqpad

How do I get .Dump() to work without showing the number of results as the first row?
I've switched a manual report to run via lprun and email to a client. However, I was removing that row manually when I saved the excel file before.
I need to keep the html formatting, so I don't want to do csv. I also use .Dump() in the report (one call at the end), I'm not writing with the html, csv, or xml writers manually.

Looking at the source of the html generated, the header that contains the number of items is located in td.typeheader. I guess you can inject a simple css style into the html generated to hide it :
td.typeheader { display: none; }
The injection can be a simple replace :
File.WriteAllText(pathToReport, File.ReadAllText(pathToReport)
.Replace("</head>", "<style type=\"text/css\">td.typeheader { display: none; }</script></head>"));

Related

Materialize select element will not show passed options (empty ul)

My question is probably really easy. I want to populate a Materialize select element with a few options. I don't want to put my options in the HTML, I want to do it from a JSON with javascript (I get the json from a different service). In my HTML file, I just have an empty select.
In the documentation, I see that during the select initalization, you can pass an options object. I assume this can be used to populate the select dropdown. A bit lower it is stated that the correct key is dropdownOptions, and you are supposed to pass an UL to it. I did so, but the UL is empty. Console log shows that the ul is built correctly. What am I missing?
let ul = document.createElement("ul");
arr.forEach(oddelek => {
let li = document.createElement("li");
li.appendChild(document.createTextNode("Four"));
ul.appendChild(li);
});
console.log(ul); // looks good
M.FormSelect.init(selects, {
"dropdownOptions": ul
});
What could be the reason that only an empty ul appears?
Because the above code didn't work, I decided to just add the elements to the HTML with javascript, and then run the init with an empty options object. But it doesn't work, the dropdown is still empty.
The init with empty options object works perfectly if the items are added manually in the html, but does not work if they are added through javascript. I have no idea why, I call the init after I add the elements. Inspecting the resulting html without the init looks just like in the documentation. Any advice?

How to extract random IDs values for elements with jmeter in a jsf web app

The application is made with JSF. I recorded the script with JMeter proxy, it works well, but the number in the id for some fields change after a day, so I need to find a way to extract and pass the correct one.
I don't know well how to use Regex, so I will really appreciate any help.
Thank you.
Parameters and values that I need to generate random Image
This is the div in the HTML with the id I need to generate random Div
<div id="solicitudSteps:j_idt75" class="ui-wizard ui-widget" style="width: 100%;">
EDIT
This is the Css Selector I'm using
This is what returns when I test with the Css Selector Tester
It looks like these dynamic values are coming from the previous response as hidden inputs so it is the matter of correlation, you can extract these dynamic input names along with the values using i.e. CSS Selector Extractor as
Add CSS Selector Extractor as a child of the previous request and configure it to extract hiddens input names
Add one more CSS Selector Extractor to get hidden inputs values:
Add JSR223 PreProcessor as a child of the request where you need to provide dynamic inputs and put the following code into "Script" area:
1.upto(vars.get('hiddenInputName_matchNr') as int, { index ->
sampler.addArgument(vars.get('hiddenInputName_' + index), vars.get('hiddenInputValue_' + index))
})
So the overall test plan structure would look like:
That's it, JMeter should extract all the dynamic inputs from the previous response and add them to the current request automatically.

Read Excel File in GUI and write back to a File

Short Summary:
Open Excel file in GUI with one row and it's records, analyze it and
write back to a file.
I am working on a project that has lots of records in Excel file. The data has web URL that I have to analyze and write appropriate comments about it.
Copying and pasting can be hectic as there are hundreds and hundreds of records.
So, I am thinking to automate the process.
What I'd like to do is have a GUI that would populate one record at a time in the GUI. Open the URL in IE. It will have some extra fields (drop down, input box) in addition to its original columns so I can record the analysis data.
Based on the drop down option, it will create a document (or append if it already exists) that record. Once clicked save, it will populate the next record.
What would be a best way to go? I thought of using Visual Basic because of its GUI, but everyone knows about VB and why I should avoid it.
I'm also thinking about web app, so it will not be OS dependent, but I am not sure how Excel files work with PHP, other web scripting languages.
Any input would be greatly appreciated. If you know any tutorial that can give some insight, will also help.
I would do this with some javascript on an html page. Here's an outline of a general strategy with a few examples, none have been tested. There's probably better ways to do some of this stuff.
Step 1 - Convert spreadsheet to CSV
File->Save As->Save as Type->CSV
Step 2 - An HTML page to act as a viewer for the URLs
Example:
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>
<script src="myAutomationScript.js"></script>
</head>
<body>
<table id="csvRecord">
<tr id="header"></tr>
<tr id="data"></tr>
</table>
<input id="nextRecord" type=submit />
<iframe id="viewer"></iframe>
</body>
</html>
Step 3 - Parse CSV
There's a jQuery plugin from this answer that will parse the CSV for you. You can read in the file (described here), or if this is a one-off thing you could just copy and paste the csv data into a string variable in your javascript file.
var csv = "",//populate this from file, or paste in data or whatever
records = $.csv.toObjects(csv),
keys = Object.keys(records[0]),
currentRecord = 0;
Step 4 - Display record in form
function displayHeaders (keys) {
//create a header cell for each key
//add a header (or headers) for your additional fields
}
function displayRecord (record) {
//populate a td cell for each piece of data
//add input element(s) for your additional review fields
//set the source of the iframe to the url
$('#viewer').setAttr('src',record.url);
}
Step 5 - Save the record and move on to the next
//this would be a handler for the click event of nextRecord
function moveOn() {
//read in data from the csvRecord table
//add the record to another collection, or read in the output file and add a line
//save the collection, or string or whatever to a local file using the html5 local file api
//++ currentRecord, and display that
currentRecord = currentRecord + 1;
displayRecord(records[currentRecord]);
}

Complicated colour scheme definition in LESS / Joomla T3

I'm building a site in Joomla 3 on T3 framework.
I'm having to use LESS for the first time, but am experienced with CSS.
The site will have differently themed landing pages. These will all be identical except for the colour scheme.
I am attempting to set up a colour scheme in the T3 'variables' less file and then implement the colours - the colour will be different for many core components - such as H1, P, DIV Background Color, etc.
So if I set up, say, a master colour for Thailand's page, I create this rule in the variables.less file:
#thai: #e55092;
and then my knowledge of exactly how LESS compiles to CSS falls flat and I lose my entire train of thought.
Because I now want to be able to set up a landing page for Thailand in the T3 template. I need to be able to use the class 'thai' in various places in this page - for instance, the H1 text should be coloured #e55092, an aside background should be #e55092, an HR should be #e55092 ... for THIS page only.
I hope this isn't a too open question but what would be best practice for achieving this, keeping my code clean and fast? My current line of thought is that I create a whole bunch of rules in LESS along the lines of:
thai.h1 { color: #thai }
thai.button [ background-color: #thai }
(excuse syntax - very new to LESS and not sure what's possible or correct)
But isn't that defeating the whole purpose of using LESS in the first place?
I think your question is very broad indeed. Depending on your situation:
One CSS file for all pages. You can consider changing selector order The code for a button can then look like that shown beneath:
.button {
border: 1px solid white;
.thai & { background-color: red;}
.japanese & { background-color: yellow;}
}
In your HTML pages: <body class="thai"> and so on..
Compile different CSS files for each landing page
In Less you can override a variable by putting the definition afterwards
You should first define a main file, for the button example this button.less file should contain something like that shown below:
#button-background-color: orange;
button { background-color: #button-background-color; }
Now you can define you thai theme file (thai.less) as follows:
#import "button.less";
#button-background-color: red;
Or alternatively compile different CSS files using the modify-var option:
lessc button.less --modify-var="button-background-color=red" thai.css

Tags getting appended to dojo editor content

I have a dojo editor on a jsp page. The dojo editor is one of the required fields and i have a validation in place for it. There is a scenario in which some tags are getting appended. I cannot find a particular pattern when it gets appended but most of the times it occurs after one selects and copies all the content and pastes on the editor. So the editor content in this case was
<div id="dijitEditorBody">content which user entered</div>
Issue: When the user deletes all content which was entered the tags are still there and get submitted. In this case atleast visually editor has no content but the field holds the following value:
<div id="dijitEditorBody"></div>
or
<div id="dijitEditorBody"><br /></div>
So it skips validation and displays an empty editor when data is retrieved from DB?
I am confused about why these tags are getting appended?
In RichText.js, this snippet :
if(dojo.isIE || dojo.isWebKit || (!this.height && !dojo.isMoz)){
// In auto-expand mode, need a wrapper div for AlwaysShowToolbar plugin to correctly
// expand/contract the editor as the content changes.
html = "<div id='dijitEditorBody'></div>";
setBodyId = false;
}else if(dojo.isMoz){
// workaround bug where can't select then delete text (until user types something
// into the editor)... and/or issue where typing doesn't erase selected text
this._cursorToStart = true;
html = " ";
}
Explains the reason why that tag is added...
Although you see it in your alertbox, I believe it's not present in the posted contents... right ?
The editor should take care of removing the extra-tags => not tested but pretty sure...