Mediawiki: Ignoring wiki highlighting and just dumping in text - mediawiki

I want to copy-paste an existing plain text into MediaWiki without any form of interpretation. However, the text contains characters that have a meaning in wiki markup, but I do not want wiki to do anything with it. I want wiki to just include it and do
the carriage return right. Both VERBATIM and NOWIKI cannot do that. Are there any other possiblities?
Here a snipplet of what I would like to enter:
#####################################################
* bla bla *
bla blabla blabla blabla blabla blabla blabla bla
bla blabla bla - bla blabla bla
bla blabla bla
bla blabla blabla
https://twitter.com/bla bla
#####################################################
bla blabla blabla blabla blabla blabla blabla blabla blabla bla
bla blabla blabla blabla blabla blabla blabla blabla blabla blabla bla
*bla bla bla bla
*bla bla
*bla blabla bla
#bla bla
#bla bla
#bla bla

<nowiki> does what you say you want: it ignores all markup and outputs the text exactly as you entered it. The problem with that is that HTML ignores newlines and considers multiple spaces as one.
What you actually want is the <pre> tag.

Related

Full Text Search - Not listing by records with the highest number of search terms

When using the Full Text Search, I am not understanding the score given to the first records.
I search for the word "butter" and get a higher Full Text Search score for the lines with the content:
[score] - content
[0.36537662148475647] - Another Butter wordtest Another example Butter word Another example with Butter word
[0.36452728509902954] - Popcorn Popz Butter 270 g Popcorn Popz Butter 270 g Popcorn Popz Butter 270 g Words example random test
[0.3440600335597992] - Content with Butter word Content with Butter word Content with Butter word Butter Butter Butter
According to Full Text Search rules, shouldn't the records with the highest number of times of the word "butter" in the content appear first? Is there another rule that might explain what is happening?
My query:
SELECT
SQL_CALC_FOUND_ROWS MATCH (content) AGAINST('+Butter') as score,
content
FROM
teste
WHERE
MATCH (content) AGAINST('+Butter' IN BOOLEAN MODE)
ORDER BY
score DESC
Thanks!

How to extract words ending with ed and the words after and before it in sql?

i have a column of ingredients and i want to extract all those ingredients that end with "ed" . e.g; i have a list of ingredients like:
Dolin dry vermouth
Cabin Fever maple flavored whiskey
bacon strips
ginger ale
tequila
Eggnog*
Flamed orange peel
Amontillado sherry
White rum
Lemon wedge
Vodka
Fresh lemon juice
Triple sec
Silver tequila
Gin
Simple syrup
Cola, to top
Cola Candied ginger
Fresh lemon juice
I want a regex which should extract complete string of ingredient ending with "ed" like:
Cabin Fever maple flavored whiskey
Flamed orange peel
Cola Candied ginger
Try pattern [a-z]ed( |$) with regexp operator/function.
Pattern explanation:
[a-z] - match any letter
ed - match ed literally
( |$) - match space or end of string (so make sure it's not followed by any letters)
Full query would be:
select *
from test
where lower(ingr) regexp '[a-z]ed( |$)'
SQL demo
Note that I added record Orange flamed to show it working when ed is at the end of the string.
SELECT * FROM ingredients i WHERE i.name LIKE ('%ed %') OR i.name LIKE ('%ed');
The output you are expecting would require two conditions
LIKE ('%ed %') :- this will give result set where ed is coming in between text like Cabin Fever maple flavored whiskey
Flamed orange peel
Cola Candied ginger
LIKE ('%ed') :- this will give the filtered result having ed as suffix in string like Cotton Candy flavored

SSIS Column Combining

I'm trying to combine data from multiple excel columns into one column and want to avoid copying and pasting it manually over and over each time I receive a file.
The data will come in this format:
C1 C2 C3 Date1 Date2 Date3 ... DateN
text text2 text3 ### ### ### ###
text text2 text3 ### ### ### ###
The end goal is to have all the dates in a column by themselves and to have all the values in a column next to their respective dates to load into a MSS table like so:
C1 C2 C3 Results Date
text text2 text3 ### Date1
text text2 text3 ### Date1
text text2 text3 ### Date2
text text2 text3 ### Date2
text text2 text3 ### Date3
text text2 text3 ### Date3
So far I'm drawing a blank on what could be done to automate this.
You can use SSIS Unpivot Transformation; it does exactly what you need. The only caveat - number of Date columns has to be fixed before you design and run SSIS package; you cannot handle dynamic number of columns in SSIS with builtin transformations.

How to see if all values within group are unique/identify those that aren't

Say that I have data like this:
group value
1 fox
1 fox
1 fox
2 dog
2 cat
3 frog
3 frog
4 dog
4 dog
I want to be able to tell if all values of value are the same within group. Another way to see this is if I could create a new variable that contains all unique values of value within group like the following:
group value all_values
1 fox fox
1 fox fox
1 fox fox
2 dog dog cat
2 cat dog cat
3 frog frog
3 frog frog
4 dog dog
4 dog dog
As we see, all groups except group 2 have only one distinct entry for value.
One way I thought that a similar thing (but not as good) could be done is to do the following:
bys group: egen tag = tag(value)
bys group: egen sum = sum(tag)
And then based on the value of sum I could determine if there were more than one entry.
However, egen tag does not work with bysort. Is there any other efficient way to get the information I need?
There are several ways to do this. One is:
clear
set more off
input ///
group str5 value
1 fox
1 fox
1 fox
2 dog
2 cat
3 frog
3 frog
4 dog
4 dog
end
*-----
bysort group (value) : gen onevalue = value[1] == value[_N]
list, sepby(group)
Suppose you have missings, but want to ignore them (not drop them); then the following works:
clear
set more off
input ///
group str5 value
1 fox
1 fox
1 fox
2 dog
2 cat
3 frog
3 frog
4 dog
4 dog
5 ox
5 ox
5
6 cow
6 goat
6
end
*-----
encode value, gen(value2)
bysort group (value2) : replace value2 = value2[_n-1] if missing(value2)
by group: gen onevalue = value2[1] == value2[_N]
list, sepby(group)
See also this FAQ, which has technique that resembles your original strategy.

Group all similiar text into different groups

I have table with text in it, I want to somehow distinguish in different groups those text that can be found by a LIKE query. So for example I have
blabla
a1aaaa
bla
lab
aaa
a1
c25
I want to get the following result or something similar that I will be able to use easily in my script.
blabla 1
bla 1
lab 1
a1aaaa 2
aaa 2
a1 2
c25 3
Here is the situation
bla IS NOT LIKE '%blabla%'
lab IS NOT LIKE '%blabla%'
blabla IS LIKE '%bla%' So it should go into one group
lab IS NOT LIKE '%bla'
blabla IS LIKE '%lab' Lab should be added to the first created group
Basically I want to group similar words to different groups
Please try the following:
SELECT DISTINCT
A.text_col AS `group_name`,
B.text_col AS `member`
FROM
text_table AS A
INNER JOIN text_table AS B
ON A.text_col LIKE concat( '%', B.text_col, '%')
Basing on your example data, it should give you:
group_name | member
-------------------------------------
blabla blabla
blabla bla
blabla lab
a1aaaa a1aaaa
a1aaaa aaa
a1aaaa a1
c25 c25
I hope it could occur helpful.