How to override span-columns at different breakpoint in SUSY - susy-compass

I think I must be missing something fundamental with how susy works, and the documentation has too few examples to understand how this works.
I want different layouts at different breakpoints. I can make it that far, but I want my elements to span different number of columns depending on what breakpoint is triggered. So if I have a general stylesheet for mobile ('mobile-first') like:
.wrapper{
.element1{
#include span-columns(4);
}
.element2{
#include span-columns(2 omega);
}
}
But once the width changes to my 'tablet' and it changes to an 8 column layout, I want to be able to change this to:
#include at-breakpoint($tablet-break $tablet-layout){
.wrapper{
#include set-container-width;
.element1{
#include span-columns(5);
}
.element2{
#include span-columns(3 omega);
}
}
}
It seems like this not only doesn't 'overwrite' the mobile settings, but it appears, upon firebug inspection, that the elements do not match up with my new tablet columns. I think it is still using a 6 column layout. Adding #include set-container-width doesn't seem to fix the problem; however, if I comment out the mobile layout it works. So it's almost as if these include statements don't overwrite, so I think I'm not understanding how susy works. Here's an example of firebug showing the element not matching the layout:
(Also I'm not sure of any SUSY best practices (except for don't nest more than 4 deep). I could define all my sass with nested #at-breakpoint statements for all my changes, or I could define my default (mobile) css and then create a separate sass block all nested within at-breakpoint. I don't know if this is causing a problem.)
UPDATE
It appears, that if I include at-breakpoint includes after the original (mobile) declaration, it seems to work. Though it does seem to require code repetition:
.element1{
#include span-columns(2 omega);
text-indent: -1em;
text-align: center;
#include at-breakpoint($tablet-break $tablet-layout){
#include span-columns(3 omega);
text-indent: 0;
text-align: left;
}
#include at-breakpoint($desktop-break $desktop-layout){
#include span-columns(3 omega);
text-indent: 0;
text-align: left;
}
}

Related

Adding a new system call Linux 5-9.8 and make it appear on boot screen

I'm trying to add a new system call to linux -5.9.8 for this I've been following this tutorial from a prev question and this one and this from a guide they are both really similar and everything does work as intended BUT to get the system call to show with dmesg we get to compile the following code after boot up:
#include <linux/kernel.h>
#include <sys/syscall.h>
#include <stdio.h>
#include <unistd.h>
#include <string.h>
#include <errno.h>
#define __NR_identity 440
long identity_syscall(void)
{
return syscall(__NR_identity);
}
int main(int argc, char *argv[])
{
long activity;
activity = identity_syscall();
if(activity < 0)
{
perror("Sorry. Your system call appears to have failed.");
}
else
{
printf("Congratulations! Your system call is functional. Run the command dmesg in the terminal and find out!\n");
}
return 0;
}
This code does in fact add the message to dmesg but it does it after boot up and I need to run the code everytime, how should I go to actually make my system call appear on the boot up screen and not later, what file should I edit to make it happen?
If the goal is to merely display some sort of message at system startup time, you don't need a system call but rather a kernel module statically linked or dynamically loaded.
In the file where you define the system call, you can add an "init" routine which will be called by the kernel at startup. To make it, the kernel build chain uses "__init" section identifier to gather all the initialization entry points into a dedicated section. Then, in the boot procedure, all the functions from this section are called. You can try something like the following from your example (I didn't tried it !):
#include <linux/kernel.h>
#include <linux/syscalls.h>
SYSCALL_DEFINE0(identity)
{
printk("I am Jihan Jasper Al-rashid.\n");
return 0;
}
void __init identity_entry(void)
{
printk("Boot message from identity\n");
}

How to rotate a Qt5 application using the linux framebuffer?

I have an embedded linux application running directly on the linux framebuffer (no x-Windows). We now have to physically rotate the display 180 degrees. How do I get my Qt application to rotate so it doesn't appear upside down? I saw reference to using the following option:
-platform linuxfb:fb=/dev/fb0:rotation:180
However, the rotation option seems to be ignored.
Using Qt 5.9.2 on Ubuntu server 16.04.6
You could handle it on application level. With QML thats easy, but with QWidgets the best I could come up with is to render the Widget on a QGraphicsScene and rotate it like this:
#include "mainwindow.h"
#include <QApplication>
#include <QGraphicsScene>
#include <QGraphicsView>
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
MainWindow w;
QGraphicsScene *scene = new QGraphicsScene();
QGraphicsView *view = new QGraphicsView();
view->setGeometry(w.geometry());
view->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
view->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
scene->addWidget(&w);
view->setScene(scene);
view->show();
view->rotate(180);
//w.show();
return a.exec();
}
It seems a bit glitchy, but you could give it a try.
Also I think the correct syntax is -platform linuxfb:fb=/dev/fb0:rotation=180 note the = instead of :
Edit: but that did not make a difference for me either.

Is it possible to pass a value of 0 to span(0)?

Long tried to create a responsive navigation. But still turned out.
But I'm still not sure I did the right thing. Because I passed a value of 0 in the span. Or so it is still possible to do? It works :)
$big: (columns: 24, gutters: 1/2,math: fluid,gutter-position: split )
#include susy-breakpoint(700px, $big)
.nav-item // is ui>li.nav-item
#include span(0 border-box)
No, this is not a proper way to use Susy. If you look at the output, you will see that you get width: -1.38889%; which is not valid CSS. It works because browsers ignore invalid code - but it's not a good idea, and it's not a meaningful use of Susy.
The only grid-output you need is gutters, so that's all you should ask Susy for. The rest you can do with plain css:
.nav-item {
#include gutters;
box-sizing: border-box;
float: left;
}

Susy and device-pixel-ratio

I haven't seen anything about this in Susy's documentation, but is there a means for adding device pixel ratio to Susy's generated media queries? Or is this something that requires customizing the at-breakpoint mixin?
Susy's at-breakpoint is really just a shortcut for the simplest mix/max media-queries. For more powerful media-queries, I recommend the breakpoint plugin. You can use that in conjunction with Susy's layout mixin to re-create the at-breakpoint effect:
#include breakpoint($your-advanced-media-queries) {
#include layout($your-desired-column-count) {
// your styles
}
}

How to disable warnings 4510 and 4610 from std::list class?

I have a bunch of warnings C4510 and C4610 when I use std::list with my class. It is a warning stating that default constructor is not available, and I want to disable them.
When I put:
#pragma warning(disable: 4510)
inside .cpp file that is instantiating this list nothing happens.
I tried placing this pragmas around function where I instantiate lists and even on top of the .cpp file but the results are the same - nothing happens. It only works if I disable warnings in properties dialog of .cpp file. I hate hiding stuff in properties like that because they get overlooked by developers. I would like to have them localized around the function. Is there something I could do about this?
EDIT:
Ok. This is how my code basically looks like. This code generates warnings 4510 and 4610 on warning level 4:
#include <list>
class foo {
public:
foo(int) { }
};
class bar {};
class problem_class {
foo m_foo;
const bar *m_bar;
public:
problem_class(const foo &_foo, const bar *_bar) : m_foo(_foo), m_bar(_bar) { }
};
void problem_fn(std::list<problem_class> &problem_collection) {
foo _foo(3);
problem_collection.clear();
problem_collection.push_back(problem_class(_foo, new bar));
}
int main(int , char **)
{
std::list<problem_class> collection;
problem_fn(collection);
return 0;
}
Instead of hiding the problem by disabling warnings, how about wrapping your class w/o a default constructor in a proxy class that does have a default constructor*. The proxy's default constructor can then do the proper initialization of the wrapped class. Then store the proxy class in the std::list. This would make your intent clear and eliminate the warning.
*assuming you can't for whatever reason actually make the wrapped class have an appropriatte default constructor.
Include #pragma before including <list>
#pragma warning (disable:4510)
#pragma warning (disable:4610)
#include <list>
You need to post some code that illustrates exactly what you are doing. Warning C4510 says:
The compiler cannot generate a default
constructor for the specified class
and no user-defined constructor was
created. You will not be able to
create objects of this type.
This doesn't seem to have anything to do with std::list, so it maybe that there is something wrong with your code.
I know this is not very helpful, but the code you posted looks fine to me and compiled with no warnings with g++ and comeau. I don't use VC++ anymore, so can't reall help further, I'm afraid.
Further Edit: Purely in the spirit of experimentation, what happens if you change:
const bar *m_bar;
to
bar *m_bar;
The MSDN docs for this warning say that:
There are several situations that
prevent the compiler from generating a
default constructor, including:
* A const data member.
Now the m_bar member isn't const (the thing it points to is) but I wonder if the compiler is a little confused about this.
#pragma warning (disable : 4510 4610)
#pragma warning (push, 3)
#include <list>
#pragma warning (pop)
#pragma warning (default : 4510 4610)
Ok, found it.
My project uses precompiled headers so in some header file that is included from StdAfx.h someone included list. When I added #pragma directives on top of the StdAfx.h everything worked. The thing that confused me is that when I added #pragma in .cpp file in front of
#include "StdAfx.h"
nothing worked (warnings were still displayed). Since list was included in precompiled headers, it had the same warning settings no matter what the .cpp file specified later on.
But, the strange thing is that even if I could not override settings in .cpp file, I could override them by specifying compile properties for that same file. How is that any different?

Resources