Search Results

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

Page 56/717 | < Previous Page | 52 53 54 55 56 57 58 59 60 61 62 63  | Next Page >

  • Generate all the ways to intersperse a list of lists, keeping each list in order.

    - by dreeves
    Given a list of lists like this [[1,2,3],[a,b,c,d],[x,y]] generate all permutations of the flattened list, [1,2,3,a,b,c,d,x,y], such that the elements of each sublist occur in the same order. For example, this one is okay [a,1,b,2,x,y,3,c,d] but this one is not [y,1,2,3,a,b,c,x,d] because y must occur after x, that being how x and y are ordered in the original sublist. I believe the number of such lists is determined by the multinomial coefficient. I.e., if there are k sublists, n_i is the length of the ith sublist, and n is the sum of the n_i's then the number of such permutations is n!/(n_i! * ... * n_k!). The question is how to generate those sublists. Pseudocode is great. An actual implementation in your language of choice is even better!

    Read the article

  • How should I be storing objects that I wish to access in reverse order of the way I placed them in

    - by andrew hicks
    I'm following this guide here: http://www.mazeworks.com/mazegen/mazetut/index.htm Or more specficially create a CellStack (LIFO) to hold a list of cell locations set TotalCells = number of cells in grid choose a cell at random and call it CurrentCell set VisitedCells = 1 while VisitedCells < TotalCells find all neighbors of CurrentCell with all walls intact if one or more found choose one at random knock down the wall between it and CurrentCell push CurrentCell location on the CellStack make the new cell CurrentCell add 1 to VisitedCells else pop the most recent cell entry off the CellStack make it CurrentCell endIf endWhile Im writing this in java, My problem is. How should I be storing my visited cells, So that I can access them from reverse order of when I placed them in. Like this? List<Location> visitedCells = new ArrayList<Location>(); Then do I grab with visitedCells.get(visitedCells.size()-1)? Location stores the x, y and z. Not something Im trying to ask you.

    Read the article

  • How to print a variable in reversed byte order in Perl?

    - by jth
    Hi, I'am trying to convert the variable $num into its reverse byte order and print it out. This is what I have done so far: my $num=0x5514ddb7; my $s=pack('I!',$num); print "$s\n"; He prints it out as some non-printable characters and in a hex editor it looks right, but how can I get it readable on the console? Already tried print sprintf("%#x\n",$s); but he complains about an non-numeric argument, so I think pack returns a string. Any ideas how can I print out `0xb7dd1455 on the console, based on $num?

    Read the article

  • What is the order of loading the CSS files in a HTML page ?

    - by Purushotham
    I want to know the order of loading the CSS files in a HTML page. My actual requirement is like this: I have more than 10 CSS files in my application. I am importing some 3 to 4 CSS files in each HTML page. The problem is I have duplicate classes that defined in some CSS files. That means I override some of the CSS classes in the CSS files. In some pages it behaves correctly. In some pages it behaves wrongly. I have inline styles defined for some of the DIVs in HTML page also. I am keeping CSS class for that DIVs also. Can anyone know which one will take higher priority or which one loads first ?

    Read the article

  • Shuffle array variables in a pre-specified order, without using extra memory of "size of input array"

    - by Eternal Learner
    Input : A[4] = {0,4,-1,1000} - Actual Array P[4] = {1,0,3,2} - Order to be reshuffled Output: A[4] = {4,0,1000,-1} Condition : Don't use an additional array as memory. Can use an extra variable or two. Problem : I have the below program in C++, but this fails for certain inputs of array P. #include<iostream> using namespace std; void swap(int *a_r,int *r) { int temp = *r; *r = *a_r; *a_r = temp; } int main() { int A[4] = {0,4,-1,1000}; int P[4] = {3,0,1,2}; int value = A[0] , dest = P[0]; for(int i=0; i<4;i++) { swap(&A[dest],&value); dest = P[dest]; } for(int i=0;i<4;i++) cout<<A[i]<<" "; }

    Read the article

  • Does the order of the columns in a SELECT statement make a difference?

    - by Frank Computer
    This question was inspired by a previous question posted on SO, "Does the order of the WHERE clause make a differnece?". Would it improve a SELECT statement's performance if the the columns used in the WHERE section are placed at the begining of the SELECT statement? example: SELECT customer.id, transaction.id, transaction.efective_date, transaction.a, [...] FROM customer, transaction WHERE customer.id = transaction.id; I do know that limiting the list of columns to only the needed ones in a SELECT statement improves performance as opposed to using SELECT * because the current list is smaller.

    Read the article

  • With a SELECT...WHERE id IN (...), order results by IN() ?

    - by Deca
    With a query such as: SELECT * FROM images WHERE id IN (12,9,15,3,1) is it possible to order the results by the contents of the IN clause? The result I'm looking for would be something like: [0] => Array ( [id] => 12 [file_name] => foo ) [1] => Array ( [id] => 9 [file_name] => bar ) [2] => Array ( [id] => 15 [file_name] => baz ) ...

    Read the article

  • How to assure applying order of function decorators in Python?

    - by Satoru.Logic
    Some decorators should only be used in the outermost layer. A decorator that augments the original function and add a configure parameter is one example. from functools import wraps def special_case(f): @wraps(f) def _(a, b, config_x=False): if config_x: print "Special case here" return return f(a, b) How can I avoid decorators like this getting decorated by another decorator? EDIT It is really disgusting to let everyone trying to apply a new decorator worry about the application order. So, is it possible to avoid this kind of situation? Is it possible to add a config option without introducing a new parameter?

    Read the article

  • How to Sort Div Content In Descending Order By Image Name?

    - by MrSeth
    I would like to sort a div by DESCENDING order based on their image name. Change From this: <div id="sort-this-div"> <p><img src="image/1.jpg"/></p> <p><img src="image/3.jpg"/></p> <p><img src="image/4.jpg"/></p> <p><img src="image/2.jpg"/></p> </div> To This <div id="sort-this-div"> <p><img src="image/4.jpg"/></p> <p><img src="image/3.jpg"/></p> <p><img src="image/2.jpg"/></p> <p><img src="image/1.jpg"/></p> </div>

    Read the article

  • How to sort a hash by value in descending order and output a hash in ruby?

    - by tipsywacky
    output.sort_by {|k, v| v}.reverse and for keys h = {"a"=>1, "c"=>3, "b"=>2, "d"=>4} => {"a"=>1, "c"=>3, "b"=>2, "d"=>4} Hash[h.sort] Right now I have these two. But I'm trying to sort hash in descending order by value so that it will return => {"d"=>4, "c"=>3, "b"=>2, "a"=>1 } Thanks in advance. Edit: let me post the whole code. def count_words(str) # YOUR CODE HERE output = Hash.new(0) sentence = str.gsub(/,/, "").gsub(/'/,"").gsub(/-/, "").downcase words = sentence.split() words.each do |item| output[item] += 1 end puts Hash[output.sort_by{ |_, v| -v }] return Hash[output.sort_by{|k, v| v}.reverse] end

    Read the article

  • Inappropriate Updates?

    - by Tony Davis
    A recent Simple-talk article by Kathi Kellenberger dissected the fastest SQL solution, submitted by Peter Larsson as part of Phil Factor's SQL Speed Phreak challenge, to the classic "running total" problem. In its analysis of the code, the article re-ignited a heated debate regarding the techniques that should, and should not, be deemed acceptable in your search for fast SQL code. Peter's code for running total calculation uses a variation of a somewhat contentious technique, sometimes referred to as a "quirky update": SET @Subscribers = Subscribers = @Subscribers + PeopleJoined - PeopleLeft This form of the UPDATE statement, @variable = column = expression, is documented and it allows you to set a variable to the value returned by the expression. Microsoft does not guarantee the order in which rows are updated in this technique because, in relational theory, a table doesn’t have a natural order to its rows and the UPDATE statement has no means of specifying the order. Traditionally, in cases where a specific order is requires, such as for running aggregate calculations, programmers who used the technique have relied on the fact that the UPDATE statement, without the WHERE clause, is executed in the order imposed by the clustered index, or in heap order, if there isn’t one. Peter wasn’t satisfied with this, and so used the ingenious device of assuring the order of the UPDATE by the use of an "ordered CTE", based on an underlying temporary staging table (a heap). However, in either case, the ordering is still not guaranteed and, in addition, would be broken under conditions of parallelism, or partitioning. Many argue, with validity, that this reliance on a given order where none can ever be guaranteed is an abuse of basic relational principles, and so is a bad practice; perhaps even irresponsible. More importantly, Microsoft doesn't wish to support the technique and offers no guarantee that it will always work. If you put it into production and it breaks in a later version, you can't file a bug. As such, many believe that the technique should never be tolerated in a production system, under any circumstances. Is this attitude justified? After all, both forms of the technique, using a clustered index to guarantee the order or using an ordered CTE, have been tested rigorously and are proven to be robust; although not guaranteed by Microsoft, the ordering is reliable, provided none of the conditions that are known to break it are violated. In Peter's particular case, the technique is being applied to a temporary table, where the developer has full control of the data ordering, and indexing, and knows that the table will never be subject to parallelism or partitioning. It might be argued that, in such circumstances, the technique is not really "quirky" at all and to ban it from your systems would server no real purpose other than to deprive yourself of a reliable technique that has uses that extend well beyond the running total calculations. Of course, it is doubly important that such a technique, including its unsupported status and the assumptions that underpin its success, is fully and clearly documented, preferably even when posting it online in a competition or forum post. Ultimately, however, this technique has been available to programmers throughout the time Sybase and SQL Server has existed, and so cannot be lightly cast aside, even if one sympathises with Microsoft for the awkwardness of maintaining an archaic way of doing updates. After all, a Table hint could easily be devised that, if specified in the WITH (<Table_Hint_Limited>) clause, could be used to request the database engine to do the update in the conventional order. Then perhaps everyone would be satisfied. Cheers, Tony.

    Read the article

  • Nested SQL Select statement fails on SQL Server 2000, ok on SQL Server 2005

    - by Jay
    Here is the query: INSERT INTO @TempTable SELECT UserID, Name, Address1 = (SELECT TOP 1 [Address] FROM (SELECT TOP 1 [Address] FROM [UserAddress] ua INNER JOIN UserAddressOrder uo ON ua.UserID = uo.UserID WHERE ua.UserID = u.UserID ORDER BY uo.AddressOrder ASC) q ORDER BY AddressOrder DESC), Address2 = (SELECT TOP 1 [Address] FROM (SELECT TOP 2 [Address] FROM [UserAddress] ua INNER JOIN UserAddressOrder uo ON ua.UserID = uo.UserID WHERE ua.UserID = u.UserID ORDER BY uo.AddressOrder ASC) q ORDER BY AddressOrder DESC) FROM User u In this scenario, users have multiple address definitions, with an integer field specifying the preferred order. "Address2" (the second preferred address) attempts to take the top two preferred addresses, order them descending, then take the top one from the result. You might say, just use a subquery which does a SELECT for the record with "2" in the Order field, but the Order values are not contiguous. How can this be rewritten to conform to SQL 2000's limitations? Very much appreciated.

    Read the article

  • ASP NET MVC : "Cannot order by type 'System.Object'."

    - by rah.deex
    This is my code. I got this sample from the Internet and I tried to modify it. private void FillGridData() { //IQueryable<SVC> query = _customerService.GetQueryable(); _dataContext = new dbServiceModelDataContext(); var query = from m in _dataContext.SVCs select m; query = AddQuerySearchCriteria(query, _grid.SearchForm); int totalRows = query.Count(); _grid.Pager.Init(totalRows); if (totalRows == 0) { _grid.Data = new List<SVC>(); return; } query = AddQuerySorting(query, _grid.Sorter); query = AddQueryPaging(query, _grid.Pager); List<SVC> customers = query.ToList(); //***ERROR IN HERE***// _grid.Data = customers; } The error says "Cannot order by type 'System.Object'.", what is the matter? Do you have solution for me? This is The AddQuerySorting Method THE PROBLEM IS IN HERE is there anything wrong about the code? :( private IQueryable<SVC> AddQuerySorting(IQueryable<SVC> query, Sorter sorter) { if (String.IsNullOrEmpty(sorter.SortField)) return query; //Used approach from http://www.singingeels.com/Articles/Self_Sorting_GridView_with_LINQ_Expression_Trees.aspx //instead of a long switch statement var param = Expression.Parameter(typeof(SVC), "customer"); var sortExpression = Expression.Lambda<Func<SVC, object>> (Expression.Convert(Expression.Property(param, sorter.SortField), typeof(object)), param); if (sorter.SortDirection == SortDirection.Asc) query = query.OrderBy(sortExpression); else query = query.OrderByDescending(sortExpression); return query; } here is AddQueryPaging Method private IQueryable<SVC> AddQueryPaging(IQueryable<SVC> query, Pager pager) { if (pager.TotalPages == 0) return query; query = query.Skip((pager.CurrentPage - 1) * pager.PageSize) .Take(pager.PageSize); return query; }

    Read the article

  • VB.NET GroupBy LINQ statement

    - by Jason
    I am having a bear of a time getting this to work. I have a List(Of MyItem) called Items that have a OrderId property on them. From those items, I want to create a list of Orders. Some items will have the same OrderId so I want to try to group by OrderId. I then want to sort by date. Here's what I have so far: Public ReadOnly Property AllOrders() As List(Of Order) Get Return Items.Select(Function(i As MyItem) New Order(i.OrderID)) _ .GroupBy(Function(o As Order) New Order(o.OrderID)) _ .OrderBy(Function(o As Order) o.DateOrdered).ToList End Get End Property This, of course, doesn't compile, and I get the error: Value of type 'System.Collections.Generic.List(Of System.Linq.IGrouping(Of Order, Order))' cannot be converted to 'System.Collections.Generic.List(Of Order))' I've bolded the part where I think the problem is, but I have no idea how to fix it. Also, it used to work fine (except there were duplicate values) before I added the .GroupBy statement. Anyone have any ideas? Thanks

    Read the article

  • How to get contacts in order of they upcoming birthdays?

    - by Pentium10
    I have code to read contacts details and to read birthday. But how do I get a list of contacts in order of they upcoming birthday? For a single contact identified by id I get details and birthday like this. Cursor c = null; try { Uri uri = ContentUris.withAppendedId( ContactsContract.Contacts.CONTENT_URI, id); c = ctx.getContentResolver().query(uri, null, null, null, null); if (c != null) { if (c.moveToFirst()) { DatabaseUtils.cursorRowToContentValues(c, data); } } c.close(); // read birthday c = ctx.getContentResolver() .query( Data.CONTENT_URI, new String[] { Event.DATA }, Data.CONTACT_ID + "=" + id + " AND " + Data.MIMETYPE + "= '" + Event.CONTENT_ITEM_TYPE + "' AND " + Event.TYPE + "=" + Event.TYPE_BIRTHDAY, null, Data.DISPLAY_NAME); if (c != null) { try { if (c.moveToFirst()) { this.setBirthday(c.getString(0)); } } finally { c.close(); } } return super.load(id); } catch (Exception e) { Log.v(TAG(), e.getMessage(), e); e.printStackTrace(); return false; } finally { if (c != null) c.close(); }

    Read the article

  • How to get contacts in order of their upcoming birthdays?

    - by Pentium10
    I have code to read contact details and to read birthdays. But how do I get a list of contacts in order of their upcoming birthday? For a single contact identified by id, I get details and birthday like this: Cursor c = null; try { Uri uri = ContentUris.withAppendedId( ContactsContract.Contacts.CONTENT_URI, id); c = ctx.getContentResolver().query(uri, null, null, null, null); if (c != null) { if (c.moveToFirst()) { DatabaseUtils.cursorRowToContentValues(c, data); } } c.close(); // read birthday c = ctx.getContentResolver() .query( Data.CONTENT_URI, new String[] { Event.DATA }, Data.CONTACT_ID + "=" + id + " AND " + Data.MIMETYPE + "= '" + Event.CONTENT_ITEM_TYPE + "' AND " + Event.TYPE + "=" + Event.TYPE_BIRTHDAY, null, Data.DISPLAY_NAME); if (c != null) { try { if (c.moveToFirst()) { this.setBirthday(c.getString(0)); } } finally { c.close(); } } return super.load(id); } catch (Exception e) { Log.v(TAG(), e.getMessage(), e); e.printStackTrace(); return false; } finally { if (c != null) c.close(); } and the code to read all contacts is: public Cursor getList() { // Get the base URI for the People table in the Contacts content // provider. Uri contacts = ContactsContract.Contacts.CONTENT_URI; // Make the query. ContentResolver cr = ctx.getContentResolver(); // Form an array specifying which columns to return. String[] projection = new String[] { ContactsContract.Contacts._ID, ContactsContract.Contacts.DISPLAY_NAME }; Cursor managedCursor = cr.query(contacts, projection, null, null, ContactsContract.Contacts.DISPLAY_NAME + " COLLATE LOCALIZED ASC"); return managedCursor; }

    Read the article

  • Is the load order for external javascript files different in IE8 compared to IE7?

    - by Benny
    Hello, I ask because I'm running an application in which I load an external script file in the HEAD section of the page, and then attempt to call a function from it in the onLoad section of the BODY tag. external.js function someFunction() { alert("Some message"); } myPage.html <html> <head> <script type="text/javascript" language="javascript" src="external.js"></script> </head> <body onLoad="someFunction();"> </body> </html> Using the developer tools in IE8, I get an exception thrown at the onLoad statement because, apparently, the external javascript file hasn't been loaded yet. I haven't had this problem come up in IE7 before, thus my question. Did they change the load order between IE7 and IE8? If so, is there a better way to do this? (the real function references many other functions and constants, which look much better in an external file) Thanks, B.J.

    Read the article

  • T-SQL Dynamic SQL and Temp Tables

    - by George
    It looks like #temptables created using dynamic SQL via the EXECUTE string method have a different scope and can't be referenced by "fixed" SQLs in the same stored procedure. However, I can reference a temp table created by a dynamic SQL statement in a subsequence dynamic SQL but it seems that a stored procedure does not return a query result to a calling client unless the SQL is fixed. A simple 2 table scenario: I have 2 tables. Let's call them Orders and Items. Order has a Primary key of OrderId and Items has a Primary Key of ItemId. Items.OrderId is the foreign key to identify the parent Order. An Order can have 1 to n Items. I want to be able to provide a very flexible "query builder" type interface to the user to allow the user to select what Items he want to see. The filter criteria can be based on fields from the Items table and/or from the parent Order table. If an Item meets the filter condition including and condition on the parent Order if one exists, the Item should be return in the query as well as the parent Order. Usually, I suppose, most people would construct a join between the Item table and the parent Order tables. I would like to perform 2 separate queries instead. One to return all of the qualifying Items and the other to return all of the distinct parent Orders. The reason is two fold and you may or may not agree. The first reason is that I need to query all of the columns in the parent Order table and if I did a single query to join the Orders table to the Items table, I would be repoeating the Order information multiple times. Since there are typically a large number of items per Order, I'd like to avoid this because it would result in much more data being transfered to a fat client. Instead, as mentioned, I would like to return the two tables individually in a dataset and use the two tables within to populate a custom Order and child Items client objects. (I don't know enough about LINQ or Entity Framework yet. I build my objects by hand). The second reason I would like to return two tables instead of one is because I already have another procedure that returns all of the Items for a given OrderId along with the parent Order and I would like to use the same 2-table approach so that I could reuse the client code to populate my custom Order and Client objects from the 2 datatables returned. What I was hoping to do was this: Construct a dynamic SQL string on the Client which joins the orders table to the Items table and filters appropriate on each table as specified by the custom filter created on the Winform fat-client app. The SQL build on the client would have looked something like this: TempSQL = " INSERT INTO #ItemsToQuery OrderId, ItemsId FROM Orders, Items WHERE Orders.OrderID = Items.OrderId AND /* Some unpredictable Order filters go here */ AND /* Some unpredictable Items filters go here */ " Then, I would call a stored procedure, CREATE PROCEDURE GetItemsAndOrders(@tempSql as text) Execute (@tempSQL) --to create the #ItemsToQuery table SELECT * FROM Items WHERE Items.ItemId IN (SELECT ItemId FROM #ItemsToQuery) SELECT * FROM Orders WHERE Orders.OrderId IN (SELECT DISTINCT OrderId FROM #ItemsToQuery) The problem with this approach is that #ItemsToQuery table, since it was created by dynamic SQL, is inaccessible from the following 2 static SQLs and if I change the static SQLs to dynamic, no results are passed back to the fat client. 3 around come to mind but I'm look for a better one: 1) The first SQL could be performed by executing the dynamically constructed SQL from the client. The results could then be passed as a table to a modified version of the above stored procedure. I am familiar with passing table data as XML. If I did this, the stored proc could then insert the data into a temporary table using a static SQL that, because it was created by dynamic SQL, could then be queried without issue. (I could also investigate into passing the new Table type param instead of XML.) However, I would like to avoid passing up potentially large lists to a stored procedure. 2) I could perform all the queries from the client. The first would be something like this: SELECT Items.* FROM Orders, Items WHERE Order.OrderId = Items.OrderId AND (dynamic filter) SELECT Orders.* FROM Orders, Items WHERE Order.OrderId = Items.OrderId AND (dynamic filter) This still provides me with the ability to reuse my client sided object-population code because the Orders and Items continue to be returned in two different tables. I have a feeling to, that I might have some options using a Table data type within my stored proc, but that is also new to me and I would appreciate a little bit of spoon feeding on that one. If you even scanned this far in what I wrote, I am surprised, but if so, I woul dappreciate any of your thoughts on how to accomplish this best.

    Read the article

  • Formatting datetime values returned in a SELECT..FOR XML statement

    - by TelJanini
    Consider the following table: Orders OrderId Date CustomerId 1000 2012-06-05 20:03:12.000 51 1001 2012-06-16 12:02:31.170 48 1002 2012-06-18 19:45:16.000 33 When I extract the Order data using FOR XML: SELECT OrderId AS 'Order/@Order-Id', Date AS 'Order/ShipDate', CustomerId AS 'Order/Customer' FROM Orders WHERE OrderId = 1000 FOR XML PATH ('') I get the following result: <Order Order-Id="1000"> <ShipDate>2010-02-20T16:03:12</ShipDate> <Customer>51</Customer> </Order> The problem is, the ShipDate value in the XML file needs to be in the format M/DD/YYYY H:mm:ss PM. How can I change the output of the ShipDate in the XML file to the desired format? Any help would be greatly appreciated!

    Read the article

  • Rails - Logic for finding info from a :has_many :through needed!

    - by Jty.tan
    I have 3 relevant tables. User, Orders, and Viewables The idea is that each User has got many Orders, but at the same time, each User can View specific other Orders that belong to other Users. So Viewables has the attributes of user_id and order_id. Orders has a :has_many :Users, :through => :viewables Is it possible to do a find through an Order's view? So something like @viewable_orders = Orders.find(:all, :conditions = ["Viewable.user_id=?",1]) To get a list of Orders which are viewable by user_id=1. (This doesn't work, else I won't be asking. :( ) The idea being that I can do something like a sidebar where the current user (the logged-in one) can view a list of other people's orders that he can view. For example Three other Users who have some Orders that he can view should be eventually displayed like this: Jack (2) Basic Order (registry_id: 1) New Order (registry_id: 29) Amy (4) Short Order (registry_id: 12) Jill (5) Hardware Order (14) Pink Order (17) Software Order (76) (The number in brackets are the respective user_id or registry_id) So to find the list of all of the orders that the current user can find (assuming user_id of the current user is 1), would be found by doing @viewable_orders = Viewable.find(:all, :conditions => ["user_id=?", 1]) And that would give me the collection of the above 6 registries. Now, the easiest way to do this, is for me to just have a list of + Jill's Hardware Order + Jill's Pink Order + Amy's Short Order + etc But that gets ugly for long lists. Thanks!

    Read the article

  • Help with MySQL query - Product orders report without duplicate shipping charges

    - by Paul
    Hello, I have an issue creating a custom report for an e-commerce store running on osCommerce. The client wants the report to have the following columns: Date, Order ID, Product Class, Product Price, Product Tax, Shipping, Order Total The criteria for generating the report are Date Range and Product Class (Textbooks for example) The client wants the report to list each Textbook purchased on its own line. Orders with multiple textbooks would display a separate line for each Textbook in the order. I have it all working except for one part: the shipping amount is order-specific (based on the order total), not product-specific, and is displaying for each product. I need it to display only for the first product of each order, so it is not counted more than once. My current query is: SELECT op.date_funds_captured as 'Date', op.orders_id as 'Order ID', pc.class as 'Product Class', round(op.products_price,2) as 'Product Price', round(op.products_tax*op.products_price/100,2) as 'Product Tax', round(otship.value,2) as 'Shipping', round(ot.value,2) as 'Order Total' from orders_products op, orders_total ot, orders_total otship, productclasses pc, products p where ot.orders_id = op.orders_id and ot.class='ot_total' and op.orders_id = otship.orders_id and otship.class = 'ot_shipping' and p.products_class_id = pc.id and op.products_id = p.products_id and pc.id = 1 pc.id = 1 -- Product class = Textbook Here is an example of the current report output. You can see the problem with order 2256 showing the shipping value three times instead of once: Date Order Product Class Price Tax Shipping Total 2010-01-04 2253 Textbook 24.95 2.43 10.03 37.41 2010-01-04 2256 Textbook 34.95 0.00 18.09 240.37 2010-01-04 2256 Textbook 55.50 0.00 18.09 240.37 2010-01-04 2256 Textbook 36.95 0.00 18.09 240.37 2010-01-04 2258 Textbook 55.50 5.41 12.17 124.24 Please help!!! Thanks, Paul

    Read the article

  • ASP.NET lock thread method

    - by Peter
    Hello, I'm developing an ASP.NET forms webapplication using C#. I have a method which creates a new Order for a customer. It looks similar to this; private string CreateOrder(string userName) { // Fetch current order Order order = FetchOrder(userName); if (order.OrderId == 0) { // Has no order yet, create a new one order.OrderNumber = Utility.GenerateOrderNumber(); order.Save(); } return order; } The problem here is, it is possible that 1 customer in two requests (threads) could cause this method to be called twice while another thread is also inside this method. This can cause two orders to be created. How can I properly lock this method, so it can only be executed by one thread at a time per customer? I tried; Mutex mutex = null; private string CreateOrder(string userName) { if (mutex == null) { mutex = new Mutex(true, userName); } mutex.WaitOne(); // Code from above mutex.ReleaseMutex(); mutex = null; return order; } This works, but on some occasions it hangs on WaitOne and I don't know why. Is there an error, or should I use another method to lock? Thanks

    Read the article

  • Why is graphviz drawing two arrows, and using a weird order?

    - by dmd
    Why is graphviz drawing two arrows from uncap_spike to peel, and why is it drawing peel to the right of hang? I want uncap_spike - peel - hang - spike, in that order, with one edge between each. digraph hangers { compound=true fontname="Gill Sans" node [fontname="Gill Sans" shape=box fillcolor=white style="rounded, filled"] edge [fontname="Gill Sans"] subgraph cluster_prep { style="filled" label=Prep gather [shape=Mrecord label="{gather | EtOH swab\nvented tubing}"] uncap_bottle [label="uncap bottle"] uncap_spike [label="uncap spike"] swab [shape=Mrecord label="{swab EtOH | wait 30 seconds for sterility}"] gather -> uncap_bottle -> swab -> uncap_spike {rank=same gather uncap_bottle swab uncap_spike} } subgraph cluster_hang { style=filled label=Hang {rank=same peel hang} } {rank=same uncap_spike -> peel -> hang -> spike -> prime} hang -> rip [color=firebrick] rip [label="eyelet\nripped" style="filled" shape=octagon regular fontcolor=white fontsize=10 width=.5 fixedsize color=firebrick fillcolor=firebrick ] swab -> not_sterile [color=firebrick] not_sterile [label="not\nsterile" style="filled" shape=octagon regular fontcolor=white fontsize=10 width=.5 fixedsize color=firebrick fillcolor=firebrick ] }

    Read the article

  • unable to implement HTTP Tunneling correctly in order to enable Java rmi calls over internet(and und

    - by Lokesh Kumar
    in my previous question :-How to Setup RMI Server under(NAT/ISP) Now,i m able to start my RMI server by Installing apache Tomcat 6.0 server. i have also installed servlet programs into apache Tomcat server in order to enable HTTP tunneling. my servlet codes:- (1) [SimplifiedServletHandler.java][2] (2) [ServletForwardCommand.java][3] these servlets resides inside :- C:\Program Files\Apache Software Foundation\Tomcat 6.0\webapps\examples\WEB-INF\classes\ one more thing that i hv added to my CalcultorClient.java program:- try { RMISocketFactory. setSocketFactory(new sun.rmi.transport.proxy .RMIHttpToCGISocketFactory( )); }catch (IOException ignored) { System.out.println("Error :- ignored.getMessage()"); } But,when i try to make client connect with server(under ISP/NAT) i get the following Exception :- RemoteException java.rmi.UnmarshalException: Error unmarshaling return header; nested exception is: java.io.IOException: HTTP request failed i don't know the correct reason behind this Exception.. but,i think that i haven't installed or invoke my servlet programs properly on server side. so,can anybody tell me the correct reason behind this error/Exception????? and if u think that it is servlet problem then tell me the correct procedure to run my serlvet program inside tomcat server.

    Read the article

  • how to indicate a change in list elements' order using jquery?

    - by keisimone
    i am using jquery sortable. right now i have a list of items that i can ALREADY use drag and drop. which is cool. i will use a submit button at the bottom of the list to submit the new order. the change in the list is not automatically submitted. All i need is somehow indicate that an element's position has changed. I googled quite a bit. no answer. original list: item1 item2 item3 item4 item5 submitbutton here. changed list: i moved item 2 below item3 for eg. item1 item3 item2 * item4 item5 submitbutton here. how do i use the sortable in jquery for me to display a sign on the item 2? i think should be the change event of sortable but i still do not know how to use it since i am a newbie in jquery. http://docs.jquery.com/UI/Sortable#event-change thank you.

    Read the article

< Previous Page | 52 53 54 55 56 57 58 59 60 61 62 63  | Next Page >