Is there a way to write data attributes in zen coding? - emmet

I use data attributes more every day, and I really miss a simple way to add a data attribute while using zen coding. I mean I can add inline style (not that I ever use it)
div[style=color:red;]
why can't I add data attribute like
div[data-color=pink]
Any work arounds?

you can:
div[data-color='pink']

I use div[data-color=pink] and it works.
Both div[data-color="pink"] and div[data-color='pink'] don't.

Related

Dynamically changing style without using Dynamic Resource?

I want to define 2 styles, 1 for high end and 1 for low end. On initial app run, system determines which one to use.
I'm thinking how to implement this. I read about DynamicResource but also know about performance considerations using it (since I'm also targeting low end devices). This is a main style used by buttons through the app.
Is it possible to use Binding of the style? Something like Bind a static variable?
What would be the best approach for this?
Thank you!
You might want to look into TemplateSelector, it might help:
Here's an example...
http://www.jerriepelser.com/blog/3-ways-dynamic-data-templates

Using a DelegatingStyledCellLabelProvider with an ITableLabelProvider

I am trying to style specific cells in my table that have a specific attribute. I have used a DelegatingStyledCellLabelProvider in the past for a Tree structure, and was hoping to do the same here.
However, I can't figure out how to get it working with my ITableLabelProvider.
I saw questions like this one that suggested using IColumnLabelProviders instead of the ITableLabelProvider, but I really don't want to go back and change my code.
Is there anything I can do?
DelegatingStyledCellLabelProvider will not work with the old style ITableLabelProvider as it does not support multiple columns. You must use separate column label providers.

How to use XBaseInterpreter in Xtext?

can someone tell me, how i can use "xbaseinterpreter"? I have no idea :(
I have written a DSL used to define simple protocol-structure for a sensornet, the goal of the work is to check if a data-message(as Instance) belongs to any user-defined structure. I want to use an interpret to analyze the user-defined structure and write the corresponding information into my database directly. I thought, xbaseinterpreter is just the one i can use, but i could not find much more useful information about it.
can one use the inferred JvmModel in the interpreter?How?
Thank you
See the tortoise language as a working example of how to use xbase and the interpreter.
http://eclipse.org/Xtext/documentation/208_tortoise.html

Qt QAbstractModel looking for data

I have my own QAbstractTableModel connected to SQLite. I get data from database and write it to my list by column name. I don't want handle to my table by SQL query when I'm looking for data.
What do you think about? Is it normal?
Please give me some advice.
To search the data in a model you can use QSortFilterProxyModel. You set your model as source model for the proxy model, and display the proxy model in a "search results" view.
You can use setFilterRegExp() and setFilterKeyColumn() to specify for instance the name you are looking for and your "name" column. You can also subclass it if you want more complex filtering. There is an example in the doc.
No, QtSQL module doesn't provide any ORM, so you have to write SQL queries on your own.
However, you can use QSortFilterProxyModel (or subclass it, or even put filtering code in your subclass of QAbstractTableModel) for searching/filtering. But I advise you not to do so, because relational databases may (and with high probability will) optimize your search.

List all context keys in a velocity template

Is there a way to list all keys in a velocity context from the template that is currently being expanded? I've done this in the past by including a reference to the context in the context. I guess this method is okay, but I'm wondering if there's a better way to do it.
That's the traditional way, and there is nothing wrong with it. If you are using VelocityTools, you can use the ContextTool to accomplish that and a bit more.