Search Results

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

Page 34/296 | < Previous Page | 30 31 32 33 34 35 36 37 38 39 40 41  | Next Page >

  • I can't delete record in Codeigniter

    - by jomblo
    I'm learning CRUD in codeigniter. I have table name "posting" and the coloumns are like this (id, title, post). I successed to create a new post (both insert into database and display in the view). But I have problem when I delete my post in the front-end. Here is my code: Model Class Post_Model extends CI_Model{ function index(){ //Here is my homepage code } function delete_post($id) { $this->db->where('id', $id); $this->db->delete('posting'); } } Controller Class Post extends CI_Controller{ function delete() { $this->load->model('Post_Model'); $this->Post_Model->delete_post("id"); redirect('Post/index/', 'refresh'); } } After click "delete" in the homepage, there was nothing happens. While I'm looking into my database, my records still available. Note: (1) to delete record, I'm following the codeigniter manual / user guide, (2) I found a message error (Undefined variable: id) after hiting the "delete" button in the front-end Any help or suggestion, please

    Read the article

  • Inserting Record into multiple tables No Common ID

    - by the_
    OK so I have two tables, MEDIA and BUSINESS. I want it set up so the forms to input into them are on the same page. MEDIA has a row that is biz_id that is the id of BUSINESS. So MEDIA is really a part of BUSINESS. HOW do I insert/add these into their tables without a common ID because I haven't yet made the record for business? I'm sorry I didn't really word this very much... You might need more clarification to answer properly and I'll be glad to give any more info. Any help would be greatly appreciated, thanks!

    Read the article

  • mysql codeigniter active record m:m deletion

    - by sea_1987
    Hi There, I have a table 2 tables that have a m:m relationship, what I can wanting is that when I delete a row from one of the tables I want the row in the joining table to be deleted as well, my sql is as follow, Table 1 CREATE TABLE IF NOT EXISTS `job_feed` ( `id` int(11) NOT NULL AUTO_INCREMENT, `body` text NOT NULL, `date_posted` int(10) NOT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=3 ; Table 2 CREATE TABLE IF NOT EXISTS `job_feed_has_employer_details` ( `job_feed_id` int(11) NOT NULL, `employer_details_id` int(11) NOT NULL, PRIMARY KEY (`job_feed_id`,`employer_details_id`), KEY `fk_job_feed_has_employer_details_job_feed1` (`job_feed_id`), KEY `fk_job_feed_has_employer_details_employer_details1` (`employer_details_id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; So what I am wanting to do is, if the a row is deleted from table1 and has an id of 1 I want the row in table to that also has that idea as part of the relationship also. I want to do this in keeping with codeigniters active record class I currently have this, public function deleteJobFeed($feed_id) { $this->db->where('id', $feed_id) ->delete('job_feed'); return $feed_id; }

    Read the article

  • Include only the latest/newest associated record with active record?

    - by railsnewbie
    is it possible to load only the latest associated record of an associated table? an example: class author attr_accessible :first_name, :last_name, :birthday has_many :books end class book attr_accessible :pages, :date of publication, :title belongs_to :author end Is there a way to generate a scope to load only the newest released book the author wrote? Or the book with the most pages? I know, that I could include or join all books. But I don't know if its possible to load only a specific book for each author. So that I could do a query like this: Author.authors_and_their_newest_book So that I could get these results first_name_author_1, last_name_author_1, birthday_author_1, pages_book_3, date of publication_book_3, title_book_3 first_name_author_2, last_name_author_2, birthday_author_2, pages_book_5, date of publication_book_5, title_book_5 first_name_author_3, last_name_author_3, birthday_author_3, pages_book_9, date of publication_book_9, title_book_9 ...

    Read the article

  • How to use Joomla to allow users to create/update data on my site?

    - by gromo
    Right now Im using an extension called chronoforms but Im open to anything that works. I can make forms just fine, and it saves the submitted data to a table. Where I am stuck is, how do I then allow my front end users who filled out and submitted the form to go back, view their old answers, change them, and resubmit them or resave them. In order to do this I think I would need to be able to retrieve their last answers from the table on which it is stored, replug the last specific data record for that user only back into the original form on the front end and let the user change and resubmit it? Unless there is a better way to allow the user to change their answers to a form and resave them? If anyone knows how to do this, or if there is a better way I should be going about doing this, (perhaps there is another extension that handles this kind of thing) please let me know. Thanks!

    Read the article

  • Which logs will tell me about the Touchpad and Keyboard locking up?

    - by Sepero
    I have an Asus N53SM laptop that I leave running for several weeks at a time. I never put it in hibernate or suspend, I only close the lid when I'm not using it. After a few days or weeks of running, the touchpad and keyboard will Both lock up (at the same time) for no apparent reason. I could be just surfing the internet when it happens. The touchpad and keyboard seem to only lock up when I'm actively using the laptop (not when idle), which may mean it's related to something I press, but I'm not sure? The touchpad never locks or unlocks when Pressing FN and the designated touchpad lock key (it does not seem to work on Linux). While the touchpad and keyboard are locked, I am able to plug in my USB mouse and successfully use it to control the screen cursor. I can also remotely get into the system with vnc and ssh, everything seems to run fine there as well. No processes appear out of control. It's just the laptops physical touchpad and keyboard that are locking up. How might I go about diagnosing this problem? What system logs to look at? (anything specific to look for in them?) Perhaps I should try reloading some modules? Any thing else I should inspect?

    Read the article

  • word wrap in tcpdf

    - by ChuckO
    I'm using tcpdf to creat a pdf version of the html table below. How do I word wrap the text in the cells? <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <style type="text/css"> table.frm { width: 960px; Height:400px; margin-left: auto; margin-right: auto; border-width: 0px 0px 0px 0px; border-spacing: 0px; border-style: solid solid solid solid; border-color: gray gray gray gray; border-collapse: collapse; background-color: white; font-family: Verdana,Arial,Helvetica,sans-serif; font-size: 11px; } table.frm th { Width: 120px; border-width: 1px 1px 1px 1px; padding: 1px 1px 1px 1px; border-style: solid solid solid solid; border-collapse: collapse; border-color: gray gray gray gray; background-color: white; } table.frm td { width: 120px; height: 80px; vertical-align: top; border-width: 1px 1px 1px 1px; padding: 2px 2px 2px 2px; border-style: solid solid solid solid; border-collapse: collapse; border-color: gray gray gray gray; background-color: white; } </style> <title>Weekly Menu</title> </head> <body> <table class="frm"> <tr> <th align="center" colspan="8"><b>WEEKLY MENU</b></th> </tr> <tr> <th align="center" colspan="8"><b>Your Name Here</b></th> </tr> <tr> <th></th> <th>Monday</th> <th>Tuesday</th> <th>Wednesday</th> <th>Thursday</th> <th>Friday</th> <th>Saturday</th> <th>Sunday</th> </tr> <tr> <td><b>Breakfast</b></td> <td>Scrambled Eggs Black Coffee</td> <td>Vegetable Omelet Black Coffee</td> <td>2 slices Toast Black Coffee</td> <td>Cereal w/milk Black Coffee</td> <td>Orange Juice Black Coffee</td> <td>Cereal w/milk Black Coffee</td> <td>Pancakes w/syrup Black Coffee</td> </tr> <tr> <td><b>Lunch</b></td> <td>Tuna Salad Sandwich Diet Coke</td> <td>Greek Salad Black Coffee</td> <td></td> <td>Amer Cheese Sandwich Orange Juice</td> <td></td> <td></td> <td></td> </tr> <tr> <td><b>Dinner</b></td> <td>Burger Fried Onions Diet Coke</td> <td>Steak Fries Diet Sprite</td> <td></td> <td>Chicken Cutlet Baked Potato Peas</td> <td></td> <td></td> <td></td> </tr> <tr> <td><b>Snack</b></td> <td>Apple</td> <td>Orange</td> <td>Sm bag of chips</td> <td>Celery Sticks</td> <td></td> <td></td> <td></td> </tr> </table> </body> </html> This is the tcpdf code: $pdf = new TCPDF('Landscape', 'mm', '', true, 'UTF-8', false); $pdf->SetTitle('Weekly Menu'); $pdf->SetMargins(15, 7.5, 12.5); $pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); $pdf->SetPrintHeader(false); $pdf->SetPrintFooter(false); $pdf->AddPage(); $pdf->setFormDefaultProp(array('lineWidth'=>0, 'borderStyle'=>'dot', 'fillColor'=>array(235, 235, 255), 'strokeColor'=>array(255,255,250))); $pdf->SetFont('times', 'BU', 12); $pdf->cell(250, 8, 'Weekly Menu', 0, 1, 'C'); $pdf->cell(250, 8, $yourname, 0, 1, 'C'); $pdf->SetFont('times', '', 10); $cw=35; $ch=25; $pdf->SetXY(15,50); $pdf->cell(25,5,'',1,0,'L'); $pdf->cell($cw,5,$day1,1,0,'C'); $pdf->cell($cw,5,$day2,1,0,'C'); $pdf->cell($cw,5,$day3,1,0,'C'); $pdf->cell($cw,5,$day4,1,0,'C'); $pdf->cell($cw,5,$day5,1,0,'C'); $pdf->cell($cw,5,$day6,1,0,'C'); $pdf->cell($cw,5,$day7,1,1,'C'); $pdf->cell(25,$ch,'Breakfast',1,0,'L',0,0,false,'','T'); $pdf->cell($cw,$ch,$record[0]->breakfast,1,0,'L',0,0,false,'','T'); $pdf->cell($cw,$ch,$record[1]->breakfast,1,0,'L',0,0,false,'','T'); $pdf->cell($cw,$ch,$record[2]->breakfast,1,0,'L',0,0,false,'','T'); $pdf->cell($cw,$ch,$record[3]->breakfast,1,0,'L',0,0,false,'','T'); $pdf->cell($cw,$ch,$record[4]->breakfast,1,0,'L',0,0,false,'','T'); $pdf->cell($cw,$ch,$record[5]->breakfast,1,0,'L',0,0,false,'','T'); $pdf->cell($cw,$ch,$record[6]->breakfast,1,1,'L',0,0,false,'','T'); $pdf->cell(25,$ch,'Lunch',1,0,'L',0,0,false,'','T'); $pdf->cell($cw,$ch,$record[0]->lunch,1,0,'L',0,0,false,'','T'); $pdf->cell($cw,$ch,$record[1]->lunch,1,0,'L',0,0,false,'','T'); $pdf->cell($cw,$ch,$record[2]->lunch,1,0,'L',0,0,false,'','T'); $pdf->cell($cw,$ch,$record[3]->lunch,1,0,'L',0,0,false,'','T'); $pdf->cell($cw,$ch,$record[4]->lunch,1,0,'L',0,0,false,'','T'); $pdf->cell($cw,$ch,$record[5]->lunch,1,0,'L',0,0,false,'','T'); $pdf->cell($cw,$ch,$record[6]->lunch,1,1,'L',0,0,false,'','T'); $pdf->cell(25,$ch,'Dinner',1,0,'L',0,0,false,'','T'); $pdf->cell($cw,$ch,$record[0]->dinner,1,0,'L',0,0,false,'','T'); $pdf->cell($cw,$ch,$record[1]->dinner,1,0,'L',0,0,false,'','T'); $pdf->cell($cw,$ch,$record[2]->dinner,1,0,'L',0,0,false,'','T'); $pdf->cell($cw,$ch,$record[3]->dinner,1,0,'L',0,0,false,'','T'); $pdf->cell($cw,$ch,$record[4]->dinner,1,0,'L',0,0,false,'','T'); $pdf->cell($cw,$ch,$record[5]->dinner,1,0,'L',0,0,false,'','T'); $pdf->cell($cw,$ch,$record[6]->dinner,1,1,'L',0,0,false,'','T'); $pdf->cell(25,$ch,'Snack',1,0,'L',0,0,false,'','T'); $pdf->cell($cw,$ch,$record[0]->snack,1,0,'L',0,0,false,'','T'); $pdf->cell($cw,$ch,$record[1]->snack,1,0,'L',0,0,false,'','T'); $pdf->cell($cw,$ch,$record[2]->snack,1,0,'L',0,0,false,'','T'); $pdf->cell($cw,$ch,$record[3]->snack,1,0,'L',0,0,false,'','T'); $pdf->cell($cw,$ch,$record[4]->snack,1,0,'L',0,0,false,'','T'); $pdf->cell($cw,$ch,$record[5]->snack,1,0,'L',0,0,false,'','T'); $pdf->cell($cw,$ch,$record[6]->snack,1,1,'L',0,0,false,'','T'); EOD;

    Read the article

  • PHP MySQLi timeout not working

    - by Marcin
    Hi guys I have a weird problem with mysqli timeout options, here you go: I am using mysqli_init() and real_connect() in order to set MYSQLI_OPT_CONNECT_TIMEOUT $this->__mysqli = mysqli_init(); if(!$this->__mysqli->options(MYSQLI_OPT_CONNECT_TIMEOUT,1)) throw new Exception('Timeout settings failed') $this->__mysqli->real_connect(host,user,pass,db); .... Then I am initiating query on locked table (LOCKE TABLE users WRITE) and its just hanging, ignoring all my settings even: set_time_limit(1); ini_set('max_execution_time',1); ini_set('default_socket_timeout',1); ini_set('mysql.connect_timeout',1); I understand why set_time_limit(1) and max_execution_time is ignored but why other timeouts and especially MYSQLI_OPT_CONNECT_TIMEOUT are ignored and how to solve it. I am using PHP 5.3.1 on Windows and Linux boxes, please help.

    Read the article

  • FileSystemWatcher.WaitForChanged returns, but there is still a lock on the file

    - by SnOrfus
    I have a program that send a document to a pdf printer driver and that driver prints to a particular directory. After the print I want to attach the pdf to an e-mail (MailMessage) and send it off. Right now, I send the document to the printer (wich spawns a new process) and then call a FileSystemWatcher.WaitForChanged(WaitForChangedResult.Created) but when the object is created, it's still not done "printing" and the pdf printer still has a lock on it, throwing an error when I try to attach that file to an e-mail. I've considered a plain Thread.Sleep(2000) or whatever, but that's far less than ideal. I considered putting the attachment code in a try/catch block and looping on failure, but again, that's just bad news. I can't really think of an elegant solution.

    Read the article

  • Using Monitor Class

    - by Mubashar Ahmad
    Dear All I would like to ask couple of Questions regarding the use of Monitor Class in .Net. To understand the Questions please look at the following Code. public class MyClass { private List<int> _MyCollection = new List<int>(); public void GetLock() { Monitor.Enter(_MyCollection); } public void ReleaseLock() { Monitor.Exit(_MyCollection); } public void UpdateCollection(/*anyparam*/) { //update collection without lock on collection } } public class MyAppMain { private static MyClass myclass = new MyClass(); public static void main(args) { try { myclass.GetLock(); //an operation that does not do any update on myclass but wanted //to ensure that the collection within myclass never update //while its doing following opetion //Do somthing } finally { myclass.ReleaseLock(); } } } Now is this the right use of monitor and do i need to use Pulse or PulseAll to signal waiting thread and if so than should use plus before or after Exit function? Regards Mubashar

    Read the article

  • Fluent NHibernate OptimisticLock.None() causes "The string 'none' is not a valid Boolean value."

    - by David Thomas Garcia
    I'm using the following mapping: public class LoadMap : IAutoMappingOverride<Load> { public void Override(AutoMapping<Load> mapping) { mapping.HasMany(x => x.Bids).OptimisticLock.None(); mapping.Version(x => x.Version); } } But when I try to create the session I get the following exception: [FormatException: The string 'none' is not a valid Boolean value.] [XmlSchemaValidationException: The 'optimistic-lock' attribute is invalid - The value 'none' is invalid according to its datatype 'http://www.w3.org/2001/XMLSchema:boolean' - The string 'none' is not a valid Boolean value.] I'm using NHibernate 2.1.2.4000 and I was using Fluent NHibernate 1.0RTM, but tried the latest build 636 just to be sure this isn't something that was fixed recently or something. As a side note, in case I'm doing this all wrong, I would like to be able to make changes to the .Bids list without incrementing Version. I saw an example on Ayende's blog that did what I wanted with properties.

    Read the article

  • Subversion lock-modify-unlock solution for SSIS .dtsx

    - by EasyDot
    Hello! I wonder how i could set up a developer enviroment for SSIS,.dtsx packages in Subversion? I read about Subversion "svn:needs-lock" property and the ability to set auto-props in a subversion repository by setting "enable-auto-props = yes" in the repository config file. The "svn:needs-lock" property is neccesary when working with SSIS,dtsx to handle the files like binary files wich must be locked to avoid mergingconflicts. How should i configure Subversion config file for this kind of development? An example for setting auto-prop svn:needs-lock to .doc files (I think its working?!): [miscellany] enable-auto-props = yes [auto-props] *.doc = svn:mime-type=application/msword;svn:needs-lock=*

    Read the article

  • Does IsolatedStorageFileStream.Lock work under SIlverlight4?

    - by Noah
    Silverlight uses an IsolatedStorageFileStream to open files. The IsolatedStorageFileStreamunder NET.4 claims to support the Lock Method (Inherited from FileStream) The following code IsolatedStorageFile isf; IsolatedStorageFileStream lockStream = new IsolatedStorageFileStream( "my.lck", FileMode.OpenOrCreate, isf ); lockStream.Lock( 0, 0 ); generates the following error, wrapped for readability, under VS2010 and Silverlight 4 'System.IO.IsolatedStorage.IsolatedStorageFileStream' does not contain a definition for 'Lock' and no extension method 'Lock' accepting a first argument of type 'System.IO.IsolatedStorage.IsolatedStorageFileStream' could be found (are you missing a using directive or an assembly reference?)

    Read the article

  • pthreads: reader/writer locks, upgrading read lock to write lock

    - by ScaryAardvark
    I'm using read/write locks on Linux and I've found that trying to upgrade a read locked object to a write lock deadlocks. i.e. // acquire the read lock in thread 1. pthread_rwlock_rdlock( &lock ); // make a decision to upgrade the lock in threads 1. pthread_rwlock_wrlock( &lock ); // this deadlocks as already hold read lock. I've read the man page and it's quite specific. The calling thread may deadlock if at the time the call is made it holds the read-write lock (whether a read or write lock). What is the best way to upgrade a read lock to a write lock in these circumstances.. I don't want to introduce a race on the variable I'm protecting. Presumably I can create another mutex to encompass the releasing of the read lock and the acquiring of the write lock but then I don't really see the use of read/write locks. I might as well simply use a normal mutex. Thx

    Read the article

  • Java Memory Model: reordering and concurrent locks

    - by Steffen Heil
    Hi The java meomry model mandates that synchronize blocks that synchronize on the same monitor enforce a before-after-realtion on the variables modified within those blocks. Example: // in thread A synchronized( lock ) { x = true; } // in thread B synchronized( lock ) { System.out.println( x ); } In this case it is garanteed that thread B will see x==true as long as thread A already passed that synchronized-block. Now I am in the process to rewrite lots of code to use the more flexible (and said to be faster) locks in java.util.concurrent, especially the ReentrantReadWriteLock. So the example looks like this: // in thread A synchronized( lock ) { lock.writeLock().lock(); x = true; lock.writeLock().unlock(); } // in thread B synchronized( lock ) { lock.readLock().lock(); System.out.println( x ); lock.readLock().unlock(); } However, I have not seen any hints within the memory model specification that such locks also imply the nessessary ordering. Looking into the implementation it seems to rely on the access to volatile variables inside AbstractQueuedSynchronizer (for the sun implementation at least). However this is not part of any specification and moreover access to non-volatile variables is not really condsidered covered by the memory barrier given by these variables, is it? So, here are my questions: Is it safe to assume the same ordering as with the "old" synchronized blocks? Is this documented somewhere? Is accessing any volatile variable a memory barrier for any other variable? Regards, Steffen

    Read the article

  • Is this (Lock-Free) Queue Implementation Thread-Safe?

    - by Hosam Aly
    I am trying to create a lock-free queue implementation in Java, mainly for personal learning. The queue should be a general one, allowing any number of readers and/or writers concurrently. Would you please review it, and suggest any improvements/issues you find? Thank you. import java.util.concurrent.atomic.AtomicReference; public class LockFreeQueue<T> { private static class Node<E> { E value; volatile Node<E> next; Node(E value) { this.value = value; } } private AtomicReference<Node<T>> head, tail; public LockFreeQueue() { // have both head and tail point to a dummy node Node<T> dummyNode = new Node<T>(null); head = new AtomicReference<Node<T>>(dummyNode); tail = new AtomicReference<Node<T>>(dummyNode); } /** * Puts an object at the end of the queue. */ public void putObject(T value) { Node<T> newNode = new Node<T>(value); Node<T> prevTailNode = tail.getAndSet(newNode); prevTailNode.next = newNode; } /** * Gets an object from the beginning of the queue. The object is removed * from the queue. If there are no objects in the queue, returns null. */ public T getObject() { Node<T> headNode, valueNode; // move head node to the next node using atomic semantics // as long as next node is not null do { headNode = head.get(); valueNode = headNode.next; // try until the whole loop executes pseudo-atomically // (i.e. unaffected by modifications done by other threads) } while (valueNode != null && !head.compareAndSet(headNode, valueNode)); T value = (valueNode != null ? valueNode.value : null); // release the value pointed to by head, keeping the head node dummy if (valueNode != null) valueNode.value = null; return value; }

    Read the article

  • Spinlocks, How Much Useful Are They?

    - by unknown
    How often do you find yourself actually using spinlocks in your code? How common is it to come across a situation where using a busy loop actually outperforms the usage of locks? Personally, when I write some sort of code that requires thread safety, I tend to benchmark it with different synchronization primitives, and as far as it goes, it seems like using locks gives better performance than using spinlocks. No matter for how little time I actually hold the lock, the amount of contention I receive when using spinlocks is far greater than the amount I get from using locks (of course, I run my tests on a multiprocessor machine). I realize that it's more likely to come across a spinlock in "low-level" code, but I'm interested to know whether you find it useful in even a more high-level kind of programming?

    Read the article

  • Multi-part question about multi-threading, locks and multi-core processors (multi ^ 3)

    - by MusiGenesis
    I have a program with two methods. The first method takes two arrays as parameters, and performs an operation in which values from one array are conditionally written into the other, like so: void Blend(int[] dest, int[] src, int offset) { for (int i = 0; i < src.Length; i++) { int rdr = dest[i + offset]; dest[i + offset] = src[i] > rdr? src[i] : rdr; } } The second method creates two separate sets of int arrays and iterates through them such that each array of one set is Blended with each array from the other set, like so: void CrossBlend() { int[][] set1 = new int[150][75000]; // we'll pretend this actually compiles int[][] set2 = new int[25][10000]; // we'll pretend this actually compiles for (int i1 = 0; i1 < set1.Length; i1++) { for (int i2 = 0; i2 < set2.Length; i2++) { Blend(set1[i1], set2[i2], 0); // or any offset, doesn't matter } } } First question: Since this apporoach is an obvious candidate for parallelization, is it intrinsically thread-safe? It seems like no, since I can conceive a scenario (unlikely, I think) where one thread's changes are lost because a different threads ~simultaneous operation. If no, would this: void Blend(int[] dest, int[] src, int offset) { lock (dest) { for (int i = 0; i < src.Length; i++) { int rdr = dest[i + offset]; dest[i + offset] = src[i] > rdr? src[i] : rdr; } } } be an effective fix? Second question: If so, what would be the likely performance cost of using locks like this? I assume that with something like this, if a thread attempts to lock a destination array that is currently locked by another thread, the first thread would block until the lock was released instead of continuing to process something. Also, how much time does it actually take to acquire a lock? Nanosecond scale, or worse than that? Would this be a major issue in something like this? Third question: How would I best approach this problem in a multi-threaded way that would take advantage of multi-core processors (and this is based on the potentially wrong assumption that a multi-threaded solution would not speed up this operation on a single core processor)? I'm guessing that I would want to have one thread running per core, but I don't know if that's true.

    Read the article

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

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

    Read the article

  • How can I implement a proper counter bean with EJB 3.0?

    - by Aaron Digulla
    I have this entity bean: import javax.persistence.*; @Entity public class CounterTest { private int id; private int counter; @Id public int getId() { return id; } public void setId(int id) { this.id = id; } public int getCounter() { return counter; } public void setCounter(int counter) { this.counter = counter; } } and this stateful bean to increment a counter: import java.rmi.RemoteException; import javax.ejb.*; import javax.persistence.*; @Stateful public class CounterTestBean implements CounterTestRemote { @PersistenceContext(unitName = "JavaEE") EntityManager manager; public void initDB() { CounterTest ct = new CounterTest(); ct.setNr(1); ct.setWert(1); manager.persist(ct); } public boolean testCounterWithLock() { try { CounterTest ct = manager.find(CounterTest.class, 1); manager.lock(ct, LockModeType.WRITE); int wert = ct.getWert(); ct.setWert(wert + 1); manager.flush(); return true; } catch (Throwable t) { return false; } } } When I call testCounterWithLock() from three threads 500 times each, the counter gets incremented between 13 and 1279 times. How do I fix this code so that it is incremented 1500 times?

    Read the article

  • Disable inserted lines in multiline TextBox

    - by Shohin
    I have a multiline Textbox for my web page. When user logs in and enters text and press "Save" button, data will be saved. Then, next time when the same user logs in and searches for data, I want him to edit only new text in multiline TextBox, not removing or replacing previously entered text. Is there any way to make multiline TextBox to lock inserted lines or inserted text and allow to only add text? Thanks in advance.

    Read the article

  • PHP MySQLi timeout on locked tables?

    - by Marcin
    Hi guys I have a weird problem with mysqli timeout options, here you go: I am using mysqli_init() and real_connect() in order to set MYSQLI_OPT_CONNECT_TIMEOUT $this->__mysqli = mysqli_init(); if(!$this->__mysqli->options(MYSQLI_OPT_CONNECT_TIMEOUT,1)) throw new Exception('Timeout settings failed') $this->__mysqli->real_connect(host,user,pass,db); .... Then I am initiating query on locked table (LOCKE TABLE users WRITE) and its just hanging, ignoring all my settings even: set_time_limit(1); ini_set('max_execution_time',1); ini_set('default_socket_timeout',1); ini_set('mysql.connect_timeout',1); I understand why set_time_limit(1) and max_execution_time is ignored but why other timeouts and especially MYSQLI_OPT_CONNECT_TIMEOUT are ignored and how to solve it. I am using PHP 5.3.1 on Windows and Linux boxes, please help.

    Read the article

  • Do condition variables still need a mutex if you're changing the checked value atomically?

    - by Joseph Garvin
    Here is the typical way to use a condition variable: // The reader(s) lock(some_mutex); if(protected_by_mutex_var != desired_value) some_condition.wait(some_mutex); unlock(some_mutex); // The writer lock(some_mutex); protected_by_mutex_var = desired_value; unlock(some_mutex); some_condition.notify_all(); But if protected_by_mutex_var is set atomically by say, a compare-and-swap instruction, does the mutex serve any purpose (other than that pthreads and other APIs require you to pass in a mutex)? Is it protecting state used to implement the condition? If not, is it safe then to do this?: // The writer protected_by_mutex_var = desired_value; some_condition.notify_all(); With the writer never directly interacting with the reader's mutex? If so, is it even necessary that different readers use the same mutex?

    Read the article

  • How is thread synchronization implemented, at the assembly language level?

    - by Martin
    While I'm familiar with concurrent programming concepts such as mutexes and semaphores, I have never understood how they are implemented at the assembly language level. I imagine there being a set of memory "flags" saying: lock A is held by thread 1 lock B is held by thread 3 lock C is not held by any thread etc But how is access to these flags synchronized between threads? Something like this naive example would only create a race condition: mov edx, [myThreadId] wait: cmp [lock], 0 jne wait mov [lock], edx ; I wanted an exclusive lock but the above ; three instructions are not an atomic operation :(

    Read the article

< Previous Page | 30 31 32 33 34 35 36 37 38 39 40 41  | Next Page >