Thursday, May 7, 2020

Grey Vertical Bars Lines in Outlook When You Reply

I've been struggling with this problem for years now but never took the time to figure out a easy way to deal with it. Often, we have an email thread and we want to reply all, only really to maintain the title and dist. list. We want to remove the email text, as it's just clutter/waste, or maybe we are changing the context/point of the email. We highlight all and hit delete, but instead of starting with a clean / blank email, we see one,two,three, or more vertical grey bars which CANNOT be deleted or backspaced away. The bars look like this:

 
 I noticed this was only an issue when using HTML as the format for the message. A simple fix for this is to change to Plain Text and then back again if you need HTML.

 

 That's it, the bars will disappear!! Little trick is going to save me so much frustration.

There is a way to remove original emails when replying, but I didn't want to do that, because most of the time I like to keep the entire thread. Sometimes, I want to delete it.

Friday, May 4, 2018

Thick Schematic Lines in LTSpice



To make nice thick schematic lines in LTSpiace:


1. On the "Tools" menu item, select the "Drafting Options" tab
2. Modify the "Pen Thickness" to the desired thickness






Wednesday, May 7, 2014

Implementing filters in Matlab using ellipord and filtfilt


We can create a custom function in Matlab using the built in ellipord and filtfilt functions included in the signal processing toolbox.

Here is a lowpass filter with explanation in the comments. Once we create this lowpass function, we can call this function and simply pass the function our input signal, sampling frequency, and cut-off frequency.

function [y,N,B,A]= lowpass(x,fs,fc);
% Description: This function uses an elliptical filter
% to filter out high frequencies.
%
% [y,N,B,A] = lowpass(x,fs,fc)
%
% Variable Definition:
% x: Input signal
% fs: Input signal sampling frequency in Hz
% fc: cutoff frequency
%
% y: Filtered signal (output)
% N: Filter order
% B: Feedforward (FIR) coefficients
% A: Feedback (IIR) coefficients
Rp = 0.5;   % Ripple in dB (passband)
Rs = 20;    % Attenuation
mf = fs/2;  % Maximum frequency
Wp = fc/mf; % Cuttoff frequency
Ws = 1.2 * Wp; %Stopband frequency
% First, determine the minimum filter order to meet specifics
[N,Wn] = ellipord(Ws,Wp,Rp,Rs);
% Next, Design the filter (find the coefficients)
[B,A] = ellip(N,Rp,Rs,Wn,'low');
% Now, apply the filter (filter the signal)
y = filtfilt(B,A,x);
% Plot the filter
figure('Color',[1 1 1]);
freqz(B,A,2^14,fs);

Monday, November 11, 2013

Automatic Sorting in Excel without a Macro (Sort Chart Data)

I really wanted to have a chart on my sheet which was sorted from high to low. Imagine if you wanted to create a bar chart which showed net income by company and wanted the chart to be sorted high to low. One solution is to just manually sort the data. Another option is to create a macro which copies the data somewhere (values only) and sorts the data, then chart the sorted data. These options all require the user to 'do something' to get the sorted chart.

I came up with a new approach using just the MAX feature, VLOOKUP, and a simple IF. The original data is in the left columns C3:C8. I just take the MAX of the group, then use a simple IF statement to assign a "One", "Two", etc, then just a VLOOKUP to get the order back at the bottom of the sheet. The IF statement is just =IF(C4=$C$9,"One",C4).

The reason I spell out the rank order is because if you don't do this and have negative numbers the logic will get screwed up as rank "5" will be greater than 99 for example and mess up your order.

Let me know if you have questions, the chart is then done on the table below. Pretty simple.

Monday, September 9, 2013

Autocreate Minitab Scripts in C++

The following code will read in a CSV file containing row and reference line data. The program will then create a Minitab script as the output file. This file can then be used directly in Minitab to auto-generate hundreds of plots. This approach can work for auto-generating / automating any scripts in Minitab.

// main_histo-limits.cpp
// James Eastham
// Version 1.0
// Purpose: The purpose of this program is to read in a set of test names and
// limits. Produce minitab script code which can be used to generate a large
// number of histograms with correct reference limit lines.
// Input: The input to this program will be a CSV file containing all the test
// names and LSL/USL for which histograms will be created.
// The input file is hard coded as limits.csv
// Output: The output will be a text file (histolimits.txt) which can be pasted
// directly into minitab and ran as a script
#include
#include
#include ;
#include ;The

using namespace std;

// int argc, char *argv[] are only needed for processing command line
// arguments. This program does not use command line arguments, so
// main() would be fine here.

int main()
{
    string testname$;           // Variable for test name read from CSV
    string lsl$;                // Varialbe for lower spec limit from CSV
    string usl$;                // Variable for upper spec limit from CSV
    // Input file name is hardcoded below as testnames.txt
    ifstream testnames ("limits.csv");
    ofstream myfile;
    // Output script file is hardcoded below as histoscript.txt
    myfile.open ("histolimits.txt");
    if (testnames.is_open())
    {
       while (testnames.good() )
             {
             getline (testnames,testname$,',');  // Read test name from file
             getline (testnames,lsl$,',');       // Read lsl from file
             getline (testnames,usl$);           // Read usl from file
             // The following cout lines simply print the info read from CSV
             // to the screen for debug purposes
             cout << testname$;  
             cout << ',';
             cout << lsl$;
             cout << ',';
             cout << usl$;
             cout << endl;
             if (testname$.length()>30)
                {
                cout << "***WARNING LONG TEST NAME, Exceeds 30 Charcaters***\n";
                }
    // The following 'myfile' lines output text to the output file
    // 'histolimits.txt'. This txt file is then used in Minitab as
    // a script. The testname$, lsl$, usl$ are used in this Minitab script
    // for naming each histogram/plot and reference/limit lines.
    // This text file can be pasted directly into Minitab.
   
    myfile << "Histogram '";
    myfile << testname$;
    myfile << "';\n";
    myfile << "Scale 1;\n";
    myfile << "TFont \"Arial Narrow\";\n";
    myfile << "PSize 8;\n";
    myfile << "Scale 2;\n";
    myfile << "TFont \"Arial Narrow\";\n";
    myfile << "PSize 8;\n";
    myfile << "AxLabel 1;\n";
    myfile << "TFont \"Arial Narrow\";\n";
    myfile << "AxLabel 2;\n";
    myfile << "TFont \"Arial Narrow\";\n";
    myfile << "PSize 8;\n";
    myfile << "NoBold;\n";
    myfile << "Table;\n";
    myfile << "TFont \"Arial Narrow\";\n";
    myfile << "Section 1;\n";
    myfile << "NoLegend;\n";
    myfile << "Density;\n";
    myfile << "Bar 'part_id';\n";
    myfile << "Color 3;\n";
    myfile << "Distribution 'part_id';\n";
    myfile << "Normal;\n";
    myfile << "Grid 1;\n";
    myfile << "Reference 1 ";
    myfile << lsl$;
    myfile << ";\n";
    myfile << "Type 3;\n";
    myfile << "Color 2;\n";
    myfile << "Size 1;\n";
    myfile << "MODEL 1;\n";
    myfile << "TFont \"Arial Narrow\";\n";
    myfile << "PSize 8;\n";
    myfile << "Reference 1 ";
    myfile << usl$;
    myfile << ";\n";
    myfile << "Type 3;\n";
    myfile << "Color 114;\n";
    myfile << "Size 1;\n";
    myfile << "MODEL 1;\n";
    myfile << "Title \"TM6PP6924 : ";
    // The following two remarks are not needed
    //myfile << "Title &\n";
    //myfile << "\"";
    myfile << testname$;
    myfile << "\";\n";
    myfile << "TFont \"Arial Narrow\";\n";
    myfile << "PSize 12;\n";
    myfile << "NoBold;\n";
    myfile << "SubTitle;\n";
    myfile << "TFont \"Arial Narrow\";\n";
    myfile << "PSize 8;\n";
    myfile << "StDist;\n";
    myfile << "Footnote;\n";
    myfile << "FPanel;\n";
    myfile << "NoDTitle;\n";
    myfile << "NoDSubtitle.\n";
     
}
testnames.close();   // close the input file
}
else cout << "Unable to open file";
   
    myfile.close();  // close the output file
    system("PAUSE");
    return EXIT_SUCCESS;
}