Search Results

Search found 7391 results on 296 pages for 'record locking'.

Page 24/296 | < Previous Page | 20 21 22 23 24 25 26 27 28 29 30 31  | Next Page >

  • ZooKeeper and RabbitMQ/Qpid together - overkill or a good combination?

    - by Chris Sears
    Greetings, I'm evaluating some components for a multi-data center distributed system. We're going to be using message queues (via either RabbitMQ or Qpid) so agents can make asynchronous requests to other agents without worrying about addressing, routing, load balancing or retransmission. In many cases, the agents will be interacting with components that were not designed for highly concurrent access, so locking and cross-agent coordination will be needed to avoid race conditions. Also, we'd like the system to automatically respond to agent or data center failures. With the above use cases in mind, ZooKeeper seemed like it might be a good fit. But I'm wondering if trying to use both ZK and message queuing is overkill. It seems like what Zookeeper does could be accomplished by my own cluster manager using AMQP messaging, but that would be hard to get really right. On the other hand, I've seen some examples where ZooKeeper was used to implement message queuing, but I think RabbitMQ/Qpid are a more natural fit for that. Has anyone out there used a combination like this? Thanks in advance, -Chris

    Read the article

  • Is it safe to lock a static variable in a non-static class?

    - by Dario Solera
    I've got a class that manages a shared resource. Now, since access to the resource depends on many parameters, this class is instantiated and disposed several times during the normal execution of the program. The shared resource does not support concurrency, so some kind of locking is needed. The first thing that came into my mind is having a static instance in the class, and acquire locks on it, like this: // This thing is static! static readonly object MyLock = new object(); // This thing is NOT static! MyResource _resource = ...; public DoSomeWork() { lock(MyLock) { _resource.Access(); } } Does that make sense, or would you use another approach?

    Read the article

  • Are we asking too much of transactional memory?

    - by Carl Seleborg
    I've been reading up a lot about transactional memory lately. There is a bit of hype around TM, so a lot of people are enthusiastic about it, and it does provide solutions for painful problems with locking, but you regularly also see complaints: You can't do I/O You have to write your atomic sections so they can run several times (be careful with your local variables!) Software transactional memory offers poor performance [Insert your pet peeve here] I understand these concerns: more often than not, you find articles about STMs that only run on some particular hardware that supports some really nifty atomic operation (like LL/SC), or it has to be supported by some imaginary compiler, or it requires that all accesses to memory be transactional, it introduces type constraints monad-style, etc. And above all: these are real problems. This has lead me to ask myself: what speaks against local use of transactional memory as a replacement for locks? Would this already bring enough value, or must transactional memory be used all over the place if used at all?

    Read the article

  • Must all Concurrent Data Store (CDB) locks be explicitly released when closing a Berkeley DB?

    - by Steve Emmerson
    I have an application that comprises multiple processes each accessing a single Berkeley DB Concurrent Data Store (CDB) database. Each process is single-threaded and does no explicit locking of the database. When each process terminates normally, it calls DB-close() and DB_ENV-close(). When all processes have terminated, there should be no locks on the database. Episodically, however, the database behaves as if some process was holding a write-lock on it even though all processes have terminated normally. Does each process need to explicitly release all locks before calling DB_ENV-close()? If so, how does the process obtain the "locker" parameter for the call to DB_ENV-loc_vec()?

    Read the article

  • How can two threads access a common array of buffers with minimal blocking ? (c#)

    - by Jelly Amma
    Hello, I'm working on an image processing application where I have two threads on top of my main thread: 1 - CameraThread that captures images from the webcam and writes them into a buffer 2 - ImageProcessingThread that takes the latest image from that buffer for filtering. The reason why this is multithreaded is because speed is critical and I need to have CameraThread to keep grabbing pictures and making the latest capture ready to pick up by ImageProcessingThread while it's still processing the previous image. My problem is about finding a fast and thread-safe way to access that common buffer and I've figured that, ideally, it should be a triple buffer (image[3]) so that if ImageProcessingThread is slow, then CameraThread can keep on writing on the two other images and vice versa. What sort of locking mechanism would be the most appropriate for this to be thread-safe ? I looked at the lock statement but it seems like it would make a thread block-waiting for another one to be finished and that would be against the point of triple buffering. Thanks in advance for any idea or advice. J.

    Read the article

  • hibernate versioning parent entity

    - by Priit
    Consider two entities Parent and Child. Child is part of Parent's transient collection Child has a ManyToOne mapping to parent with FetchType.LAZY Both are displayed on the same form to a user. When user saves the data we first update Parent instance and then Child collection (both using merge). Now comes the tricky part. When user modifies only Child property on the form then hibernate dirty checking does not update Parent instance and thus does not increase optimistic locking version number for that entity. I would like to see situation where only Parent is versioned and every time I call merge for Parent then version is always updated even if actual update is not executed in db.

    Read the article

  • Lock thread using somthing other than a object

    - by Scott Chamberlain
    when using a lock does the thing you are locking on have to be a object. For example is this legal static DateTime NextCleanup = DateTime.Now; const TimeSpan CleanupInterval = new TimeSpan(1, 0, 0); private static void DoCleanup() { lock ((object)NextCleanup) { if (NextCleanup < DateTime.Now) { NextCleanup = DateTime.Now.Add(CleanupInterval); System.Threading.ThreadPool.QueueUserWorkItem(new System.Threading.WaitCallback(cleanupThread)); } } return; } EDIT-- From reading SLaks' responce I know the above code would be not valid but would this be? static MyClass myClass = new MyClass(); private static void DoCleanup() { lock (myClass) { // } return; }

    Read the article

  • Generating a set of files containing dumps of individual tables in a way that guarantees database co

    - by intuited
    I'd like to dump a MySQL database in such a way that a file is created for the definition of each table, and another file is created for the data in each table. I'd like this to be done in a way that guarantees database integrity by locking the entire database for the duration of the dump. What is the best way to do this? Similarly, what's the best way to lock the database while restoring a set of these dump files? edit I can't assume that mysql will have permission to write to files.

    Read the article

  • Mixing synchronized() with ReentrantLock.lock()

    - by yarvin
    In Java, do ReentrantLock.lock() and ReetrantLock.unlock() use the same locking mechanism as synchronized()? My guess is "No," but I'm hoping to be wrong. Example: Imagine that Thread 1 and Thread 2 both have access to: ReentrantLock lock = new ReentrantLock(); Thread 1 runs: synchronized (lock) { // blah } Thread 2 runs: lock.lock(); try { // blah } finally { lock.unlock(); } Assume Thread 1 reaches its part first, then Thread 2 before Thread 1 is finished: will Thread 2 wait for Thread 1 to leave the synchronized() block, or will it go ahead and run?

    Read the article

  • Determining the hostname/IP address from the MX record in PHP

    - by pmmenneg
    Hi there, have a basic email domain validation script that takes a user's email domain, resolves the IP address from that and then checks that against various published blacklists. Here is how I am determining the IP: $domain = substr(strchr($email, '@'), 1); $ip = gethostbyname($domain); The problem is that some email address domains, such as [email protected], use an MX record rather than an A record, so using gethostbyname('alumni.example.net') will fail to resolve. I know when a user's email is using an MX in the email itself by using the PHP checkdnsrr function, but once at that stage am a little stuck as to how to proceed. In theory, I could parse out the 'root' domain, i.e. 'example.net' and check it, but I've not found reliable regex that can handle this task when the user could easily have an email the format of [email protected]... So, any suggestions on how to best tackle this??

    Read the article

  • How can I tell datacontext I've updated a record via StoreProcedure

    - by Ldsenow
    Hi Geeks, I've a stroe procedure to update a record and after running it I use LinqToSql to delete the record. I know it is weird but I just want to test how smart the datacontext it is and understand how it works. Since the datacontext caches the results so any change via it can be recorded but now I use a store procedure to update something, it would not know. So when I try to delete it, an exception comes out "Row not found or changed". How I can tell the datacontext what I have updated? If I can do so the problem will sovle.

    Read the article

  • Access - how to derive a field upon entry of a record

    - by jonos
    I have an Access database for a media rental company which includes the following tables, among others; LOAN: customer_id (pk), loan_datetimeLeant (pk), loan_dateReturned (pk) LOAN_ITEMS: customer_id (pk), loan_datetimeLeant (pk), item_id (pk), loanItem_cost ITEM: item_id (pk), product_id, item_availability PRODUCT: product_id (pk), product_name, product_type MEDIA_COST: product_type (pk), product_cost So basically the 'product type' (DVD, VHS etc) determines the cost. The 'product id' determines what movie, platform etc each item is. My question is: When creating a form for the Loan_Items table, how can I populate the loanItem_cost field (so it is stored) whenever a new Loan_Item record is added? I need to store it as the cost of the item (product_cost) may change over time and I'd like to record what the customer paid at the time the loan was made. Thanks in advance

    Read the article

  • Daily/Weekly/Monthly Record Count Search via StoredProcedure

    - by user270960
    Using MS SQL Server.I have made a Stored Procedure naming "SP_Get_CallsLogged". I have a table named "TRN_Call", and it has one column named "CallTime" which is a DateTime. I have a web-page in my application where the User enters:- 1.StartDate (DateTime) 2.EndDate (DateTime) 3.Period(Daily/Weekly/Monthly) (varchar) (from DropDownList) I want to get the Record Count of those calls in my table *TRN_Call* on the basis of the specified Period(Daily/Weekly/Monthly) selected by user in the DropDownList. e.g. StartDate ='1/18/2010 11:10:46 AM' EndDate ='1/25/2010 01:10:46 AM' Period =Daily So the record count between these above mentioned dates(StartDate+EndDate) should come in a manner so that I can refer to those counts separately i.e. the following:- Date 1/18/2010 Records Found 5 Date 1/19/2010 Records Found 50 Date 1/20/2010 Records Found 15 Date 1/21/2010 Records Found 32 Date 1/22/2010 Records Found 12 Date 1/23/2010 Records Found 15 Date 1/24/2010 Records Found 17 Date 1/25/2010 Records Found 32 and send those Counts to the Web Application so that these counts could be listed then in the Crystal Reports.

    Read the article

  • iPhone Development - Using NSPredicate to retrieve most recently added record from CoreData

    - by Mustafa
    I want to retrieve the most recently added record from CoreData. I was wondering if that's possible using NSPredicate? If so, how? e.g. i have a one-to-many relationship between Department and Staff, and i want to fetch the Staff record that was most recently employed. The Staff table has a date field which can be used. I don't want to fetch all the Staff records and then look for the right one. Note that CoreData stores the related records in an NSSet.

    Read the article

  • AVAudioRecorder prepareToRecord works, but record fails

    - by iPadDeveloper2011
    I just built and tested a basic AVAudioRecorder/AVAudioPlayer sound recorder and player. Eventually I got this working on the device, as well as the simulator. My player/recorder code is in a single UIView subclass. Unfortunately, when I copy the class into my main project, it no longer works (on the device--the simulator is fine). prepareToRecord is working fine, but record isn't. Here is some code: audioRecorder = [[ AVAudioRecorder alloc] initWithURL:url settings:recordSettings error:&error]; if ([audioRecorder prepareToRecord]){ audioRecorder.meteringEnabled = YES; if(![audioRecorder record])NSLog(@"recording failed!"); }else { int errorCode = CFSwapInt32HostToBig ([error code]); NSLog(@"preparedToRecord=NO Error: %@ [%4.4s])" , [error localizedDescription], (char*)&errorCode); ... I get "recording failed". Anyone have any ideas why this is happening?

    Read the article

  • How to manage multiple versions of the same record

    - by Darvis Lombardo
    I am doing short-term contract work for a company that is trying to implement a check-in/check-out type of workflow for their database records. Here's how it should work... 1) A user creates a new entity within the application. There are about 20 related tables that will be populated in addition to the main entity table. 2) Once the entity is created the user will mark it as the master. 3) Another user can make changes to the master only by "checking out" the entity. Multiple users can checkout the entity at the same time. 4) Once the user has made all the necessary changes to the entity, they put it in a "needs approval" status. 5) After an authorized user reviews the entity, they can promote it to master which will put the original record in a tombstoned status. The way they are currently accomplishing the "check out" is by duplicating the entity records in all the tables. The primary keys include EntityID + EntityDate, so they duplicate the entity records in all related tables with the same EntityID and an updated EntityDate and give it a status of "checked out". When the record is put into the next state (needs approval), the duplication occurs again. Eventually it will be promoted to master at which time the final record is marked as master and the original master is marked as dead. This design seems hideous to me, but I understand why they've done it. When someone looks up an entity from within the application, they need to see all current versions of that entity. This was a very straightforward way for making that happen. But the fact that they are representing the same entity multiple times within the same table(s) doesn't sit well with me, nor does the fact that they are duplicating EVERY piece of data rather than only storing deltas. I would be interested in hearing your reaction to the design, whether positive or negative. I would also be grateful for any resoures you can point me to that might be useful for seeing how someone else has implemented such a mechanism. Thanks! Darvis

    Read the article

  • How to modify TList<record> value?

    - by Astronavigator
    How to modify TList < record value ? type TTest = record a,b,c:Integer end; var List:TList<TTest>; A:TTest; P:Pointer; .... .... List[10] := A; <- OK List[10].a:=1; <- Here compiler error : Left side cannot be assined to P:=@List[10]; <- Error: Variable requied

    Read the article

  • Writing datatable to database file, one record at a time

    - by Kevin
    I want to write a C# program that will read a row from a datatable (named loadDT) and update a database file (named Forecasts.mdb). My datatable looks like this (each day's value is a number representing kilowatts usage forecast): Hour Day1 Day2 Day3 Day4 Day5 Day6 Day7 1 519 520 524 498 501 476 451 My database file looks like this: Day Hour KWForecast 1 1 519 2 1 520 3 1 524 ... and so on. Basically, I want to be able to read one row from the datatable, and then extrapolate that out to my database file, one record at a time. Each row from the datatable will result in seven records written to the database file. Any ideas on how to go about this? I can connect to my database, the connection string works, and I can update and delete from the database. I just can't wrap my head around how to do this one record at a time.

    Read the article

  • Writing datatable to database file, one record at a time in C#

    - by Kevin
    Hi! I want to write a C# program that will read a row from a datatable (named loadDT) and update a database file (named Forecasts.mdb). My datatable looks like this (each day's value is a number representing kilowatts usage forecast): Hour Day1 Day2 Day3 Day4 Day5 Day6 Day7 1 519 520 524 498 501 476 451 My database file looks like this: Day Hour KWForecast 1 1 519 2 1 520 3 1 524 ... and so on. Basically, I want to be able to read one row from the datatable, and then extrapolate that out to my database file, one record at a time. Each row from the datatable will result in seven records written to the database file. Any ideas on how to go about this? I can connect to my database, the connection string works, and I can update and delete from the database. I just can't wrap my head around how to do this one record at a time. Thanks in advance for any help and advice.

    Read the article

  • Rails - Active Record :conditions overrides :select

    - by Nick
    I have a fairly large model and I want to retrieve only a select set of fields for each record in order to keep the JSON string I am building small. Using :select with find works great but my key goal is to use conditional logic with an associated model. Is the only way to do this really with a lamda in a named scope? I'm dreading that perhaps unnecessarily but I'd like to understand if there is a way to make the :select work with a condition. This works: @sites = Site.find :all, :select => 'id,foo,bar' When I try this: @sites = Site.find :all, :select => 'id,foo,bar', :include => [:relatedmodel], :conditions => ["relatedmodel.type in (?)", params[:filters]] The condition works but each record includes all of the Site attributes which makes my JSON string way way too large. Thanks for any pointers!

    Read the article

< Previous Page | 20 21 22 23 24 25 26 27 28 29 30 31  | Next Page >