change susy $total-columns on pc view - susy-compass

Im trying to change $total-columns like this:
#include at-breakpoint(55em 12)
$total-columns: 12
as suggested here:
Susy: change the number of columns according to screen size
but I cant get it to work.
I start off by setting _base with
$total-columns: 5
I designed for mobile,
but in a pc-view I want the container to have 12 columns.
Am I missing anything?

According to the Susy reference maybe try the following (Depending if 60em should be your min or max value):
$media-layout: 12 60em; // Use 12 cols up to max 60em.
or
$media-layout: 30em 12 60em;// Use 12 cols between min 30em & max 60em.
or
$media-layout: 60em 12; // At min 60em, use 12-col layout.
Take the defined variable and enter that variable in the mixin:
#include at-breakpoint($media-layout)

Related

Increasing height merged cells Apache POI

I am using Apache POI SXSSF to generate xlsx document. The document uses Times New Roman sizes 9 and 11, and the default cell width and height have been changed. The question is how to calculate the height of the merged cells so that all the text fits (the height of the cell must be dynamically set according to the given text)? The server running the application does not have a display, and this code is running in the IBM Integration Bus.
The solution from How to get the needed height of a multi line rich-text field (any font, any font size) having defined width using Java? is not suitable. The server running the application is missing a display and the string int ppi = java.awt.Toolkit.getDefaultToolkit().getScreenResolution(); returns an exception, and manually picking the ppi value is also not possible. If there is a display, everything works correctly.
And is there any way to use the "align center selection" function somehow?
I found that centering a selection gives a similar result as merging multiple cells horizontally, but I couldn't find an answer anywhere on how to use this in Apache POI. As a result, experimentally, I found out that in order to achieve this effect, you need to do the following things:
Create CellStyle; specify setWrapText(true) and setAlignment(HorizontalAlignment.CENTER_SELECTION) for it
Apply the style created in step 1 to all cells that need to be merged
Specify the value in the first cell
Code example:
Font font = wb.createFont(); // where wb - is SXSSFWorkbook object
font.setFontName("Times New Roman");
font.setFontHeightInPoints((short) 11);
CellStyle style = wb.createCellStyle();
style.setFont(font);
style.setWrapText(true);
style.setAlignment(HorizontalAlignment.CENTER_SELECTION);
for (int i = 0; i <= endCellNum - firstCellNum; i++){ // where endCellNum - number of last cell of selection and firstCellNum is number of first cell of selection
Cell cell = curRow.createCell(firstCellNum + i);
cell.setCellStyle(cs);
if (i == 0){
firstCell = cell;
}
}
firstCell.setCellValue(value);

XSLFTable get size to see if it will fit in slide after insertion

I am working on a slide show where I insert N number of rows. There are two issues...
I don't know the number of rows, there is a max of 50 we will allow but even 50 will go out of the slide.
The text I will add to each column can also be somewhat long.
Right now, my current approach is allowing 15 rows, creating a new slide to add the next 15, and so on until I hit 50.
What I would prefer to do is get the size of the table and after I finish one row, I would like to check if it is overflowing out of the slide, and if it is, I'll remove it, make a new slide, and add it to the new table.
An alternative approach if possible, is keep the row height locked, and allow any extra text to kinda be hidden until the cell is selected (similar to an excel spreadsheet).
Using a similar approach here
Apache POI get Font Metrics
Solution:
stringList is repopulated for each row
int max = 0;
int j = 0;
for (String text : stringList) {
AttributedString attributedString = new AttributedString(text);
attributedString.addAttribute(
TextAttribute.FAMILY, "Avenir Book", 0, text.length());
attributedString.addAttribute(TextAttribute.SIZE, (float)14);
TextLayout layout = new TextLayout(attributedString.getIterator(), fontRenderContext);
Rectangle2D bounds = layout.getBounds();
max = Math.max(max, (int) Math.ceil((bounds.getWidth() * covertToEmu)
/ (table.getTblGrid().getGridColList().get(j).getW())));
j++
}
covertToEmu is just a number...bounds.getWidth() is in 72 dpi and table.getTblGrid().getGridColList().get(j).getW() (the width) is in EMU. 72 dpi is just the pixels in inches...which is 72 pixels per inch. An EMU per inch is 914400.
So convertToEmu is 914400 / 72 = 12700.
The max is the number of "rows" it takes...the rest is kinda hard coded, but I split the list of data I have into sublists and add it to each slide. I know 20 rows is a good fit so if it gets higher than that I create a new list, to add to a new slide.
Also worth noting I am using CTTable, which you can get from a method in XSLFTable.

resource IDs in VC++

I define resource IDs as below:
#define _RESOURCE_ID 150
#define IDR_OPBUTTON _RESOURCE_ID + 10
When I use below code to change the text of button, it doesn't work:
SetDlgItemText(hWnd, IDR_OPBUTTON, _T("-"));
But if I give it a number directly, it does work:
#define IDR_OPBUTTON 160
Can anybody tell me why? Thanks in advance!
Also, I tried function GetDlgItemInt for a textbox, it has the same behavior.
Did you try to put parenthesis?
#define IDR_OPBUTTON (_RESOURCE_ID + 10)

Matlab - Using symbols in gscatter

Ok, so I'm trying to use gscatter to plot 8 different points in a figure. These 8 points are all different and thus I want to give them different symbols. I know that gscatter will automatically assign them different colors, but I also want to be able to use the figure in black and white. I have written the following code:
lincol = {'k';'k';'k';'k';'k';'k';'k';'k'};
linsym = {'+';'o';'*';'.';'x';'s';'d';'^'};
limits = [-1 1 -1 1];
close all
for i = 1:3;
figure(i); hold on
gscatter(RfootXdistpertRel(:,i),RfootYdistpertRel(:,i),lincol,linsym);
legend('Pert1', 'Pert2', 'Pert3', 'Pert4', 'Pert5', 'Pert6', 'Pert7', 'Pert8')
hline(0);
vline(0);
axis(limits);
end
According to the matlab syntax, I should be able to specify color and marker symbol in this way (gscatter(x,y,col,sym)). The variables used are 8 by 1 vectors, just as the lincol and linsym. However, it gives me an error:
Error using plot
Color value must be a 3 or 4 element vector
Can anyone help? It's just such a silly problem to have.
Luc
It seems that you have some errors in your code. The syntax for gscatter should include at least 3 parameters : x, y and group. It seems that group is missing.
Furthermore the definition of color and sym may be wrong. Try col = 'kkkkkkkk'; instead of lincol = {'k';'k';'k';'k';'k';'k';'k';'k'};.
I hope this helps.
Regards.
Jonay

jQuery Flot: Change xaxis when zooming

Is there a way I can get the x-axis to switch from showing hour, to e.g. week days, months .. when zooming out?
Currently my x-axis is configured as such:
xaxis: {
mode: "time",
minTickSize: [1, "second"],
timeformat: "%H:%M:%S",
}
My default the graph looks nice, but when I zoom out enough times, the labels on the xaxis just display "00:00". How can I change the timeformat so that the date is included also? E.g. Tue 27 00:00 or similar.
Here's an example of when the graph is zoomed out a lot (obviously I need to remote some datapoints to make it look smoother..)
You can add a date using the standard specifiers, like %Y-%m-%d. A full list can be found in the API docs under the Time Series Data section.
To get the format to update based on the range, i.e. show HMS when zoomed in but YMD when zoomed out, is trickier. You'll need to listen for the 'plotzoom' event and check the range to see whether the format needs to change. If so, use getOptions() to retrieve and update the plot's options, then call setupGrid & draw to redraw the plot using the new format.
I solved this by making a custom tickFormatter for the X-axis:
In your xaxis options put:
xaxis: {
mode: "time",
tickFormatter: customXAxisFormatter,
...
}
Then your customXAxisFormatter could be eg. :
function customXAxisFormatter(val, axis)
{
var d = new Date(val);
// If time difference is more than 24 hours
if ((axis.max - axis.min) > (24*3600*1000))
return d.strftime("%a<br>%H:%M");
else
return d.strftime("%H:%M");
}
I hope this helps :)

Resources