I am trying to delete a measure group A from the cube in C# using
//measureGroup is of type AS.MeasureGroup
measureGroup.Drop();
Since this measure group A exists in a many to many relationship in another measure group, how can I delete this relationship in c#. I want to drop this measure group and not drop the other measure groups as well.
Is there anything that I need to do before I drop the Measure Group?
Have you already tried it? In my opinion it should only affect the Dimensions which are using this many-to-many relationship. I.e. if you drop the intermediate MeasureGroup, you will not be able to get Results from the Many-To-Many dimension. If there are other dimensions using the target Measuregroup they should still be working. If you remove the target MeasureGroup and there are other dimensions related to the intermediate MeasureGroup, they too should still be functional.
But I must admit that I'm not really an expert when it comes to Analysis Services.
Maybe you post a short example of what you're trying to do?
Related
we have a cube browser using Microsoft.AnalysisServices.AdomdClient to get the data.
When we get MeasureGroups, we use
GetSchemaDataSet("MDSCHEMA_MEASUREGROUPS", restrictions)
We want to hide MeasureGroups without any Measures, but the only way we've found to do this is to do
GetSchemaDataSet("MDSCHEMA_MEASURES", restrictions)
for each MeasureGroup, and that takes a long time for our cubes.
Is there a way to get number of Measures already when we get the MeasureGroups?
Thanks!
We normal query the DMV like below to get the details of measures. i.e., query the $SYSTEM.MDSCHEMA_MEASURES DMV. This is usually very fast in our environment.
SELECT [MEASUREGROUP_NAME], [MEASURE_NAME], * FROM $SYSTEM.MDSCHEMA_MEASURES
ORDER BY [MEASUREGROUP_NAME]
More details in the very old blog:
https://bennyaustin.com/2011/03/01/ssas-dmv-queries-cube-metadata/
I have this common scenario of displaying comments with user details and I'm trying to figure out the best way to do this on Parse.
(Let's say we have a class comment: id, post, user and a class user: id, photo, name).
I was trying to do something like this that it isn't possible on Parse:
var userDetails = ParseObject.GetQuery("User");
var query = ParseObject.GetQuery ("Review")
.WhereEqualTo ("business", application.currentBusiness)
.WhereMatchesQuery ("user", userDetails);
It is not working because users is a Relation, let me explain more:
From what I have read on documentation there are 2 ways to have relations in parse. one with arrays and one with pointers.
Arrays are good when you want to include the whole object (in my case the user) but not for more than 100 results.
Pointers are better for a big database but in order to get for every comment the user details I will have to do one extra query.. that's a lot of queries...
So my options are those I think:
1) Retrieve the whole query with a full outer join with arrays
The problem with this is the speed if my app is getting bigger and bigger
2) Retrieve the whole query with a full outer join with relations
Many many queries. I will reach the parse.com limit of request/sec very fast.
3) Store the details I want in the comments class along the User_ID
This might be a good idea but I'm using Login with Facebook and after the login, the user photos will be updated if it has change since the last time, so if I want to use this idea I have to somehow disable the update of the photo.
4) Use arrays and retrieve only a certain number of comments each time.
This sounds like the best approach, I will get every time around 50 seconds and I can implement a ListView that will load more comments when we are reaching the end of the List.
What do you think guys? What do I have to do? Am I missing something here?
The best solution after all was to use Pointer for the User.
With the pointer and the .Include you can get the whole user object without doing many queries and without destroying the connection of the User class with the comments class by storing the whole User object on the Comment class, nice.
Also if someone want to know how to make a join with pointers and how to retrieve the object then here is q query to retrieve comment and photo:
var query = ParseObject.GetQuery ("Comments")
.WhereEqualTo ("Article", _article)
.Include ("user");
And here is how to access the photo
_user.photo = queryResult.Get<ParseObject>("user").Get<ParseFile>("profile_pic").Url;
I'm making an autocad plugin and i want to create a new entity that is a combination of a line and the text.If i select the line the text is selected and backwords when i delete the line delete the text etc etc.How to treat them as one object referencing eachother?Is this possible?
I recommend using groups. Below is a link on how to access groups, I'm sure that site has more information on creating groups.
Users can control whether objects are selected with the group based on the system variable, PICKSTYLE. you can use ctrl+ h to toggle the PICKSTYLE value.
http://adndevblog.typepad.com/autocad/2012/04/how-to-detect-whether-entity-is-belong-to-any-group-or-not.html
Another option - though it doesn't answer your question - and this is something for you to think about: is to create a new block which consists of the line and some text. The line can be an entity in your block, and the text can be a tag string value. the tag can be called "line_information".
I know this might be abit too late but there is a better more flexible way to do this, although it's not actually combining the two entities but rather more of a visual effect.
It's called using Overrules. Basically you change the way the entity is displayed. So instead of displaying a line, you can display a circle, or in your case display a text and a line.
Overruling is a very powerful tool, you can not only change how the entity looks but also add grips, remove grips, change how entity is highlighted or highlight other entities when your entity is highlighted, override some of the entity methods like erase and much more.
Best place to start from is Kean Walmsley's "Through the Interface" blog.
And here is a link to this blog related to what you want to achieve
http://through-the-interface.typepad.com/through_the_interface/2009/08/a-simple-overrule-to-change-the-way-autocad-lines-are-displayed-using-net.html
What is the best way to retrieve a "X" number of random records using Entity Framework (EF5 if it's relevant). The value of "X" will be set based on where this will be used.
Is there a method for doing this built into EF or is best to pull down a result set and then use a C# random number function to pull the records. Or is there a method that I'm not thinking of?
On the off chance that it's relevant I have a table that stores images that I use for different usages (there is a FK to an image type table). The images that I use in my carousel on the homepage is what I'm wanting to add some variety to...consequently how "random" it is doesn't matter to me much. I'm just trying to get away from the same six or so pictures always being displayed. (Also, I'm not really interested in debating/discussing storing images in a table vs local storage.)
The solution needs to be one using EF via a LINQ statement. If this isn't directly possibly I may end up doing something SIMILAR to what #cmd has recommended in the comments. This would most likely be a matter of retrieving a record count...testing the PK to make sure the resulting object wasn't null and building a LIST of the X number of object's PKs to pass to front end. The carousel lazy loads the images so I don't actually need the image when I'm building the list that will be used by the carousel.
Can you just add an ORDER BY RAND() clause to your query?
See this related question: MySQL: Alternatives to ORDER BY RAND()
I'm writing an application that I will use to keep up with my monthly budget. This will be a C# .NET 4.0 Winforms application.
Essentially my budget will be a matrix of data if you look at it visually. The columns are the "dates" at which that budget item will be spent. For example, I have 1 column for every Friday in the month. The Y axis is the name of the budget item (Car payment, house payment, eating out, etc). There are also categories, which are used to group the budget item names that are similar. For example, a category called "Housing" would have budget items called Mortgage, Rent, Electricity, Home Insurance, etc.
I need a good way to store this data from a code design perspective. Basically I've thought of two approaches:
One, I can have a "BudgetItem" class that has a "Category", "Value", and "Date". I would have a linear list of these items and each time I wanted to find a value by either date or category, I iterate this list in some form or fashion to find the value. I could probably use LINQ for this.
Second, I could use a 2D array which is indexed first by column (date) and second by row. I'd have to maintain categories and budget item names in a separate list and join the data together when I do my lookups somehow.
What is the best way to store this data in code? I'm leaning more towards the first solution but I wanted to see what you guys think. Later on when I implement my data persistence, I want to be able to persist this data to SQL server OR to an XML file (one file per monthly budget).
While your first attempt looks nicer, obviusly the second could be faster (depends on how you implement it). However when we are talking about desktop applications which are not performance critical, your first idea is definitely better, expecially because will help you a lot talking about maintaining your code. Also remember that the entity framework could be really nice in this situation
Finally if you know how to works with XML, I think is really better for this type of project. A database is required only when you have a fair amount of tables, as you explained you will only have 2 tables (budgetitem and category), I don't think you need a database for such a simple thing