Search Results

Search found 4300 results on 172 pages for 'mark virtue'.

Page 74/172 | < Previous Page | 70 71 72 73 74 75 76 77 78 79 80 81  | Next Page >

  • DispatcherOperations.Wait()

    - by Mark
    What happens if you call dispatcherOperation.Wait() on an operation that has already completed? Also, the docs say that it returns a DispatcherOperationStatus, but wouldn't that always be Completed since it (supposedly) doesn't return until it's done? I was trying to use it like this: private void Update() { while (ops.Count > 0) ops.Dequeue().Wait(); } public void Add(T item) { lock (sync) { if (dispatcher.CheckAccess()) { list.Add(item); OnCollectionChanged(new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Add, item)); } else { ops.Enqueue(dispatcher.BeginInvoke(new Action<T>(Add), item)); } } } I'm using this in WPF, so all the Add operations have to occur on the UI thread, but I figured I could basically just queue them up without having to wait for it to switch threads, and then just call Update() before any read operations to ensure that the list is up to date, but my program started hanging.

    Read the article

  • Large static arrays are slowing down class load, need a better/faster lookup method

    - by Visualize
    I have a class with a couple static arrays: an int[] with 17,720 elements a string[] with 17,720 elements I noticed when I first access this class it takes almost 2 seconds to initialize, which causes a pause in the GUI that's accessing it. Specifically, it's a lookup for Unicode character names. The first array is an index into the second array. static readonly int[] NAME_INDEX = { 0x0000, 0x0001, 0x0005, 0x002C, 0x003B, ... static readonly string[] NAMES = { "Exclamation Mark", "Digit Three", "Semicolon", "Question Mark", ... The following code is how the arrays are used (given a character code). [Note: This code isn't a performance problem] int nameIndex = Array.BinarySearch<int>(NAME_INDEX, code); if (nameIndex > 0) { return NAMES[nameIndex]; } I guess I'm looking at other options on how to structure the data so that 1) The class is quickly loaded, and 2) I can quickly get the "name" for a given character code. Should I not be storing all these thousands of elements in static arrays?

    Read the article

  • Forced naming of parameters in python

    - by Mark Mayo
    In python you may have a function definition: def info(object, spacing=10, collapse=1) which could be called in any of the following ways: info(odbchelper) info(odbchelper, 12) info(odbchelper, collapse=0) info(spacing=15, object=odbchelper) thanks to python's allowing of any-order arguments, so long as they're named. The problem we're having is as some of our larger functions grow, people might be adding parameters between spacing and collapse, meaning that the wrong values may be going to parameters that aren't named. In addition sometimes it's not always clear as to what needs to go in. We're after a way to force people to name certain parameters - not just a coding standard, but ideally a flag or pydev plugin? so that in the above 4 examples, only the last would pass the check as all the parameters are named. Odds are we'll only turn it on for certain functions, but any suggestions as to how to implement this - or if it's even possible would be appreciated.

    Read the article

  • jQuery Running a function in a context and adding to a variable

    - by Mark
    For this question I'm going to give a simplified example of what I want to do, and the function I want to learn to write. var collection = ''; <div id='container'> <span>1</span> <span>2</span> <span>3</span> </div> What I want to do this, for every span in the div, take its text, add it to the collection. So ideally it would look like: $('#container').addtoCollection(collection); The method would be something like: $(this).find('span').each(function () { collection = collection + $(this).text(); }). Where the first this would equal #container. So in the end you can do: console.log(collection); and get: 123 How do I write the function that does this? Thanks!

    Read the article

  • simple fbml fb:login-button is not rendering in ie6

    - by Mark
    The following codes works in FF and Chrome, but IE6 does not render the connect button. What am I missing here? <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:fb="http://www.facebook.com/2008/fbml"> <head> <title></title> </head> <body> <fb:login-button>Login button</fb:login-button> <script src="http://static.ak.connect.facebook.com/js/api_lib/v0.4/FeatureLoader.js.php" type="text/javascript"></script> <script type="text/javascript"> FB_RequireFeatures(["XFBML"], function(){ FB.Facebook.init("API_KEY", "/xd_receiver.htm"); }); </script> </body> </html>

    Read the article

  • Not compile code blocks when publishing?

    - by Menno Gouw
    I have many lines i just use for debugging and helpers. Is there a way i can mark these so they do not compile when publishing a project but still can use when running/debugging my program within Eclipse? Even better would be to mark a certain field as debug only and discard everything that has to do with that field completely when publishing. I understand this might get one in trouble when using fields like that and using that in critical parts of the code. But i often find myself initializing a lot of debug fields then comment them out which results in errors down the line if i do not comment those out as well. So is there some way to handle this in a better and more efficient way?

    Read the article

  • Mongodb - how to deserialze when a property has an Interface return type

    - by Mark Kelly
    I'm attempting to avoid introducing any dependencies between my Data layer and client code that makes use of this layer, but am running into some problems when attempting to do this with Mongo (using the MongoRepository) MongoRepository shows examples where you create Types that reflect your data structure, and inherit Entity where required. Eg. [CollectionName("track")] public class Track : Entity { public string name { get; set; } public string hash { get; set; } public Artist artist { get; set; } public List<Publish> published {get; set;} public List<Occurence> occurence {get; set;} } In order to make use of these in my client code, I'd like to replace the Mongo-specific types with Interfaces, e.g: [CollectionName("track")] public class Track : Entity, ITrackEntity { public string name { get; set; } public string hash { get; set; } public IArtistEntity artist { get; set; } public List<IPublishEntity> published {get; set;} public List<IOccurenceEntity> occurence {get; set;} } However, the Mongo driver doesn't know how to treat these interfaces, and I understandably get the following error: An error occurred while deserializing the artist property of class sf.data.mongodb.entities.Track: No serializer found for type sf.data.IArtistEntity. --- MongoDB.Bson.BsonSerializationException: No serializer found for type sf.data.IArtistEntity. Does anyone have any suggestions about how I should approach this?

    Read the article

  • CS Majors: Hardest concept(s) you learned in school?

    - by Mark Lubin
    For the CS majors out there what were the hardest CS classes or concepts that you learned in your undergraduate schooling? Did you find once you learned the basics,(data structs, OOP fundamentals, discrete math, pointers, recursion, etc) the rest followed naturally or did you hit a wall at any point in your higher classes like OS'es and Compilers? Thanks for the input!

    Read the article

  • streaming xml pretty printer in C/C++ using expat or libxml2?

    - by Mark Zeren
    I have a library that outputs xml without whitespace all on one line. In some cases I'd like to pretty print that output. I'm looking for a BSD-ish licensed C/C++ library or sample code that will take a raw xml byte stream and pretty print it. Here's some pseudo code showing one way that I might use this functionality: void my_write(const char* buf, int len); PrettyPrinter pp(bind(&my_write)); while (...) { // ... get some more xml ... const char* buf = xmlSource.get_buf(); int len = xmlSource.get_buf_len(); int written = pp.write(buf, len); // calls my_write with pretty printed xml // ... error handling, maybe call write again, etc. ... } I'd like to avoid instantiating a DOM representation. I already have dependencies on the expat and libxml2 shared libraries, and I'd rather not add any more shared library dependencies.

    Read the article

  • How to refer to enum values inside nhibernate formula mapping specification?

    - by mark
    Dear ladies and sirs. I have two entities types: RunContainer parent entity type Run child entity type Run has a property Status, which is of type RunStatus, like so: public enum RunStatus { Created, Starting, // ... } public class Run { public int ContainerId { get; private set; } // ... public RunStatus Status { get; private set; } } RunContainer has a calculated property ActiveRunCount, like so: public class RunContainer { public int Id { get; private set; } // ... public int ActiveRunCount { get; private set; } } In the mapping for the RunContainer.ActiveRunCount property, I use the formula specification like so: <property name="ActiveRunCount" formula="(select count(r.Id) from Run r where r.ContainerId = Id and r.Status = 1)"/> My problem is that I refer to the RunStatus enum values in the formula by their respective numeric value, rather than the appropriate symbolic name. Can anyone tell me how can I use the symbolic name instead? Thanks.

    Read the article

  • what are LPARAM and WPARAM defined as

    - by Mark Heath
    I know I'm being lazy here and I should trawl the header files for myself, but what are the actual types for LPARAM and WPARAM parameters? Are they pointers, or four byte ints? I'm doing some C# interop code and want to be sure I get it working on x64 systems.

    Read the article

  • "input cannot be resolved" when added a try..catch

    - by Mark
    I originally tried to get my throw statement to work without a try catch and the userInput = input.nextInt(); line worked fine. But when I tried adding the try..catch it didn't like my input saying it cannot be resolved. I don't think my try..catch is correct yet but I am planning on tackling that after I can get this input to be recognized but I would appreciate any feedback on things you see with that as well. Thanks import java.util.Scanner; public class Program6 { public static void main(String[] args) { final int NUMBER_HIGH_LIMIT = 100; final int NUMBER_LOW_LIMIT = 10; int userInput; try { System.out.print("Enter a number between 10 and 100: "); userInput = input.nextInt();//Says input cannot be resolved Verify v = new Verify(NUMBER_HIGH_LIMIT, NUMBER_LOW_LIMIT); } catch(NumberHighException exception) { userInput = 0; } catch(NumberLowException exception) { userInput = 0; } } }

    Read the article

  • Global name not defined error in Django/Python trying to set foreignkey

    - by Mark
    Summary: I define a method createPage within a file called PageTree.py that takes a Source model object and a string. The method tries to generate a Page model object. It tries to set the Page model object's foreignkey to refer to the Source model object which was passed in. This throws a NameError exception! I'm trying to represent a website which is structured like a tree. I define the Django models Page and Source, Page representing a node on the tree and Source representing the contents of the page. (You can probably skip over these, this is a basic tree implementation using doubly linked nodes). class Page(models.Model): name = models.CharField(max_length=50) parent = models.ForeignKey("self", related_name="children", null=True); firstChild = models.ForeignKey("self", related_name="origin", null=True); nextSibling = models.ForeignKey("self", related_name="prevSibling", null=True); previousSibling = models.ForeignKey("self", related_name="nxtSibling", null=True); source = models.ForeignKey("Source"); class Source(models.Model): #A source that is non dynamic will be refered to as a static source #Dynamic sources contain locations that are names of functions #Static sources contain locations that are places on disk name = models.CharField(primary_key=True, max_length=50) isDynamic = models.BooleanField() location = models.CharField(max_length=100); I've coded a python program called PageTree.py which allows me to request nodes from the database and manipulate the structure of the tree. Here is the trouble making method: def createPage(pageSource, pageName): page = Page() page.source = pageSource page.name = pageName page.save() return page I'm running this program in a shell through manage.py in Windows 7 manage.py shell from mysite.PageManager.models import Page, Source from mysite.PageManager.PageTree import * ... create someSource = Source(), populate the fields, and save it ... createPage(someSource, "test") ... NameError: global name 'source' is not defined When I type in the function definition for createPage into the shell by hand, the call works without error. This is driving me bonkers and help is appreciated.

    Read the article

  • jQuery, selecting form elements by name, getting: Error: uncaught exception: Syntax error, unrecogni

    - by Mark Steudel
    I'm trying to select an select element by name I found this thread showing how to do it, and I followed it but I'm getting Syntax error. I'm using jquery 1.4.1, here's my code. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> <title>TODO supply a title</title> <script type="text/javascript" src="/js/jquery-1.4.1.min.js"></script> <script type="text/javascript"> $(document).ready(function(){ alert( $('select[@name="country[0]"]').val() ); }) </script> </head> <body> <form> <select name="country[0]"> <option value="23">test</option> </select> </form> </body> </html> Thanks in advance for any insight. MS

    Read the article

  • Reading PDF metadata in PHP

    - by Mark Trapp
    I'm trying to read metadata attached to arbitrary PDFs: title, author, subject, and keywords. Is there a PHP library, preferably open-source, that can read PDF metadata? If so, or if there isn't, how would one use the library (or lack thereof) to extract the metadata? To be clear, I'm not interested in creating or modifying PDFs or their metadata, and I don't care about the PDF bodies. I've looked at a number of libraries, including FPDF (which everyone seems to recommend), but it appears only to be for PDF creation, not metadata extraction.

    Read the article

  • Is there a fast way to change all the collation to utf8_unicode?

    - by Mark
    I have realised after making about 20 tables that I need to user utf8_unicode as opposed to utf8_general. What is the fastest way to change it using PHPMyAdmin? I had one idea: Export the database as SQL then using notepad run a find and replace on it and then reimport it... but it sounds like a bit of a headache. Is there a better way?

    Read the article

  • PHP - complete url parser help

    - by Mark
    I have been trying to find an effective url parser, php's own does not include subdomain or extension. On php.net a number of users had contributed and made this: function parseUrl($url) { $r = "^(?:(?P<scheme>\w+)://)?"; $r .= "(?:(?P<login>\w+):(?P<pass>\w+)@)?"; $r .= "(?P<host>(?:(?P<subdomain>[-\w\.]+)\.)?" . "(?P<domain>[-\w]+\.(?P<extension>\w+)))"; $r .= "(?::(?P<port>\d+))?"; $r .= "(?P<path>[\w/]*/(?P<file>\w+(?:\.\w+)?)?)?"; $r .= "(?:\?(?P<arg>[\w=&]+))?"; $r .= "(?:#(?P<anchor>\w+))?"; $r = "!$r!"; // Delimiters preg_match ( $r, $url, $out ); return $out; } Unfortunately it fails on paths with a '-' and I can't for the life of me workout how to amend it to accept '-' in the path name. Thanks

    Read the article

  • rails - caches_action expire_action

    - by mark
    Hi I want to expire a cached action and wondered how to generate the correct reference. #controller caches_action :index, :layout => false #generates this fragment which works fine views/0.0.0.0:3000/article/someid/posts #sweeper ... expire_action article_posts_path(:article_id => post.article) # results in this Expired fragment: views//en/article/someid/posts (0.0ms) So this is almost ok, except the host is missing. What do I do that supplies this to the expire_action method? Thanks in advance.

    Read the article

  • How do you determine how coarse or fine-grained a 'responsibility' should be when using the single r

    - by Mark Rogers
    In the SRP, a 'responsibility' is usually described as 'a reason to change', so that each class (or object?) should have only one reason someone should have to go in there and change it. But if you take this to the extreme fine-grain you could say that an object adding two numbers together is a responsibility and a possible reason to change. Therefore the object should contain no other logic, because it would produce another reason for change. I'm curious if there is anyone out there that has any strategies for 'scoping', the single-responsibility principle that's slightly less objective?

    Read the article

< Previous Page | 70 71 72 73 74 75 76 77 78 79 80 81  | Next Page >