Editor or Js extension for Textile Tables - vim

Is there anything similar to:
https://github.com/vkocubinsky/SublimeTableEditor
I have to write quite many tables in textile (Redmine) and I'd like to have them in pretty format
|_. Header1 |
| row1 |
| row2 |
rather than in that ugly one:
|_. Header1|
|row1|
|row2|
Especially when I want to create more sophisticated tables:
|_. Header1 |_. Header2 |
|/2. two lines row1| one|
|two|
|/2. two lines row2| one|
|two|
and it should look like this:
|_. Header1 |_. Header2 |
|/2. two lines row1 | one |
| two |
|/2. two lines row2 | one |
| two |
I'm looking for something for SublimeText/VIM/Notepad++ or JS extension to format tables properly in a text file.

I threw together something to help me with this the other day, and added an output format for textile tables.
http://joecullin.com/data_converter/
You have to choose Redmine table as the output format. I still use this tool every time I want to create a table in redmine. Even for small tables it's easier than typing the markdown by hand. Now I can paste in data from Excel pretty easily, and then paste the result into Redmine.
There are still some kinks in my code, but if I have a large table it gets me to a good starting point quickly. Then I can fix things up by hand. You might look at that code as inspiration if you're considering writing your own javascript.

Related

VBA - Remove duplicates which contain less information

First question on Stack, but not my first visit!
Basically I have this huge Excel database (>24 000 rows, merged from different tables) I have been working on for weeks and now that I'm done adding new entries, I have to clean it by removing a lot of duplicates.
The array/table is structured in the following manner :
+---------+-------+--------------------+-------------+--------------------+
| Company | Name | Address | Phone | Email |
+---------+-------+--------------------+-------------+-----------+--------+
| Baij&Co | Steve | 458 Preston avenue | 4156854789 | steve#baij&co.com |
I did search through conventional methods but they don't exactly answer my problem, such as:
Using the "Remove Duplicates" Excel button by selecting all columns to make sure I only keep unique values
Using the filtering method to identify the duplicates and then remove them.
However, my goal is to remove the duplicates for which the given row(s) contains the minimal amount of information, as shown in this example:
+--------- +-------+--------------------+-------------+--------------------+
| Company | Name | Address | Phone | Email |
+--------- +-------+--------------------+-------------+--------------------+
| Baij&Co | Steve | (blank) | 4156854789 | steve#baij&co.com |
| Baij&Co | Steve | (blank) | (blank) | steve#baij&co.com |
| Baij&Co | Steve | 458 Preston avenue | 4156854789 | steve#baij&co.com |
Here, I would like to remove the 1st AND 2nd row as they contain less information (missing address & phone entry) about the same contact.
Does it makes sense..?
I only know the basics of VBA (like creating a userform to add a new contact and fill out the entered information in the right cells) but I struggle with advanced algorithms.
I just know the VBA related function cannot be customized, apart from selecting the columns in which I want to remove the duplicates :
Sheets("Database").Range("ContactsTable").RemoveDuplicates Columns:=1:15, Header:=xlNo
Any ideas?
Thanks fellas!
So I followed #Tim Williams 's suggestion (which is similar to Scott's actually) and did the following:
I realized that email addresses were the unique identifier (or primary key) and I have to delete rows that don't contain any (as it becomes useless to have a contact file without contact information).
I added a column named "Count" and inserted the following formula:
=COUNTIF(N:N; N2)
--> Here, "N:N" is the column containing all email addresses. "N2" being the first cell.
I then sorted the table by descending order on the newly "Count" column to have the most occurrences first.
Then used the "Remove Duplicate" Excel tool and selected the email address column.
As a result, 10 000 rows have been removed (out of 24 000). One thing for sure is this table contains now unique contact files based on the email address. However, I will never know for sure if the most filled row was kept for each contact sadly (unless I spend days comparing both databases, row after row).
Problem solved I guess! Although I would be interested in a VBA-script to do the same (to learn on the algorithm aspect) if anyone knows anything about it :-)
Thanks again!

How can I make a fixed width mutliline table in vim/neovim?

I want to write a text file for a video script. I want to format the text like a table. It needs to have two columns and any number of rows. I want the text in the 'cells' to be multiline but have a fixed width for the columns.
Here's the effect I'm trying to achieve with three columns. I don't need the scene numbers: Example Script
VimWiki is the best I've found so far, but the columns aren't fixed width and it's difficult or impossible to re-flow the text.
Any suggestions for a better way to do this?
I wonder if the markdown table style is suited for your demands. The example scripts can be found below. I use vim-table-mode to draw these tables, once the table has been created, you can add new rows to it with automatically match the previous width. Here is the demo for this plugin and its GitHub repo can be found here.
| App | Usage | NeedTimeMaster? |
| ------------------- | --------------- | ----------------- |
| Telegram | tec. Chat | No |
| Mail | Communications | No |
| Chrome | Browser | No |
| Things | Tasks | Maybe(slightly) |
| Books | Books | No |

Lookup table with variable breakpoints

BACKGROUND
Normally when I am dealing with tables to find values to work with the tables are nicely laid out with something like:
and I rearrange them to make my lookup life easier by converting the table to look like:
I toss in the extra column so that someone maintain the table in the future will have an easier time updating the table and formulas that refer to it. The formula I was using to for the table above was:
=INDEX(C3:I5,MATCH(MIN(B7:B8),A3:A5,1),MATCH(MAX(B7:B8),C2:I2,1))
Where B7:B8 had the dimensions I was referring to. Right now I am working with the assumption that large dimensions only come in set sizes. I would need to incorporate an interpolation approach if permitted and any sizes were used.
CURRENT ISSUE
Now I just came across a table that is making me really think about what is the best approach to the situation. The initial table looks like:
d/b | Cs | Kls
<=1 | - | 1
>1 | <=10 | 1
>1 | >10 but <Ck | 1-0.3*(Cs/Ck)^4
>1 | >=Ck | (0.70*E05)/Cs^2*fbu)
and my first go round at rearranging the table is:
d/b | Cs | Kls
0 | 1 | 0 | 0 | 1
1 | 1 | 0 | 10 | 1
1 | 1 | 10 | Ck | 1-0.3*(Cs/Ck)^4
1 | 1 | Ck | 9.99E+101 | (0.70*E05)/Cs^2*fbu)
So my two stumbling blocks is d/b can be any positive number 1.00001 or 0.99999 type deal. so the d/b lookup has me a bit concerned only for the moment as in the background example the first column I am checking against is >= values.
The second stumbling block I have is that the breakpoint for the second lookup value Cs has a variable for two of the break point ranges. The approach I was planning on taking here was simply calculate the value and pass it to the table when I go to do the look up. Now this approach works great for me when there is only one item to check. This approach I do not think will work when I have to deal with multiple items to check. Right now the only things I can think of are:
Each item would require its own table...which kind of defeats the purpose of the table.
convert the table to a nested IF function.
Its been a long day for me and the mind is a bit fried. I am wondering if anyone would care to share their insight on the approaches I am thinking of or has an approach of their own for a table with a variable as a break point?
Ahh fiddle sticks! I just reread the question and I never stated I was trying to pull the formula/result from the third column (ie Kls). Told you mind was fried.
If I wind up going the nested if route I would use something like:
=IF(OR(E50<=1,E57<=10),1,IF(E57<E63,1-0.3*(E57/E63)^4,0.7*G63/(E57^2*D71)))
Where
- E50 is b/d
- E57 is Cs
- E63 is Ck
- G65 is E05
- D71 is fbu
I think a nested-IF would be better than rearranging the tables. You are losing some values by rearranging the cutoffs.
In your first example, the smaller dimension has >64 but <114.
When you change that, you have 0 to 64, 65 to 114. What about 64.5? This value is not part of your table. Nested IF statements would allow you to keep the original values of the table. Also, you can use a named range for variables which are the breakpoint for the second lookup value Cs.

Cross reference two data sources for matches in Excel 2010

Firstly, thank you for checking my quesiton. I'm new to doing anything advanced in Excel so I'm a bit lost.
I am trying to match names from two different sources that have the same data structure. There are 3 columns, LastName, FirstName, MiddleName. I added a fourth row to denote which organization the record came from and put both sources into one table and made a pivot out of it which works well enough but I'm having a hard time generating any useful data from it.
There are two main objectives once I have them matched.
I need a percentage of matching.
I need to be able to filter out the ones that matched so I can investigate the ones that didn't.
Here is a small example.
+-------------+-----------+------------+------+
| LastName | FirstName | MiddleName | Org. |
+-------------+-----------+------------+------+
| Jones | Mike | Anthony | Org1 |
| Black | Marry | | Org1 |
| Zeek | Winston | E | Org1 |
| Jones | Mike | A | Org2 |
| Black-Smith | Marry | | Org2 |
| Zeek | Winston | E | Org2 |
+-------------+-----------+------------+------+
As you can see out of the list only Winston E Zeek would really match because all three names are exactly the same. Mike Jones won't match because the listed middle names are wrong and Black and Black-Smith won't match because they are technically different last names. These issues with the data are fine at this stage because those are exactly what I'm trying to identify with a larger data set.
Maybe Excel isn't the best for this issue without using VBA? I'm not familiar with VBA which is why I haven't tried it yet and I unfortunately have limited time.
How can I solve this matching problem?
Any assistance and guidance will be appreciated.
Here's a quick idea:
Sort the data by last name, first name, middle name. That should put same/similar names next to each other.
Add a column that, for each row, has a worksheet function like =IF(A3=A2,1,0). This will indicate if this row matches the one above.
Sum the new column... That will tell you the number of matches. Divide by the total number of rows, to get your percentage.
You can modify the function in step 2, to indicate as tight of a match that you want.
Advantage: No VBA needed. Disadvantage: It requires some manual work and interpretation.

Use heading as column

I have a spreadsheet set out similar to below:
Weekly Report | 25/06/2012
-------------------------------
Name | Course |
-------------------------------
Peter | Maths |
-------------------------------
John | English |
-------------------------------
James | History |
-------------------------------
Each week a new report is sent with sometimes different and sometimes the same people on different courses. I want to use SSIS to create an extra column to show the date which is usually in cell b3 of the spreadsheet.
So the final thing would look like
Weekly Report | 25/06/2012
--------------------------------------------
Name | Course | Date |
--------------------------------------------
Peter | Maths | 25/06/2012 |
--------------------------------------------
John | English | 25/06/2012 |
--------------------------------------------
James | History | 25/06/2012 |
-------------------------------------------
Hopefully explained myself there. I am rather new to SSIS so don't know if it's really obvious or something more difficult.
Thanks for clarifying your question. You have two steps: extracting the date and turning it into a column. I would probably use an Execute SQL task to query the Excel sheet and map the date to a package variable. Then you can use that variable in a Derived Column transformation to add it to the data set being processed.
Finally, you might want to consider not using SSIS at all. If your source is Excel and your destination is MySQL, then using SSIS means you also need SQL Server. So depending on your environment writing your own script or program might be simpler.

Resources