Search Results

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

Page 105/166 | < Previous Page | 101 102 103 104 105 106 107 108 109 110 111 112  | Next Page >

  • Iterate attributes and IBOutlets of a UIViewController

    - by Espuz
    I've a generic UIViewController on my app. All the UIViewController on the app inherits from this generic one. I'm trying to automate the deallocation and releasing of attributes and IBOutlets as properties. I'm doing the first (attributes) on dealloc method and the second (IBOutlets as properties) on viewDidUnload. - (void) dealloc { [_att1 release]; _att1 = nil; [_att2 release]; _att2 = nil; // ... } - (void) viewDidUnload { self.att1 = nil; // att1 is an IBOutlet self.att2 = nil; // att2 is an IBOutlet // ... } Is there any way to iterate all my attributes and IBOutlets to simplify this operations? I want to avoid do it for each outlet and attribute and delegate it to the generic UIViewController. Thanks.

    Read the article

  • Reranging a uitableview

    - by Nicolay
    Hallo @ All I ran into the same problem as desciped in http://stackoverflow.com/questions/1884491/crashing-while-trying-to-move-uitableview-rows! All I want to do is on specific reranging operations insert a new cell or delet the selected one! Sometimes I get a * Assertion failure in -[_UITableViewUpdateSupport _setupAnimationForReorderingRow], /SourceCache/UIKit/UIKit-963.10/UITableViewSupport.m:295 Attempt to create two animations for cell exception and when I want to reload my data by calling [self.tableView reloadData] I get a * Terminating app due to uncaught exception 'NSRangeException', reason: '* -[NSCFArray objectAtIndex:]: index (0) beyond bounds (0)' This is quiet anoying! Is there anybody out there who knows how to handle this problem? Please help me!

    Read the article

  • Should I denormalize a has_many has_many?

    - by Cameron
    I have this: class User < ActiveRecord::Base has_many :serials has_many :sites, :through => :series end class Serial < ActiveRecord::Base belongs_to :user belongs_to :site has_many :episodes end class Site < ActiveRecord::Base has_many :serials has_many :users, :through => :serials end class Episode < ActiveRecord::Base belongs_to :serial end I would like to do some operations on User.serials.episodes but I know this would mean all sorts of clever tricks. I could in theory just put all the episode data into serial (denormalize) and then group_by Site when needed. If I have a lot of episodes that I need to query on would this be a bad idea? thanks

    Read the article

  • Are spinlocks a good choice for a memory allocator?

    - by dsimcha
    I've suggested to the maintainers of the D programming language runtime a few times that the memory allocator/garbage collector should use spinlocks instead of regular OS critical sections. This hasn't really caught on. Here are the reasons I think spinlocks would be better: At least in synthetic benchmarks that I did, it's several times faster than OS critical sections when there's contention for the memory allocator/GC lock. Edit: Empirically, using spinlocks didn't even have measurable overhead in a single-core environment, probably because locks need to be held for such a short period of time in a memory allocator. Memory allocations and similar operations usually take a small fraction of a timeslice, and even a small fraction of the time a context switch takes, making it silly to context switch in the case of contention. A garbage collection in the implementation in question stops the world anyhow. There won't be any spinning during a collection. Are there any good reasons not to use spinlocks in a memory allocator/garbage collector implementation?

    Read the article

  • Combining XSLT transforms

    - by Flynn1179
    Is there a way to combine two XSLT documents into a single XSLT document that does the same as transforming using the original two in sequence? i.e. Combining XSLTA and XSLTB into XSLTC such that XSLTB( XSLTA( xml )) == XSLTC( xml )? There's three reasons I'd like to be able to do this: Simplifies development; some operations need sequential transforms, and although I can generate a combined one by hand, it's a lot more difficult to maintain that two much simpler, separate transforms. Speed; one transform is in most cases hopefully faster than two. I'm currently working on a program that literally just transforms a data file in XML into an XHTML page capable of editing it using one XSLT, and a second XSLT that transforms the XHTML page back into the data file when it's saved. One test I hope to be able to do is to combine the two, and easily confirm that the 'combined' XSLT should leave the data unchanged.

    Read the article

  • Cross-referencing UML models in VS 2010

    - by cheaster
    I am just starting to explore/use the UML modeling support in Visual Studio 2010 Umltimate. I have created two model projects within a single solution. Let's call them Model A and Model B. I have some data types (classes) defined in Model B. I want to use them as return types for operations in Model A. However, I cannot figure out how to make the types defined in Model B show up in Model A when attempting to set return type on an operation. Any help/suggestions would be greatly appreciated! Thanks!

    Read the article

  • How do I determine darker or lighter color variant of a given color?

    - by Nidonocu
    Given a source color of any hue by the system or user, I'd like a simple algorithm I can use to work out a lighter or darker variants of the selected color. Similar to effects used on Windows Live Messenger for styling the user interface. Language is C# with .net 3.5. Responding to comment: Color format is (Alpha)RGB. With values as bytes or floats. Marking answer: For the context of my use (a few simple UI effects), the answer I'm marking as accepted is actually the most simple for this context. However, I've given up votes to the more complex and accurate answers too. Anyone doing more advanced color operations and finding this thread in future should definitely check those out. Thanks SO. :)

    Read the article

  • python parallel computing: split keyspace to give each node a range to work on

    - by MatToufoutu
    My question is rather complicated for me to explain, as i'm not really good at maths, but i'll try to be as clear as possible. I'm trying to code a cluster in python, which will generate words given a charset (i.e. with lowercase: aaaa, aaab, aaac, ..., zzzz) and make various operations on them. I'm searching how to calculate, given the charset and the number of nodes, what range each node should work on (i.e.: node1: aaaa-azzz, node2: baaa-czzz, node3: daaa-ezzz, ...). Is it possible to make an algorithm that could compute this, and if it is, how could i implement this in python? I really don't know how to do that, so any help would be much appreciated

    Read the article

  • C# eval equivalent?

    - by Adhip Gupta
    I can do an eval("something()"); to execute the code dynamically in JavaScript. Is there a way for me to do the same thing in C#? What I am exactly trying to do is that I have an integer variable (say i) and I have multiple properties by the names: "Property1","Property2","Property3" etc. Now, I want to perform some operations on the " Propertyi " property depending on the value of i. This is really simple with Javascript. Is there any way to do this with C#? Edit: Oh, and I am using C# 2.0

    Read the article

  • How to avoid Mercurial repo corruption when sharing a repository between Windows/Mac?

    - by Stabledog
    I have several projects which are shared between Windows and Mac. The dev machine is a Mac running Parallels: the files are stored on the Mac side, and the source is shared to the Windows side. This is very convenient, as I can switch back and forth between Windows and Mac tools rapidly without having to sync files. Recently I switched from Subversion to Mercurial, and now I'm having problems with the Mercurial repository becoming corrupt if I use the Windows tools to add/update, etc. I have to be very careful about which operations on the Windows side are safe (mainly the read-only stuff) and of course I forget rather regularly. Does anybody know why the corruption occurs? I thought Mercurial repositories were platform-agnostic. Any ideas how to prevent it without removing the Windows tools entirely?

    Read the article

  • How to detect if breaking an edge will make a graph disjoint?

    - by the_graph_guy
    I have a graph that starts off with a single, root node. Nodes are added one by one to the graph. At node creation time, they have to be linked either to the root node, or to another node, by a single edge. Edges can also be created and deleted (one by one, between any two nodes). Nodes can be deleted one at a time. Node and edge creation, deletion operations can happen in any arbitrary order. OK, so here's my question: When an edge is deleted, is it possible do determine, in constant time (i.e. with an O(1) algorithm), if doing this will divide the graph into two disjoint subgraphs? If it will, then which side of the edge will the root node belong? I'm willing to maintain, within reasonable limits, any additional data structure that can facilitate the derivation of this information. Maybe it is not possible to do it in O(1), if so any pointers to literature will be appreciated.

    Read the article

  • ASP.MVC ModelBinding Behaviour

    - by OldBoy
    This one has me stumped, despite the numerous posts on here. The scenario is a basic MVC(2) web application with simple CRUD operations. Whenever the edit form is submitted and the UpdateModel() called, an exception is thrown: System.Data.Linq.ForeignKeyReferenceAlreadyHasValueException was unhandled by user code This occurs against a DropDownList value which is a foreign key on the entity table. However, there is another DropDownList list on the form, representing another foreign key, which does not throw the error (unsurprisingly). Changing the property values manually inside the Edit Action: Recipe recipe = repository.GetRecipe(int.Parse(formValues["recipeid"])); recipe.CategoryId = Convert.ToInt32(formValues["CategoryId"].ToString()); recipe.Page = int.Parse(formValues["Page"].ToString()); recipe.PublicationId=Convert.ToInt32(formValues["PublicationId"].ToString()); Allows the CategoryId and Page properties to be updated, and then the error is thrown on the PublicationId. All of the referential integrity is checked an the same in the db and the dbml. Any light shed on this would be most welcome.

    Read the article

  • i need help to designe code in c++

    - by user344987
    ) Design and implement a Graph data structure. Use adjacency matrix to implement the unweighted graph edges. The Graph must support the following operations: 1.Constructor 2.Destructor 3.Copy constructor 4.A function to add an edge between two nodes in the graph 5.A display function that outputs all the edges of the graph 6.A function edge that accepts two nodes, the function returns true if there is an edge between the passed nodes, and returns false otherwise. B.(100 points) Depth first search and Breadth first search functions. C.(100 points) A function to output a spanning tree of the graph, use any algorithm you find appropriate, also, make the necessary changes on the data structure in A to implement your algorithm.

    Read the article

  • How to add the UAC shield icon to program that still must target XP?

    - by bsruth
    I have a program that still must target Windows XP (_WIN32_WINNT 0x501), as most of our customers still use XP. However, we have been shipping Vista for a while, and are now pushing Windows 7 upgrades. For the software to work correctly on the newer OSs, there are a couple operations that require UAC elevation. I have the elevation code working, but would like to have the UAC icon present on the buttons that launch the UAC process. Unfortunately, all of the options defined in Microsoft's UAC UI document require _WIN32_WINNT 0x600 or newer. Is there any way to get the appropriate UAC icon (Vista and 7 use different ones) to show on the button while still being able to target XP (where no icon will be shown)? I'm using C++, but may be able to adapt a .NET solution.

    Read the article

  • How to create a voldemort store?

    - by Pankaj
    I am trying to understand the Voldemort java API. I am new to non relational databases, so as I understand, Voldemort's store can be compared to a table in relational model. I saw the following code in the documentation. String bootstrapUrl = "tcp://localhost:6666"; StoreClientFactory factory = new SocketStoreClientFactory(new ClientConfig().setBootstrapUrls(bootstrapUrl)); // create a client that executes operations on a single store StoreClient client = factory.getStoreClient("test"); Here, we got a Store client based on the an existing store (test). How can I actually create a store for Voldemort through java?

    Read the article

  • How to implement a set ?

    - by nomemory
    I want to implement a Set in C. Is it OK to use a linked list, when creating the SET, or should I use another approach ? How do you usually implement your own set (if needed). NOTE: If I use the Linked List approach, I will probably have the following complexities for my operations: init : O(1); destroy: O(n); insert: O(n); remove: O(n); union: O(n*m); intersection: O(n*m); difference: O(n*m); ismember: O(n); issubset: O(n*m); setisequal: O(n*m); O(n*m) seems may be a little to big especially for huge data... Is there a way to implement my Set more efficient ?

    Read the article

  • Is there a way to set a DLL to always follow CultureInfo.InvariantCulture by default, if not specifi

    - by JL
    I have a lot of code in a class library that does not specify CultureInfo.InvariantCulture. For example in toString operations, toBool, toInt, etc. Is there a way I can get set a property for the class library to always execute using CultureInfo.InvariantCulture, even if it is not explicitly specified everywhere in the code? Sort of like a global switch? It is not only messy to have to explicitly type it everytime, it makes my code less readable, and is a royal pain for example: if (Convert.ToInt16(task.RetryCount, CultureInfo.InvariantCulture) < Convert.ToInt16(ConfigurationManager.AppSettings["TasksMaxRetry"], CultureInfo.InvariantCulture))

    Read the article

  • What can cause reset connection when running PHP script?

    - by marcin_koss
    I've developed a web application with CodeIgniter that works perfectly on my local machines (one with windows and one with Linux). When I moved it to my hosting server, connection gets reset when running one particular PHP script that does a few MySQL queries and some operations on arrays. The data I'm querying is small, just a few tables with up to 25 records. Firefox returns "The connection was reset" after maybe 2-3 seconds. I checked the servers error logs but there was nothing there. Unfortunately I don't have access to Apache error logs. What can cause this behavior?

    Read the article

  • .NET 3.5SP1 64-bit memory model vs. 32-bit memory model

    - by James Dunne
    As I understand it, the .NET memory model on a 32-bit machine guarantees 32-bit word writes and reads to be atomic operations but does not provide this guarantee on 64-bit words. I have written a quick tool to demonstrate this effect on a Windows XP 32-bit OS and am getting results consistent with that memory model description. However, I have taken this same tool's executable and run it on a Windows 7 Enterprise 64-bit OS and am getting wildly different results. Both the machines are identical specs just with different OSes installed. I would have expected that the .NET memory model would guarantee writes and reads to BOTH 32-bit and 64-bit words to be atomic on a 64-bit OS. I find results completely contrary to BOTH assumptions. 32-bit reads and writes are not demonstrated to be atomic on this OS. Can someone explain to me why this fails on a 64-bit OS? Tool code: using System; using System.Threading; namespace ConsoleApplication1 { class Program { static void Main(string[] args) { var th = new Thread(new ThreadStart(RunThread)); var th2 = new Thread(new ThreadStart(RunThread)); int lastRecordedInt = 0; long lastRecordedLong = 0L; th.Start(); th2.Start(); while (!done) { int newIntValue = intValue; long newLongValue = longValue; if (lastRecordedInt > newIntValue) Console.WriteLine("BING(int)! {0} > {1}, {2}", lastRecordedInt, newIntValue, (lastRecordedInt - newIntValue)); if (lastRecordedLong > newLongValue) Console.WriteLine("BING(long)! {0} > {1}, {2}", lastRecordedLong, newLongValue, (lastRecordedLong - newLongValue)); lastRecordedInt = newIntValue; lastRecordedLong = newLongValue; } th.Join(); th2.Join(); Console.WriteLine("{0} =? {2}, {1} =? {3}", intValue, longValue, Int32.MaxValue / 2, (long)Int32.MaxValue + (Int32.MaxValue / 2)); } private static long longValue = Int32.MaxValue; private static int intValue; private static bool done = false; static void RunThread() { for (int i = 0; i < Int32.MaxValue / 4; ++i) { ++longValue; ++intValue; } done = true; } } } Results on Windows XP 32-bit: Windows XP 32-bit Intel Core2 Duo P8700 @ 2.53GHz BING(long)! 2161093208 > 2161092246, 962 BING(long)! 2162448397 > 2161273312, 1175085 BING(long)! 2270110050 > 2270109040, 1010 BING(long)! 2270115061 > 2270110059, 5002 BING(long)! 2558052223 > 2557528157, 524066 BING(long)! 2571660540 > 2571659563, 977 BING(long)! 2646433569 > 2646432557, 1012 BING(long)! 2660841714 > 2660840732, 982 BING(long)! 2661795522 > 2660841715, 953807 BING(long)! 2712855281 > 2712854239, 1042 BING(long)! 2737627472 > 2735210929, 2416543 1025780885 =? 1073741823, 3168207035 =? 3221225470 Notice how BING(int) is never written and demonstrates that 32-bit reads/writes are atomic on this 32-bit OS. Results on Windows 7 Enterprise 64-bit: Windows 7 Enterprise 64-bit Intel Core2 Duo P8700 @ 2.53GHz BING(long)! 2208482159 > 2208121217, 360942 BING(int)! 280292777 > 279704627, 588150 BING(int)! 308158865 > 308131694, 27171 BING(long)! 2549116628 > 2548884894, 231734 BING(int)! 534815527 > 534708027, 107500 BING(int)! 545113548 > 544270063, 843485 BING(long)! 2710030799 > 2709941968, 88831 BING(int)! 668662394 > 667539649, 1122745 1006355562 =? 1073741823, 3154727581 =? 3221225470 Notice that BING(long) AND BING(int) are both displayed! Why are the 32-bit operations failing, let alone the 64-bit ones?

    Read the article

  • Access static constant variable from multiple threads in C

    - by user325519
    I have some experience with multithread programming under Linux (C/C++ & POSIX threads), however most obvious cases are sometimes very complicated. I have several static constant variables (global and function local) in my code, can I access them simultaneously from multiple threads without using mutexes? Because I don't modify them it should be ok, but it's always better to ask. I have to do heavy speed optimization, so even as fast operations as mutex lock/unlock are quite expensive for me, especially because my application is going to access these variables form long loops.

    Read the article

  • How to Parse 'Mathy' Stuff...

    - by Rob P.
    Please forgive my title, I really don't know how to phrase it better. This isn't a school assignment or anything, but I realize it's a mostly academic question. But, what I've been struggling to do is parse 'math' text and come up with an answer. For Example - I can figure out how to parse '5 + 5' or '3 * 5' - but I fail when I try to correctly chain operations together. (5 + 5) * 3 It's mostly just bugging me that I can't figure it out. If anyone can point me in a direction, I'd really appreciate it.

    Read the article

  • In Selenium IDE, can I store an element to use in subsequent asserts?

    - by Colin Fine
    I've just started using Selenium-IDE (not looked at selenium-RC yet: if somebody tells me that that is the answer to my question I'll look at it) One of the operations I'm testing generates some output in a table in the next HTML page, but the order of the rows is not predictable. I can obviously use 'assertTextPresent', but I want to do a bit more, and check that various bits of text are in the same row. What I would like to be able to do is to identify a tr by some content, and then use that tr in subsequent asserts; something like storeExpression //table[@id='TABLE_6']/td[.='case_1']/.. row assertText ${row} 'Some text' assertText ${row} 'Some other text' to check that 'Some text' and 'Some other text' occur in the same table row as 'case_1'. I haven't got this to work so far, and I'm not sure whether it is possible, or what syntax to use if it is. Has anybody managed to do this?

    Read the article

  • Speedup C++ code

    - by Werner
    Hi, I am writing a C++ number crunching application, where the bottleneck is a function that has to calculate for double: template<class T> inline T sqr(const T& x){return x*x;} and another one that calculates Base dist2(const Point& p) const { return sqr(x-p.x) + sqr(y-p.y) + sqr(z-p.z); } These operations take 80% of the computation time. I wonder if you can suggest approaches to make it faster, even if there is some sort of accuracy loss Thanks

    Read the article

  • Replace String pattern in Java

    - by Hirantha
    I have the following string "value=\"\\d{4}((((0[1-9])|(1[0-2]))((0[1-9])|([12]\\d)|(3[01]))?)?|(\\-(((0[1-9])|(1[0-2]))(\\-((0[1-9])|([12]\\d)|(3[01])))?)?)?)d{4}" There I want to replace all the occurrences of "{" with NCHAR(0x7B) "}" with NCHAR(0x7D). An the content in-between "{ }" should remain unchanged: Ex: \\d{4} after replacing -> NCHAR(0x7B) 4 NCHAR(0x7D). Is there a way to do this using Regular Expressions in Java?. Anyway, this can be done processing the whole string using string operations.

    Read the article

  • Copying a database into a new database including structure and data

    - by Jason
    In phpMyAdmin under operations I can "Copy database to:" and select Structure and data CREATE DATABASE before copying Add AUTO_INCREMENT value I need to be able to do that without using phpMyAdmin. I know how to create the database and user. I have a source database that's a shell that I can work from so all I really need is the how to copy all the table structure and data part. (I know, the harder part) system() & exec() are not options for me which rules out mysqldump. (I think) How can I loop through each table and recreate it's structure and data? Is it just looping through the results of SHOW TABLES then for each table looping through DESCRIBE tablename Then, is there an easy way for getting the data copied?

    Read the article

< Previous Page | 101 102 103 104 105 106 107 108 109 110 111 112  | Next Page >