Search Results

Search found 3874 results on 155 pages for 'nested transactions'.

Page 12/155 | < Previous Page | 8 9 10 11 12 13 14 15 16 17 18 19  | Next Page >

  • Can someone describe the nested set model from a C#/LINQ perspective?

    - by Chad
    I know the nested set model doesn't pertain to the C# language or LINQ directly... it's what I'm using to develop my web app. For hierarchical data (categories with sub-categories in my case), I'm currently using something similar to the Adjacency List model. At the moment, I've only got 2 levels of categories, but I'd like to take it further and allow for n levels of categories using the nested set model. I'm not quite clear on how to use it in a C# context. Here's the article I'm reading on the nested set model. Though this article cleared up my confusion some, I still have a big ?? in my head: - Is inserting, updating or deleting categories tedious? It looks like the left and right numbers would require re-numbering... what would the LINQ queries look like for the following scenarios? Delete a child node (re-number all node's left/right values) Delete a parent node (what do you do with the orphans?) Move a child node to a different parent node (renumber again) If my understanding is correct, at all times the child node's left/right values will always be between the parent node's left/right values, am I correct? Seems easy enough, if only the categories were static... most likely I need to spend more time to get my head around the concept. Any help is greatly appreciated!

    Read the article

  • DBTransactions between stateless calls using GUIDs

    - by Marty Trenouth
    I'm looking to add transactional support to my DB engine and providing to Abstract Transaction Handling down to passing in Guids with the DB Action Command. The DB engine would run similar to: private static Database DB; public static Dictionary<Guid,DBTransaction> Transactions = new ...() public static void DoDBAction(string cmdstring,List<Parameter> parameters,Guid TransactionGuid) { DBCommand cmd = BuildCommand(cmdstring,parameters); if(Transactions.ContainsKey(TransactionGuid)) cmd.Transaction = Transactions[TransactionGuid]; DB.ExecuteScalar(cmd); } public static BuildCommand(string cmd, List<Parameter> parameters) { // Create DB command from EntLib Database and assign parameters } public static Guid BeginTransaction() { // creates new Transaction adding it to "Transactions" and opens a new connection } public static Guid Commit(Guid g) { // Commits Transaction and removes it from "Transactions" and closes connection } public static Guid Rollback(Guid g) { // Rolls back Transaction and removes it from "Transactions" and closes connection } The Calling system would run similar to: Guid g try { g = DBEngine.BeginTransaction() DBEngine.DoDBAction(cmdstring1, parameters,g) // do some other stuff DBEngine.DoDBAction(cmdstring2, parameters2,g) // sit here and wait for a response from other item DBEngine.DoDBAction(cmdstring3, parameters3,g) DBEngine.Commit(g) } catch(Exception){ DBEngine.Rollback(g);} Does this interfere with .NET connection pooling (other than a connection be accidently left open)? Will EntLib keep the connection open until the commit or rollback?

    Read the article

  • Should nested attributes be automatically deleted when I delete the parent record?

    - by brad
    I'm playing around with nested forms in attributes and have a model Invoice that has_many invoice_phone_numbers. I have the following line in my invoice.rb model file accepts_nested_attributes_for :invoice_phone_numbers, :allow_destroy => true, :reject_if => proc { |attrs| attrs.all? { |k, v| v.blank? } } This does what it should and I can delete invoice_phone_numbers from the form by selecting their 'delete' checkbox. But when I delete an Invoice, I have noticed that the nested invoice_phone_numbers are not also deleted. This causes problems as rails seems to reuse id numbers in the Invoice model (Should it? Does this depend on the database? I'm using SQLite3) so phone numbers from previous invoices turn up in new invoices after they have been created. Anyway, my question is should the nested attributes be deleted when I delete the parent attribute? Is there a way to make this happen automatically as part of the nesting process or do I need to deal with this in my invoice model? If so, what is the best way to do this? I would try to go about this with a before_destroy callback but want to know if this is the best way to do this. Anyway, thanks.

    Read the article

  • Spring, iBatis, MySQL - how to manage transactions?

    - by Enrique
    Hello I'm building a web application with spring ibatis and mysql. I'm going to use mysql stored procedures and I will call them with ibatis. My question is about how to manage the transactions. Should I manage the transactions inside the stored procedures or with spring/ibatis or with both?

    Read the article

  • Using pivot tables to group transactions

    - by andreas
    I have my bank account statement and what I would like to do is group the descriptions of the transactions together with their debit or credit and sum their total. I could then see that, e.g., for ebay.com my total debit was $2000, etc. Description Debit Credit A 1 B 1 A 1 B 1 C 1 D 1 A 1 What I want to do is use a pivot table Description Debit Credit A 3 B 2 C 1 D 1 I am no able to do that, as I can't group the description and have additional debit and credit columns -- I get them all in rows with blanks.

    Read the article

  • PHP Nested classes work... sort of?

    - by SeanJA
    So, if you try to do a nested class like this: //nestedtest.php class nestedTest{ function test(){ class E extends Exception{} throw new E; } } You will get an error Fatal error: Class declarations may not be nested in [...] but if you have a class in a separate file like so: //nestedtest2.php class nestedTest2{ function test(){ include('e.php'); throw new E; } } //e.php class E Extends Exception{} So, why does the second hacky way of doing it work, but the non-hacky way of doing it does not work?

    Read the article

  • Ruby on Rails: Simple way to select all records of a nested model?

    - by Josh Pinter
    Just curious, I spent an embarrassing amount of time trying to get an array of all the records in a nested model. I just want to make sure there is not a better way. Here is the setup: I have three models that are nested under each other (Facilities Tags Inspections), producing code like this for routes.rb: map.resources :facilities do |facilities| facilities.resources :tags, :has_many => :inspections end I wanted to get all of the inspections for a facility and here is what my code ended up being: def facility_inspections @facility = Facility.find(params[:facility_id]) @inspections = [] @facility.tags.each do |tag| tag.inspections.each do |inspection| @inspections << inspection end end end It works but is this the best way to do this - I think it's cumbersome. Thanks in advance. Josh

    Read the article

  • BigQuery - UK dev community, JSON, nested/repeated, improved data loading - Live from London

    BigQuery - UK dev community, JSON, nested/repeated, improved data loading - Live from London Join Michael Manoochehri and Ryan Boyd live from London to discuss Strata London and Best Practices for using BigQuery. They'll also host an open Office Hours. Please add your questions to Google Moderator on developers.google.com From: GoogleDevelopers Views: 87 14 ratings Time: 33:00 More in Science & Technology

    Read the article

  • Hierarchies on Steroids #1: Convert an Adjacency List to Nested Sets

    SQL Server MVP Jeff Moden shows us a new very high performance method to convert an "Adjacency List" to “Nested Sets” on a million node hierarchy in less than a minute and 100,000 nodes in just seconds. Not surprisingly, the "steroids" come in a bottle labeled "Tally Table". 12 essential tools for database professionalsThe SQL Developer Bundle contains 12 tools designed with the SQL Server developer and DBA in mind. Try it now.

    Read the article

  • SEO: Nested List vs List, Split Over Divs vs Definition List

    - by Jon P
    From an SEO perspective which, if any, is better: Option 1: Nested lists with h2 tags <ul id="mainpoints"> <li><h2>Powerful Analysis</h2> <ul> <li>Charting and indicators</li> <li>Daily trading signals</li> <li>Company health checks</li> </ul> </li> <li><h2>World Market Data</h2> <ul> [List Items removed for brevity] </ul> </li> <li><h2>Daily Market Data</h2> <ul> [List Items removed for brevity] </ul> </li> </ul> Option 2: Divs with h2 and lists <div id="mainpoints"> <div> <h2>Powerful Analysis</h2> <ul> <li>Charting and indicators</li> <li>Daily trading signals</li> <li>Company health checks</li> </ul> </div> <div> <h2>World Market Data</h2> <ul> [List Items removed for brevity] </ul> </div> <div> <h2>Daily Market Data</h2> <ul> [List Items removed for brevity] </ul> </div> </div> Option 3: Definition List <dl id="mainpoints"> <dt>Powerful Analysis</dt> <dd>- Charting and indicators</dd> <dd>- Daily trading signals</dd> <dd>- Company health checks</dd> <dt>World Market Data</dt> [List Items removed for brevity] <dt>Daily Market Data</dt> [List Items removed for brevity] </dl> My instincts tell me that semanticaly the pure list options (1 & 3) are the best and that h2 may be more SEO friendly (1 & 2) which would point to option 1 as being the best option. I do love the lean makeup of the definition list but will I take an SEO hit by losing the h2 tags? Before anyone asks, h2 is not valid markup in a dt tag. Are my instincts right with a nested list being the way to go?

    Read the article

  • How to use will_paginate with a nested resource in Rails?

    - by Sue Petersen
    I'm new to Rails, and I'm having major trouble getting will_paginate to work with a nested resource. I have two models, Statement and Invoice. will_paginate is working on Statement, but I can't get it to work on Invoice. I know I'd doing something silly, but I can't figure it out and the examples I've found on google won't work for me. statement.rb class Statement < ActiveRecord::Base has_many :invoices def self.search(search, page) paginate :per_page => 19, :page => page, :conditions => ['company like ?', "%#{search}%"], :order => 'date_due DESC, company, supplier' end end statements_controller.rb <irrelevant code clipped for readability> def index #taken from the RAILSCAST 51, will_paginate podcast @statements = Statement.search(params[:search], params[:page]) end I call this in the view like so, and it works: <%= will_paginate @statements %> But I can't figure out how to get it to work for Invoices: invoice.rb class Invoice < ActiveRecord::Base belongs_to :statement def self.search(search, page) paginate :per_page => 19, :page => page, :conditions => ['company like ?', "%#{search}%"], :order => 'employee' end end invoices_controller.rb class InvoicesController < ApplicationController before_filter :find_statement #TODO I can't get will_paginate to work w a nested resource def index #taken from the RAILSCAST 51, will_paginate podcast @invoices = Invoice.search(params[:search], params[:page]) end def find_statement @statement_id = params[:statement_id] return(redirect_to(statements_url)) unless @statement_id @statement = Statement.find(@statement_id) end end And I try to call it like this: <%= will_paginate (@invoices) % The most common error message, as I play with this, is: "The @statements variable appears to be empty. Did you forget to pass the collection object for will_paginate?" I don't have a clue what the problem is, or how to fix it. Thanks for any help and guidance!

    Read the article

  • How to keep a trace of a record inside a nested repeater?

    - by Amokrane
    Hi, I have the following implementation: As you can see I have a repeater (listing the Machines) and a nested repeater (listing the WindowsServices inside each Machine). For each Windows Service I can perform an action using a button. However, to perform this action I need to know which Machine and which WindowsService are concerned. This is my code: protected void Page_Init(object sender, EventArgs e) { rptMachine.ItemDataBound += new RepeaterItemEventHandler(rptMachine_ItemDataBound); } protected void Page_Load(object sender, EventArgs e) { // bind the Machine repeater rptMachine.DataSource = _monitoringService.Machines; rptMachine.DataBind(); } protected void rptMachine_ItemDataBound(object sender, RepeaterItemEventArgs e) { if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem) { Repeater nestedRepeater = (Repeater) e.Item.FindControl("rptWindowsService"); nestedRepeater.DataSource = ((IMachine) e.Item.DataItem).WindowsServices; nestedRepeater.DataBind(); Button btnActionInner = null; // bind the action button situated inside the nested repeater foreach(RepeaterItem ri in nestedRepeater.Items) { if((Button)ri.FindControl("btnAction") != null) { btnActionInner = (Button) ri.FindControl("btnAction"); btnActionInner.CommandName = "ActionState"; btnActionInner.CommandArgument = strWindowsService; } } } } protected void rptWindowsService_ItemCommand(object source, RepeaterCommandEventArgs e) { // do the specific action stop/run for the windows service if (e.CommandName == "ActionState") { if(((Button)(e.CommandSource)).Text.Equals("Stop")) { } else if(((Button)(e.CommandSource)).Text.Equals("Run")) { } } } } } So basically I need to know (inside rptWindowsService_ItemCommand) what is the pair that is concerned by the operation. What's the best way to do that? Don't hesitate to ask for more clarifications! Thanks

    Read the article

  • Is There a More Efficient Way to Write Nested While Loops?

    - by Ryan
    The code below shows nested while loops, but it's not the very efficient. Suppose I wanted to extend the code to include 100 nested while loops. Is there a better way to accomplish this task? <?php $count = 1; $num = 1; $options=3; while ( $num <=$options ) { echo "(".$num . ") "; $num1 = 1; $options1=3; while ( $num1 <=$options1 ) { echo "*".$num1 . "* "; $num2 = 1; $options2=3; while ( $num2 <=$options2 ) { echo "@".$num2 . "@ "; $num3 = 1; $options3=3; while ( $num3 <=$options3 ) { echo $num3 . " "; $num3++; $count++; } echo "<br />"; $num2++; } echo "<br />"; $num1++; } echo "<br />"; $num++; } echo $count; ?>

    Read the article

  • Nested Class member function can't access function of enclosing class. Why?

    - by Rahul
    Please see the example code below: class A { private: class B { public: foobar(); }; public: foo(); bar(); }; Within class A & B implementation: A::foo() { //do something } A::bar() { //some code foo(); //more code } A::B::foobar() { //some code foo(); //<<compiler doesn't like this } The compiler flags the call to foo() within the method foobar(). Earlier, I had foo() as private member function of class A but changed to public assuming that B's function can't see it. Of course, it didn't help. I am trying to re-use the functionality provided by A's method. Why doesn't the compiler allow this function call? As I see it, they are part of same enclosing class (A). I thought the accessibility issue for nested class meebers for enclosing class in C++ standards was resolved. How can I achieve what I am trying to do without re-writing the same method (foo()) for B, which keeping B nested within A? I am using VC++ compiler ver-9 (Visual Studio 2008). Thank you for your help.

    Read the article

  • CouchDB: accessing nested structutes in map function

    - by Vegar
    I have a document based on a xml structure that I have stored in a CouchDB database. Some of the keys contains namespaces and are on the form "namespace:key": {"mykey":{nested:key":"nested value"}} In the map function, I want to emit the nested value as a key, but the colon inside the name makes it hard... emit(doc.mykey.nested:key, doc) <-- will not work. Does anyone know how this can be solved?

    Read the article

  • NHibernate transactions randomly not rolled back

    - by cbp
    I have a suite of integration tests that run inside transactions. Sometimes it seems that NHibernate transactions are not being correctly rolled back. I can't work out what causes this. Here is a slightly simplified overview of the base class that these integration test fixtures run with: public class IntegrationTestFixture { private TransactionScope _transactionScope; private ConnectionScope _connectionScope; [TestFixtureSetUp] public virtual void TestFixtureSetUp() { var session = NHibernateSessionManager.SessionFactory.OpenSession(); CallSessionContext.Bind(session); _connectionScope = new ConnectionScope(); _transactionScope = new TransactionScope(); } [TestFixtureTearDown] public virtual void TestFixtureTearDown() { _transactionScope.Dispose(); _connectionScope.Dispose(); var session = CurrentSessionContext.Unbind(SessionFactory); session.Close(); session.Dispose(); } } A call to the TransactionScope's commit method is never made, therefore how is it possible that data still ends up in the database?

    Read the article

  • hibernate transaction safety (with, without JBoss)

    - by Andy Nuss
    Hi, I am currently using just Hibernate and tomcat (no JBoss), and have hibernate transactions which I'm not clear on what transaction safety level I'm actually using, especially for those which read and get values and then update them). Thus I might be getting dirty reads? So I'm going to start having to study my transactions that require non-dirty reads, and make sure that (1) hibernate controls the transaction safety level of those transactions properly, and (2) be able to still have those transactions where dirty reads are ok. Do I need to install Hibernate with JBoss to control transaction safety levels? If so, what's the easiest way to do this without dramatically changing my application to use the J2EE apis, as I am currently using the basic Hibernate apis. Or better, can I get JTA control with Hibernate without using JBoss? Andy

    Read the article

  • Better understanding of my SQL transactions

    - by Slew Poke
    I just realized that my application was needlessly making 50+ database calls per user request due to some hidden coding -- hidden in the sense that between LINQ, persistence frameworks and events it just so turned out that a huge number of calls were being made without me being aware. Is there a recommended way to analyze individual transactions going to my SQL 2008 database, preferably with some integration to my Visual Studio 2010 environment? I want to be able to 'spy' on individual transactions being made, but only for certain pieces of my code, and without making serious changes to either the code or database.

    Read the article

  • How to avoid StaleObjectStateException when transaction updates thousands of entities?

    - by ThinkFloyd
    We are using Hibernate 3.6.0.Final with JPA 2 and Spring 3.0.5 for a large scale enterprise application running on tomcat 7 and MySQL 5.5. Most of the transactions in application, lives for less than a second and update 5-10 entities but in some use cases we need to update more than 10-20K entities in single transaction, which takes few minutes and hence more than 70% of times such transaction fails with StaleObjectStateException because some of those entities got updated by some other transaction. We generally maintain version column in all tables and in case of StaleObjectStateException we generally retry but since these longs transactions are anyways very long so if we keep on retrying then also I am not very sure that we'll be able to escape StaleObjectStateException. Also lot of activities keep updating these entities in busy hours so we cannot go with pessimistic approach because it can potentially halt many activities in system. Please suggest how to fix such long transaction issue because we cannot spawn thousands of independent and small transactions because we cannot afford messed up data in case of some failed & some successful transactions.

    Read the article

  • Setting a time limit for a transaction in MySQL/InnoDB

    - by Trevor Burnham
    This sprang from this related question, where I wanted to know how to force two transactions to occur sequentially in a trivial case (where both are operating on only a single row). I got an answer—use SELECT ... FOR UPDATE as the first line of both transactions—but this leads to a problem: If the first transaction is never committed or rolled back, then the second transaction will be blocked indefinitely. The innodb_lock_wait_timeout variable sets the number of seconds after which the client trying to make the second transaction would be told "Sorry, try again"... but as far as I can tell, they'd be trying again until the next server reboot. So: Surely there must be a way to force a ROLLBACK if a transaction is taking forever? Must I resort to using a daemon to kill such transactions, and if so, what would such a daemon look like? If a connection is killed by wait_timeout or interactive_timeout mid-transaction, is the transaction rolled back? Is there a way to test this from the console? Clarification: innodb_lock_wait_timeout sets the number of seconds that a transaction will wait for a lock to be released before giving up; what I want is a way of forcing a lock to be released. Update: Here's a simple example that demonstrates why innodb_lock_wait_timeout is not sufficient to ensure that the second transaction is not blocked by the first: START TRANSACTION; SELECT SLEEP(55); COMMIT; With the default setting of innodb_lock_wait_timeout = 50, this transaction completes without errors after 55 seconds. And if you add an UPDATE before the SLEEP line, then initiate a second transaction from another client that tries to SELECT ... FOR UPDATE the same row, it's the second transaction that times out, not the one that fell asleep. What I'm looking for is a way to force an end to this transaction's restful slumber.

    Read the article

  • MSDTC - Communication with the underlying transaction manager has failed (Firewall open, MSDTC network access on)

    - by SocialAddict
    I'm having problems with my ASP.NET web forms system. It worked on our test server but now we are putting it live one of the servers is within a DMZ and the SQL server is outside of that (on our network still though - although a different subnet) I have open up the firewall completely between these two boxes to see if that was the issue and it still gives the error message "Communication with the underlying transaction manager has failed" whenever we try and use the "TransactionScope". We can access the data for retrieval it's just transactions that break it. We have also used msdtc ping to test the connection and with the amendments on the firewall that pings successfully, but the same error occurs! How do i resolve this error? Any help would be great as we have a system to go live today. Panic :) Edit: I have created a more straightforward test page with a transaction as below and this works fine. Could a nested transaction cause this kind of error and if so why would this only cause an issue when using a live box in a dmz with a firewall? AuditRepository auditRepository = new AuditRepository(); try { using (TransactionScope scope = new TransactionScope()) { auditRepository.Add(DateTime.Now, 1, "TEST-TRANSACTIONS#1", 1); auditRepository.Save(); auditRepository.Add(DateTime.Now, 1, "TEST-TRANSACTIONS#2", 1); auditRepository.Save(); scope.Complete(); } } catch (Exception ex) { Response.Write("Test Error For Transaction: " + ex.Message + "<br />" + ex.StackTrace); }

    Read the article

  • What is the best way to add and order to Doctrine Nested Set Trees?

    - by murze
    What is the best way to add a sense of order in Doctrine Nested Sets? The documention contains several examples of how to get al the childeren of a specific node $category->getNode()->getSiblings() But how can I for example: change the position of the fourth sibling to the second position get only the second sibling add a sibling between the second and third child etc... Do I have to manually add and ordercolumn to the model to do these operations?

    Read the article

< Previous Page | 8 9 10 11 12 13 14 15 16 17 18 19  | Next Page >