Search Results

Search found 5262 results on 211 pages for 'operation'.

Page 10/211 | < Previous Page | 6 7 8 9 10 11 12 13 14 15 16 17  | Next Page >

  • Rails - operation outside of a rollback

    - by Brian Armstrong
    I have a before_create filter that checks if people are posting too many comments. If they are I want to flag their account. class Comment < ActiveRecord::Base before_create :check_rate_limit def check_rate_limit comments_in_last_minute = self.user.comments.count(:conditions => ["comments.created_at > ?", 1.minute.ago]) if comments_in_last_minute > 2 user.update_attribute :status, "suspended" return false end true end end The before filter returns false to stop the comment from being created. The problem is that this triggers a ROLLBACK which also undoes the changes I made to the user model. What's the correct pattern to accomplish this? Specifically: running a check each time an object is created and being able to edit another model if the check fails.

    Read the article

  • [C#] Onpaint events (invalidated) changing execution order after a period normal operation (runtime)

    - by Luke Mcneice
    Hi all, I have 3 data graphs that are painted via the their paint events. When I have data that I need to insert into the graph I call the controls invalidate() command. The first control's paint event actually creates a bitmap buffer for the other 2 graphs to avoid repeating a long loop. So the invalidate commands are in a specific order (1,2,3). This works well, however when the graphed data reaches the end of the graph window (PictureBox) where the data would normally start scrolling, the paint events begin firing in the wrong order (2,3,1). has anyone came across this before? why might this be happening?

    Read the article

  • Read/Write operation on Fat table with out using System.IO in C#

    - by AZHAR
    Hi i am new to the system programming...i want to read information from fat table like total sector,total physical drive,containing logical drive types and as well containing files in the drives(like their file size,when accessed)with all information of files..and then display of these files with respect of their hierarchy at GUI. this is easy if we use System.IO namespace.but it is restricted for me.so please help

    Read the article

  • Bulk Insert takes 4x as long on first operation of the day

    - by patrick
    I do Bulk Inserts into a table with about 14 million rows at fiver minute increments during a 7 hour period during the day. These inserts take somewhere between 9-14 secs. However, the first insert always takes about 40 secs. Anyone know what SQL Server 2005 would be doing differently on the first insert into a table for that day? From what I've read I should probably use the SqlBulkCopy class instead of just using a bulk insert in a stored procedure. Is that that the general consensus?

    Read the article

  • Running log operation in Http Modules?

    - by Niranjan
    Hi, I have a simple requirement in which I want to execute a long running application program on server (e.g. DTSX) I want to make an HTTP module for this, But I have a question whether the DTSX will run even if the user closes the page and browser. In my case user hits the handler with a query string but what if the user closes the browser immediately? How is the behavior different from simple linear page processing? I want my DTSX package to finish once its started no matter how much time it takes and also dont want to halt the user that is why I am using http modules in place of linear asp page processing. Reagrds, Niranjan

    Read the article

  • Javascript callback not firing when AJAX operation complete

    - by MisterJames
    Given the following code on an ASP.NET MVC View: <% using (Ajax.BeginForm("AddCommunity", new AjaxOptions { UpdateTargetId = "community-list", OnSuccess = "BindCommunityHover" })) { %> Add Community: <input type="text" id="communityName" name="communityName" /> <input type="submit" value="Add" /> <% } %> And the following JavaScript method in the file: function BindCommunityHover() { $(".community-item-li").hover( function () { $(this).addClass("communityHover"); }, function () { $(this).removeClass("communityHover"); } ); }; Is there any reason why BindCommunityHover is not being called when the AJAX result comes back? The community-list div is properly updated (the action returns a partial view). I have also tried setting OnComplete (instead of OnSuccess) to no avail. The BindCommunityHover method is called in a $(function(){...}); block when the page first loads, and for all existing .community-item-li elements, it works. The partial result from my controller replaces all items in that div with more of the same class. The OnSuccess method is supposed to fire after the document is updated. Update: k...this gets weird. I added the following to the BindCommunityHover method: alert($(".community-item-li").size()); I'm getting 240 in the alert when the page loads and when the callback fires. So, the callback IS firing, jQuery is matching the elements but not applying the styles...

    Read the article

  • get Generic CRUD operation in EF

    - by kathy
    Hello, Is there any way or design pattern can I use to get Generic CRUD operations? Because I’m working on n-tire application using EF in the data layer and I don’t want to use CRUD Functions in Every Entities. Your help would be appreciated

    Read the article

  • after XOR operation find C (and XOR reversability)

    - by Jason z
    Assume: unsigned char A = 10; unsigned char B = 11; unsigned char C = 12; unsigned char Diff1 = A ^ B; unsigned char Diff2 = B ^ C; //find any of A or B or C using Diff1 and Diff2 Question is: There were 3 values initially for which we found 2 differences. Is there any way we can find any if A or B or C using 2 differences Diff1 and Diff2? I know XOR is not reversible unless you know the key, but keeping in view that unsigned __int8 is 0...255 maximum 256 different values. stay well.

    Read the article

  • Is it possible to "intercept" a 3rd party library's "WriteFile" operation

    - by stout
    This is likely a long shot, but I thought I'd ask anyway. I'm using a document management system's API. They provide a "WriteFile" method to save a given document to disk. However, the library does not have a way to simply read a document into memory. My only option, it seems, is to write to disk, then read it back in again. I'm wondering if there is a better way to work around this obvious limitation. Thanks in advance!

    Read the article

  • Operation can only be performed on cells that belong to a DataGridView control

    - by The Demigeek
    The following code throws an InvalidOperationException with the above message and I don't understand why. My code calls the following method when the user may have made changes to the datagridview's underlying data source. The goal is to update the display with any changed data, and preserve the sort column and order. private void ReloadDataGridBindingListFromDatabase() { DataGridView dgv = myDataGridViewControl; DataGridViewColumn sortedColumn = dgv.SortedColumn; SortOrder sortOrder = dgv.SortOrder; //do stuff here to refresh dgv.DataSource if (sortedColumn != null) { //this line throws an exception sortedColumn.HeaderCell.SortGlyphDirection = sortOrder; } //etc. } Clearly, sortedColumn.HeaderCell is a cell that belongs to a DataGridView control. So why am I getting this exception? Many thanks for your input.

    Read the article

  • NSString writeToFile operation couldn't be completed

    - by Chonch
    Hey, I have an xml file in my application bundle. I want to copy it to the documents folder at installation and then, every time the app launches, get the newest version of this file from the Internet. I use this code: // Check if the file exists in the documents folder NSString *documentsPath = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0]; if (![[NSFileManager defaultManager] fileExistsAtPath:[documentsPath stringByAppendingPathComponent:@"fileName.xml"]]) // If not, copy it there (from the bundle) [[NSFileManager defaultManager] copyItemAtPath:[[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:@"OriginalFile.xml"] toPath:[documentsPath stringByAppendingPathComponent:@"fileName.xml"] error:nil]; // Get the newest version of the file from the server NSURL *url=[[NSURL alloc] initWithString:@"http://www.sitename.com/webservice.asmx/webserviceName"]; NSString *results = [[NSString alloc] initWithContentsOfURL:url]; // Replace the current version with the newest one, only if it is valid if (results != nil) [results writeToFile:[documentsPath stringByAppendingPathComponent:@"fileName.xml"] atomically:NO encoding:NSStringEncodingConversionAllowLossy error:nil]; The problem is that the writeToFile command always returns NO and the file's contents remain identical to the original file I included in my app bundle. I checked the value of results and it's correct. I also made sure that the app does perform the writeToString command, but still, it always returns NO. Can anybody tell me what I'm doing wrong? Thanks,

    Read the article

  • Different return XML in a WCF Operation

    - by Sean Hederman
    I am writing a service to a international HTTP standard, and there is one method that can return three different XML results, call them Single, Multiple and Error. Now I've written an IXmlSerializable class that can consume each of these results and generate them. However, WCF seems to insist that I can only have a single return XML root name. I have to choose an XmlRoot for my custom object of either Single, Multiple or Error. How can I set up WCF so that I can choose at runtime what the root will be? This is what I have currently. /// <summary> /// A collection of items. /// </summary> [XmlRoot("Multiple", Namespace = "DAV:")] public sealed class ItemCollection : IEnumerable<Item>, IXmlSerializable /// <summary> /// Processes and returns the items. /// </summary> [WebInvoke(Method = "POST", UriTemplate = "{*path}", BodyStyle = WebMessageBodyStyle.Bare)] [OperationContract] [XmlSerializerFormat] ItemCollection Process(string path);

    Read the article

  • sql server: import operation won't copy full schema

    - by P a u l
    I recall that the import tool in sql server 2000 would copy indexes, relationships, etc. In sql server 2005/2008 the import tool in SSMS will only create the tables, copy the data, but the keys, indexes, relationships are missing. I can find no option in the import wizard to enable this? What am I missing here? Is this not possible anymore for any good reason?

    Read the article

  • Clojure: Testing every value from map operation for truth

    - by Ralph
    How can I test that every value in the collection returned by map is true? I am using the following: (defn test [f coll] (every? #(identity %) (map f coll))) with the anonymous function #(identity %), but I was wondering if there is a better way. I cannot use (apply and ...) because and is a macro. UPDATE: BTW, I am making my way through The Haskell Road to Logic, Maths, and Programming, by Kees Doets and Jan can Eijck, but doing the exercises in Clojure. It's a very interesting book.

    Read the article

  • Performance tuning of a Hibernate+Spring+MySQL project operation that stores images uploaded by user

    - by Umar
    Hi I am working on a web project that is Spring+Hibernate+MySQL based. I am stuck at a point where I have to store images uploaded by a user into the database. Although I have written some code that works well for now, but I believe that things will mess up when the project would go live. Here's my domain class that carries the image bytes: @Entity public class Picture implements java.io.Serializable{ long id; byte[] data; ... // getters and setters } And here's my controller that saves the file on submit: public class PictureUploadFormController extends AbstractBaseFormController{ ... protected ModelAndView onSubmit(HttpServletRequest request, HttpServletResponse response, Object command, BindException errors) throws Exception{ MutlipartFile file; // getting MultipartFile from the command object ... // beginning hibernate transaction ... Picture p=new Picture(); p.setData(file.getBytes()); pictureDAO.makePersistent(p); // this method simply calls getSession().saveOrUpdate(p) // committing hiernate transaction ... } ... } Obviously a bad piece of code. Is there anyway I could use InputStream or Blob to save the data, instead of first loading all the bytes from the user into the memory and then pushing them into the database? I did some research on hibernate's support for Blob, and found this in Hibernate In Action book: java.sql.Blob and java.sql.Clob are the most efficient way to handle large objects in Java. Unfortunately, an instance of Blob or Clob is only useable until the JDBC transaction completes. So if your persistent class defines a property of java.sql.Clob or java.sql.Blob (not a good idea anyway), you’ll be restricted in how instances of the class may be used. In particular, you won’t be able to use instances of that class as detached objects. Furthermore, many JDBC drivers don’t feature working support for java.sql.Blob and java.sql.Clob. Therefore, it makes more sense to map large objects using the binary or text mapping type, assuming retrieval of the entire large object into memory isn’t a performance killer. Note you can find up-to-date design patterns and tips for large object usage on the Hibernate website, with tricks for particular platforms. Now apparently the Blob cannot be used, as it is not a good idea anyway, what else could be used to improve the performance? I couldn't find any up-to-date design pattern or any useful information on Hibernate website. So any help/recommendations from stackoverflowers will be much appreciated. Thanks

    Read the article

  • Using Qt's XML library for simple operation

    - by David Powers
    I basically want to use the XML parser from Qt in my existing project. I have only used Qt once before, and that was with Qt Designer, and I am not having much luck finding anything on Google about how to just use the XML library. I have downloaded a web page that has one large list, and I want to parse it and add each list item to a c++ list. I found this sample code on Ubuntu forums... http://www.uluga.ubuntuforums.org/showpost.php?p=9112973&postcount=6 I want to use that except I need to know what exactly I need to add to the project to get access to it. One other small question is QDomDocument seems to be for files (makes sense) but I have the XML in a string. What part of the XML library works for contents of a string?

    Read the article

  • Wcf service operation contract change

    - by pdiddy
    I recently added a parameter to one of the method of a wcf. It was a string parameter. The thing is that I didn't update the service reference on the client side but I was still able to call the wcf service ..... Wasn't it suppose to break?

    Read the article

  • InstallExecuteSequence cache interferes with custom action operation

    - by Dima G
    I need to upgrade a product that could be installed in per-user context to a new version that is always in per-machine context. The requirements are: Whether the old version was installed in a Per-User (no matter who) or Per-Machine context should be completely seamless to an administrator user that performs the upgrade. The MSI upgrade should succeed without the need to know the password of the user that originally installed the previous version of the product in a Per-User context. The installation should be performed from a single .msi file (no setup.exe is allowed). The installation should be able to run in a silent (non-UI) mode. No reboots are allowed during installation. My strategy is to find in the beginning of the installation whether the product is already installed in per-user context, and if so, to transform the registry keys manually to Per-Machine context (I checked: no additional changes such as file system changes etc. are needed except this transform). I figured out how to move all appropriate keys in the registry from the user settings to the machine settings (pre-loaded appropriate user hive in case it didn't appear in HKEY_USERS) and created custom action that does it - and it does work when I run it as a stand-alone executable before running the MSI. The problem, however, is that when Windows Installer runs InstallExecuteSequence it first creates a 'cached product context' for all products. So when my custom action runs in the course of InstallExecuteSequence, this cache has already been created. Thus FindRelatedProducts action that determines if older product with same upgrade code exists looks on that cache and ignores the changes that my custom action applied. If before running the MSI the previous product was in per-user context, FindRelatedProducts will look at the cache and not apply the upgrade and remove the previous version, because the new product is in per-machine context, even though the previous product version is already configured to per-machine context in the registry by that time by my custom action. What can be done to solve this problem without violating the requirements stated above?

    Read the article

  • relational type operation on key value storage

    - by wayne
    in my objects table i have id | type | parent | order | created and then in my data table i have object_id | key | value i want to get object of type 'x' where key 'y' === 'z' in the most optimal way possible. ie. get user where slug === 'jonny' i'm currently doing it with joins, because i'm doing this in mysql as a quick test. but i'll be moving to redis or a similar key/value storage system so obviously that won't work.

    Read the article

  • row operation in same table and same coloumns

    - by Raj
    Hi! i have a little problem to discuss i hope it will easy for you. suppose i have table A with 2 columns as item price milk 25 milk 50 milk 100 Butter 25 Butter 100 Butter 200 now i want to display a table B derived from table A as item price growth rate milk 0 milk 100 milk 100 Butter 100 Butter 200 Butter 100 formula for growth rate for row1 is ((row[1]-row[0])/row[0])*100 eg for 1st row ((50-25)/25)*100 can you suggest a SQl Query for it

    Read the article

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