DokuWiki: Side-By-Side diff: Table with two cols in code block in table cell - dokuwiki

I want to create a table in DokuWiki which has two rows.
On the left side is a code block (old code), and on the right side there is an other code block (new code).
How to format this in dokuwiki?
If it would be html, it would be easy:
<table>
<tr>
<td>
<pre>
...
</pre>
</td>
<td>
<pre>
...
</pre>
</td>
</tr>
</table>
Optional: Syntax highlighting for Python would be nice.

This should do the work:
| <code>Row 1 Col 1</code> | <code>Row 1 Col 2</code> |
Or for a simple monospaced text use '':
| ''%%Row 1 Col 1%%'' | ''%%Row 1 Col 2%%'' |
EDIT Add %% %% makes string to be not interpreted as DokuWiki syntax.
Here the documentation: https://www.dokuwiki.org/wiki:syntax

||border=1
||!Table heading 1||!Table heading 2||
||Cell 1.1||Cell 1.2||
||Cell 2.1||Cell 2.2||

Related

How to split array list into multiple rows and columns in scala

I am reading this XML file using scala and I had to define custom schema's for each table attribute as they are different.
<CATALOG>
<TABLE at_name="Furniture">
<ROWDATA>
<ROW typeid="0" caseid="0" key="1" code="0"/>
<ROW typeid="1" caseid="0" key="1" code="0"/>
<ROW typeid="1" caseid="1" key="1" code="0"/>
</ROWDATA>
</TABLE>
<TABLE at_name="Cutlery">
<ROWDATA>
<ROW cutleryTypeid="0" color="Blue" code="0"/>
<ROW cutleryTypeid="0" color="Blue" code="0"/>
</ROWDATA>
</TABLE>
<TABLE at_name="Apparel">
<ROWDATA>
<ROW ApparelTypeid="1" color="Blue" barcode="0111"/>
<ROW ApparelTypeid="0" color="Blue" barcode"1122"/>
</ROWDATA>
</TABLE>
<CATALOG>
I now have the following array list created like this(for attribute furniture):
val gl = DF.select("ROWDATA").rdd.map(r => r(0)).collect()
for(element<-gl)
{
println(element)
}
When I print the elements I get this:
[WrappedArray([0,0,1,0], [1,0,1,0], [1,1,1,0])]
I want this transformed into two outputs.
Output 1:
id elements
1 [0,0,1,0]
2 [1,0,1,0]
3 [1,0,1,0]
Then I want convert it like this:
Output 2:
id col1 col2 col3 col4
1 0 0 1 0
2 1 0 1 0
3 1 0 1 0
Any help on this please?

MaterialUI Table rows with different amount of cells aligned

I am trying to create a table where I essentially have two headings of different cell size and the items in the table must follow the second heading, like this:
**Main Heading 1** | **Main Heading 2**
sub 11 | sub 12 | sub 13 | sub 14 | sub 21 | sub 22 | sub 23 | sub 24
item | item | item | item | item | item | item | item
...
I have tried with the following structure
<Table size="small" aria-label="stock-flow">
<TableHead>
<TableRow>
<TableCell>Main Heading 1</TableCell>
<TableCell>Main Heading 2</TableCell>
</TableRow>
<TableRow>
<TableCell>Sub 11</TableCell>
<TableCell>Sub 12</TableCell>
<TableCell>Sub 13</TableCell>
<TableCell>Sub 14</TableCell>
<TableCell>Sub 21</TableCell>
<TableCell>Sub 22</TableCell>
<TableCell>Sub 23</TableCell>
<TableCell>Sub 24</TableCell>
</TableRow>
</TableHead>
<TableBody>
<TableRow>
<TableCell>Item 11</TableCell>
<TableCell>Item 12</TableCell>
<TableCell>Item 13</TableCell>
<TableCell>Item 14</TableCell>
<TableCell>Item 21</TableCell>
<TableCell>Item 22</TableCell>
<TableCell>Item 23</TableCell>
<TableCell>Item 24</TableCell>
</TableRow>
</TableBody>
</Table>
But that aligns Main heading 1 and Main Heading 2 above sub11 and sub12 and leaves 6 empty spaces after that.
I essentially want to have 2 "main" columns and a way to create whatever sizes of columns/rows I want in each of them.
EDIT: I found the answer, I have to use the colSpan property and give it a value of the amount of cells that I want to have underneath the main heading, so both headings get colSpan={4}
I found the answer, I have to use the colSpan property and give it a value of the amount of cells that I want to have underneath the main heading, so both headings get colSpan={4}

How to replace particular string in table column value in PostgreSQL

I am trying to replace certain text with other text in PostgreSQL.
To be more specific, I am trying to replace image path and anchor href in article (table blog_posts) from relative to absolute path. Some of the images and anchors already have an absolute path that should not get disturbed.
I tried to select the records which I need to modify:
SELECT
bp.id,
bp.article,
FROM
blog_posts bp
WHERE
bp.article LIKE '%src=%"/fixed_word/%'
OR
bp.article LIKE '%src="/fixed_word/%'
OR
bp.article LIKE '%href="/fixed_word/%'
OR
bp.article LIKE '%href=%"/fixed_word/%'
now I am not sure how to proceed further to update. Please help to get right solution.
My data is something like this:
MyTable: blog_posts
id article
1 any text <img any-atribute src="/fixed_word/variable_word1/something.png"/> any text
2 any text <a any-attribute href="/fixed_word/variable_word2/something2.png"><img src="/fixed_word/variable_word2/something2.png"/> </a>any text
3 any text <img src="https://mydomain.subdomain.com/fixed_word/variable_word1/something.png"/> any text
4 any text <img any-attribute src=\"/fixed_word/variable_word1/something.png"/> any text
5 any text <a any-attribute href=\"/fixed_word/variable_word2/something2.png"><img src=\"/fixed_word/variable_word2/something2.png"/> </a>any text
6 any text <img any-attribute src="https://mydomain.subdomain.com/fixed_word/variable_word6/something6.png"/> any text
OutPut should be:
id article
1 any text <img any-atribute src="https://mydomain.subdomain.com/fixed_word/variable_word1/something.png"/> any text
2 any text <a any-attribute href="https://mydomain.subdomain.com/fixed_word/variable_word2/something2.png"><img src="https://mydomain.subdomain.com/fixed_word/variable_word2/something2.png"/> </a>any text
3 any text <img src="https://mydomain.subdomain.com/fixed_word/variable_word1/something.png"/> any text
4 any text <img any-attribute src="https://mydomain.subdomain.com/fixed_wordvariable_word1/something.png"/> any text
5 any text <a any-attribute href="https://mydomain.subdomain.com/fixed_word/variable_word2/something2.png">
6 any text <img any-attribute src="https://mydomain.subdomain.com/fixed_word/variable_word6/something6.png"/> any text
This can be a starting point:
UPDATE blog_posts
SET article = regexp_replace(
article,
E'(src|href)=[^"]*"/fixed_word/([^"]*)',
E'\\1="https://mydomain.subdomain.com/fixed_word/\\2',
'g'
)
WHERE article ~ E'(src|href)=[^"]*"/fixed_word/([^"]*)';

Using inner join with msqli

I have tried every single expalnation on this but I keep getting errors please help me out guys this might have been answered but its over a week I keep struggleing with it.
I have two Tables
Student and Certificate
the two tables have a relationship on student, i have a unique column student reg no and on certificate student reg which are bot the same values.
I am trying to select data from the two table into a table in html but its not working
here is my statement
<?php
$sql = "SELECT * s.studentsregno
s.fullname
s.program
c.certificateno AS cert_no
c.dateofissue AS date_ofissue
c.status AS pick_status
FROM student s
JOIN certificate c on c.studentreg = s.studentregno";
$result = $db->query($sql);
if ($result->num_rows > 0) {
// output data of each row
while($row = $result->fetch_assoc()){
echo
'<tr class="odd gradeX">
<td>'.$row["studentregno"].'</td>
<td>'.$row["fullname"].'</td>
<td>'.$row["program"].'</td>
<td class="center">'.$row["cert_no"].'</td>
<td class="center">'.$row["date_ofissue"].'</td>
<td class="center">Picked</td>
</tr>';
}
}
$db->close();
?>
Maybe try by adding some coma and not using * the other, something like this :
SELECT s.studentsregno, s.fullname, s.program, c.certificateno AS cert_no, c.dateofissue AS date_ofissue, c.status AS pick_status FROM student s JOIN certificate c on (c.studentreg = s.studentregno);
I'm not a big fan of renaming like this the table too so if it still doesn't work, try by remplacing s and c by the real table name and just use this surname when you really need it (a join beetween two from the same table)

Show table rownumber

I have a script which type is="text/x-tmpl"
This script generates the rows and columns into the tbody.
What I try to do is to create a column which have a input to show the number of row of each item.
example:
row 1: thumbnail - Filename - 1
row 2: thumbnail - Filenaem - 2
...
...
I want that the user can change his row number.
The problem is that always show "0".
Here is the code:
{% for (var i=0, file; file=o.files[i]; i++) { %}
<tr class="template-upload fade">
<td><input type="text" value="{%=[i]%}"></td> /**My input to show the number of row**/
</tr>
{% } %}