Search Results

Search found 3180 results on 128 pages for 'david sauter'.

Page 70/128 | < Previous Page | 66 67 68 69 70 71 72 73 74 75 76 77  | Next Page >

  • access exception when invoking method of an anonymous class using java reflection

    - by Asaf David
    Hello I'm trying to use an event dispatcher to allow a model to notify subscribed listeners when it changes. the event dispatcher receives a handler class and a method name to call during dispatch. the presenter subscribes to the model changes and provide a Handler implementation to be called on changes. Here's the code (I'm sorry it's a bit long). EventDispacther: package utils; public class EventDispatcher<T> { List<T> listeners; private String methodName; public EventDispatcher(String methodName) { listeners = new ArrayList<T>(); this.methodName = methodName; } public void add(T listener) { listeners.add(listener); } public void dispatch() { for (T listener : listeners) { try { Method method = listener.getClass().getMethod(methodName); method.invoke(listener); } catch (Exception e) { System.out.println(e.getMessage()); } } } } Model: package model; public class Model { private EventDispatcher<ModelChangedHandler> dispatcher; public Model() { dispatcher = new EventDispatcher<ModelChangedHandler>("modelChanged"); } public void whenModelChange(ModelChangedHandler handler) { dispatcher.add(handler); } public void change() { dispatcher.dispatch(); } } ModelChangedHandler: package model; public interface ModelChangedHandler { void modelChanged(); } Presenter: package presenter; public class Presenter { private final Model model; public Presenter(Model model) { this.model = model; this.model.whenModelChange(new ModelChangedHandler() { @Override public void modelChanged() { System.out.println("model changed"); } }); } } Main: package main; public class Main { public static void main(String[] args) { Model model = new Model(); Presenter presenter = new Presenter(model); model.change(); } } Now, I except to get the "model changed" message. However, I'm getting an java.lang.IllegalAccessException: Class utils.EventDispatcher can not access a member of class presenter.Presenter$1 with modifiers "public". I understand that the class to blame is the anonymous class i created inside the presenter, however I don't know how to make it any more 'public' than it currently is. If i replace it with a named nested class it seem to work. It also works if the Presenter and the EventDispatcher are in the same package, but I can't allow that (several presenters in different packages should use the EventDispatcher) any ideas?

    Read the article

  • Basic questions about SNMP

    - by David Hodgson
    Hi, I'm learning about SNMP, and writing some applications using it. I have some basic questions about the protocol: Do the agents store its state on the device itself? If there is a trap set on an agent, can you do a poll on the same OID to get the same information? Without using a mib file, is there a way to query a device for all of its information at once? If not, and you're writing your own customized manager, do you have to know the structure of what it reports up front? If you're setting up an agent to report, is there usually a way to control the frequency of how often it sends a trap? Or does it usually send a trap as often as some condition is satisfied?

    Read the article

  • Windows SBS 2003 Remote Desktop Problem

    - by david.healed
    Hi, I used to remote access the SBS 2003 server through RDC and it has been working all the time but now I am unable to connect to the server. Whenever I pressed the "Connect" button on the Remote Desktop Connection dialog, a dialog with messages like "Connecting to: xx.xx.xx.xx" and "Configuring remote session..." appeared and then disappeared quickly, leaving the Remote Desktop Connection dialog there. How to fix the problem? Is the any way to reinstall the Remote Desktop on the server. Thank you.

    Read the article

  • How to use SLF4J Log4jLoggerAdapter

    - by David Wong
    I'm deploying an enterprise application on Weblogic 8.1 which has log4j 1.2.8 on it's classpath. I'm getting the following error with SLF4J 1.6.1: SLF4J versions 1.4.0 and later requires log4j 1.2.12 or later http://www.slf4j.org/codes.html#log4j_version Above link recommends using Log4jLoggerAdapter. I've changed Logger logger = LoggerFactory.getLogger(HelloWorld.class); logger.info("Hello World"); to Log4jLoggerAdapter logger = (Log4jLoggerAdapter) LoggerFactory.getLogger(HelloWorld.class); logger.info("Hello World"); However, I'm still encountering the error. Any advice on how to correctly implement this? Thanks

    Read the article

  • Objective C Array and Object Release

    - by david
    Hi, I have a newbie question regarding when to release the elements of a NSArray. See following pseudo code: NSMutalbeArray *2DArray = [[NSMutableArray alloc] initWithCapacity:10]; for (int i=0;i<10;i++) { NSMutableArray *array = [[MSMutableArray alloc] initWithCapacity:5]; for (int j=0;j<5;j++) { MyObject *obj = [[MyObject alloc] init]; [array addObject:obj]; [obj release]; } [2DArray addObject:array]; [array release]; } // use 2DArray to do something [2DArray release] My question here is, when I release 2DArray, do I need to explicitly release each of its element (array) first? Also, before I release the "array" object, do I need to release each of its element (MyObject) first? I am new to Objective C. Please help. thanks.

    Read the article

  • How to View Android Native Code Profiling?

    - by David R.
    I started my emulator with ./emulator -trace profile -avd emulator_15. I then tracked down the trace files to ~/.android/avd/rodgers_emulator_15.avd/traces/profile, where there are six files: qtrace.bb, qtrace.exc, qtrace.insn, qtrace.method, qtrace.pid, qtrace.static. I can't figure out what to do with these files. I've tried both dmtracedump and traceview on all of the files, but none seem to generate any output I can do anything with. How can I view the proportion of time taken by native method calls on Android?

    Read the article

  • SQL CE not loading from network share

    - by David Veeneman
    I installed VS 2010 RC yesterday, and suddenly, SQL Server CE isn't loading files from a network share. In projects compiled with VS 2008, if I try to open a SQL CE file located on a network share, I get an error that reads like this: Internal error: Cannot open the shared memory region. If I try to create a data connection in VS 2010 to a SQL CE file on a network share, I get this error: SQL Server Compact does not support opening database files on a network share. Can anyone shed any light on what's going on? Thanks.

    Read the article

  • Best way to handle global state

    - by David
    Hi there, I was wondering if anyone could offer some advice on 'best practices' for using global state in a web application - specifically PHP, although im looking for generic best practices i.e. design patterns etc. At the moment I just use a static class, calling it Configs. I suppose this is similar to using the registry pattern but surely there is a more elegant way of handling global data within an application - i just cant think of a better way though.

    Read the article

  • Can't Build for iPhone Device

    - by David Beck
    After upgrading to the iPhone SDK 4.0, I get the following error when building for device: gcc-4.0: Invalid arch name : armv7 Command /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc-4.0 failed with exit code 1 Before, I was only building for armv6 (the default on pre 4.0 SDK's).

    Read the article

  • Forms/AD Authentication with Sharepoint

    - by David Lively
    All, I'm configuring Sharepoint to use forms authentication with LDAP/Active Directory. I'm new to Sharepoint, so if this is obvious, please point me in the right direction. Whenever I attempt to log in with a bad account or password, I get the very friendly (and correct) error message, The server could not sign you in. Make sure your user name and password are correct, and then try again. ... which implies that Sharepoint is able to communicate with AD. If I log in with a valid account, I get a page that says: (I added the grey bar to cover up the login name) Any suggestions? The account I'm logging in with is an administrator and has been granted full control in central administration. Also, interesting note: If I click the "sign in as a different user" link, and attempt to sign in using with the same credentials I just used, the site just redirects back to the login page, with no error or status message. If I then manually enter the site url, it again shows the "Error: Access Denied" page. Argh.

    Read the article

  • Ajax model binding of a complex type

    - by David G
    I am trying to do something along the lines of the following where I have a Controller with an method similar to: public ActionResult Insert(Author author) { //do something... } Where the Author type looks like: public class Author { public string FirstName { get; set; } public string LastName { get; set; } public Book[] Books { get; set; } public Author() { Books = new Book[0]; } } public class Book { public string Title { get; set; } public int NumberOfPages { get; set; } } From a page I want to submit data using JQuery and Ajax something like function addAuthor() { var auth = { 'FirstName': 'Roald', 'LastName': 'Dahl', 'Books': [ { 'Title': 'Charlie and the Chocolate Factory', 'NumberOfPages': 264 }, { 'Title': 'The Twits', 'NumberOfPages': 316 } ] }; $.ajax({ type: "GET", url: "/Insert", data: auth }); } MVC binds the Author object (FirstName and LastName are set) but doesn't bind the Books property. Why is that and how can I submit an object containing an Array (or a Collection) as a property through AJAX?

    Read the article

  • How can I use CSS pseudo-classes with GWT's UiBinder?

    - by David
    I've been using the in-line styles approach as recommended by GWT's UiBinder documentation. I'm puzzled, though, about how to use CSS pseudo-classes with UiBinder; for example, suppose I would otherwise (without UiBinder) have this CSS rule: #myLink:hover { background:blue } Can I implement that rule in UiBinder?

    Read the article

  • Select count() max() Date

    - by DAVID
    I have a table with shifts history along with emp ids. I'm using this query to retrieve a list of employees and their total shifts by specifying the range to count from: SELECT ope_id, count(ope_id) FROM operator_shift WHERE ope_shift_date >=to_date( '01-MAR-10','dd-mon-yy') and ope_shift_date <= to_date('31-MAR-10','dd-mon-yy') GROUP BY OPE_ID which gives OPE_ID COUNT(OPE_ID) 1 14 2 7 3 6 4 6 5 2 6 5 7 2 8 1 9 2 10 4 10 rows selected. How do I choose the employee with the highest number of shifts under the specified range date?

    Read the article

  • CATransitionFade not working on newly added subviews

    - by David Liu
    For some reason, fading in new buttons using CATransition isn't working for me when it's a newly added button. The fade animation, however, is working on existing subviews. Code: // Add new button. CATransition *animation = [CATransition animation]; [animation setDuration:0.5]; [animation setType:kCATransitionFade]; [[button layer] addAnimation:animation forKey:@"fadeIn"]; [self.view addSubview:button]; // Enable previous button (Enabling fades in different type of background) if(toolbar.buttons.count != 0){ UIButton * prevButton = [toolbar.buttons objectAtIndex:(toolbar.buttons.count - 1)]; prevButton.enabled = YES; [[prevButton layer] addAnimation:animation forKey:@"fadeIn"]; }

    Read the article

  • To PHP Namespace or not to PHP Namespace

    - by David
    ok, im relatively new to php programming and have been plodding along quite unaware that it is possible to actually use namespaces in php as I can in c# etc. Its really ugly though as they have decided to use backslashes - why! Anyway, I am interested in other php programmers views on whether namespaces will catch on in php and whether I should begin to use them now?

    Read the article

  • Is it valid to use unsafe struct * as an opaque type instead of IntPtr in .NET Platform Invoke?

    - by David Jeske
    .NET Platform Invoke advocates declaring pointer types as IntPtr. For example, the following [DllImport("user32.dll")] static extern IntPtr SendMessage(IntPtr hWnd, UInt32 Msg, Int32 wParam, Int32 lParam); However, I find when interfacing with interesting native interfaces, that have many pointer types, flattening everything into IntPtr makes the code very hard to read and removes the typical typechecking that a compiler can do. I've been using a pattern where I declare an unsafe struct to be an opaque pointer type. I can store this pointer type in a managed object, and the compiler can typecheck it form me. For example: class Foo { unsafe struct FOO {}; // opaque type unsafe FOO *my_foo; class if { [DllImport("mydll")] extern static unsafe FOO* get_foo(); [DllImport("mydll")] extern static unsafe void do_something_foo(FOO *foo); } public unsafe Foo() { this.my_foo = if.get_foo(); } public unsafe do_something_foo() { if.do_something_foo(this.my_foo); } While this example may not seem different than using IntPtr, when there are several pointer types moving between managed and native code, using these opaque pointer types for typechecking is a godsend. I have not run into any trouble using this technique in practice. However, I also have not seen an examples of anyone using this technique, and I wonder why. Is there any reason that the above code is invalid in the eyes of the .NET runtime? My main question is about how the .NET GC system treats "unsafe FOO *my_foo". Is this pointer something the GC system is going to try to trace, or is it simply going to ignore it? My hope is that because the underlying type is a struct, and it's declared unsafe, that the GC would ignore it. However, I don't know for sure. Thoughts?

    Read the article

  • Integrating ASP.NET MVC 2 with classic ASP

    - by David Lively
    I'm in the process of moving a large classic ASP application to ASP.NET MVC 2. Questions: My question is about project organization. I would prefer to not mix the MVC code with the ASP code in the same VS project. I'd like to have an MVC WAP with areas that match the parts of the website that I'm migrating. For instance, the old site has a folder /products/default.asp..... /products/productName/default.asp etc. In the MVC WAP, I'd like to have an area called "products", which I could then, either through a rewrite, routing, or preferably through some IIS configuration, point the "products" folder on the ASP site to. In this way, I could gradually move root folders from the ASP site to the MVC application. However, if I create the MVC WAP in a virtual folder, then my routes wind up looking like http://localhost/virtualFolder/products instead of http://localhost/products Any suggestions on how to conquer this? I know that, during deployment, I could deploy the MVC WAP into the root of the ASP site, but this doesn't help with debugging.

    Read the article

  • How to delete duplicate vectors within a multidimensional vector?

    - by David
    I have a vector of vectors: vector< vector<int> > BigVec; It contains an arbitrary number of vectors, each of an arbitrary size. I want to delete not duplicate elements of each vector, but any vectors that are the exact same as another. I don't need to preserve the order of the vectors so I can sort etc.. It should be a really simple problem to solve but I'm new to this, my (not-working) best effort: for (int i = 0; i < BigVec.size(); i++) { for (int j = 1; j < BigVec.size() ; j++ ) { if (BigVec[i][0] == BigVec [j][i]); { BigVec.erase(BigVec.begin() + j); i = 0; // because i get the impression deleting a j = 1; // vector messes up a simple iteration through } } } I think there might be a solution using Unique(), but I can't get that to work either.

    Read the article

  • Importing a SQL Server 2005 Profile Trace Template into SQL 2008

    - by David Stein
    I'm using SQL Server 2008, but my ERP Vendor only offers a SQL 2005 trace template that they'd like me to run on my system. When I attempt to import it, I receive confirmation that it was successfully imported. However, it does not show up in the list of available templates. I've done this on two separate servers to the same effect. Is this a known problem with SQL Server 2008? I Googled unsuccessfully.

    Read the article

  • How to profile Doctrine in Zend Framework

    - by David Zapata
    Good day. I'm using Doctrine as ORM for my Zend Framework project. This is the first time I use it. I've followed the ZendCasts Doctrine chapters, and everything works for me, but I needed to perform some profiling; There is a Doctrine_Connection_Profiler class that should be used to profile the Doctrine Model internal queries, but I've tried to use it without success. I always get a "PDOException: You cannot serialize or unserialize PDOStatement instances" exception when I perform my Unit Tests. Here is a example: $conn = Doctrine_Manager::connection($doctrineConfig['dsn'], $dbconfname); ... if( APPLICATION_ENV != 'production'){ $obj_doctrine_profiler = new Doctrine_Connection_Profiler(); $conn->setListener($obj_doctrine_profiler); } All of my Unit Tests works if I comment/delete the $conn->setListener($obj_doctrine_profiler); line. This code block is located in my Bootstrap.php class; the weird thing is, the web application works just fine even with the mentioned code line. Thank you so much for your help. please excuse me if my english is not the best.

    Read the article

  • Total stack sizes of threads in one process

    - by David
    I use pthreads_attr_getthreadsizes() to get default stack size of one thread, 8MB on my machine. But when I create 8 threads and allocate a very large stack size to them, say hundreds of MB, the program crash. So, I guess, shall ("Number of threads" x "stack size of per thread") shall less than a value(virtual memory size)?

    Read the article

< Previous Page | 66 67 68 69 70 71 72 73 74 75 76 77  | Next Page >