How to disable built-in code box when using Syntaxhighlighter3? - dokuwiki

I'm using Dokuwiki and want to get rid built-in code box (boxes with grey outline) when using Syntaxhighlighter3.
Appreciate if anyone know how to do this.

Add these lines to the css file (in your case shCore.css)
box-shadow: 0 0 0 0 !important;
The file sxh3\styles\shCore.css ( when the above line is inserted at line 28 ) would like as follows:
.syntaxhighlighter table tbody,
.syntaxhighlighter table thead,
.syntaxhighlighter table caption,
.syntaxhighlighter textarea {
-moz-border-radius: 0 0 0 0 !important;
-webkit-border-radius: 0 0 0 0 !important;
box-shadow: 0 0 0 0 !important; /* <-- this line */
background: none !important;
border: 0 !important;
bottom: auto !important;
float: none !important;
height: auto !important;

Related

Is there a way to make a responsive table for email templates either using mjml or html? Is it overflow supported for email templates?

I want to know how to make a responsive table, and it's a large table. Is the property "overflow" supported for email provider services.
<mjml version="3.3.3">
<mj-head>
<mj-style>
.table-container {
overflow-x: auto;
white-space: nowrap;
}
</mj-style>
</mj-head>
<mj-body >
<mj-section>
<mj-column css-class="table-container">
<mj-table width="100%">
<tr style="border-bottom:1px solid #ecedee;text-align:left;padding:15px 0;">
<th style="padding: 0 15px 0 0;">Year</th>
<th style="padding: 0 15px;">Language</th>
<th style="padding: 0 0 0 15px;">Inspired from</th>
<th style="padding: 0 15px 0 0;">Year</th>
<th style="padding: 0 15px;">Language</th>
<th style="padding: 0 0 0 15px;">Inspired from</th>
<th style="padding: 0 15px 0 0;">Year</th>
<th style="padding: 0 15px;">Language</th>
<th style="padding: 0 0 0 15px;">Inspired from</th>
</tr>
<tr>
<td style="padding: 0 15px 0 0;">1995</td>
<td style="padding: 0 15px;">PHP</td>
<td style="padding: 0 0 0 15px;">C, Shell Unix</td>
<td style="padding: 0 15px 0 0;">1995</td>
<td style="padding: 0 15px;">PHP</td>
<td style="padding: 0 0 0 15px;">C, Shell Unix</td>
<td style="padding: 0 15px 0 0;">1995</td>
<td style="padding: 0 15px;">PHP</td>
<td style="padding: 0 0 0 15px;">C, Shell Unix</td>
</tr>
<tr>
<td style="padding: 0 15px 0 0;">1995</td>
<td style="padding: 0 15px;">JavaScript</td>
<td style="padding: 0 0 0 15px;">Scheme, Self</td>
<td style="padding: 0 15px 0 0;">1995</td>
<td style="padding: 0 15px;">JavaScript</td>
<td style="padding: 0 0 0 15px;">Scheme, Self</td>
<td style="padding: 0 15px 0 0;">1995</td>
<td style="padding: 0 15px;">JavaScript</td>
<td style="padding: 0 0 0 15px;">Scheme, Self</td>
</tr>
</mj-table>
</mj-column>
</mj-section>
</mjml>
Or what is the better way to make responsive tables for emails? I tried the code above and I can't see the overflow for the table.

Handle SVG sprite file with flutter_svg

I have SVG file on server side named sprite-icons.svg:
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<symbol id="icon-1" viewBox="0 0 826800 826800">
<path fill="#222222" d="M201379 197582l31452 0 0 432178 -31452 0 0 -432178zm122701 72034l33469 0 0 282159 -33469 0 0 -282159zm138450 74734l31666 0 0 135933 -31666 0 0 -135933zm131388 -147310l31503 0 0 432178 -31503 0 0 -432178z"/>
</symbol>
<symbol id="icon-2" viewBox="0 0 826800 826800">
<path fill="#aaaaaa" d="M201379 197582l31452 0 0 432178 -31452 0 0 -432178zm122701 72034l33469 0 0 282159 -33469 0 0 -282159zm138450 74734l31666 0 0 135933 -31666 0 0 -135933zm131388 -147310l31503 0 0 432178 -31503 0 0 -432178z"/>
</symbol>
</svg>
I have url to get it, but when I try do it with flutter_svg this way:
SvgPicture.network('https://some-domain.com/img/sprite-icons.svg')
// or
SvgPicture.network('https://some-domain.com/img/sprite-icons.svg#icon-1')
I'm getting an error:
StateError (Bad state: SVG did not specify dimensions
The SVG library looks for a `viewBox` or `width` and `height` attribute to determine the viewport boundary of the SVG. Note that these attributes, as with all SVG attributes, are case sensitive.
Is it possible to get such SVG sprite file and render included svgs (icon-1 and icon-2) with flutter_svg? Or any other way? Thanks.

How to assign specific values to colours in imagesc

I'm trying to assign three possible values of a matrix to three colours when plotted using imagesc in MATLAB.
All I want is imagesc() to represent 0 as white, 1 as black and 2 as red.
Initially imagesc() does this, but as the for-loop proceeds, the colours for 1 and 2 get swapped.
I have tried re-ordering the colours assigned to colormap(), but the colours still swap.
Here is my code:
Grid = 10;
M = zeros(Grid);
M(3,1:3)=1;M(2,3)=1;M(1,2)=1;
Black = [0 0 0];
White = [1 1 1];
Red = [1 0 0];
Background = White;
colormap([Background; Red; Black])
figure()
imagesc(M)
...so far, so good. I have five black squares in the corner.
However as my loop proceeds and 2's are introduced, the matrix looks like this:
0 0 0 0 0 0 0
0 2 1 0 0 0 0
1 0 1 0 0 0 0
0 1 1 0 0 0 0
0 0 0 0 0 0 0
0 0 0 0 0 0 0
0 0 0 0 0 0 0
0 0 0 0 0 0 0
0 0 0 0 0 0 0
0 0 0 0 0 0 0
but now the image shows BLACK for 2, and RED for 1.
How do I maintain the colour-to-value relationships?
Your main mistake is having the red and black colors reversed in your colormap. You probably did this because putting the colors in the correct order made the pixels red in your first matrix - which was unwanted. The reason for this is the way pixel values are mapped to colormap colors, which can be seen by showing a colorbar. Your custom colormap happened to work because red was used for pixels with a value of about 0.5 - of which there were none.
What you need to do is correctly set the color limits for your axes:
colormap([Background; Black; Red])
set(gca, 'CLim', [0 2]);
Then, this is what would happen for the initial matrix (note that there are no red pixels in the image, but the colormap is ready for them nonetheless):

Swift extra trailing newline when reading file

I am making an app where my levels are stored as grids of numbers in a text file, and when reading them in, I keep getting a trailing newline when there isn't one. The content of the text file being read in is the following (note there is no trailing newline, the last line just ends). Ignore the tick marks, they are there for clarity to mark the beginning and end of the file content.
'1 1 0 0
1 0 0 0
0 0 0 0
0 0 0 0'
My code:
let mypath = Bundle.main.path(forResource:"level1", ofType:nil)!
let content = try! String(contentsOfFile:mypath)
let lines:[String] = content.components(separatedBy:"\n")
print("lines=\(lines)")
print("content = '\(content)'")
Output:
lines=["1 1 0 0", "1 0 0 0", "0 0 0 0", "0 0 0 0", ""]
content = '1 1 0 0
1 0 0 0
0 0 0 0
0 0 0 0
'
As you can see, there is a fifth array element, implying that there were four "\n" strings found in the file, when there were only three. Plus the value of content has an extra newline at the end.
Now if I add a trailing newline to the file such that the file content is (everything between the tick marks):
'1 1 0 0
1 0 0 0
0 0 0 0
0 0 0 0
'
The output becomes:
lines=["1 1 0 0", "1 0 0 0", "0 0 0 0", "0 0 0 0", ""]
content = '1 1 0 0
1 0 0 0
0 0 0 0
0 0 0 0
'
It's the exact same as before!
If I add two trailing newlines, then the output accounts for it, becoming
lines=["1 1 0 0", "1 0 0 0", "0 0 0 0", "0 0 0 0", "", ""]
content = '1 1 0 0
1 0 0 0
0 0 0 0
0 0 0 0
'
Why is this? Is it a bug? Is there any way I can turn this "feature" off? I need to count the number of lines, and this is throwing off everything. I know I can trim off all the extra newlines, but that just seems like a patch to avoid the problem rather than a fix to the problem itself.

How can i count number of particles in each grid box in this code?

how can i count number of particles in each grid box in this code
here is my code below:
xyRange=[1,5];
P=3;
vx=0.6;
vy=0.4;
X=[];
Y=[];
for day=1:5
X=[X;randi(xyRange,P,1)];
Y=[Y;randi(xyRange,P,1)];
X=X+vx;
Y=Y+vy;
end
plot(X,Y,'kd');
grid on;
axis([1,50,1,50]);
j = floor(X/5)+1;
k = floor(Y/5);
box = k*10+j;
If you have the Statistics Toolbox, the easiest way is to use hist3.
In your case, when I plotted the grid, it looks like each box was separated in units of 5. As such, the command is very simply this:
cnt = hist3([X,Y], {0:5:50 - 2.5, 0:5:50 - 2.5});
X and Y are your 2D data points, and the second element is a cell array of X and Y values which denote the centres of each of the points in each grid. Take note that the points that are defined are with respect to the origin being at the top left corner. If you want to make sure that the origin is at the bottom left corner, you would actually need to do this:
cnt = flipud(cnt.');
On my run I get this:
cnt =
0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0
0 1 6 0 0 0 0 0 0 0 0
0 5 3 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0
When producing your plot, I get this:
If you compare the counts in comparison to the grid produced at the top, you'll see that the match. However, because of the way I specified the centre of the bins, the first and last row, and the first and last column are meaningless, so you can safely eliminate these from your analysis.
If you want a nice pictorial example of this, call hist3 without any output arguments:
%// Plot 2D histogram with some transparency
hist3([X,Y], {(0:5:50) - 2.5, (0:5:50) - 2.5}, 'FaceAlpha', 0.65);
%// Set height of each bar coloured according to height
set(get(gca,'child'),'FaceColor','interp','CDataMode','auto');
view(-34,68); %// Change camera view for better look
We get this: