Creating project file filters for VS2015+ with premake5? - premake

In our original solution, we have filters in our projects that allow us to sort files: "Source Files", "Header Files", etc.
I would like to reproduce this behaviour with premake 5. I'm able to create filters for sorting projects using group "..." but I'm unable to perform the same task inside a project.
Any ideas?

The call you're looking for is vpaths:
vpaths {
["Headers"] = { "**.h", "**.hpp" },
["Sources/*"] = {"**.c", "**.cpp"},
["Docs"] = "**.md"
}

Related

How to iterate elements list and map in Terraform

I want to create a folder structure in S3 with Terraform so that it defaults to all environments. The idea is to have structures similar to these:
locals {
folder = [
{
provider = "provider-1",
process = "batch-process",
final = ["people","cart"]
},
{
provider = "provider-1",
process = "online-process",
final = ["log","order"]
}]}
Bucket-1
provider-1
batch-process
people
cart
online-process
log
order
I managed to create a list with all the S3 directories I would like to have, but I know this is not the most efficient way.
I tried to follow some examples found here but they returned an error. What is the correct way to do this iteration without having to write the entire directory?

Spatial index type not set properly using .NET SDK

Using CosmosDb and the .NET SDK, I can't seem to get the spatial index set the way I'm telling it.
NOTE: I am not creating any spatial indexes when the collection is created. I am updating it separately.
I am setting it for a single SpatialType of Point, but it still creates a list of all spatial types.
Here's my code:
containerResponse.Resource.IndexingPolicy.IndexingMode = IndexingMode.Consistent;
containerResponse.Resource.IndexingPolicy.SpatialIndexes.Clear();
containerResponse.Resource.IndexingPolicy.Automatic = true;
containerResponse.Resource.IndexingPolicy.SpatialIndexes
.Add(
new SpatialPath
{
Path = "/*",
SpatialTypes = { SpatialType.Point }
}
);
await Client.GetContainer(database, collection).ReplaceContainerAsync(containerResponse.Resource);
When I check the result in Azure Portal Data Explorer, I see this:
"spatialIndexes": [
{
"path": "/*",
"types": [
"Point",
"LineString",
"Polygon",
"MultiPolygon"
]
}
],
I can manually override it in the portal, but I'm trying to automate this.
Any idea what I'm doing wrong?
If it doesn't make any difference, then fine. Maybe someday I'll find another use for all those other spatial indexes, but I still don't know why it's not working.
This is expected behavior but it's not currently documented. This is being addressed now.
Bottom line these other spatial types will have no impact on cost or performance.

Can I create additional axes/dimensions in Premake?

Premake 5 gives you two functions to separate independent configuration variables in your projects: configurations and platforms. So for example, you might have:
configurations { "Debug", "Release" }
platform { "Windows", "Linux" }
The documentation refers to these as axes, which is a good way to describe them, since you can have independent settings for each axis:
Really, platforms are just another set of build configuration names, providing another axis on which to configure your project.
But what if I want another axis? For example, the data types used for particular calculations:
calctypes { "Long", "Default", "Short" }
Can I create this new axis, and if so, how?
I think tags (a new feature due to be released in the next alpha build) might be what you're looking for. Here is an example from the pull request where they were implemented:
workspace 'foobar'
configurations { 'release-std', 'debug-std', 'release-blz', 'debug-blz' }
filter { 'configuration:*-std' }
tags { 'use-std' }
filter { 'configuration:*-blz' }
tags { 'use-blz' }
project 'test'
filter { 'tags:use-blz' }
includedependencies { 'blz' }
defines { 'USE_BLZ' }
filter { 'tags:use-std' }
defines { 'USE_STD' }
Update: If you would like to see how to add custom fields (e.g. defines, configurations, etc.), have a look at the api.register() calls in _premake_init.lua. To see how to enable filtering on one of these fields, have a look at this pull request.
While adding new fields is trivial and can be done anywhere, we need to do some work before it will be as simple to enable those fields for filtering.

Firebase data Structure

Im trying to develop little todo app using firebase and angular. Im struggling a bit with the structure of the data since Im not used of not dealing with arrays.
The "random letters" are the unique id generated by $push() in firebase. Would this be a correct way of structuring my data in firebase?
There is no such thing as "the correct way", unless we go through all of your use-cases. That said: your approach sounds reasonable.
I would make one change thought and change your data structure to:
{
"lists": {
"jhgyftdr": {
"feref3f344f":"Item 1",
"fewfw4":"Item 2"
}
},
"users":{
"user1":{
"name":"john doe"
"lists":
"jhgyftdr": true
}
}
}
So this simply uses the (push-generated) name() under users -> lists.
With this structure you could load the lists for a user with something like this:
var ref = new Firebase('https://your.firebaseio.com/');
ref.child('users/user1/lists').on('value', function(lists) {
lists.forEach(function(listSnapshot) {
ref.child('lists/'+listSnapshot.name()).once('value', function(listSnapshot) {
console.log(listSnapshot.val());
});
});
});
Please don't include screenshots of text. I had to now go and capture your data; time which I could've spent answering questions.

pre-populating app settings witha meteor collection

I'm trying to get my head around the way meteor work.
I'm building a site prototype and I'd like to pre-populate it with data like site.title, site.logo, site.contact.number etc...
I've created a Settings collection:
Settings = new Meteor.Collection('settings');
Settings.insert(
{
logo: 'test logo',
contact: {
human: '01 01 01 01 01',
machine: '0101010101'
}
}
)
is it possible in the html markup to then retrieve this data across templates, as Meteor is subscribed to the collection?
I'm trying to do things like:
{{settings.logo}}
<a href="{{settings.contact.machine}}" class="logo url" rel="me" {{settings.contact.human}}</a>
Meteor is running on auto publish at the moment so I'm not sure if I need to do something in my main.js file. Can Meteor access all values automatically? at the moment it prints [object,object]
update
I've created a settings.json file:
{
"public" : {
"logo" : "my fancy company name",
"contact" : {
"human" : "01 01 01 01 01 ",
"machine" : "0044101010101"
}
}
}
Then I changed my Handlebars.registerHelper to
Handlebars.registerHelper('view', function(){
return Meteor.settings.public
});
I can now access all of the settings without creating a Collection for them, much more easily.
cheers
Your approach is wrong on several levels.
The handlebar expression {{settings.contact.machine}} will insert *currentContextObject*.settings.contact.machine into the HTML, where *currentContextObject* is the template's data context.
What is your template's data context? I don't know but it doesn't matter because settings.contact.machine won't make sense either way. Settings is a collection of documents but you are trying to use it as if it were a single object.
What would work in JS is Settings.findOne().contact.machine. To access this setting across templates you would need to create a global template helper like e.g.:
if (Meteor.isClient) {
Handlebars.registerHelper("getMachineContact", function() {
return Settings.findOne().contact.machine;
});
}
Then you could use {{getMachineContact}} in your HTML.
Still this solution wouldn't be nice and you should probably be using Meteor.settings instead of a Settings collection for solving your use case.
Similar to here you could then create a global template helper that returns arbitrary values from Meteor.settings given their path, meaning you could for example write {{getSetting "contact.machine"}}. This approach would involve converting a string in dot notation ("contact.machine") into an object reference so this question might be useful.

Resources