Search Results

Search found 8397 results on 336 pages for 'implementation'.

Page 21/336 | < Previous Page | 17 18 19 20 21 22 23 24 25 26 27 28  | Next Page >

  • Yii PHP Framework- Implementation

    - by Josh
    I was just curious if Yii is supposed to be compiled into PHP or not. Is it possible to use Yii just by copying the Framework to a folder on the server and then including something (something as in one of the yii files- I am not sure how it works) in the scripts I wish to use the framework for? (Noob when it comes to frameworks and usage) Thanks, Josh

    Read the article

  • SqlDataReader / DbDataReader implementation question

    - by Jose
    Does anyone know how DbDataReaders actually work. We can use SqlDataReader as an example. When you do the following cmd.CommandText = "SELECT * FROM Customers"; var rdr = cmd.ExecuteReader(); while(rdr.Read()) { //Do something } Does the data reader have all of the rows in memory, or does it just grab one, and then when Read is called, does it go to the db and grab the next one? It seems just bringing one into memory would be bad performance, but bringing all of them would make it take a while on the call to ExecuteReader. I know I'm the consumer of the object and it doesn't really matter how they implement it, but I'm just curious, and I think that I would probably spend a couple hours in Reflector to get an idea of what it's doing, so thought I'd ask someone that might know. I'm just curious if anyone has an idea.

    Read the article

  • GTK implementation of MessageBox

    - by Bernard
    I have been trying to implement Win32's MessageBox using GTK. The app using SDL/OpenGL, so this isn't a GTK app. I handle the initialisation (gtk_init) sort of stuff inside the MessageBox function as follows: int MessageBox(HWND hwnd, const char* text, const char* caption, UINT type){ GtkWidget *window = NULL; GtkWidget *dialog = NULL; gtk_init(&gtkArgc, &gtkArgv); window = gtk_window_new(GTK_WINDOW_TOPLEVEL); g_signal_connect(G_OBJECT(window), "delete_event", G_CALLBACK(delete_event), NULL); g_signal_connect(G_OBJECT(window), "destroy", G_CALLBACK(destroy), NULL); // gcallback calls gtk_main_quit() gtk_init_add((GtkFunction)gcallback, NULL); if (type & MB_YESNO) { dialog = gtk_message_dialog_new(GTK_WINDOW(window), GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_QUESTION, GTK_BUTTONS_YES_NO, text); } else { dialog = gtk_message_dialog_new(GTK_WINDOW(window), GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_INFO, GTK_BUTTONS_OK, text); } gtk_window_set_title(GTK_WINDOW(dialog), caption); gint result = gtk_dialog_run(GTK_DIALOG(dialog)); gtk_main(); gtk_widget_destroy(dialog); if (type & MB_YESNO) { switch (result) { default: case GTK_RESPONSE_DELETE_EVENT: case GTK_RESPONSE_NO: return IDNO; break; case GTK_RESPONSE_YES: return IDYES; break; } } return IDOK;} Now, I am by no means an experienced GTK programmer, and I realise that I'm probably doing something(s) horribly wrong. However, my problem is that the last dialog popped up with this function stays around until the process exits. Any ideas?

    Read the article

  • ruby on rails named scope implementation

    - by Engwan
    From the book Agile Web Development With Rails class Order < ActiveRecord::Base named_scope :last_n_days, lambda { |days| {:conditions => ['updated < ?' , days] } } named_scope :checks, :conditions => {:pay_type => :check} end The statement orders = Orders.checks.last_n_days(7) will result to only one query to the database. How does rails implement this? I'm new to Ruby and I'm wondering if there's a special construct that allows this to happen. To be able to chain methods like that, the functions generated by named_scope must be returning themselves or an object than can be scoped further. But how does Ruby know that it is the last function call and that it should query the database now? I ask this because the statement above actually queries the database and not just returns an SQL statement that results from chaining.

    Read the article

  • implementation Services in MVVM

    - by netmajor
    I want to use Services(WCF/RIA /Web) to take data from Entity Data Model class (maybe NHibernate class) and prepared it special for View layer binding. I have few Silverlight page, so should I create for each page separate service class ? Or create one interface and all method will implement it in one service class? Do You have some advice helped with my with services ?

    Read the article

  • another porter stemming algorithm implementation question ?

    - by mike
    Hi, I am trying to implement porter stemming algorithm, but i am having difficualties understanding this point Step 1c (*v*) Y -> I happy -> happi sky -> sky Isn't that the the opposite of what we want to do , why does the algorithim convert the Y into I. for the complete algorithm here http://tartarus.org/~martin/PorterStemmer/def.txt Thanks

    Read the article

  • jQTouch Spinning Wheel (Cubiq) Implementation Won't Work

    - by Peter
    I am trying to get a nice Spinning Wheel working within my webapp; http://bit.ly/89oWud However, I keep receiving an error within Mobile Safari that the variable 'blabla' cannot be found. I have implemented both of these suggested solutions: 1# Change SpinningWheelCSS 2# Change JQTouch CSS, JS files, and add JQTouch wrapper to body Neither worked for me. I am trying to use the incredible Spinning Wheel by Cubiq.org. I'm likely doing something wrong, but for the life of me I can't figure out what it is. Help is very much appreciated.

    Read the article

  • Using the WF rules engine without workflow in production - implementation experiences

    - by Josh E
    I'm designing an application for a type of case management system that has a big requirement for customizable, flexible business rules. I'm planning on using the WF Rules Engine without workflow (see: here, among other examples and such). One of the points my client brought up (justifiably so!) is whether there are extant examples of using the rules engine for a business rules engine without workflow. My question, of course is: Has anyone used the WF Rules engine sans workflow in a production application before, and what were your experiences?

    Read the article

  • MVC implementation/best-practices question

    - by Vivin Paliath
    I have to work with some code that isn't truly MVC (i.e., it doesn't use an explicit framework among other things). Right now we make do with servlets that pass data to services. Here is my problem. I am receiving a post to a servlet that contains a whole bunch of address data that I have to save to the database. The data is (obviously) in the HttpRequest object. My question is, how do I pass this data into a service? I am reluctant to do it like this: AddressService.saveAddress(request); Because I don't think the service should have a dependency on the request. My other option is to do something like this: String addressLine = request.getParameter("addressLine"); .. .. about 7 other parameters .. String zip = request.getParameter("zip"); AddressService.saveAddress(addressLine, ... 7 other parameters ..., zip); But I don't like having a function with a huge number of parameters either. I was thinking of making an intermediate object called AddressData that would hold data from the request, and then passing that into the service. Is that an acceptable way of doing things?

    Read the article

  • Exception during secure communication implementation

    - by Liran
    hi everyone. im trying to implement simple secured client server communiction using WCF. when im launching mt server everty thing is OK , But when im launching my client im getting this error: Error : An error occurred while making the HTTP request to https://localhost:800 0/ExchangeService. This could be due to the fact that the server certificate is not configured properly with HTTP.SYS in the HTTPS case. This could also be caus ed by a mismatch of the security binding between the client and the server. this is the server code : Uri address = new Uri("https://localhost:8000/ExchangeService"); WSHttpBinding binding = new WSHttpBinding(); //Set Binding Params binding.Security.Mode = SecurityMode.Transport; binding.Security.Transport.ClientCredentialType = HttpClientCredentialType.None; binding.Security.Transport.ProxyCredentialType = HttpProxyCredentialType.None; Type contract = typeof(ExchangeService.ServiceContract.ITradeService); ServiceHost host = new ServiceHost(typeof(TradeService)); host.AddServiceEndpoint(contract, binding, address); host.Open(); this is the client configuration (app.config): </client> <bindings> <wsHttpBinding> <binding name="TradeWsHttpBinding"> <security mode="Transport"> <transport clientCredentialType="None" proxyCredentialType ="None"/> </security> </binding> </wsHttpBinding> </bindings> the security configuration at both the client and the server are the same , and i dont need certificate for the server in that kind of security (transport) so why do i get this exception ???? thanks...

    Read the article

  • NetLogo 4.1 - implementation of a motorway ( Problem creating collision of cars )

    - by user206019
    Hi there, I am trying to create a simulation of motorway and the behaviour of the drivers in NetLogo. I have some questions that I m struggling to solve. Here is my code: globals [ selected-car ;; the currently selected car average-speed ;; average speed of all the cars look-ahead ] turtles-own [ speed ;; the current speed of the car speed-limit ;; the maximum speed of the car (different for all cars) lane ;; the current lane of the car target-lane ;; the desired lane of the car change? ;; true if the car wants to change lanes patience ;; the driver's current patience max-patience ;; the driver's maximum patience ] to setup ca import-drawing "my_road3.png" set-default-shape turtles "car" crt number_of_cars [ setup-cars ] end to setup-cars set color blue set size .9 set lane (random 3) set target-lane (lane + 1) setxy round random-xcor (lane + 1) set heading 90 set speed 0.1 + random 9.9 set speed-limit (((random 11) / 10) + 1) set change? false set max-patience ((random 50) + 10) set patience (max-patience - (random 10)) ;; make sure no two cars are on the same patch loop [ ifelse any? other turtles-here [ fd 1 ] [ stop ] ;if count turtles-here > 1 ; fd 0.1 ;if ; ;ifelse (any? turtles-on neighbors) or (count turtles-here > 1) ;[ ; ifelse (count turtles-here = 1) ; [ if any? turtles-on neighbors ; [ ; if distance min-one-of turtles-on neighbors [distance myself] > 0.9 ; [stop] ; ] ; ] ; [ fd 0.1 ] ;] ;[ stop ] ] end to go drive end to drive ;; first determine average speed of the cars set average-speed ((sum [speed] of turtles) / number_of_cars) ;set-current-plot "Car Speeds" ;set-current-plot-pen "average" ;plot average-speed ;set-current-plot-pen "max" ;plot (max [speed] of turtles) ;set-current-plot-pen "min" ;plot (abs (min [speed] of turtles) ) ;set-current-plot-pen "selected-car" ;plot ([speed] of selected-car) ask turtles [ ifelse (any? turtles-at 1 0) [ set speed ([speed] of (one-of (turtles-at 1 0))) decelerate ] [ ifelse (look-ahead = 2) [ ifelse (any? turtles-at 2 0) [ set speed ([speed] of (one-of turtles-at 2 0)) decelerate ] [ accelerate if count turtles-at 0 1 = 0 and ycor < 2.5 [lt 90 fd 1 rt 90] ] ] [accelerate if count turtles-at 0 1 = 0 and ycor < 2.5 [lt 90 fd 1 rt 90] ] ] if (speed < 0.01) [ set speed 0.01 ] if (speed > speed-limit) [ set speed speed-limit ] ifelse (change? = false) [ signal ] [ change-lanes ] ;; Control for making sure no one crashes. ifelse (any? turtles-at 1 0) and (xcor != min-pxcor - .5) [ set speed [speed] of (one-of turtles-at 1 0) ] [ ifelse ((any? turtles-at 2 0) and (speed > 1.0)) [ set speed ([speed] of (one-of turtles-at 2 0)) fd 1 ] [jump speed] ] ] tick end ;; increase speed of cars to accelerate ;; turtle procedure set speed (speed + (speed-up / 1000)) end ;; reduce speed of cars to decelerate ;; turtle procedure set speed (speed - (slow-down / 1000)) end to signal ifelse (any? turtles-at 1 0) [ if ([speed] of (one-of (turtles-at 1 0))) < (speed) [ set change? true ] ] [ set change? false ] end ;; undergoes search algorithms to change-lanes ;; turtle procedure show ycor ifelse (patience <= 0) [ ifelse (max-patience <= 1) [ set max-patience (random 10) + 1 ] [ set max-patience (max-patience - (random 5)) ] set patience max-patience ifelse (target-lane = 0) [ set target-lane 1 set lane 0 ] [ set target-lane 0 set lane 1 ] ] [ set patience (patience - 1) ] ifelse (target-lane = lane) [ ifelse (target-lane = 0) [ set target-lane 1 set change? false ] [ set target-lane 0 set change? false ] ] [ ifelse (target-lane = 1) [ ifelse (pycor = 2) [ set lane 1 set change? false ] [ ifelse (not any? turtles-at 0 1) [ set ycor (ycor + 1) ] [ ifelse (not any? turtles-at 1 0) [ set xcor (xcor + 1) ] [ decelerate if (speed <= 0) [ set speed 0.1 ] ] ] ] ] [ ifelse (pycor = -2) [ set lane 0 set change? false ] [ ifelse (not any? turtles-at 0 -1) [ set ycor (ycor - 1) ] [ ifelse (not any? turtles-at 1 0) [ set xcor (xcor + 1) ] [ decelerate if (speed <= 0) [ set speed 0.1 ] ] ] ] ] ] end I know its a bit messy because I am using code from other models from the library. I want to know how to create the collision of the cars. I can't think of any idea. As you notice my agent has almost the same size as the patch (I set it to 0.9 so that you can distinguish the space between 2 cars when they are set next to each other and I round the coordinates so that they are set to the centre of the patch). In my accelerate procedure I set my agent to turn left, move 1, turn right in a loop. I want to know if there's a command that lets me make the agent jump from one lane to the other (to the patch next to it on its left) without making it turn and move. And last, if you notice the code i created the car checks the patch that is next to it on the lane on its left and the patch in front of it and the back of it. So if the 3 patches on its left are empty then it can change lane. The fuzzy part is that when i run the setup and I press Go sometimes (not always) the car goes out of the 3 basic lanes. To understand this I have 7 lanes. The middle one which I don't use which is lane 0. Then there are 3 lanes on top of lane 0 and 3 below it. So the code I am using refers to the upper 3 lanes where I set the cars but for some reason some of the cars change lane and go to lane -3 then -2 and so forth. If someone can give me a tip I would really appreciate it. Thank you in advance. Tip: if you want to try this code in netlogo keep in mind that on interface tab I have 2 buttons one setup and one go as well as 3 sliders with names: number_of_cars , speed-up , slow-down.

    Read the article

  • template engine implementation

    - by qwerty
    I am currently building this small template engine. It takes a string containing the template in parameter, and a dictionary of "tags,values" to fill in the template. In the engine, I have no idea of the tags that will be in the template and the ones that won't. I am currently iterating (foreach) on the dictionnary, parsing my string that I have put in a string builder, and replacing the tags in the template by their corresponding value. Is there a more efficient/convenient way of doing this? I know the main drawback here is that the stringbuilder is parsed everytime entirely for each tag, which is quite bad... (I am also checking, though not included in the sample, after the process that my template does not contain any tag anymore. They are all formated in the same way: @@tag@@) //Dictionary<string, string> tagsValueCorrespondence; //string template; StringBuilder outputBuilder = new StringBuilder(template); foreach (string tag in tagsValueCorrespondence.Keys) { outputBuilder.Replace(tag, tagsValueCorrespondence[tag]); } template = outputBuilder.ToString(); Responses: @Marc: string template = "Some @@foobar@@ text in a @@bar@@ template"; StringDictionary data = new StringDictionary(); data.Add("foo", "value1"); data.Add("bar", "value2"); data.Add("foo2bar", "value3"); Output: "Some text in a value2 template" instead of: "Some @@foobar@@ text in a value2 template"

    Read the article

  • Unit testing several implementation of the same trait/interface

    - by paradigmatic
    I program mostly in scala and java, using scalatest in scala and junit for unit testing. I would like to apply the very same tests to several implementations of the same interface/trait. The idea is to verify that the interface contract is enforced and to check Liskov substitution principle. For instance, when testing implementations of lists, tests could include: An instance should be empty, if and only if and only if it has zero size. After calling clear, the size sould be zero. Adding an element in the middle of a list, will increment by one the index of rhs elements. etc. What are the best practices ?

    Read the article

  • J: Self-reference in bubble sort tacit implementation

    - by Yasir Arsanukaev
    Hello people! Since I'm beginner in J I've decided to solve a simple task using this language, in particular implementing the bubblesort algorithm. I know it's not idiomatically to solve such kind of problem in functional languages, because it's naturally solved using array element transposition in imperative languages like C, rather than constructing modified list in declarative languages. However this is the code I've written: (((<./@(2&{.)), $:@((>./@(2&{.)),2&}.)) ^: (1<#)) ^: # Let's apply it to an array: (((<./@(2&{.)), $:@((>./@(2&{.)),2&}.)) ^: (1<#)) ^: # 5 3 8 7 2 2 3 5 7 8 The thing that confuses me is $: referring to the statement within the outermost parentheses. Help says that: $: denotes the longest verb that contains it. The other book (~ 300 KiB) says: 3+4 7 5*20 100 Symbols like + and * for plus and times in the above phrases are called verbs and represent functions. You may have more than one verb in a J phrase, in which case it is constructed like a sentence in simple English by reading from left to right, that is 4+6%2 means 4 added to whatever follows, namely 6 divided by 2. Let's rewrite my code snippet omitting outermost ()s: ((<./@(2&{.)), $:@((>./@(2&{.)),2&}.)) ^: (1<#) ^: # 5 3 8 7 2 2 3 5 7 8 Reuslts are the same. I couldn't explain myself why this works, why only ((<./@(2&{.)), $:@((>./@(2&{.)),2&}.)) ^: (1<#) is treated as the longest verb for $: but not the whole expression ((<./@(2&{.)), $:@((>./@(2&{.)),2&}.)) ^: (1<#) ^: # and not just (<./@(2&{.)), $:@((>./@(2&{.)),2&}.), because if ((<./@(2&{.)), $:@((>./@(2&{.)),2&}.)) ^: (1<#) is a verb, it should also form another verb after conjunction with #, i. e. one might treat the whole sentence (first snippet) as a verb. Probably there's some limit for the verb length limited by one conjunction. Look at the following code (from here): factorial =: (* factorial@<:) ^: (1&<) factorial 4 24 factorial within expression refers to the whole function, i. e. (* factorial@<:) ^: (1&<). Following this example I've used a function name instead of $:: bubblesort =: (((<./@(2&{.)), bubblesort@((>./@(2&{.)),2&}.)) ^: (1<#)) ^: # bubblesort 5 3 8 7 2 2 3 5 7 8 I expected bubblesort to refer to the whole function, but it doesn't seem true for me since the result is correct. Also I'd like to see other implementations if you have ones, even slightly refactored. Thanks.

    Read the article

  • Problem with stack based implementation of function 0x42 of int 0x13

    - by IceCoder
    I'm trying a new approach to int 0x13 (just to learn more about the way the system works): using stack to create a DAP.. Assuming that DL contains the disk number, AX contains the address of the bootable entry in PT, DS is updated to the right segment and the stack is correctly set, this is the code: push DWORD 0x00000000 add ax, 0x0008 mov si, ax push DWORD [ds:(si)] push DWORD 0x00007c00 push WORD 0x0001 push WORD 0x0010 push ss pop ds mov si, sp mov sp, bp mov ah, 0x42 int 0x13 As you can see: I push the dap structure onto the stack, update DS:SI in order to point to it, DL is already set, then set AX to 0x42 and call int 0x13 the result is error 0x01 in AH and obviously CF set. No sectors are transferred. I checked the stack trace endlessly and it is ok, the partition table is ok too.. I cannot figure out what I'm missing... This is the stack trace portion of the disk address packet: 0x000079ea: 10 00 adc %al,(%bx,%si) 0x000079ec: 01 00 add %ax,(%bx,%si) 0x000079ee: 00 7c 00 add %bh,0x0(%si) 0x000079f1: 00 00 add %al,(%bx,%si) 0x000079f3: 08 00 or %al,(%bx,%si) 0x000079f5: 00 00 add %al,(%bx,%si) 0x000079f7: 00 00 add %al,(%bx,%si) 0x000079f9: 00 a0 07 be add %ah,-0x41f9(%bx,%si) I'm using qemu latest version and trying to read from hard drive (0x80), have also tried with a 4bytes alignment for the structure with the same result (CF 1 AH 0x01), the extensions are present.

    Read the article

  • Biometric implementation in Java application and Image Comparision

    - by harigm
    How do I compare the 2 images in Java based web application. I have installed the Biometric thumb reader, I need to read the user Thumb and compare it with his thumb image which is captured during the registration process. Initially I am storing the image in the Mysql as Blob. Else I can store that image in a separate folder as well Please suggest which is best way to do 1)Shall i Use the Java script 2)Is there any built in Java API to perform this

    Read the article

  • Enumerator Implementation: Use struct or class?

    - by Hosam Aly
    I noticed that List<T> defines its enumerator as a struct, while ArrayList defines its enumerator as a class. What's the difference? If I am to write an enumerator for my class, which one would be preferable? EDIT: My requirements cannot be fulfilled using yield, so I'm implementing an enumerator of my own. That said, I wonder whether it would be better to follow the lines of List<T> and implement it as a struct.

    Read the article

  • e-shop implementation: Status for Orders?

    - by Guillermo
    Hello Again my fellow programmers out there, I'm designing and programming from scratch a online shop. It has a Module to manage "Orders" that are recieved via the frontend. I'm needing to have a status to know whats happening with an order in s certain moment, let's say the statuses are: Pending Payment Confirmed - Awaiting shipment Shipped Cancelled My question is a simple one, but is very important to decide on the store design, and is: What would you do so store this status: Would you create a column for it in the Orders table or would you just "calculate" the status of each order depending if payments has been recieved or shipments has been made for every order? (except I suppose for a is_cancelled column) What would be the best approach to model this kind of problem? PD: I even wish in the future to have these statuses configurable buy other clientes using the same software..

    Read the article

  • Credit card system implementation?

    - by Mark
    My site is going to have a credit system that basically works a lot like a credit card. Each user has an unlimited credit limit, but at the end of each week, they have to pay it off. For example, a user might make several purchases between March 1st and 7th, and then at the end of March 7th, they would be emailed an invoice that lists all their purchases during the week and a total that is due by the 14th. If they don't pay it off, their account is simply deactivated until they do. I'm just trying to wrap my head around how to implement this. I have a list of all their purchases, that's not a problem, but I'm just trying to figure out what to do with it. On the end of the 7th day, I could set up a cronjob to generate an invoice, which would basically have an id, and due date, and then I would need another many-to-many table to link all the purchases to the invoice. Then when a user adds money to their account, I guess it's applied against their current outstanding invoice? And what if they don't pay off their invoice by the time a new invoice rolls around, so now they have 2 outstanding ones, how do I know which to apply it against? Or do I make the cronjob check for any previous outstanding invoices, cancel them, and add a new item to the new invoice as "balance forward (+interest)"? How would you apply the money against an invoice? Would each payment have to be linked to an invoice, or could I just deposit it to their account credit, and then somehow figure out whats been paid and what hasn't? What if they pay in advance, before their invoice has been generated? Do I deduct it from their credit from the invoice upon generation, or at the end of the week when its due? There are so many ways to do this... Can anyone describe what approach they would take?

    Read the article

  • How to test a DAO with JPA implementation ?

    - by smallufo
    Hi I came from the Spring camp , I don't want to use Spring , and am migrating to JavaEE6 , But I have problem testing DAO + JPA , here is my simplified sample : public interface PersonDao { public Person get(long id); } This is a very basic DAO , because I came from Spring , I believe DAO still have it value , so I decided to add a DAO layer . public class PersonDaoImpl implements PersonDao , Serializable { @PersistenceContext(unitName = "test", type = PersistenceContextType.EXTENDED) EntityManager entityManager ; public PersonDaoImpl() { } @Override public Person get(long id) { return entityManager .find(Person.class , id); } } This is a JPA-implemented DAO , I hope the EE container or the test container able to inject the EntityManager. public class PersonDaoImplTest extends TestCase { @Inject protected PersonDao personDao; @Override protected void setUp() throws Exception { //personDao = new PersonDaoImpl(); } public void testGet() { System.out.println("personDao = " + personDao); // NULL ! Person p = personDao.get(1L); System.out.println("p = " + p); } } This is my test file . OK , here comes the problem : Because JUnit doesn't understand @javax.inject.Inject , the PersonDao will not be able to injected , the test will fail. How do I find a test framework that able to inject the EntityManager to the PersonDaoImpl , and @Inject the PersonDaoImpl to the PersonDao of TestCase ? I tried unitils.org , but cannot find a sample like this , it just directly inject the EntityManagerFactory to the TestCast , not what I want ...

    Read the article

  • WPF/SL EventAggregator implementation with durable subscribers behavior?

    - by sha1dy
    Hi. Currently I'm building an application using latest Prism for Silverlight 4. I've a module and in that module I've two views with view models. Also I've a module view with two regions for each view. In module initialization I'm registering my views and view models in Unity container and also register views with corresponding regions. The problem is that views should display something similar to table-detail information - first view shows available entities ans the second view shows detail of selected entity. I need a way how to pass them initial selected entity. Newly created first view doesn't have any selected entity and newly created second view doesn't show any details. Currently I'm doing that this way: In module I create two view models and register them as instances in Unity container and then I register views as types for corresponding regions. Each view subscribes to EntitySelectedEvent from EventAggregator. Module initializer publish this event after initialization and this way two views are selecting the same entity. I know this looks ugly - I tried publishing this event from one of view models but the problems is that EventAggregator in Prism doesn't support durable subscribers - this means that if the second view model didn't subscribe to event before the first view model fired it, it won't receive and event. I know this is a normal behavior of EventAggregator, but I'm looking for a solution when view models can fire events without depending on initialization order of them - that is the first model can fire event before the second model was created and the second model will receive this 'queued' event after subscribing to it. Are there any other messaging implementations for WPF/SL which do support such behavior or using a mediator (in my example it's a module itself) isn't such a bad idea after all? One big problem with mediator is that models must be created right away in initialize and they can't be registered as types in container because this leads again to missing subscribers.

    Read the article

  • C#: IComparable implementation private

    - by Anonymous Coward
    Hello I'm new to C# so this might be a really dump question: I implemented IComparable in my class and want to test it with NUnit. But the CompareTo-Method is marked as private and thus not accessible from the test. What's the reason for this and how can I fix this? The IComparable: public class PersonHistoryItem : DateEntity,IComparable { ... int IComparable.CompareTo(object obj) { PersonHistoryItem phi = (PersonHistoryItem)obj; return this.StartDate.CompareTo(phi.StartDate); } } The test: [TestMethod] public void TestPersonHistoryItem() { DateTime startDate = new DateTime(2001, 2, 2); DateTime endDate = new DateTime(2010, 2, 2); PersonHistoryItem phi1 = new PersonHistoryItem(startDate,endDate); PersonHistoryItem phi2 = new PersonHistoryItem(startDate, endDate); Assert.IsTrue(phi1.CompareTo(phi2)==0); }

    Read the article

  • Asp.net Security: IIdentity.IsAuthenticated default implementation.

    - by Pickels
    Hello Stackoverflowers, I am writing my own custom Identity class which implements IIdentity. I don't need to change the default method IsAuthenticated but so now I was wondering how does the default IIdentity determines if it should return true or false? I thought to find the answer in the FormsAuthenticationTicket I am using but not sure if that is correct. Thanks in advance, Pickels

    Read the article

  • An implementation of Sharir's or Aurenhammer's deterministic algorithm for calculating the intersect

    - by RGrey
    The problem of finding the intersection/union of 'N' discs/circles on a flat plane was first proposed by M. I. Shamos in his 1978 thesis: Shamos, M. I. “Computational Geometry” Ph.D. thesis, Yale Univ., New Haven, CT 1978. Since then, in 1985, Micha Sharir presented an O(n log2n) time and O(n) space deterministic algorithm for the disc intersection/union problem (based on modified Voronoi diagrams): Sharir, M. Intersection and closest-pair problems for a set of planar discs. SIAM .J Comput. 14 (1985), pp. 448-468. In 1988, Franz Aurenhammer presented a more efficient O(n log n) time and O(n) space algorithm for circle intersection/union using power diagrams (generalizations of Voronoi diagrams): Aurenhammer, F. Improved algorithms for discs and balls using power diagrams. Journal of Algorithms 9 (1985), pp. 151-161. Earlier in 1983, Paul G. Spirakis also presented an O(n^2) time deterministic algorithm, and an O(n) probabilistic algorithm: Spirakis, P.G. Very Fast Algorithms for the Area of the Union of Many Circles. Rep. 98, Dept. Comput. Sci., Courant Institute, New York University, 1983. I've been searching for any implementations of the algorithms above, focusing on computational geometry packages, and I haven't found anything yet. As neither appear trivial to put into practice, it would be really neat if someone could point me in the right direction!

    Read the article

< Previous Page | 17 18 19 20 21 22 23 24 25 26 27 28  | Next Page >