Search Results

Search found 253 results on 11 pages for 'monkey boson'.

Page 5/11 | < Previous Page | 1 2 3 4 5 6 7 8 9 10 11  | Next Page >

  • Is there a standard format string in ASP.NET to convert 1/2/3/... to 1st/2nd/3rd...?

    - by Dr. Monkey
    I have an integer in an Access database, which is being displayed in ASP.NET. The integer represents the position achieved by a competitor in a sporting event (1st, 2nd, 3rd, etc.), and I'd like to display it with a standard suffix like 'st', 'nd', 'rd' as appropriate, rather than just a naked number. An important limitation is that this is for an assignment which specifies that no VB or C# code be written (in fact it instructs code behind files to be deleted entirely). Ideally I'd like to use a standard format string if available, otherwise perhaps a custom string (I haven't worked with format strings much, and this isn't high enough priority to dedicate significant time to*, but I am very curious about whether there's a standard string for this). (* The assignment is due tonight, and I've learned the hard way that I can't afford to spend time on things that don't get the marks, even if they irk me significantly.)

    Read the article

  • How do I create a thread-safe write-once read-many value in Java?

    - by Software Monkey
    This is a problem I encounter frequently in working with more complex systems and which I have never figured out a good way to solve. It usually involves variations on the theme of a shared object whose construction and initialization are necessarily two distinct steps. This is generally because of architectural requirements, similar to applets, so answers that suggest I consolidate construction and initialization are not useful. By way of example, let's say I have a class that is structured to fit into an application framework like so: public class MyClass { private /*ideally-final*/ SomeObject someObject; MyClass() { someObject=null; } public void startup() { someObject=new SomeObject(...arguments from environment which are not available until startup is called...); } public void shutdown() { someObject=null; // this is not necessary, I am just expressing the intended scope of someObject explicitly } } I can't make someObject final since it can't be set until startup() is invoked. But I would really like it to reflect it's write-once semantics and be able to directly access it from multiple threads, preferably avoiding synchronization. The idea being to express and enforce a degree of finalness, I conjecture that I could create a generic container, like so: public class WoRmObject<T> { private T object; WoRmObject() { object=null; } public WoRmObject set(T val) { object=val; return this; } public T get() { return object; } } and then in MyClass, above, do: private final WoRmObject<SomeObject> someObject; MyClass() { someObject=new WoRmObject<SomeObject>(); } public void startup() { someObject.set(SomeObject(...arguments from environment which are not available until startup is called...)); } Which raises some questions for me: Is there a better way, or existing Java object (would have to be available in Java 4)? Is this thread-safe provided that no other thread accesses someObject.get() until after it's set() has been called. The other threads will only invoke methods on MyClass between startup() and shutdown() - the framework guarantees this. Given the completely unsynchronized WoRmObject container, it is ever possible under either JMM to see a value of object which is neither null nor a reference to a SomeObject? In other words, does has the JMM always guaranteed that no thread can observe the memory of an object to be whatever values happened to be on the heap when the object was allocated.

    Read the article

  • How do I modify gitstats to only utilize a specified file extension for it's statistics?

    - by Fake Code Monkey Rashid
    Hello good people! The website of the statistics generator in question is: http://gitstats.sourceforge.net/ It's git repo can be cloned from: git clone git://repo.or.cz/gitstats.git What I want to do is something like: ./gitstatus --ext=".py" /input/foo /output/bar Failing being able to easily pass the above option without heavy modification, I'd just hardcore the file extentsion I want to be included. However, I'm unsure of the relevant section of code to modify and even if I did no, I'm unsure of how to start such modifications. It's seems like it'd be rather simple but alas...

    Read the article

  • Flow Based Programming

    - by Software Monkey
    I have been doing a little reading on Flow Based Programming over the last few days. There is a wiki which provides further detail. And wikipedia has a good overview on it too. My first thought was, "Great another proponent of lego-land pretend programming" - a concept harking back to the late 80's. But, as I read more, I must admit I have become intrigued. Have you used FBP for a real project? What is your opinion of FBP? Does FBP have a future? In some senses, it seems like the holy grail of reuse that our industry has pursued since the advent of procedural languages.

    Read the article

  • Accessing subclass members from a superclass pointer C++

    - by Dr. Monkey
    I have an array of custom class Student objects. CourseStudent and ResearchStudent both inherit from Student, and all the instances of Student are one or the other of these. I have a function to go through the array, determine the subtype of each Student, then call subtype-specific member functions on them. The problem is, because these functions are not overloaded, they are not found in Student, so the compiler kicks up a fuss. If I have a pointer to Student, is there a way to get a pointer to the subtype of that Student? Would I need to make some sort of fake cast here to get around the compile-time error?

    Read the article

  • How can I debug a session

    - by Organ Grinding Monkey
    I have been asked to work of a very large web application and deploy it. The problem that I'm facing here is that when I deploy the application and more that 1 user logs into the system, the sessions seem to cross over i.e: Person A logs in and works on the site, all good. When person B logs in, person A will then be logged in as person B as well. I have been asked to work of a very large web application and deploy it. The problem that I'm facing here is that when I deploy the application and more that 1 user logs into the system, the sessions seem to cross over i.e: Person A logs in and works on the site, all good. When person B logs in, person A will then be logged in as person B as well. If anyone has experienced this behaviour before and can steer me in the right direction, that would be first prize, Second prize would be to show me how I can debug this situation so that I can find out where the problem is and fix it. Some information about the application. From what I've been told and what I've seen within the app is that it started as a .Net 1.1 application and got upgraded to .Net 2 and that's why the log in system was done the way it is. (The application is huge and now complete and that's why I cant rewrite the whole user authentication process, it will just take to long and I don't know what effect it might have) All the Logged in User information is stored in properties that have been added in the Global.asax.vb file. (could this be the problem?) Any help here would be greatly appreciated

    Read the article

  • Bind to Count of items in the DataContext

    - by Organ Grinding Monkey
    I want to bind to the Count/amount of items within my DataContext. I have an object, lets say person which has a List<address> as a property. I would like to display the amount of addresses for that person ie: 5 or 6 or whatever the case may be. I've tried {Binding Path=address#.Count} and a few others but that doesnt seem to work. Any help would be appreciated, thanks.

    Read the article

  • Should '#include' and 'using' statements be repeated in both header and implementation files (C++)?

    - by Dr. Monkey
    I'm fairly new to C++, but my understanding is that a #include statement will essentially just dump the contents of the #included file into the location of that statement. This means that if I have a number of '#include' and 'using' statements in my header file, my implementation file can just #include the header file, and the compiler won't mind if I don't repeat the other statements. What about people though? My main concern is that if I don't repeat the '#include', 'using', and also 'typedef' (now that I think of it) statements, it takes that information away from the file in which it's used, which could lead to confusion. I am just working on small projects at the moment where it won't really cause any issues, but I can imagine that in larger projects with more people working on them it could become a significant issue. An example follows: //Unit.h #include <string> #include <ostream> #include "StringSet.h" using std::string; using std::ostream; class Unit { public: //public members private: //private members //unrelated side-question: should private members //even be included in the header file? } ; //Unit.cpp #include "Unit.h" //The following are all redundant from a compiler perspective: #include <string> #include <ostream> #include "StringSet.h" using std::string; using std::ostream; //implementation goes here

    Read the article

  • Is there a standard .NET exception to throw when a class doesn't implement a required attribute?

    - by a typing monkey
    Suppose I want to throw a new exception when invoking a generic method with a type that doesn't have a required attribute. Is there a .NET exception that's appropriate for this situation, or, more likely, one that would be a suitable ancestor for a custom exception? For example: public static class ClassA { public static T DoSomething<T>(string p) { Type returnType = typeof(T); object[] typeAttributes = returnType.GetCustomAttributes(typeof(SerializableAttribute), true); if ((typeAttributes == null) || (typeAttributes.Length == 0)) { // Is there an exception type in the framework that I should use/inherit from here? throw new Exception("This class doesn't support blah blah blah"); // Maybe ArgumentException? That doesn't seem to fit right. } } } Thanks.

    Read the article

  • Can a thread call wait() on two locks at once in Java (6)

    - by Dr. Monkey
    I've just been messing around with threads in Java to get my head around them (it seems like the best way to do so) and now understand what's going on with synchronize, wait() and notify(). I'm curious about whether there's a way to wait() on two resources at once. I think the following won't quite do what I'm thinking of: synchronized(token1) { synchronized(token2) { token1.wait(); token2.wait(); //won't run until token1 is returned System.out.println("I got both tokens back"); } } In this (very contrived) case token2 will be held until token1 is returned, then token1 will be held until token2 is returned. The goal is to release both token1 and token2, then resume when both are available (note that moving the token1.wait() outside the inner synchronized loop is not what I'm getting at). A loop checking whether both are available might be more appropriate to achieve this behaviour (would this be getting near the idea of double-check locking?), but would use up extra resources - I'm not after a definitive solution since this is just to satisfy my curiosity.

    Read the article

  • nut (UPS) and SSL certificates

    - by Mausy5043
    Today I installed nut on my Ubuntu server (14.03). $ uname -a Linux boson 3.13.0-24-generic #47-Ubuntu SMP Fri May 2 23:30:00 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux The UPS is connected to another server (called neutron), so I use nut-client to keep tabs on the UPS state. When I do sudo upsc [email protected] I get: Init SSL without certificate database battery.charge: 15 battery.charge.low: 10 battery.charge.warning: 50 battery.date: not set battery.mfr.date: 2012/11/27 : The first line of the output concerns me. I've not seen this on other installations of nut on Debian-based servers. What can I do to get rid of that line? EDIT: This "Init SSL without certificate database" is extra annoying because it is not part of the output of upsc and therefore I cannot grep it out.

    Read the article

  • In a Rails unit test, how can I get a User fixture to load its associated Profile?

    - by MikeJ
    In the documentation concerning Fixtures (http://api.rubyonrails.org/classes/Fixtures.html) they provide the following example of using label references for associations: ### in pirates.yml reginald: name: Reginald the Pirate monkey: george ### in monkeys.yml george: name: George the Monkey pirate: reginald So following their lead, I have a User model that has_one :profile, a Profile model that belongs_to :user, and tried to set up fixtures per their example: ### in users.yml reginald: id: 1 login: reginald ### in profiles.yml reginalds_profile: id: 1 name: Reginald the Pirate user: reginald (Note: since my association is one-way, the User fixture doesn't have a "profile: reginalds_profile" association--putting it in causes an error because the SQL table has no profile_id attribute.) The problem is, in my unit tests everything seems to load correctly, but users(:reginald).profile is always nil. What am I missing?

    Read the article

  • Finding specific pixel colors of a BitmapImage

    - by Andrew Shepherd
    I have a WPF BitmapImage which I loaded from a .JPG file, as follows: this.m_image1.Source = new BitmapImage(new Uri(path)); I want to query as to what the colour is at specific points. For example, what is the RGB value at pixel (65,32)? How do I go about this? I was taking this approach: ImageSource ims = m_image1.Source; BitmapImage bitmapImage = (BitmapImage)ims; int height = bitmapImage.PixelHeight; int width = bitmapImage.PixelWidth; int nStride = (bitmapImage.PixelWidth * bitmapImage.Format.BitsPerPixel + 7) / 8; byte[] pixelByteArray = new byte[bitmapImage.PixelHeight * nStride]; bitmapImage.CopyPixels(pixelByteArray, nStride, 0); Though I will confess there's a bit of monkey-see, monkey do going on with this code. Anyway, is there a straightforward way to process this array of bytes to convert to RGB values?

    Read the article

  • How to recursively serialize an object using reflection ?

    - by Tony
    I want to navigate to the N-th level of an object, and serialize it's properties in String format. For Example: class Animal { public String name; public int weight; public Animal friend; public Set<Animal> children = new HashSet<Animal>() ; } should be serialized like this: {name:"Monkey", weight:200, friend:{name:"Monkey Friend",weight:300 ,children:{...if has children}}, children:{name:"MonkeyChild1",weight:100,children:{... recursively nested}} } And you may probably notice that it is similar to serializing an object to json. I know there're many libs can do this, can you give me some instructive ideas on how to write this?

    Read the article

  • How to find the maximum value for each key in a List of Dictionaries using LINQ?

    - by Argos
    I have a List of Dictionaries that have keys of type string and values that are ints. Many of the dictionaries have the same keys in them but not all of them. So my question is: using LINQ how would I find the maximum value associated with each distinct key across all of the dictionaries? So for example given the following input: var data = new List<Dictionary<string, int>> { new Dictionary<string, int> {{"alpha", 4}, {"gorilla", 2}, {"gamma", 3}}, new Dictionary<string, int> {{"alpha", 1}, {"beta", 3}, {"gamma", 1}}, new Dictionary<string, int> {{"monkey", 2}, {"beta", 2}, {"gamma", 2}}, }; I would like some kind of collection that contains: {"alpha", 4}, {"gorilla", 2}, {"gamma", 3}, {"beta", 3}, {"monkey", 2} (I'm currently looping through the list and keeping track of things myself, really just wondering if there is a nicer LINQ-esque way of doing it) EDIT: I also don't know what the string keys are in advance

    Read the article

  • How do polymorphic inline caches work with mutable types?

    - by kingkilr
    A polymorphic inline cache works by caching the actual method by the type of the object, in order to avoid the expensive lookup procedures (usually a hashtable lookup). How does one handle the type comparison if the type objects are mutable (i.e. the method might be monkey patched into something different at run time). The one idea I've come up with would be a "class counter" that gets incremented each time a method is adjusted, however this seems like it would be exceptionally expensive in a heavily monkey patched environ since it would kill all the PICs for that class, even if the methods for them weren't altered. I'm sure there must be a good solution to this, as this issue is directly applicable to Javascript and AFAIK all 3 of the big JS VMs have PICs (wow acronym ahoy).

    Read the article

  • Best way to search for a saturation value in a sorted list

    - by AB Kolan
    A question from Math Battle. This particular question was also asked to me in one of my job interviews. " A monkey has two coconuts. It is fooling around by throwing coconut down from the balconies of M-storey building. The monkey wants to know the lowest floor when coconut is broken. What is the minimal number of attempts needed to establish that fact? " Conditions: if a coconut is broken, you cannot reuse the same. You are left with only with the other coconut Possible approaches/strategies I can think of are Binary break ups & once you find the floor on which the coconut breaks use upcounting from the last found Binary break up lower index. Window/Slices of smaller sets of floors & use binary break up within the Window/Slice (but on the down side this would require a Slicing algorithm of it's own.) Wondering if there are any other way to do this.

    Read the article

  • Why use threading data race will occur, but will not use gevent

    - by onlytiancai
    My test code is as follows, using threading, count is not 5,000,000 , so there has been data race, but using gevent, count is 5,000,000, there was no data race . Is not gevent coroutine execution will atom "count + = 1", rather than split into a one CPU instruction to execute? # -*- coding: utf-8 -*- import threading use_gevent = True use_debug = False cycles_count = 100*10000 if use_gevent: from gevent import monkey monkey.patch_thread() count = 0 class Counter(threading.Thread): def __init__(self, name): self.thread_name = name super(Counter, self).__init__(name=name) def run(self): global count for i in xrange(cycles_count): if use_debug: print '%s:%s' % (self.thread_name, count) count = count + 1 counters = [Counter('thread:%s' % i) for i in range(5)] for counter in counters: counter.start() for counter in counters: counter.join() print 'count=%s' % count

    Read the article

  • HTML: Creating tool in HTML which enables to mark on an image

    - by A.Amidi
    I am creating an online survey-monkey for conducting a research. Participants are asked to mark the preferred places for building the parking on the map (image). In other words, participants should be able to mark on the image (map) wherever they want and subsequently I could have an access to the saved locations after survey. I am writing to know how I can provide tools for participants to draw or mark on the map by using HTML codes.

    Read the article

  • Microsoft turning into a toothless tiger?

    <b>Technology & Life Integrationt:</b> "Many moons ago ( and I am not talking about those drunken moons at passing cars :), while the IT jungle was still fresh and green. There was a big blue king of the jungle. This top monkey position was usurped by an up and coming tiger that, while the tigers name seemed small and soft, it wasn't afraid to show its teeth."

    Read the article

  • Outsourcing a private project: can it be done?

    - by Stafford Williams
    I'm an employed software designer/developer/analyst/monkey and I'm pondering the possibility of outsourcing the coding component(s) of some private(ly funded) projects. I have never used outsourcing before and am hesitant due to the contractors i've seen in the workplace that seem to have a reverse relationship on renumeration vs results/quality. Has anyone had any luck with outsourcing private coding jobs and can you offer any pointers?

    Read the article

  • Scaling Down Pixel Art?

    - by Michael Stum
    There's plenty of algorithms to scale up pixel art (I prefer hqx personally), but are there any notable algorithms to scale it down? In my case, the game is designed to run at 1280x720, but if someone plays at a lower resolution I want it to still look good. Most Pixel Art discussions center around 320x200 or 640x480 and upscaling for use in console emulators, but I wonder how modern 2D games like the Monkey Island Remake look good on lower resolutions? (Ignoring the options of having multiple versions of assets (essentially, mipmapping))

    Read the article

  • Frontend development, where to start?

    - by glitch
    I've been stuck on the backend for years now, working on webservices, DBs, SDKs, APIs and all that jazz, and so that's an area that I have a decent grasp of, but I've absolutely no clue about how the frontend works. What's a good place to start for a backend monkey like me who wants to learn the best practices, latest technologies and the philosophy behind modern web page design and its interaction with the server? I want to be cool like all of the other javascript kids. Thanks!

    Read the article

  • 25 Passwords to Avoid to Thwart Hackers

    SplashData, a vendor of smartphone productivity applications for consumers and businesses, recently released a list of the top 25 most commonly used passwords for 2011. The company compiled the list after analyzing files of stolen passwords that hackers posted online to share with their cybercriminal colleagues. Without further adieu, here is the list of passwords that made SplashData's top 25: password, 123456, 12345678, qwerty, abc123, monkey, 1234567, letmein, trustno1, dragon, baseball, 111111, iloveyou, master, sunshine, ashley, bailey, passw0rd, shadow, 123123, 654321, superman, qazwsx...

    Read the article

< Previous Page | 1 2 3 4 5 6 7 8 9 10 11  | Next Page >