Using PowerShell to find discrepencies between two different CSV files? - powershell

Good afternoon, Stack Overflow!
To begin, I would like to say that I'm extremely new to the world of scripting but am eager to learn as much as I can. Currently, I am trying to learn how to create a script that would compare two different CSV files for discrepancies and then output to another Excel sheet the discrepancies.
One one sheet, there are a bunch of columns of data for which I only need a couple columns of. For example:
File 1:
Name;Bug;Status;Due Date;Nonsense;Bananas;Issue Key
File 2:
Name;Bug;Status;Cross Reference;Status;Due Date
One thing I would like to point out is that the "Issue Key" column is synonymous with "Cross Reference" in File 2. I know that I could use this to my advantage but can't seem to understand how to start. I'd like to be able to compare the data for 3 to 4 columns between the two files and see any changes/discrepancies.

Is there a reason you want to use PowerShell? So far from what you describe it seems it would make more sense to use a differencing tool. https://winmerge.org/ is one such example and there are lots of others out there. OTOH If this is something you need to do consistently on a large scale it would probably make more sense to do it programmatically.

Related

how do I duplicate a project in Anylogic

I have a very simple question. Normally in other programs, such as word, you can just simply save the document under a different resulting in two separate documents. However, this doesn't work for AnyLogic. Does anyone know how to duplicate a project?
If you do file save as it will create a new alp file for you
But for it to be a truly different model you need to change the Java Package to something unique... See how it is kept as model24 in my screenshot
But be careful it can have some unwanted consequences in a very complex model and you will need to fix these manually, but all doable

Make a Class Schedule Report

How can I make my Crystal Report look like the attached image? I have had no success creating it with a crosstab.
The short answer is that Crystal Reports isn't really equipped to handle the format you're dealing with. And here's why:
Let's assume for a moment you've already figured out how to interpret your query into something usable. Since we aren't using a Cross Table, the best you could hope for would be setting a Details section for each individual time slot and arranging a large number of formulas into a grid shape:
The problem is that every Formula would need to be unique; interpreting whether there is a Class at that Time and Date, and which Class it is. There would be up to 168 of those formulas and you'd have to manually go in and modify each one to check for their own unique combination of Date and Time. Which defeats the whole purpose of using a computer - to make repeated tasks easier.
Plus you'll have difficulty with the formatting: You'd need to program every "cell" to use a unique set of colors based on the displayed Class. That part is technically doable, but there's no way to "merge the cells" when classes last longer than a half hour. You'd end up with something like this:
So don't torture yourself trying to make this happen in Crystal. Even with all the time and effort it would take to formulate the grid, there's no good way to make it look like your screenshot.
That said, it looks as though you managed to put a schedule together in Excel. Is there any reason you can't use Excel instead? It's a much more powerful tool, and a cursory Google search suggests it can handle queries as well.

Dynamic data range references for charts

I have an OpenOffice Calc spread sheet that I'm using to track some data. I have three charts made from the data. I periodically add more data to the spreadsheet. My current way to propagate this to the chart is to alter the data ranges manually of each chart. I'd like to automate this, or at least not have to redundantly change each chart separately.
My current idea was to do something like $A$1:$A{$F$1} for the ranges where $F$1 holds the current last line. Unfortunately, OpenOffice doesn't recognize this, but I thought there might be a function or work around for it. I haven't been able to find one yet.
So, is there a way to execute my idea, or perhaps a better way to do it?
There is a very similar question to this, but the asker asked for many more features and the answer was to use something other than a spreadsheet. It was never answered whether this specific feature was possible.
Also:
First method is to extend the range of the graph way down, with lots of empty space.
Second method is to include only one extra line of data in the graph and when you add data, always insert it above that line.

Writing text information to existing CSV file with Matlab

I am appending an array of numbers to an existing excel file using this:
dlmwrite(mydatafile,newdataarray,'-append');
I need to add a column to the beginning of the new row for a text identifier (employee name), but I can't get Matlab to write the name to a single cell. Does anyone have any ideas how I'd be able to do this?
Your question is not completely clear, for example it is not completely defined how you can add a column to a row.
If the following does not work I would recommend you to provide a small scale example of the data that you have and the things you want to append.
Assuming you just need to get this done and are not looking for a pretty solution you could try to:
First read it into matlab
Then perform the operation that you like
Then write it to a new file
This will allow you to do pretty much anything but whether it is convenient depends on your specific needs.

Fastest method of checking if multiple different strings are a substring of a 2nd string

Context:
I'm creating a program which will sort and rename my media files which are named e.g. The.Office.s04e03.DIVX.WaREZKiNG.avi into an organized folder structure, which will consist of a list of folders for each TV Series, each folder will have a list of folders for the seasons, and those folders will contain the media files.
The problem:
I am unsure as to what the best method for reading a file name and determining what part of that name is the TV Show. For e.g. In "The.Office.s04e03.DIVX.WaREZKiNG.avi", The Office is the name of the series. I decided to have a list of all TV Shows and to check if each TV Show is a substring in the file name, but as far as I know this means I have to check every single series against the name for every file.
My question: How should I determine if a string contains one of many other strings?
Thanks
The Aho-Corsasick algorithm[1] efficiently solves the "does this possibly long string exactly contain any of these many short strings" problem.
However, I suspect this isn't really the problem you want to solve. It seems to me that you want something to extract the likely components from a string that is in one of possibly many different formats. I suspect that having a few different regexps for likely providers, video formats, season/episode markers, perhaps a database of show names, etc, is really what you want. Then you can independently run these different 'information extractors' on your filenames to pull out their structure.
[1] http://en.wikipedia.org/wiki/Aho%E2%80%93Corasick_string_matching_algorithm
It depends on the overall structure of the filenames in general, for instance is the series name always first? If so a tree structure work well. Is there a standard marking between words (period in your example) if so you can split the string on those and create a case-insensitive hashtable of interesting words to boost performance.
However extracting seasons and episodes becomes more difficult, a simple solution would be to implement an algorithm to handle each format you uncover, although by using hints you could create an interesting parser if you wanted too. (Likely overkill however)