Search Results

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

Page 6/155 | < Previous Page | 2 3 4 5 6 7 8 9 10 11 12 13  | Next Page >

  • Mounting a Nested SSH Location

    - by Brandon Pelfrey
    I have a server that is only SSH-accessible to machines within a network and my only access to that network from the outside world is a single publicly-SSH-accessible node. Is there some way that I can mount the nested machine from the outside? Me - Public SSH-accessible Node - Internal SSH-accessible Machine Thanks!

    Read the article

  • Using nested classes for constants?

    - by antirysm
    What's wrong with using nested classes to group constants? Like so: public static class Constants { public static class CategoryA { public const string ValueX = "CatA_X"; public const string ValueY = "CatA_Y"; } public static class CategoryB { public const string ValueX = "CatB_X"; public const string ValueY = "CatB_Y"; } } Used like so: Console.WriteLine(Constants.CategoryA.ValueY); Console.WriteLine(Constants.CategoryB.ValueX); You could also make the "Constants"-class partial...

    Read the article

  • Validate number of nested attributes

    - by Damien MATHIEU
    Hello, I have a model with nested attributes : class Foo < ActiveRecord::Base has_many :bar accepts_nested_attributes_for :bar end It works fine. However I'd want to be sure that for every Foo, I have at least two Bar. I can't access the bar_attributes in my validations so it seems I can't validate it. Is there any clean way to do so ?

    Read the article

  • Rails nested form for belongs_to

    - by user1232533
    I'm new to rails and have some troubles with creating a nested form. My models: class User < ActiveRecord::Base belongs_to :company accepts_nested_attributes_for :company, :reject_if => :all_blank end class Company < ActiveRecord::Base has_many :users end Now i would like to create a new company from the user sign_up page (i use Devise btw) by given only a company name. And have a relation between the new User and new Company. In the console i can create a company for a existing User like this: @company = User.first.build_company(:name => "name of company") @company.save That works, but i can't make this happen for a new user, in my new user sign_up form i tried this (i know its wrong by creating a new User fist but im trying to get something working here..): <%= simple_form_for(resource, :as => resource_name, :html => { :class => 'form-horizontal' }, :url => registration_path(resource_name)) do |f| %> <%= f.error_notification %> <div class="inputs"> <% @user = User.new company = @user.build_company() %> <% f.fields_for company do |builder| %> <%= builder.input :name, :required => true, :autofocus => true %> <% end %> <%= f.input :email, :required => true, :autofocus => true %> <%= f.input :password, :required => true %> <%= f.input :password_confirmation, :required => true %> </div> <div class="form-actions"> <%= f.button :submit, :class => 'btn-primary', :value => 'Sign up' %> </div> I did my best to google for a solution/ example.. found some nested form examples but it's just not clear to me how to do this. Really hope somebody can help me with this. Any help on this would be appreciated. Thanks in advance! Greets, Daniel

    Read the article

  • SQL SERVER – Table Variables and Transactions – SQL in Sixty Seconds #007 – Video

    - by pinaldave
    Today’s SQL in Sixty Seconds video is inspired from my presentation at TechEd India 2012 on Misconception and Resolution. Quite often I have seen people getting confused with certain behavior of the T-SQL. They expect SQL to behave certain way and SQL Server behave differently. This kind of issue often creates confusion and frustration. Sometime I have seen them also confusing it with bug and submitting the bug, where reality is totally different. Similar concept which are going to see today. I have seen quite commonly developer assuming that table various will be rolled back when transaction is rolled back. This sixty seconds video describes that table various are not rolled back when transactions are rolled back. More on Errors: Difference Temp Table and Table Variable – Effect of Transaction Effect of TRANSACTION on Local Variable – After ROLLBACK and After COMMIT Debate – Table Variables vs Temporary Tables – Quiz – Puzzle – 13 of 31 I encourage you to submit your ideas for SQL in Sixty Seconds. We will try to accommodate as many as we can. Reference: Pinal Dave (http://blog.sqlauthority.com) Filed under: Database, Pinal Dave, PostADay, SQL, SQL Authority, SQL in Sixty Seconds, SQL Query, SQL Scripts, SQL Server, SQL Tips and Tricks, SQLServer, T SQL, Video

    Read the article

  • Distributed transactions and queues, ruby, erlang

    - by chrispanda
    I have a problem that involves several machines, message queues, and transactions. So for example a user clicks on a web page, the click sends a message to another machine which adds a payment to the user's account. There may be many thousands of clicks per second. All aspects of the transaction should be fault tolerant. I've never had to deal with anything like this before, but a bit of reading suggests this is a well known problem. So to my questions. Am I correct in assuming that secure way of doing this is with a two phase commit, but the protocol is blocking and so I won't get the required performance? It appears that DBs like redis and message queuing system like Rescue, RabbitMQ etc don't really help me a lot - even if I implement some sort of two phase commit, the data will be lost if redis crashes because it is essentially memory-only. All of this has led me to look at erlang - but before I wade in and start learning a new language, I would really like to understand better if this is worth the effort. Specifically, am I right in thinking that because of its parallel processing capabilities, erlang is a better choice for implementing a blocking protocol like two phase commit, or am I confused?

    Read the article

  • How can I get SQL Server transactions to use record-level locks?

    - by Joe White
    We have an application that was originally written as a desktop app, lo these many years ago. It starts a transaction whenever you open an edit screen, and commits if you click OK, or rolls back if you click Cancel. This worked okay for a desktop app, but now we're trying to move to ADO.NET and SQL Server, and the long-running transactions are problematic. I found that we'll have a problem when multiple users are all trying to edit (different subsets of) the same table at the same time. In our old database, each user's transaction would acquire record-level locks to every record they modified during their transaction; since different users were editing different records, everyone gets their own locks and everything works. But in SQL Server, as soon as one user edits a record inside a transaction, SQL Server appears to get a lock on the entire table. When a second user tries to edit a different record in the same table, the second user's app simply locks up, because the SqlConnection blocks until the first user either commits or rolls back. I'm aware that long-running transactions are bad, and I know that the best solution would be to change these screens so that they no longer keep transactions open for a long time. But since that would mean some invasive and risky changes, I also want to research whether there's a way to get this code up and running as-is, just so I know what my options are. How can I get two different users' transactions in SQL Server to lock individual records instead of the entire table? Here's a quick-and-dirty console app that illustrates the issue. I've created a database called "test1", with one table called "Values" that just has ID (int) and Value (nvarchar) columns. If you run the app, it asks for an ID to modify, starts a transaction, modifies that record, and then leaves the transaction open until you press ENTER. I want to be able to start the program and tell it to update ID 1; let it get its transaction and modify the record; start a second copy of the program and tell it to update ID 2; have it able to update (and commit) while the first app's transaction is still open. Currently it freezes at step 4, until I go back to the first copy of the app and close it or press ENTER so it commits. The call to command.ExecuteNonQuery blocks until the first connection is closed. public static void Main() { Console.Write("ID to update: "); var id = int.Parse(Console.ReadLine()); Console.WriteLine("Starting transaction"); using (var scope = new TransactionScope()) using (var connection = new SqlConnection(@"Data Source=localhost\sqlexpress;Initial Catalog=test1;Integrated Security=True")) { connection.Open(); var command = connection.CreateCommand(); command.CommandText = "UPDATE [Values] SET Value = 'Value' WHERE ID = " + id; Console.WriteLine("Updating record"); command.ExecuteNonQuery(); Console.Write("Press ENTER to end transaction: "); Console.ReadLine(); scope.Complete(); } } Here are some things I've already tried, with no change in behavior: Changing the transaction isolation level to "read uncommitted" Specifying a "WITH (ROWLOCK)" on the UPDATE statement

    Read the article

  • customer.name joining transactions.name vs. customer.id [serial] joining transactions.id [integer]

    - by Frank Computer
    INFORMIX-SQL 7.32 Pawnshop Application: one-to-many relationship where each customer (master) can have many transactions (detail). customer( id serial, pk_name char(30), {PATERNAL-NAME MATERNAL-NAME, FIRST-NAME MIDDLE-NAME} [...] ); unique index on id; unique cluster index on name; transaction( fk_name char(30), ticket_number serial, [...] ); dups cluster index on fk_name; unique index on ticket_number; Several people have told me this is not the correct way to join master to detail. They said I should always join customer.id[serial] to transactions.id[integer]. When a customer pawns merchandise, clerk queries the master using wildcards on name. The query usually returns several customers, clerk scrolls until locating the right name, enters a 'D' to change to detail transactions table, all transactions are automatically queried, then clerk enters an 'A' to add a new transaction. The problem with using customer.id joining transaction.id is that although the customer table is maintained in sorted name order, clustering the transaction table by fk_id groups the transactions by fk_id, but they are not in the same order as the customer name, so when clerk is scrolling through customer names in the master, the system has to jump allover the place to locate the clustered transactions belonging to each customer. As each new customer is added, the next id is assigned to that customer, but new customers dont show up in alphabetical order. I experimented using id joins and confirmed the decrease in performance. How can I use id joins instead of name joins and still preserve the clustered transaction order by name if transactions has no name column?

    Read the article

  • python union of 2 nested lists with index

    - by sbas
    I want to get the union of 2 nested lists plus an index to the common values. I have two lists like A = [[1,2,3],[4,5,6],[7,8,9]] and B = [[1,2,3,4],[3,3,5,7]] but the length of each list is about 100 000. To A belongs an index vector with len(A): I = [2,3,4] What I want is to find all sublists in B where the first 3 elements are equal to a sublist in A. In this example I want to get B[0] returned ([1,2,3,4]) because its first three elements are equal to A[0]. In addition, I also want the index to A[0] in this example, that is I[0]. I tried different things, but nothing worked so far :( First I tried this: Common = [] for i in range(len(B)): if B[i][:3] in A: id = [I[x] for x,y in enumerate(A) if y == B[i][:3]][0] ctdCommon.append([int(id)] + B[i]) But that takes ages, or never finishes Then I transformed A and B into sets and took the union from both, which was very quick, but then I don't know how to get the corresponding indices Does anyone have an idea?

    Read the article

  • nested for loop

    - by Gary
    Hello, Just learning Python and trying to do a nested for loop. What I'd like to do in the end is place a bunch of email addresses in a file and have this script find the info, like the sending IP of mail ID. For now i'm testing it on my /var/log/auth.log file Here is my code so far: #!/usr/bin/python # this section puts emails from file(SpamEmail) in to a array(array) in_file = open("testFile", "r") array = in_file.readlines() in_file.close() # this section opens and reads the target file, in this case 'auth.log' log = open("/var/log/auth.log", "r") auth = log.readlines() for email in array: print "Searching for " +email, for line in auth: if line.find(email) > -1: about = line.split() print about[0], print Inside 'testfile' I have the word 'disconnect' cause I know it's in the auth.log file. It just doesn't find the word 'disconnect'. In the line of "if line.find(email) -1:" i can replace email and put "disconnect" the scripts finds it fine. Any idea? Thanks in advance. Gary

    Read the article

  • Return pointer to nested inner class from generic outer class

    - by helixed
    I'm new to C++, so bear with me. I have a generic class called A. A has a nested class called B. A contains a method called getB(), which is supposed to return a new instance of B. However, I can't get my code to compile. Here's what it looks like:#include A.h template <class E> class A { public: class B { public: int data; }; B * getB(); }; A.cpp #include "A.h" template <class E> A<E>::B * A::getB() { return new B(); } When I try to compile this, I get the following error: error: expected constructor, destructor, or type conversion before '*' token Does anybody know what I'm doing wrong? Thanks, helixed

    Read the article

  • Nasty deep nested loop in Rails

    - by CalebHC
    I have this nested loop that goes 4 levels deep to find all the image widgets and calculate their sizes. This seems really inefficient and nasty! I have thought of putting the organization_id in the widget model so I could just call something like organization.widgets.(named_scope), but I feel like that's a bad short cut. Is there a better way? Thanks class Organization < ActiveRecord::Base ... def get_image_widget_total total_size = 0 self.trips.each do |t| t.phases.each do |phase| phase.pages.each do |page| page.widgets.each do |widget| if widget.widget_type == Widget::IMAGE total_size += widget.image_file_size end end end end end return total_size end ... end

    Read the article

  • Ruby on Rails - nested attributes: How do I access the parent model from child model

    - by TMaYaD
    I have a couple of models like so class Bill < ActiveRecord::Base has_many :bill_items belongs_to :store accepts_nested_attributes_for :bill_items end class BillItem <ActiveRecord::Base belongs_to :product belongs_to :bill validate :has_enough_stock def has_enough_stock stock_available = Inventory.product_is(self.product).store_is(self.bill.store).one.quantity errors.add(:quantity, "only #{stock_available} is available") if stock_available < self.quantity end end The above validation so obviously doesn't work because when I'm reading the bill_items from nested attributes inside the bill form, the attributes bill_item.bill_id or bill_item.bill are not available before being saved. So how do I go about doing something like that?

    Read the article

  • wpf: design time error while writing Nested type in xaml

    - by viky
    I have created a usercontrol which accept type of enum and assign the values of that enum to a ComboBox control in that usercontrol. Very Simple. I am using this user control in DataTemplates. Problem comes when there comes nested type. I assign that using this notation EnumType="{x:Type myNamespace:ParentType + NestedType}" It works fine at runtime. but at design time it throws error saying Could not create an instance of type 'TypeExtension' Why? Due to this I am not able to see my window at design time. Any help?

    Read the article

  • iPhone Setting ViewController nested in NSMutableArray

    - by Peter George
    Hello I'm trying to set attributes for a viewcontroller nested inside a NSMutableArray, for example I have 3 ViewController inside this array: FirstViewController *firstViewController = [FirstViewController alloc]; SecondViewController *secondViewController = [SecondViewController alloc]; ThirdViewController *thirdViewController = [ThirdViewController alloc]; NSMutableArray *viewControllerClasses = [[NSMutableArray alloc] initWithObjects: firstViewController, secondViewController, thirdViewController, nil]; for (int x=0; x<[viewControllerClasses count]; x++) { // as an example to set managedObjectContext I otherwise would set firstViewController.managedObjectContext = context; [viewControllerClasses objectAtIndex:x].managedObjectContext = context; } But this results in an error: Request for member "managedObjectContext" in something not a structure or union. Shouldn't be "firstViewController" be the same as [viewControllerClasses objectAtIndex:0]?

    Read the article

  • Lua class instance with nested tables

    - by Anonnobody
    Hello, Simple lua game with simple class like so: creature = class({ name = "MONSTER BADDY!", stats = { power = 10, agility = 10, endurance = 10, filters = {} }, other_things = ... }) creatureA = creature.new() creatureB = creature.new() creatureA.name = "Frank" creatureB.name = "Zappa" creatureA.stats.agility = 20 creatureB.stats.power = 12 -- blah blah blah Non table values are individual to each instance, but table values are shared among all instances and if I modify a stats.X value in one instance, all other instances see the same stats table. Q1: Is my OO implementation flawed? I tried LOOP and the same result occured, is there a fundamental flaw in my logic? Q2: How would you have each instance of creature have it's own stats table (and sub tables)? PS. I cannot flatten my class table as it's a bit more complicated than the example and other parts of the code are simplified with this nested table implementation. Thanks a bunch.

    Read the article

  • Nested form problem in Rails : NoMethodError in Show

    - by brianheys
    I'm trying to build a simple product backlog application to teach myself Rails. For each product, there can be multiple product backlog entries, so I want to create a product view that shows the product information, all the backlog entries for the product, and includes a nested form for adding more backlog entries. Everything works until I try to add the form to the view, which then results in the following error: NoMethodError in Products#show Showing app/views/products/show.html.erb where line #29 raised: undefined method `pblog_ref' for #<Product:0x10423ba68> Extracted source (around line #29): 26: <%= f.error_messages %> 27: <p> 28: <%= f.label :pblog_ref %><br /> 29: <%= f.text_field :pblog_ref %> 30: </p> 31: <p> 32: <%= f.label :product %><br /> The product view where the problem is reported is as follows (the partial works fine, so I won't include that code): <h1>Showing product</h1> <p> <b>Product ref:</b> <%=h @product.product_ref %> </p> <p> <b>Description:</b> <%=h @product.description %> </p> <p> <b>Owner:</b> <%=h @product.owner %> </p> <p> <b>Status:</b> <%=h @product.status %> </p> <h2>Product backlog</h2> <div id="product-backlog"> <%= render :partial => @product.product_backlogs %> </div> <% form_for(@product, ProductBacklog.new) do |f| %> <%= f.error_messages %> <p> <%= f.label :pblog_ref %><br /> <%= f.text_field :pblog_ref %> </p> <p> <%= f.label :product %><br /> <%= f.text_field :product %> </p> <p> <%= f.label :description %><br /> <%= f.text_field :description %> </p> <p> <%= f.label :owner %><br /> <%= f.text_field :owner %> </p> <p> <%= f.label :status %><br /> <%= f.text_field :status %> </p> <p> <%= f.submit 'Create' %> </p> <% end %> <%= link_to 'Edit', edit_product_path(@product) %> | <%= link_to 'Back', products_path %> This is the Product model: class Product < ActiveRecord::Base validates_presence_of :product_ref, :description, :owner has_many :product_backlogs end This is the ProductBacklog model: class ProductBacklog < ActiveRecord::Base belongs_to :product end These are the routes: map.resources :product_backlogs map.resources :products, :has_many => :product_backlogs I've checked what I'm doing against the Creating a weblog in 15 minutes with Rails 2 screencast, and in principle I seem to be doing the same thing as him - only his nested comments form works, and mine doesn't! I hope someone can help with this, before I turn mad! I'm sure it's something trivial.

    Read the article

  • Loading a DB table into nested dictionaries in Python

    - by Hossein
    Hi, I have a table in MySql DB which I want to load it to a dictionary in python. the table columns is as follows: id,url,tag,tagCount tagCount is the number of times that a tag has been repeated for a certain url. So in that case I need a nested dictionary, in other words a dictionary of dictionary, to load this table. Because each url have several tags for which there are different tagCounts.the code that I used is this:( the whole table is about 22,000 records ) cursor.execute( ''' SELECT url,tag,tagCount FROM wtp ''') urlTagCount = cursor.fetchall() d = defaultdict(defaultdict) for url,tag,tagCount in urlTagCount: d[url][tag]=tagCount print d first of all I want to know if this is correct.. and if it is why it takes so much time? Is there any faster solutions? I am loading this table into memory to have fast access to get rid of the hassle of slow database operations, but with this slow speed it has become a bottleneck itself, it is even much slower than DB access. and anyone help? thanks

    Read the article

  • Bash Nested Loops, mixture of dates and numbers

    - by Saleh
    Hi, I am trying to output a range of commands with different dates and numbers associated. for each hour eg. Output im trying to do in a loop is: shell.sh filename<number e.g. between 1-24> <date e.g. 20100928> <number e.g. between 1-24> <id> So basically the the above will generate an output done 24 times for each particular day with a unique 4 digit id. I was thinking of having a nested loop, as the batch number needs to be unique. can anyone help?

    Read the article

  • Mongoid Embeds_many won't save on nested form

    - by Brandon J McKay
    I've got an embeds_many association I'm trying to set up which I've done successfully before, but I'm trying to do it all in one nested form and I can't figure it out. Let's say we have a pocket model: class Pocket include Mongoid::Document field :title, type: String embeds_many :coins, cascade_callbacks: true end and a Coin Model: class Coin include Mongoid::Document field :name, type: String embedded_in :pocket end in my form for the pocket, I'm using: = f.fields_for @pocket.coins do |coin| = coin.text_field :name My controller is the default scaffolded controller. When I use the console, it saves fine and I can see the new pocket and coin I've created. But when I try to create or update a coin from the form, the pocket saves but the coin remains unchanged. What am I missing here?

    Read the article

  • How do I override methods of nested types?

    - by Mason Wheeler
    I've got a custom TObjectList descendant in Delphi 2009, and I'd like to play with its enumerator a bit and add some filtering functionality to the MoveNext method, to cause it to skip certain objects. MoveNext is called by DoMoveNext, which is a virtual method, so this shouldn't be difficult to override... except for one thing. The TEnumerator for TObjectList isn't its own class; it's declared as a nested type within the TObjectList declaration. Is there any simple way to override TEnumerator.DoMoveNext in my descendant class, or do I have to reimplement the whole TEnumerator? It's not a very big class, but I'd prefer to keep redundancies to a minimum if I can...

    Read the article

  • Rails 3 Create method using nested resources?

    - by user1461119
    How can I clean this up using rails 3 features? I have a post that belongs to a group and also a user. The group and user has_many posts. I am using a nested resource resources :groups do resources :posts end <%= form_for @post, :url => group_posts_path(params[:group_id]) do |f| %> .... <% end %> def create @group = Group.find(1) @post = @group.posts.build(params[:post]) @post.user_id = current_user.id respond_to do |format| if @post.save ..... end end end Thank you.

    Read the article

  • Update ancestors in a nested set?

    - by Travis
    I am using nested sets to represent a tree in mysql, like so: Tree ID title lft rgt Given the ID of a node in the tree, what is the easiest / best way to UPDATE that node as well as all of it's ancestors? For example, let's say that the node ID (36) is 4 levels deep in the tree. I would like to update its title, as well as every parent node's title, all the way to the root, to the word "fish". (Should be four updates in all.) Thanks for your help!

    Read the article

  • Use nested static class as ActionListener for the Outer class

    - by Digvijay Yadav
    I want to use an nested static class as an actionListener for the enclosing class's GUI elements. I did something like this: public class OuterClass { public static void myImplementation() { OuterClass.StartupHandler startupHandler = new OuterClass.StartupHandler(); exitMenuItem.addActionListener(startupHandler); // error Line } public static class StartupHandler implements ActionListener { @Override public void actionPerformed(ActionEvent e) { //throw new UnsupportedOperationException("Not supported yet."); if (e.getSource() == exitMenuItem) { System.exit(1); } else if (e.getSource() == helpMenuItem) { // show help menu } } } } But when I invoke this code I get the NullPointerException at the //error Line. Is this the right method to do do this or there is something I did am missing?

    Read the article

< Previous Page | 2 3 4 5 6 7 8 9 10 11 12 13  | Next Page >