Search Results

Search found 4126 results on 166 pages for 'bitwise operations'.

Page 100/166 | < Previous Page | 96 97 98 99 100 101 102 103 104 105 106 107  | Next Page >

  • Does my Dictionary must use locking mechanism?

    - by theateist
    Many threads have access to summary. Each thread will have an unique key for accessing the dictionary; Dictionary<string, List<Result>> summary; Do I need locking for following operations? summary[key] = new List<Result>() summary[key].Add(new Result()); It seems that I don't need locking because each thread will access dictionary with different key, but won't the (1) be problematic because of adding concurrently new record to dictionary with other treads?

    Read the article

  • Implementing DRY Forms

    - by virtualeyes
    Getting into Play 2.0, overall, blown away, great stuff. Anyway, wondering how one can achieve DRY forms in Play? If you look at the create & edit examples in the Computer Database Sample, you'll see that the form elements are repeated. With just 4 fields (in the sample form), no big deal, but when you're dealing with large, complex forms and/or handling many CRUD models, the duplication becomes a bigger maintenance issue. On the binding end ( form.bindFromRequest and form.fill(Foo) ), the implementation is so elegant for create/edit operations; is there a corresponding solution in the template layer?

    Read the article

  • A datastructure for Robotic Sort

    - by amit.codename13
    I am trying to solve this problem : https://www.spoj.pl/problems/CERC07S/ I have identified that i need a datastructure in which reversing operations have lesser time complexity. I tried to create one using a doubly linked list, in which (i thought) reversing can be done in O(1) by just changing a value associated with the starting and ending node which indicates the direction of traversing the list. I tried to implement it but got stuck. Maybe the approach is wrong! Are trees applicable here? If yes, how? Any ideas or links are appreciated? Thanks in advance.

    Read the article

  • Whats the best data-structure for storing 2-tuple (a, b) which support adding, deleting tuples and c

    - by bhups
    Hi So here is my problem. I want to store 2-tuple (key, val) and want to perform following operations: - keys are strings and values are Integers - multiple keys can have same value - adding new tuples - updating any key with new value (any new value or updated value is greater than the previous one, like timestamps) - fetching all the keys with values less than or greater than given value - deleting tuples. Hash seems to be the obvious choice for updating the key's value but then lookups via values will be going to take longer (O(n)). The other option is balanced binary search tree with key and value switched. So now lookups via values will be fast (O(lg(n))) but updating a key will take (O(n)). So is there any data-structure which can be used to address these issues? Thanks.

    Read the article

  • How to replace values in multi-valued ESE column?

    - by Soonts
    I have a multi-valued short ASCII text column in one of the tables in my ESE database, that holds the person's phone numbers. I have the new set of values, and I'd like to wipe the old values completely, and only use the new values. The JET_bitSetRevertToDefaultValue bit doesn't seem to work. While the MSDN documentation says "It causes the column to return the default column value on subsequent retrieve column operations. All existing column values are removed.", I found that it does nothing (no return value is returned). Or, is there an easy way to find out how many values does the column contain (this could be zero, e.g. when I'm doing an insertion, not update)? If it was, I could just run a loop from 'nValues' to 1, erasing the value by setting it to the null while providing the itagSequence value, to achieve what I want. I'm programming C#, and using the latest version of ManagedEsent library. Thanks in advance!

    Read the article

  • Performance implications of finalizers on JVM

    - by Alexey Romanov
    According to this post, in .Net, Finalizers are actually even worse than that. Besides that they run late (which is indeed a serious problem for many kinds of resources), they are also less powerful because they can only perform a subset of the operations allowed in a destructor (e.g., a finalizer cannot reliably use other objects, whereas a destructor can), and even when writing in that subset finalizers are extremely difficult to write correctly. And collecting finalizable objects is expensive: Each finalizable object, and the potentially huge graph of objects reachable from it, is promoted to the next GC generation, which makes it more expensive to collect by some large multiple. Does this also apply to JVMs in general and to HotSpot in particular?

    Read the article

  • Int PK inner join Vs Guid PK inner Join on SQL Server. Execution plan.

    - by bigb
    I just did some testing for Int PK join Vs Guid PK. Tables structure and number of records looking like that: Performance of CRUD operations using EF4 are pretty similar in both cases. As we know Int PK has better performance rather than strings. So SQL server execution plan with INNER JOINS are pretty different Here is an execution plan. As i understand according with execution plan from attached image Int join has better performance because it is taking less resources for Clustered index scan and it is go in two ways, am i right? May be some one may explain this execution plan in more details?

    Read the article

  • Help me understand Dispose() implementation code from MSDN

    - by Benny
    the following code is from MSDN: Idisposable pattern protected virtual void Dispose(bool disposing) { // If you need thread safety, use a lock around these // operations, as well as in your methods that use the resource. if (!_disposed) { if (disposing) { if (_resource != null) _resource.Dispose(); Console.WriteLine("Object disposed."); } // Indicate that the instance has been disposed. _resource = null; _disposed = true; } } why the following statement: _resource = null; _disposed = true; are not enclosed by if (disposing) statement block? for me i would probably write like this: if (disposing) { if (_resource != null) { _resource.Dispose(); _resource = null; _disposed = true; } Console.WriteLine("Object disposed."); } anything wrong with my version?

    Read the article

  • Why do C++ streams use char instead of unsigned char?

    - by Johannes Schaub - litb
    I've always wondered why the C++ Standard library has instantiated basic_[io]stream and all its variants using the char type instead of the unsigned char type. char means (depending on whether it is signed or not) you can have overflow and underflow for operations like get(), which will lead to implementation-defined value of the variables involved. Another example is when you want to output a byte, unformatted, to an ostream using its put function. Any ideas? Note: I'm still not really convinced. So if you know the definitive answer, you can still post it indeed.

    Read the article

  • jQuery : how to manipulate indexes?

    - by Gabriel Theron
    Should not be such a hard question... I'm just having a hard time figuring out how to make operations on some jquery elements, particularly their indexes. Teh codez: $( "#docSlider" ).css("background-image", "url(../../bundles/mypath/images/maquette/img" + $( "#selectable li" ).index( this ) + (".jpg)")); I want to make the name of the picture I load depend on the index of a jQuery selectable. So I grab the index and try to add 1... but it can't work because "+" is also a concatenator. I've tried to parseInt as well, but it was always worth 0. How do I simply transform the index to an integer and then concatenate it with the rest of the string? Thank you in advance! Edit : I'm using a function that already exists, so I can hardly change the parameters (well, I guess I can't...)

    Read the article

  • Correct (pretty) window redraw during the creation

    - by Coder
    Does anyone know what is a correct way to redraw window during lengthy initialization operations? Say I have HWND with NULL brush, and it does some not so quick child window initialization (Window initialization is not so quick on Vista and 7, especially on netbooks, even with threaded app). With this config window stays black for half a second on slower laptops. But if I supply window color brush, it seems that there are some sort of child controls or something that draws black squares on top of it, which also seems ugly. Even though the controls are created without WS_VISIBLE initially. Oh, the window has the WS_EX_COMPOSITED style, which should do the double buffering to avoid flicker. But it still behaves ugly. Are there any other tricks I've forgotten, missed?

    Read the article

  • Switch to BigInteger if necessary

    - by fahdshariff
    I am reading a text file which contains numbers in the range [1, 10^100]. I am then performing a sequence of arithmetic operations on each number. I would like to use a BigInteger only if the number is out of the int/long range. One approach would be to count how many digits there are in the string and switch to BigInteger if there are too many. Otherwise I'd just use primitive arithmetic as it is faster. Is there a better way? Is there any reason why Java could not do this automatically i.e. switch to BigInteger if an int was too small? This way we would not have to worry about overflows.

    Read the article

  • Database structure for storing Bank-like accounts and transactions

    - by user1241320
    We're in the process of adding a bank-like sub-system to our own shop. We already have customers, so each will be given a sort of account and transactions of some kind will be possible (adding to the account or subtracting from it). So we at least need the account entity, the transaction one and operations will then have to recalculate overall balances. How would you structure your database to handle this? Is there any standard bank system have to use that I could mock? By the way, we're on mysql but will also look at some nosql solution for performance boost.

    Read the article

  • Primary reasons why programming language runtimes use stacks?

    - by manuel aldana
    Many programming language runtime environments use stacks as their primary storage structure (e.g. see JVM bytecode to runtime example). Quickly recalling I see following advantages: Simple structure (pop/push), trivial to implement Most processors are anyway optimized for stack operations, so it is very fast Less problems with memory fragmentation, it is always about moving memory-pointer up and down for allocation and freeing complete blocks of memory by resetting the pointer to the last entry offset. Is the list complete or did I miss something? Are there programming language runtime environments which are not using stacks for storage at all?

    Read the article

  • How can i add an image in html email from lotus domino agent?

    - by mike_x_
    i want to add a simple image into an email which i want to send from a lotus agent. I paste below a part of the code: StringBuilder sb = new StringBuilder(); sb.append("<div><img src=\"http://goo.gl/lziMZN\"></div>"); email.setHTMLPart(sb.toString()); email.send("[email protected]"); I also tried to use an image from my image resources in the nsf. Whatever i tried i get an empty image area (browser-no-image icon) in the email i receive. I also have checked "Allow restricted operations" in my agent. I would prefer it if there is a solution to use an image from my resources and not an external link. Any solutions?

    Read the article

  • C# - Dictionary with generic array as value

    - by alhazen
    In my class, I want to use a dictionary with the following declaration: Dictionary<string, T[]> Since the operations of my class are exactly the same for all generic types, I do not wish to define my class as generic (which means I would have to create a separate instance of my class for each generic type I insert into the dictionary ?). One alternative I'm attempting is to use Dictionary<string, object> instead: public void Add<T>(string str, T value) { // Assuming key already exists var array = (T[]) dictionary[str]; array[0] = value; } However, when iterating over the dictionary, how do I cast the object value back to an array ? foreach(string strKey in dictionary.Keys) { var array = (T[]) dictionary[strKey]; // How to cast here ? //... array[0] = default(T); } Thanks.

    Read the article

  • pass php array to jquery with getJSON

    - by robertdd
    i want to pass a php aray to jQuery: $.getimagesarr = function() { $.getJSON('operations.php', {'operation':'getimglist'}, function(data){ var arr = new Array(); arr = data; return arr; }); } var data = $.getimagesarr(); if (data){ jQuery.each(data, function(i, val) { .... }); } it return undefined in php i have this: function getimglist(){ $results = $_SESSION['files']; echo json_encode($results); } it is possible?

    Read the article

  • How to use a object whose copy constructor and copy assignment is private?

    - by coanor
    In reading TCPL, I got a problem, as the title refered, and then 'private' class is: class Unique_handle { private: Unique_handle& operator=(const Unique_handle &rhs); Unique_handle(const Unique_handle &rhs); public: //... }; the using code is: struct Y { //... Unique_handle obj; }; and I want to execute such operations: int main() { Y y1; Y y2 = y1; } although, these code are come from TCPL, but I still can not got the solution... Can anybody help me, appreciate.

    Read the article

  • What's currently the best way to extend Excel using C#?

    - by user169867
    I have the professional versions of VS2008 & VS2010. I wish to add a couple buttons to a toolbar in Excel. When they are clicked I'd like to be able to open a form (either WinForms or WPF is fine) collect a few values from the user in the form and then take that data + read cell values from the current worksheet to perform some database operations. What's currently the best way to do this using C#? I'd greatly appreciate a pointer to any examples / tutorials. My understanding is that VS2010 has improved the process alot but I may have to deal w/ Excel 2003 which I don't think it supports. I get confused between Visual Studio 2008s Extensibility-Shared Addin template and other Office Addin templates I've seen. I'm not sure when which type of solution is appropriate. I'm new to Office development so I'd really appreciate any help to get me going on the right track. Thanks much.

    Read the article

  • Hebbian learning

    - by Bane
    I have asked another question on Hebbian learning before, and I guess I got a good answer which I accepted, but, the problem is that I now realize that I've mistaken about Hebbian learning completely, and that I'm a bit confused. So, could you please explain how it can be useful, and what for? Because the way Wikipedia and some other pages describe it - it doesn't make sense! Why would we want to keep increasing the weight between the input and the output neuron if the fire together? What kind of problems can it be used to solve, because when I simulate it in my head, it certainly can't do the basic AND, OR, and other operations (say you initialize the weights at zero, the output neurons never fire, and the weights are never increased!)

    Read the article

  • Tridion Core Service - Transaction roll back isnt working

    - by Tamir Lahav
    We are using the core service in ASP.NET custom page in order to create pages and components and sevenral updates (checkout,save and chekin). we want those operations to work in transaction, we tried to implement it acording to some examples over the net. However we didn't succeded operating the rollback. It seems that the operation are immediately performed without waiting for the comit . The code we used for simple check out - roll back operation for example is TransactionOptions txOptions = new TransactionOptions { IsolationLevel = IsolationLevel.ReadCommitted }; using (TransactionScope scope = new TransactionScope( TransactionScopeOption.Required, txOptions)) { using (CoreService2010Client m_client = new CoreService2010Client()) { PageData pp = m_client.CheckOut("tcm:309-36311-64", false, new ReadOptions()) as PageData; } scope.Dispose(); } We also added this recomended configuration to the web config bindings section What are we missing ?

    Read the article

  • Sql Server 2000 Stored Procedure Prevent Parallelism or something?

    - by user187305
    I have a huge disgusting stored procedure that wasn't slow a couple months ago, but now is. I barely know what this thing does and I am in no way interested in rewriting it. I do know that if I take the body of the stored procedure and then declare/set the values of the parameters and run it in query analyzer that it runs more than 20x faster. From the internet, I've read that this is probably due to a bad cached query plan. So, I've tried running the sp with "WITH RECOMPILE" after the EXEC and I've also tried putting the "WITH RECOMPLE" inside the sp, but neither of those helped even a little bit. When I look at the execution plan of the sp vs the query, the biggest difference is that the sp has "Parallelism" operations all over the place and the query doesn't have any. Can this be the cause of the difference in speeds? Thank you, any ideas would be great... I'm stuck.

    Read the article

  • What data is actually stored in a B-tree database in CouchDB?

    - by Andrey Vlasovskikh
    I'm wondering what is actually stored in a CouchDB database B-tree? The CouchDB: The Definitive Guide tells that a database B-tree is used for append-only operations and that a database is stored in a single B-tree (besides per-view B-trees). So I guess the data items that are appended to the database file are revisions of documents, not the whole documents: +---------|### ... | | +------|###|------+ ... ---+ | | | | +------+ +------+ +------+ +------+ | doc1 | | doc2 | | doc1 | ... | doc1 | | rev1 | | rev1 | | rev2 | | rev7 | +------+ +------+ +------+ +------+ Is it true? If it is true, then how the current revision of a document is determined based on such a B-tree? Doesn't it mean, that CouchDB needs a separate "view" database for indexing current revisions of documents to preserve O(log n) access? Wouldn't it lead to race conditions while building such an index? (as far as I know, CouchDB uses no write locks).

    Read the article

  • When to use Vanilla Javascript vs. jQuery?

    - by jondavidjohn
    I have noticed while monitoring/attempting to answer common jQuery questions, that there are certain practices using javascript, instead of jQuery, that actually enable you to write less and do ... well the same amount. And may also yield performance benefits. A specific example $(this) vs this Inside a click event referencing the clicked objects id jQuery $(this).attr("id"); Javascript this.id; Are there any other common practices like this? Where certain Javascript operations could be accomplished easier, without bringing jQuery into the mix. Or is this a rare case? (of a jQuery "shortcut" actually requiring more code) EDIT : While I appreciate the answers regarding jQuery vs. plain javascript performance, I am actually looking for much more quantitative answers. While using jQuery, instances where one would actually be better off (readability/compactness) to use plain javascript instead of using $(). In addition to the example I gave in my original question.

    Read the article

  • Known problems with filemtime() on Windows - files getting touched arbitrarily?

    - by Pekka
    Is there a known issue leading to file modification times of cache files on Windows XP SP 3 getting arbitrarily updated, but without any actual change? Is there some service on a standard Windows XP - Backup, Sync, Versioning, Virus scanner - known to touch files? They all have a .txt extension. If there isn't, forget it. Then I'm getting something wrong in my cache routines, and I'll debug my way through. Background: I'm building a simple caching wrapper around a slow web site on a Windows server. I am comparing the filemtime() time stamp to some columns in the data base to determine whether a cached file is stale. I'm having problems using this method because the modification time of the cache files seems to get updated in between operations without me doing anything. THis results in stale files being displayed. I'm the only user on the machine. The operating system is Windows XP, the webserver a XAMPP Apache 2 with PHP 5.2

    Read the article

< Previous Page | 96 97 98 99 100 101 102 103 104 105 106 107  | Next Page >