Search Results

Search found 17924 results on 717 pages for 'z order'.

Page 75/717 | < Previous Page | 71 72 73 74 75 76 77 78 79 80 81 82  | Next Page >

  • add method to reflection-object and named-scopes

    - by toy
    I Like to add a method to my has_many relation in the way that it is applyed on the relation object. I got an Order wich :has_many line_items I like to write things like order.line_items.calculate_total # returns the sum of line_items this I could do with: :has_many line_items do def calculate_total ... end end but this would not be applyed to named_scopes like payalbes_only: order.line_items.payables_only.calculate_total here calculate total would receive all line_items of order and not the scoped ones from payables_only-scope. My log tells me that the paybles_only scope is even not applied to the sql.

    Read the article

  • Silverlight MediaElement issue

    - by George2
    Hello everyone, I am using Silverlight 3.0 + .Net 3.5 + VSTS 2008 + C# to develop a simple video application using MediaElement of Silverlight. I have two videos and I want to play them at the same time (similar to picture in picture effect) -- i.e. a part of the two videos are overlapped when they are playing (the same concept of Z-Order in UI design). I want to play one MediaElement on top of the other MediaElement, and I am wondering how to assign the overlap order (similar to set Z-Order UI element, but I did not find MediaElement has Z-Order property)? thanks in advance, George

    Read the article

  • Windows Mobile : How to bind dropdown's selectedvalue to a column in table A and the list data to a

    - by Rob
    Hi, I am trying to learn the basics of Windows Mobile development against SQL CE and have come across a basic problem. I have two tables. One called Customers that stores customer info and has an identity column called ID as the primary key. The other table is called Orders which has a column called CustomerID (the FK constraint is present). I have added a DataSet to the project that contains both tables and have autogenerated the edit/view forms. This has produced a text control for the CustomerID column in the Order table for the new/edit form and I deleted it and replaced it with a dropdown list. Then, using the 'Advanced' databinding options (in Properties) I set the datasource of the list to the Customers table setting the value to the ID field and the text to the CustomerName field. I then set the SelectedValue of the list box to the CustomerID field of the Orders dataset. So far so good. When I run the app in the emulator and view the 'New' form for Orders the Customer dropdown is indeed populated with a list of customer names and I can select one and happily create a new order successfully. This is confirmed when I see the order appear in the Orders Grid form. However, when I then click on the order in the grid and then select 'Edit' the order loads but the dropdown always shows the first customer in the list and doesn't seem to bind the SelectedValue to the Orders dataset CustomerID field. Now I am an ASP.NET guy and normally hand craft the DAL and it's binding to the UI so I'm not entirely sure where to look to investigate what is going wrong here as this is all generated code. I am sure it is something very trivial but any pointers would be appreciated. My gut feeling is that the SelectedValue and the Customers.CustomerID values do not match for some reason? Many thanks, Rob.

    Read the article

  • Remove another user's lock obtained with sp_getapplock on SQL Server

    - by joshperry
    We have a system that uses sp_getapplock to create an exclusive mutex any time someone opens an order in the GUI. This is used to prevent multiple people from making changes to an order simultaneously. Sometimes people will open an order and go home, leaving it open. This effectively blocks anyone from being able to make changes to the order. I then get emails, calls and end up doing a kill <spid> in enterprise manager. Obviously I've gotten sick of this and want to make a quick self-service webform. The main problem I've run into is that kill requires sysadmin privileges, which I do not want to give to the user that the our website runs as. I have tried sp_releaseapplock but this doesn't let you release another user's lock (even when calling it as a sysadmin). So, finally my question; does anyone know of an alternative method to release a lock that was obtained by another user using sp_getapplock?

    Read the article

  • Distributed Message Ordering

    - by sbanwart
    I have an architectural question on handling message ordering. For purposes of this question, the transport is irrelevant, so I'm not going to specify one. Say we have three systems, a website, a CRM and an ERP. For this example, the ERP will be the "master" system in terms of data ownership. The website and the CRM can both send a new customer message to the ERP system. The ERP system then adds a customer and publishes the customer with the newly assigned account number so that the website and CRM can add the account number to their local customer records. This is a pretty straight forward process. Next we move on to placing orders. The account number is required in order for the CRM or website to place an order with the ERP system. However the CRM will permit the user to place an order even if the customer lacks an account number. (For this example assume we can't modify the CRM behavior) This creates the possibility that a user could create a new customer, and place an order before the account number gets updated in the CRM. What is the best way to handle this scenario? Would it be best to send the order message sans account number and let it go to an error queue? Would it be better to have the CRM endpoint hold the message and wait until the account number is updated in the CRM? Maybe something completely different that I haven't thought of? Thanks in advance for any help.

    Read the article

  • shopping cart to email

    - by marc-andre menard
    I use simplecartjs to make a shopping cart on my website where you can select element and send it to your cart... next step, will be the checkout process, but for business reason, no checkout process will append, and a simple form with name and email and date for order pickup will be ask. Now the order must be send to an email address (at the company) that will fullfill the order. The question : how to send the content of the cart to an email body or as attachement ?

    Read the article

  • NSFetchedResultsController sections localized sorted

    - by Gerd
    How could I use the NSFetchedResultsController with translated sort key and sectionKeyPath? Problem: I have ID in the property "type" in the database like typeA, typeB, typeC,... and not the value directly because it should be localized. In English typeA=Bird, typeB=Cat, typeC=Dog in German it would be Vogel, Katze, Hund. With a NSFetchedResultController with sort key and sectionKeyPath on "type" I receive the order and sections - typeA - typeB - typeC Next I translate for display and everything is fine in English: - Bird - Cat - Dog Now I switch to German and receive a wrong sort order - Vogel - Katze - Hund because it still sorts by typeA, typeB, typeC So I'm looking for a way to localize the sort for the NSFetchedResultsController. I tried the transient property approach, but this doesn't work for the sort key because the sort key need to be in the entity. I have no other idea. But I can't believe that's not possible to use NSFetchedResultsController on a derived attribute required for localization? There are related discussions like http://stackoverflow.com/questions/1384345/using-custom-sections-with-nsfetchedresultscontroller but the difference is that the custom section names and the sort key have probably the same order. Not in my case and this is the main difference. At the end I would need a sort order for the necessary NSSortDescriptor on a derived attribute, I guess. This sort order has also to serve for the sectionKeyPath. Thanks for any hint.

    Read the article

  • Sort and Group in LINQ

    - by Jono
    I apologise in advance if this has been answered before; it seems so fundamental to me yet I haven't turned up the answer in any of my searches. I have a list of string tuples, say (P1,P2) I'd like to know if there's a LINQ statement where I could group by P1 (in ascending order), and have that group contain all the P2 values for the group (in descending order). For input: ("A","B"), ("A","C"), ("D","B") I'd like to get two groups: "A" and "D" (in that order, every time) where group "A" contains "C" and "B" (in that order, every time) and group "D" contains, well, "B". Is this possible with the built-in LINQ classes or do I need to iterate the groups and sort them myself? Sounds like hard work~

    Read the article

  • Threads in Java

    - by owca
    I've created simple program to test Threads in Java. I'd like it to print me numbers infinitely, like 123123123123123. Dunno why, but currently it stops after one cycle finishing 213 only. Anyone knows why ? public class Main { int number; public Main(int number){ } public static void main(String[] args) { new Infinite(2).start(); new Infinite(1).start(); new Infinite(3).start(); } } class Infinite extends Thread { static int which=1; static int order=1; int id; int number; Object console = new Object(); public Infinite(int number){ id = which; which++; this.number = number; } @Override public void run(){ while(1==1){ synchronized(console){ if(order == id){ System.out.print(number); order++; if(order >= which){ order = 1; } try{ console.notifyAll(); console.wait(); } catch(Exception e) {} } else { try{ console.notifyAll(); console.wait(); } catch(Exception e) {} } } try{Thread.sleep(0);} catch(Exception e) {} } } }

    Read the article

  • is there a way to get a "subtree" from hclust ? (R)

    - by Tal Galili
    Hello all, I wish to create a "subtree" from an hclust object. For example, let's say I have the following object: a <- list() # initialize empty object a$merge <- matrix(c(-1, -2, -3, -4, 1, 2, -5,-6, 3,4), nc=2, byrow=TRUE ) a$height <- c(1, 1.5, 3,4,4.5) # define merge heights a$order <- 1:6 # order of leaves(trivial if hand-entered) a$labels <- 1:6# LETTERS[1:4] # labels of leaves class(a) <- "hclust" # make it an hclust object plot(a) # look at the result Now I wish the extract from it the following subtree: a <- list() # initialize empty object a$merge <- matrix(c(-1, -2, -3, -4, 1, 2 ), nc=2, byrow=TRUE ) a$height <- c(1, 1.5, 3) # define merge heights a$order <- 1:4 # order of leaves(trivial if hand-entered) a$labels <- 1:4# LETTERS[1:4] # labels of leaves class(a) <- "hclust" # make it an hclust object plot(a) # look at the result How could I access it? (I know that cutree could get me the objects of the sub tree, but not create an actual hclust object) Thanks for any help, Tal

    Read the article

  • MVC: Submit one form from a page with multiple forms

    - by Rob
    I'm working in an ASP.NET 3.5 MVC application where i've got a view with multiple forms in it. Form 1 contains information about products and will form a shoppingcart with a remove button. Form 2 is as below and is to be used to get the information from the shoppingcart and create an order of it. <% using (Html.BeginForm()) { %> <%=Html.Hidden(Order.ProductId", "E63EF586-F625-4C8D-B82E-E63A6FA4A63C")%> <%=Html.Hidden(Order.Amount", 1)%> <input type="submit" value="Pay" /> <%} % The first form contains a similar beginform with a foreach loop to get the information about the products from the model. When i use the submit button on the second form everything seems to be submitted and the action in the controller for the first form is trying to handle the request. That is where the error occurce because the information in the viewmodel isn't corresponding to what is being expected. The controller which is trying to handle the request: [AcceptVerbs(HttpVerbs.Post)] public ActionResult ShowShoppingcartForm([Bind(Prefix = "Order")] MyViewmodel viewModel) { //.. } The controller which is expected to handle the request: [AcceptVerbs(HttpVerbs.Post)] public ActionResult SaveOrder([Bind(Prefix = "Order")] MyViewmodel viewModel) { throw new NotImplementedException(); }

    Read the article

  • Silverlight RIA Services - Showing columns from multiple tables

    - by Villager
    Hello, I have been evaluating Silverlight and .NET RIA Services for my company. I am trying to decide if it is right for us. For the most part, I like it. But, I see one item that I am surprised that I cannot do easily. Because of this, I'm guessing I'm doing some thing wrong. To demonstrate, I have two database tables: Order ----- ID CustomerID OrderDate OrderNumber Customer -------- ID FirstName LastName Address When I create my Domain Service class, I select both of these tables. On the Silverlight application, I drag-and-drop the Order entity from the Data Sources page to my Silverlight page. When I do this, a DataGrid is added with all of the properties in the Order entity. In reality though, I would like the DataGrid to show: Order.OrderNumber Order.OrderDate Customer.FirstName Customer.LastName Because this information is spread across multiple tables, I'm not sure how to use RIA Services to show them in my Silverlight application. What is the recommended way to do this? Should I add a view in my database? Can I do it without touching the database? Thank you,

    Read the article

  • Commutative (operational transform) diffs for databases

    - by barrycarter
    What Unix program generates "diff"s between text files (or INSERT/UPDATE/DELETEs for databases) in such a way that the order that the "diff"s are applied in is irrelevant, and the result is the same regardless of order. Etherpad used to do something like this. Example (for a given document or database): % Adam makes a change X, then Bob makes a change Y, then Adam makes another change Z. % However, because of network latency, Adam sees the changes in this order: XZY, while Bob sees them in this order: YXZ. % However, the code/changes are written so that XYZ and YXZ yield the same result. Note: ideally, this can be done without having to do X/Y/Z inverse at any point. I have read http://stackoverflow.com/questions/2043165/operational-transformation-library but I'm not sure this really does what I want.

    Read the article

  • problem with jquery sortable of ul with childrens - how to allow li to be sorted only on the same le

    - by Y.G.J
    $(document).ready(function() { $("#test-list").sortable({ items: "> li", handle : '.handle', axis: 'y', opacity: 0.6, update : function () { var order = $('#test-list').sortable('serialize'); $("#info").load("process-sortable.asp?"+order+"&id=catid&order=orderid&table=tblCats"); } }); $("#test-sub").sortable({ containment: "ul", items: "li", handle : '.handle2', axis: 'y', opacity: 0.6, update : function () { var order = $('ul').sortable('serialize'); $("#info").load("process-sortable.asp?"+order+"&id=catid&order=orderid&table=tblCats"); } }); }); <ul id="test-list"> <li id="listItem_10">first<img align="middle" src="Themes/arrow.png" class="handle" /></li> <li id="listItem_8">second<img align="middle" src="Themes/arrow.png" class="handle" /> <ul id="test-sub"> <li id="listItem_4><img align="middle" src="Themes/arrow.png" class="handle2" /></li> <li id="listItem_3"><img align="middle" src="Themes/arrow.png" class="handle2" /></li> <ul id="test-sub"> <li id="listItem_9"><img align="middle" src="Themes/arrow.png" class="handle2" /></li> </ul> </li> </ul> </li> </ul> the problems i have: sorting the main ul is working but not all the time - i will try to fix that my own but if there is a problem with the code here and not the one in proccess-sortable - tell me. moving li in the main ul is ok but the sub or the sub of the sub is having problem - i can drag something from one sub to it's sub or the other way too - i don't want that to happend. i want to be able to drag li and by selecting that one that only this ul group will send to proccess-sortable to be updated - how can i catch the specific ul of li i am draging?

    Read the article

  • WPF ComboBox Binding

    - by MadSeb
    Hi So I have the following model: public class Person { public String FirstName { get; set; } public String LastName { get; set; } public String Address { get; set; } public String EMail { get; set; } public String Phone { get; set; } } public class Order { public Person Pers { get; set;} public Product Prod { get; set; } public List<Person> AllPersons { get; set; } public Order(Person person, Product prod ) { this.Pers = person; this.Prod = prod; AllPersons = database.Persons.GetAll(); } } And I have a WPF window used to edit an order. I set the DataContext to Order. public SetDisplay(Order ord) { DataContext = ord; } I have the following XAML: <ComboBox Name="myComboBox" SelectedItem = "{Binding Path=Pers, Mode=TwoWay}" ItemsSource = "{Binding Path=AllPersons, Mode=OneWay}" DisplayMemberPath = "FirstName" IsEditable="False" /> <Label Name="lblPersonName" Content = "{Binding Path=Pers.FirstName}" /> <Label Name="lblPersonLastName" Content = "{Binding Path=Pers.LastName}" /> <Label Name="lblPersonEMail" Content = "{Binding Path=Pers.EMail}" /> <Label Name="lblPersonAddress" Content = "{Binding Path=Pers.Address}" /> However, the binding does not seem to work.......When I change the selected item , the labels do not update .... Regards!! Any reply is appreciated !!

    Read the article

  • How to save timers with connection to OrderId?

    - by Adrian Serafin
    Hi! I have a system where clients can make orders. After making order they have 60 minutes to pay fot it before it will be deleted. On the server side when order is made i create timer and set elapsed time to 60 minutes System.Timer.Timers timer = new System.Timers.Timer(1000*60*60); timer.AutoReset = false; timer.Elapsed += HandleElapsed; timer.Start(); Because I want to be able to dispose timer if client decides to pay and I want to be able to cancel order if he doesn't I keep two Dictionaries: Dictionary<int, Timer> _orderTimer; Dictionary<Timer, int> _timerOrder; Then when client pay's I can access Timer by orderId with O(1) thanks to _orderTimer dictionary and when time elapsed I can access order with O(1) thanks to _timerOrder dictionary. My question is: Is it good aproach? Assuming that max number of rows I have to keep in dictionary in one moment will be 50000? Maybe it would be better to derive from Timer class, add property called OrderId, keep it all in List and search for order/timer using linq? Or maybe you I should do this in different way?

    Read the article

  • sorting nested list, allow only li to be sorted witin the same ul

    - by Y.G.J
    what i want to achive is: sorting the main ul is working but not all the time - i will try to fix that my own but if there is a problem with the code here and not the one in proccess-sortable - tell me. moving li in the main ul is ok but the sub or the sub of the sub is having problem - i can drag something from one sub to it's sub or the other way too - i don't want that to happend. i want to be able to drag li and by selecting that one that only this ul group will send to proccess-sortable to be updated - how can i catch the specific ul of li i am draging? $(document).ready(function() { $("#test-list").sortable({ items: "> li", handle : '.handle', axis: 'y', opacity: 0.6, update : function () { var order = $('#test-list').sortable('serialize'); $("#info").load("process-sortable.asp?"+order+"&id=catid&order=orderid&table=tblCats"); } }); $("#test-sub").sortable({ containment: "ul", items: "li", handle : '.handle2', axis: 'y', opacity: 0.6, update : function () { var order = $('ul').sortable('serialize'); $("#info").load("process-sortable.asp?"+order+"&id=catid&order=orderid&table=tblCats"); } }); }); this is the html part <ul id="test-list"> <li id="listItem_10">first<img align="middle" src="Themes/arrow.png" class="handle" /></li> <li id="listItem_8">second<img align="middle" src="Themes/arrow.png" class="handle" /> <ul id="test-sub"> <li id="listItem_4><img align="middle" src="Themes/arrow.png" class="handle2" /></li> <li id="listItem_3"><img align="middle" src="Themes/arrow.png" class="handle2" /></li> <ul id="test-sub"> <li id="listItem_9"><img align="middle" src="Themes/arrow.png" class="handle2" /></li> </ul> </li> </ul> </li> </ul>

    Read the article

  • nhibernate : mapping to column other than primary key

    - by frosty
    I have the following map. My intention is for the order.BasketId to map to orderItem.BasketId. Tho when i look at the sql i see that it's mapping order.Id to orderItem.BasketId. How do i define in my order map which order property to map against basketId. It seems to default to the primary key. <property name="BasketId" column="Basket_ID" type="Int32"/> <set name="OrderItems" table="item_basket_contents" generic="true" inverse="true" > <key column="Basket_ID" /> <one-to-many class="EStore.Domain.Model.OrderItem, EStore.Domain"/> </set>

    Read the article

  • How can I optimize retrieving lowest edit distance from a large table in SQL?

    - by Matt
    Hey, I'm having troubles optimizing this Levenshtein Distance calculation I'm doing. I need to do the following: Get the record with the minimum distance for the source string as well as a trimmed version of the source string Pick the record with the minimum distance If the min distances are equal (original vs trimmed), choose the trimmed one with the lowest distance If there are still multiple records that fall under the above two categories, pick the one with the highest frequency Here's my working version: DECLARE @Results TABLE ( ID int, [Name] nvarchar(200), Distance int, Frequency int, Trimmed bit ) INSERT INTO @Results SELECT ID, [Name], (dbo.Levenshtein(@Source, [Name])) As Distance, Frequency, 'False' As Trimmed FROM MyTable INSERT INTO @Results SELECT ID, [Name], (dbo.Levenshtein(@SourceTrimmed, [Name])) As Distance, Frequency, 'True' As Trimmed FROM MyTable SET @ResultID = (SELECT TOP 1 ID FROM @Results ORDER BY Distance, Trimmed, Frequency) SET @Result = (SELECT TOP 1 [Name] FROM @Results ORDER BY Distance, Trimmed, Frequency) SET @ResultDist = (SELECT TOP 1 Distance FROM @Results ORDER BY Distance, Trimmed, Frequency) SET @ResultTrimmed = (SELECT TOP 1 Trimmed FROM @Results ORDER BY Distance, Trimmed, Frequency) I believe what I need to do here is to.. Not dumb the results to a temporary table Do only 1 select from `MyTable` Setting the results right in the select from the initial select statement. (Since select will set variables and you can set multiple variables in one select statement) I know there has to be a good implementation to this but I can't figure it out... this is as far as I got: SELECT top 1 @ResultID = ID, @Result = [Name], (dbo.Levenshtein(@Source, [Name])) As distOrig, (dbo.Levenshtein(@SourceTrimmed, [Name])) As distTrimmed, Frequency FROM MyTable WHERE /* ... yeah I'm lost */ ORDER BY distOrig, distTrimmed, Frequency Any ideas?

    Read the article

  • Emulating a "OR" condition in Datastore.

    - by Jelle
    Hello again, I'm using the Google App Engine with Python (Django). How to emulate "SELECT * FROM bla WHERE touser = common.userstats("key") OR fromuser = common.userstats("key") ORDER BY date ASC"? I was thinking of something like this, but I can't get it in the order I want. recievedlist = models.P1.all() recievedlist.filter("touser =", common.userstats("key")) plus1list = recievedlist.fetch(50) sendlist = models.P1.all() sendlist.filter("fromuser =", common.userstats("key")) plus1list += sendlist.fetch(50) # order plus1list

    Read the article

  • How 404 error asp.net mvc 2 IIS 7?

    - by Dmitriy
    Hello! I tried to catch 404 errors like this... But when i try to load http://localhost:11415/wfwe/wefwe/ - all good work. When i try to load http://localhost:11415/order/ - fail (with error The RouteData must contain an item named 'action' with a non-empty string value.) When i try to load http://localhost:11415/Images/ - fail with error File does not exist My routes: routes.Add("Order", new LowercaseRoute("Order/{action}/{id}", new RouteValueDictionary( new { controller = "Order", action = "", id = UrlParameter.Optional }), new MvcRouteHandler())); routes.Add("NotFound", new LowercaseRoute("{*url}", new RouteValueDictionary( new { controller = "Pages", action = "Http404", }), new MvcRouteHandler())); Why route NotFound - don't catch all 404 error. And When i try to upload to my hosting and try 404 i get this error (NotFound route not work at all) 404 - File or directory not found. The resource you are looking for might have been removed, had its name changed, or is temporarily unavailable. I work with this all day, but nothig... please help me

    Read the article

  • STORED PROCEDURE working in my local test machine cannot be created in production environment.

    - by Marcos Buarque
    Hi, I have an SQL CREATE PROCEDURE statement that runs perfectly in my local SQL Server, but cannot be recreated in production environment. The error message I get in production is Msg 102, Level 15, State 1, Incorrect syntax near '='. It is a pretty big query and I don't want to annoy StackOverflow users, but I simply can't find a solution. If only you could point me out what settings I could check in the production server in order to enable running the code... I must be using some kind of syntax or something that is conflicting with some setting in production. This PROCEDURE was already registered in production before, but when I ran a DROP - CREATE PROCEDURE today, the server was able to drop the procedure, but not to recreate it. I will paste the code below. Thank you! =============== USE [Enorway] GO /****** Object: StoredProcedure [dbo].[Spel_CM_ChartsUsersTotals] Script Date: 03/17/2010 11:59:57 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO CREATE PROC [dbo].[Spel_CM_ChartsUsersTotals] @IdGroup int, @IdAssessment int, @UserId int AS SET NOCOUNT ON DECLARE @RequiredColor varchar(6) SET @RequiredColor = '3333cc' DECLARE @ManagersColor varchar(6) SET @ManagersColor = '993300' DECLARE @GroupColor varchar(6) SET @GroupColor = 'ff0000' DECLARE @SelfColor varchar(6) SET @SelfColor = '336600' DECLARE @TeamColor varchar(6) SET @TeamColor = '993399' DECLARE @intMyCounter tinyint DECLARE @intManagersPosition tinyint DECLARE @intGroupPosition tinyint DECLARE @intSelfPosition tinyint DECLARE @intTeamPosition tinyint SET @intMyCounter = 1 -- Table that will hold the subtotals... DECLARE @tblTotalsSource table ( IdCompetency int, CompetencyName nvarchar(200), FunctionRequiredLevel float, ManagersAverageAssessment float, SelfAssessment float, GroupAverageAssessment float, TeamAverageAssessment float ) INSERT INTO @tblTotalsSource ( IdCompetency, CompetencyName, FunctionRequiredLevel, ManagersAverageAssessment, SelfAssessment, GroupAverageAssessment, TeamAverageAssessment ) SELECT e.[IdCompetency], dbo.replaceAccentChar(e.[Name]) AS CompetencyName, (i.[LevelNumber]) AS FunctionRequiredLevel, ( SELECT ROUND(avg(CAST(ac.[LevelNumber] AS float)),0) FROM Spel_CM_AssessmentsData aa INNER JOIN Spel_CM_CompetenciesLevels ab ON aa.[IdCompetencyLevel] = ab.[IdCompetencyLevel] INNER JOIN Spel_CM_Levels ac ON ab.[IdLevel] = ac.[IdLevel] INNER JOIN Spel_CM_AssessmentsEvents ad ON aa.[IdAssessmentEvent] = ad.[IdAssessmentEvent] WHERE aa.[EvaluatedUserId] = @UserId AND aa.[AssessmentType] = 't' AND aa.[IdGroup] = @IdGroup AND ab.[IdCompetency] = e.[IdCompetency] AND ad.[IdAssessment] = @IdAssessment ) AS ManagersAverageAssessment, ( SELECT bc.[LevelNumber] FROM Spel_CM_AssessmentsData ba INNER JOIN Spel_CM_CompetenciesLevels bb ON ba.[IdCompetencyLevel] = bb.[IdCompetencyLevel] INNER JOIN Spel_CM_Levels bc ON bb.[IdLevel] = bc.[IdLevel] INNER JOIN Spel_CM_AssessmentsEvents bd ON ba.[IdAssessmentEvent] = bd.[IdAssessmentEvent] WHERE ba.[EvaluatedUserId] = @UserId AND ba.[AssessmentType] = 's' AND ba.[IdGroup] = @IdGroup AND bb.[IdCompetency] = e.[IdCompetency] AND bd.[IdAssessment] = @IdAssessment ) AS SelfAssessment, ( SELECT ROUND(avg(CAST(cc.[LevelNumber] AS float)),0) FROM Spel_CM_AssessmentsData ca INNER JOIN Spel_CM_CompetenciesLevels cb ON ca.[IdCompetencyLevel] = cb.[IdCompetencyLevel] INNER JOIN Spel_CM_Levels cc ON cb.[IdLevel] = cc.[IdLevel] INNER JOIN Spel_CM_AssessmentsEvents cd ON ca.[IdAssessmentEvent] = cd.[IdAssessmentEvent] WHERE ca.[EvaluatedUserId] = @UserId AND ca.[AssessmentType] = 'g' AND ca.[IdGroup] = @IdGroup AND cb.[IdCompetency] = e.[IdCompetency] AND cd.[IdAssessment] = @IdAssessment ) AS GroupAverageAssessment, ( SELECT ROUND(avg(CAST(dc.[LevelNumber] AS float)),0) FROM Spel_CM_AssessmentsData da INNER JOIN Spel_CM_CompetenciesLevels db ON da.[IdCompetencyLevel] = db.[IdCompetencyLevel] INNER JOIN Spel_CM_Levels dc ON db.[IdLevel] = dc.[IdLevel] INNER JOIN Spel_CM_AssessmentsEvents dd ON da.[IdAssessmentEvent] = dd.[IdAssessmentEvent] WHERE da.[EvaluatedUserId] = @UserId AND da.[AssessmentType] = 'm' AND da.[IdGroup] = @IdGroup AND db.[IdCompetency] = e.[IdCompetency] AND dd.[IdAssessment] = @IdAssessment ) AS TeamAverageAssessment FROM Spel_CM_AssessmentsData a INNER JOIN Spel_CM_AssessmentsEvents c ON a.[IdAssessmentEvent] = c.[IdAssessmentEvent] INNER JOIN Spel_CM_CompetenciesLevels d ON a.[IdCompetencyLevel] = d.[IdCompetencyLevel] INNER JOIN Spel_CM_Competencies e ON d.[IdCompetency] = e.[IdCompetency] INNER JOIN Spel_CM_Levels f ON d.[IdLevel] = f.[IdLevel] -- This will link with user's assigned functions INNER JOIN Spel_CM_FunctionsCompetenciesLevels g ON a.[IdFunction] = g.[IdFunction] INNER JOIN Spel_CM_CompetenciesLevels h ON g.[IdCompetencyLevel] = h.[IdCompetencyLevel] AND e.[IdCompetency] = h.[IdCompetency] INNER JOIN Spel_CM_Levels i ON h.[IdLevel] = i.[IdLevel] WHERE (NOT c.[EndDate] IS NULL) AND a.[EvaluatedUserId] = @UserId AND c.[IdAssessment] = @IdAssessment AND a.[IdGroup] = @IdGroup GROUP BY e.[IdCompetency], e.[Name], i.[LevelNumber] ORDER BY e.[Name] ASC -- This will define the position of each element (managers, group, self and team) SELECT @intManagersPosition = @intMyCounter FROM @tblTotalsSource WHERE NOT ManagersAverageAssessment IS NULL IF IsNumeric(@intManagersPosition) = 1 BEGIN SELECT @intMyCounter += 1 END SELECT @intGroupPosition = @intMyCounter FROM @tblTotalsSource WHERE NOT GroupAverageAssessment IS NULL IF IsNumeric(@intGroupPosition) = 1 BEGIN SELECT @intMyCounter += 1 END SELECT @intSelfPosition = @intMyCounter FROM @tblTotalsSource WHERE NOT SelfAssessment IS NULL IF IsNumeric(@intSelfPosition) = 1 BEGIN SELECT @intMyCounter += 1 END SELECT @intTeamPosition = @intMyCounter FROM @tblTotalsSource WHERE NOT TeamAverageAssessment IS NULL -- This will render the final table for the end user. The tabe will flatten some of the numbers to allow them to be prepared for Google Graphics. SELECT SUBSTRING( ( SELECT ( '|' + REPLACE(ma.[CompetencyName],' ','+')) FROM @tblTotalsSource ma ORDER BY ma.[CompetencyName] DESC FOR XML PATH('') ), 2, 1000) AS 'CompetenciesNames', SUBSTRING( ( SELECT ( ',' + REPLACE(ra.[FunctionRequiredLevel]*10,' ','+')) FROM @tblTotalsSource ra FOR XML PATH('') ), 2, 1000) AS 'FunctionRequiredLevel', SUBSTRING( ( SELECT ( ',' + CAST(na.[ManagersAverageAssessment]*10 AS nvarchar(10))) FROM @tblTotalsSource na FOR XML PATH('') ), 2, 1000) AS 'ManagersAverageAssessment', SUBSTRING( ( SELECT ( ',' + CAST(oa.[GroupAverageAssessment]*10 AS nvarchar(10))) FROM @tblTotalsSource oa FOR XML PATH('') ), 2, 1000) AS 'GroupAverageAssessment', SUBSTRING( ( SELECT ( ',' + CAST(pa.[SelfAssessment]*10 AS nvarchar(10))) FROM @tblTotalsSource pa FOR XML PATH('') ), 2, 1000) AS 'SelfAssessment', SUBSTRING( ( SELECT ( ',' + CAST(qa.[TeamAverageAssessment]*10 AS nvarchar(10))) FROM @tblTotalsSource qa FOR XML PATH('') ), 2, 1000) AS 'TeamAverageAssessment', SUBSTRING( ( SELECT ( '|t++' + CAST([FunctionRequiredLevel] AS varchar(10)) + ',' + @RequiredColor + ',0,' + CAST(ROW_NUMBER() OVER(ORDER BY CompetencyName) - 1 AS varchar(2)) + ',9') FROM @tblTotalsSource FOR XML PATH('') ), 2, 1000) AS 'FunctionRequiredAverageLabel', SUBSTRING( ( SELECT ( '|t++' + CAST([ManagersAverageAssessment] AS varchar(10)) + ',' + @ManagersColor + ',' + CAST(@intManagersPosition AS varchar(2)) + ',' + CAST(ROW_NUMBER() OVER(ORDER BY CompetencyName) - 1 AS varchar(2)) + ',9') FROM @tblTotalsSource FOR XML PATH('') ), 2, 1000) AS 'ManagersLabel', SUBSTRING( ( SELECT ( '|t++' + CAST([GroupAverageAssessment] AS varchar(10)) + ',' + @GroupColor + ',' + CAST(@intGroupPosition AS varchar(2)) + ',' + CAST(ROW_NUMBER() OVER(ORDER BY CompetencyName) - 1 AS varchar(2)) + ',9') FROM @tblTotalsSource FOR XML PATH('') ), 2, 1000) AS 'GroupLabel', SUBSTRING( ( SELECT ( '|t++' + CAST([SelfAssessment] AS varchar(10)) + ',' + @SelfColor + ',' + CAST(@intSelfPosition AS varchar(2)) + ',' + CAST(ROW_NUMBER() OVER(ORDER BY CompetencyName) - 1 AS varchar(2)) + ',9') FROM @tblTotalsSource FOR XML PATH('') ), 2, 1000) AS 'SelfLabel', SUBSTRING( ( SELECT ( '|t++' + CAST([TeamAverageAssessment] AS varchar(10)) + ',' + @TeamColor + ',' + CAST(@intTeamPosition AS varchar(2)) + ',' + CAST(ROW_NUMBER() OVER(ORDER BY CompetencyName) - 1 AS varchar(2)) + ',10') FROM @tblTotalsSource FOR XML PATH('') ), 2, 1000) AS 'TeamLabel', (Count(src.[IdCompetency]) * 30) + 100 AS 'ControlHeight' FROM @tblTotalsSource src SET NOCOUNT OFF GO

    Read the article

  • Silverlight DataGrid Exception Reordering Column Headers

    - by Mike
    I'm trying to set the initial display order of the column headers in a silverlight datagrid by changing the column header DisplayIndex values. If I try to set the column order at page load time, I get an out of range exception. If I set the column order (same routine) at a later time like, in a button click handler, it works. Is this just a bug in the silverlight datagrid control? Suggestions for a possible work around?

    Read the article

  • Inlines in Django Admin

    - by Oli
    I have two models, Order and UserProfile. Each Order has a ForeignKey to UserProfile, to associate it with that user. On the django admin page for each Order, I'd like to display the UserProfile associated with it, for easy processing of information. I have tried inlines: class UserInline(admin.TabularInline): model = UserProfile class ValuationRequestAdmin(admin.ModelAdmin): list_display = ('address1', 'address2', 'town', 'date_added') list_filter = ('town', 'date_added') ordering = ('-date_updated',) inlines = [ UserInline, ] But it complains that UserProfile "has no ForeignKey to" Order - which it doesn't, it's the other way around. Is there a way to do what I want?

    Read the article

  • Problem with for-loop in python

    - by Protean
    This code is supposed to be able to sort the items in self.array based upon the order of the characters in self.order. The method sort runs properly until the third iteration, unil for some reason the for loop seems to repeat indefinitely. What is going on here? class sorting_class: def __init__(self): self.array = ['ca', 'bd', 'ac', 'ab'] #An array of strings self.arrayt = [] self.globali = 0 self.globalii = 0 self.order = ['a', 'b', 'c', 'd'] #Order of characters self.orderi = 0 self.carry = [] self.leave = [] self.sortedlist = [] def sort(self): for arrayi in self.arrayt: #This should only loop for the number items in self.arrayt. However, the third time this is run it seems to loop indefinitely. print ('run', arrayi) #Shows the problem if self.order[self.orderi] == arrayi[self.globali]: self.carry.append(arrayi) else: if self.globali != 0: self.leave.append(arrayi) def srt(self): self.arrayt = self.array my.sort() #First this runs the first time. while len(self.sortedlist) != len(self.array): if len(self.carry) == 1: self.sortedlist.append(self.carry) self.arrayt = self.leave self.leave = [] self.carry = [] self.globali = 1 self.orderi = 0 my.sort() elif len(self.carry) == 0: if len(self.leave) != 0: #Because nothing matches 'aa' during the second iteration, this code runs the third time" self.arrayt = self.leave self.globali = 1 self.orderi += 1 my.sort() else: self.arrayt = self.array self.globalii += 1 self.orderi = self.globalii self.globali = 0 my.sort() self.orderi = 0 else: #This is what runs the second time. self.arrayt = self.carry self.carry = [] self.globali += 1 my.sort() my = sorting_class() my.srt()

    Read the article

< Previous Page | 71 72 73 74 75 76 77 78 79 80 81 82  | Next Page >