Search Results

Search found 5157 results on 207 pages for 'logic gates'.

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

  • MVC helper functions business logic

    - by Menelaos Vergis
    I am creating some helper functions (mvc.net) for creating common controls that I need in almost every project such as alert boxes, dialogs etc. If these do not contain any business logic and it's just client side code (html, js) then it's ok. My problem arises when I need some business logic behind this helper. I want to create a 'rate my (web) application' control that will be visible every 3 days and the user may hide it for now, navigate to rate link or hide it for ever. To do this I need some sort of database access and a code that acts as business logic. Normally I would use a controller for this, with my DI and everything, but I don't know where to put this code now. This should be placed in the helper function or in a controller that responds objects instead of ActionResults?

    Read the article

  • In a given Json, search for the particular given string based on key, return true if found, else false Using jQuery/Javascript

    - by NaanuManu
    Given JSON String/object {"selectAll":false,"include":{"country_197":{"id":"197","data_type":"country","name":"Singapore","desc":"","parent_key_id":"all_all","status":""},"country_100":{"id":"100","data_type":"country","name":"India","desc":"","parent_key_id":"all_all","status":""}},"exclude":{"state_2":{"id":"2","data_type":"state","name":"Andhra Pradesh","desc":"","parent_key_id":"country_100","status":""}}} Given search string is: country_100 Required : Have to search for country_100 in Given JSON String/object by key parent_key_id Ex: searching country_100 is found : {"selectAll":false,"include":{"country_197":{"id":"197","data_type":"country","name":"Singapore","desc":"","parent_key_id":"all_all","status":""},"country_100":{"id":"100","data_type":"country","name":"India","desc":"","parent_key_id":"all_all","status":""}},"exclude":{"state_2":{"id":"2","data_type":"state","name":"Andhra Pradesh","desc":"","parent_key_id":"**country_100**","status":""}}} So return True, else return false please help me in finding a solution.

    Read the article

  • Technique to Solve Hard Programming logic

    - by Paresh Mayani
    I have heard about many techniques which are used by developer/software manager to solve hard programming logic or to create flow of an application and this flow will be implemented by developers to create an actual application. Some of the technique which i know, are: Flowchart Screen-Layout Data Flow Diagram E-R Diagram Algorithm of every programs I'd like to know about two facts: (1) Are there any techniques other than this ? (2) Which one is the most suitable to solve hard programming logic and process of application creation?

    Read the article

  • Downmix surround to Dolby Pro-Logic at the OS/driver level in Windows 7?

    - by davr
    First off, I'm talking about Dolby Pro-Logic, a really old tech for encoding 4 audio channels (L/R/C/SR) into two analog outputs, and then extracting them again. It was used in surround sound systems in the last century. I have a modern PC that can output 5.1 analog audio (Three outputs on the back carry six channels of audio). But I have a really old surround sound reciever that only has a two-channel, L/R input, which it extracts 4 channels of audio from, and outputs to 5.1 speakers. What I want is some way for the OS, Windows 7, to act as if I really had 5.1 audio channels available, so applications produce surround audio, but before outputting it out of the back of my PC, apply Dolby Pro-Logic matrix encoding so that it outputs over only two channels. These two channels would then get sent to my receiver via a RCA cable, which would decode it again and drive the surround speakers. Is anything like this possible? I'm pretty sure I could do it at an application / codec level, but I'm looking for something that I just have to set once.

    Read the article

  • When does logic belong in the Business Object/Entity, and when does it belong in a Service?

    - by Casey
    In trying to understand Domain Driven Design I keep returning to a question that I can't seem to definitively answer. How do you determine what logic belongs to a Domain entity, and what logic belongs to a Domain Service? Example: We have an Order class for an online store. This class is an entity and an aggregate root (it contains OrderItems). Public Class Order:IOrder { Private List<IOrderItem> OrderItems Public Order(List<IOrderItem>) { OrderItems = List<IOrderItem> } Public Decimal CalculateTotalItemWeight() //This logic seems to belong in the entity. { Decimal TotalWeight = 0 foreach(IOrderItem OrderItem in OrderItems) { TotalWeight += OrderItem.Weight } return TotalWeight } } I think most people would agree that CalculateTotalItemWeight belongs on the entity. However, at some point we have to ship this order to the customer. To accomplish this we need to do two things: 1) Determine the postage rate necessary to ship this order. 2) Print a shipping label after determining the postage rate. Both of these actions will require dependencies that are outside the Order entity, such as an external webservice to retrieve postage rates. How should we accomplish these two things? I see a few options: 1) Code the logic directly in the domain entity, like CalculateTotalItemWeight. We then call: Order.GetPostageRate Order.PrintLabel 2) Put the logic in a service that accepts IOrder. We then call: PostageService.GetPostageRate(Order) PrintService.PrintLabel(Order) 3) Create a class for each action that operates on an Order, and pass an instance of that class to the Order through Constructor Injection (this is a variation of option 1 but allows reuse of the RateRetriever and LabelPrinter classes): Public Class Order:IOrder { Private List<IOrderItem> OrderItems Private RateRetriever _Retriever Private LabelPrinter _Printer Public Order(List<IOrderItem>, RateRetriever Retriever, LabelPrinter Printer) { OrderItems = List<IOrderItem> _Retriever = Retriever _Printer = Printer } Public Decimal GetPostageRate { _Retriever.GetPostageRate(this) } Public void PrintLabel { _Printer.PrintLabel(this) } } Which one of these methods do you choose for this logic, if any? What is the reasoning behind your choice? Most importantly, is there a set of guidelines that led you to your choice?

    Read the article

  • Term for unit testing that separates test logic from test result data

    - by mario
    So I'm not doing any unit testing. But I've had an idea to make it more appropriate for my field of use. Yet it's not clear if something like this exists, and if, how it would possibly be called. Ordinary unit tests combine the test logic and the expected outcome. In essence the testing framework only checks for booleans (did this match, did the expected result result). To generalize, the test code itself references the audited functions, and also explicites the result values like so: unit::assert( test_me() == 17 ) What I'm looking for is a separation of concerns. The test itself should only contain the tested logic. The outcome and result data should be handled by the unit testing or assertion framework. As example: unit::probe( test_me() ) Here the probe actually doubles as collector in the first run, and afterwards as verification method. The expected 17 is not mentioned in the test code, but stored or managed elsewhere. How is this scheme called? Or how would you call it? I hope I can find some actual implementations with the proper terminology. Obviously such a pattern is unfit for TDD. It's strictly for regression testing. Also obviously, it cannot be used for all cases. Only the simpler test subjects can be analyzed that way, for anything else the ordinary unit test setup and assertion steps are required. And yes, this could be manually accomplished by crafting a ResultWhateverObject, but that would still require hardwiring that to the test logic. Also keep in mind that I'm inquiring for use with scripting languages, and not about Java. I'm aware that the xUnit pattern originates there, and why it's hence as elaborate as it is. Btw, I've discovered one test execution framework which allows for shortening simple test notations to: test_me(); // 17 While thus the result data is no longer coded in (it's a comment), that's still not a complete separation and of course would work only for scalar results.

    Read the article

  • Moving all UI logic to Client Side?

    - by Mag20
    Our team originally consisted of mostly server side developers with minimum expertise in Javascript. In ASP.NET we used to write a lot of UI logic in code-behind or more recently through controllers in MVC. A little while ago 2 high level client side developers joined our team. They can do in HTMl/CSS/Javascript pretty much anything that we could previously do with server-side code and server-side web controls: Show/hide controls Do validation Control AJAX refreshing So I started to think that maybe it would be more efficient to just create a high level API around our business logic, kinda like Amazon Fulfillment API: http://docs.amazonwebservices.com/fws/latest/APIReference/, so that client side developers would fully take over the UI, while server side developers would only concentrate on business logic. So for ordering system you would have a high level API like: OrderService.asmx CreateOrderResponse CreateOrder(CreateOrderRequest) AddOrderItem AddPayment - SubmitPayment - GetOrderByID FindOrdersByCriteria ... There would be JSON/REST access to API, so it would be easy to consume from client-side UI. We could use this API for both internal UI development and also for 3-rd parties to create their own applications. With advances in Javascript and availability of good client side developers, is it a good time to get rid of code-behind/controllers and just concentrate on developing high level APIs (ala Amazon) that client side developers can consume?

    Read the article

  • RESTful applications logic and cross resource operations

    - by Gaz_Edge
    I have an RESTful api that allows my users to receive enquiries about their business e.g. 'I would like to book service x on date y. Is this available?'. The api saves this information as a resource to the following URI users/{userId}/enquiries/{enquiryId} The information shown when this resource is retrieved are the standard sort of things you'd expect from an enquiry - email, first_name, last_name, address, message The api also allows customers to be created for a user. The customer has a login and password and also a profile. The following URIs expose these two resources PUT users/{userId}/customers/{customerId} PUT users/{userId}/customers/{customerId}/profile The problem I am having is that I would like to have the ability to allow users to create a customer from an enquiry. For example, the user is able to offer their service on the date requested and will then want to setup a customer with login details etc to allow them to manage the rest of the process. The obvious answer would be to use a URI like users/{userId}/enquiries/{enquiryId}/convert-to-client The problem with this is is that it somewhat goes against a lot of what I've been reading about how to implement REST (specifically from the book Restful Web Services which suggests that URIs should point to resources not operations on resources). The other option would be to get the client application (i.e. the code that calls the api) to handle some of this application logic. This doesn't quite feel right to me. I have implemented in my design that the client app is fairly dumb. It knows just enough to display the results from the API, and does not contain any application logic. Would be great to hear what others views are on the best way of setting this up Am I wrong to have no application logic in the client app? How would I perform this operation purely in the REST api?

    Read the article

  • Help me with this logic (newbie) [migrated]

    - by Surendra
    I need to generate a half pyramid number series with the entered starting number and the number of lines in a html page using Javascript and show the result in html page . I have done the Java scripting and stuff . What I don't get is the logic to it. Take a look at this you may get an idea what I'm talking about: Here is my function in Javascript that will be triggered on a button click function doFunction(){ var enteredNumber=document.getElementById("start"); var lines=document.getElementById("lines"); var result; for(i=0;i<=lines.value;i++) { for(j=enteredNumber.value;j<=i;j++) { document.write(j + "&nbsp;" + "&nbsp;"); } document.write("<br />"); } } Help me with the logic to print following order: 1 1 2 1 2 3 1 2 3 4 1 2 3 4 5 There is a condition. I will specify $start and $lines. If $start = 5 and $lines = 3 then output should be like: 5 5 6 5 6 7 I have had used the for loop , but that doesn't work if I give my own start number that is higher than the number of lines. I actually need it done with Javascript, I have had done the necessary but I'm confused with the logic to generate such series (with the user given values) I had actually used two for loops to generate the regular number series like below 1 1 2 1 2 3 and so on.

    Read the article

  • Handling game logic events by behavior components

    - by chehob
    My question continues on topic discussed here I have tried implementing attribute/behavior design and here is a quick example demonstrating the issue. class HealthAttribute : public ActorAttribute { public: HealthAttribute( float val ) : mValue( val ) { } float Get( void ) const { return mValue; } void Set( float val ) { mValue = val; } private: float mValue; }; class HealthBehavior : public ActorBehavior { public: HealthBehavior( shared_ptr< HealthAttribute > health ) : pHealth( health ) { // Set OnDamage() to listen for game logic event "DamageEvent" } void OnDamage( IEventDataPtr pEventData ) { // Check DamageEvent target entity // ( compare my entity ID with event's target entity ID ) // If not my entity, do nothing // Else, modify health attribute with received DamageEvent data } protected: shared_ptr< HealthAttribute > pHealth; }; My question - is it possible to get rid of this annoying check for game logic events? In the current implementation when some entity must receive damage, game logic just fires off event that contains damage value and the entity id which should receive that damage. And all HealthBehaviors are subscribed to the DamageEvent type, which leads to any entity possesing HealthBehavior call OnDamage() even if he is not the addressee.

    Read the article

  • « Windows 8 est très excitant » pour Bill Gates, le fondateur de Microsoft heureux depuis qu'il utilise l'OS

    « Windows 8 est très excitant » pour Bill Gates le fondateur de Microsoft heureux depuis qu'il utilise l'OS Bill Gates, le fondateur de Microsoft pense que Windows 8 est « un produit excitant » et « une très grosse affaire pour Microsoft ». S'exprimant lors d'une interview de l'Associated Press sur la prochaine campagne de sa fondation pour éradiquer la polio, l'emblématique ex-PDG de Microsoft n'a pas raté l'occasion de donner ses impressions sur l'OS à un mois de sa sortie grand public. Bill Gates serait fasciné par la nouvelle expérience qu'apporte Windows 8, qu'il utilise déjà, et est satisfait de ce qu'offre l'OS : « je suis très heureux avec Windows...

    Read the article

  • Bill Gates fait la promotion des MacBook sur son blog, à quand Steve Jobs déclarant "Windows 7, c'était mon idée" ?

    Bill Gates fait la promotion des MacBook sur son blog, à quand Steve Jobs déclarant "Windows 7, c'était mon idée" ? Sur son blog "The Gates Notes", Bill Gates, figure emblématique de Microsoft, a publié une image bigrement inattendue. Dans un post où l'homme expose ses pensées à propos du système scolaire américain, et se lamente d'un trop peu d'élèves diplômés, il illustre sa réflexion avec la photo de deux étudiants... dont l'un est en train de travailler sur un Mac ! Et même un MacBook, selon les plus fins observateurs. Comme si ce n'était pas suffisant, une forme noire posée sur une pochette jaune, au dessus de l'ordinateur, à tout l'air d'être un iPhone. Beau joueur, le Bill ! ...

    Read the article

  • Les tablettes avec stylet ont-elles un avenir ? Bill Gates y croit

    Mise à jour du 05.05.2010 par Katleen Les tablettes avec stylet ont-elles un avenir ? Comme le défend Bill Gates Les tablettes, qu'on les aime ou non, sont le sujet dont tout le monde parle en ce moment. Aussi était-il naturel que, lors d'une interview télévisée, Bill Gates soit questionné à ce sujet. L'homme, toujours membre du conseil d'administration de Microsoft, a été mis face au succès immense remporté par l'iPad d'Apple qu'il estime être "un excellent travail", gadget auquel on a comparé Courier. L'annonce fracassante il y a quelques jours de l'annulation du projet avait fait grand bruit. Bill Gates est revenu sur ce fait, pour en nuancer l'impact négatif. Courier éta...

    Read the article

  • Humour : Créez vos dialogues entre Steve Jobs et Bill Gates, en rajoutant des bulles sur les images

    Humour : Créez vos dialogues entre Steve Jobs et Bill Gates, en rajoutant des bulles sur les images Un site américain à eu la bonne idée de lancer un concours plutôt original : fournissant trois photographies qui se suivent d'une récente entrevue entre Steve Jobs et Bill Gates, il propose aux internautes d'y insérer leurs propres bulles pour donner vie à leurs propres dialogues. Partant de là, tout est possible, on peut même modifier l'ordre des images pour créer le dialogue le plus loufoque possible entre ces deux géants du marché de l'informatique. Voici les trois images de base, vierges : [IMG]http://www.gizmodo.fr/wp-content/uploads/2010/05/jobs-vs-gates.jpg[/IMG] Voici maintenant l'...

    Read the article

  • Bill Gates exclut la possibilité d'un retour à la tête de Microsoft, les rumeurs sur son retour sont aussi tenaces que son engagement caritatif

    Bill Gates exclut la possibilité d'un retour à la tête de Microsoft Les rumeurs de son retour sont aussi tenaces que son engagement philanthropique Bill Gates a signé sa lettre de démission en 2008 après des décennies de travail acharné à la tête de Microsoft, une entreprise qu'il a menée au rang de leader mondial du logiciel. Il revient couper court aux rumeurs tenaces concernant son retour à l'empire qu'il a fondé et affirme n'avoir aucune intention de revenir à la société dans un rôle actif. Lors d'une conférence à Abu Dhabi, Bill Gates déclare : « Je passe environ 15 % de mon temps en tant que président de Microsoft et je leur donne de nombreux conseils. Ils vont de l'avant avec W...

    Read the article

  • What is the correct way to deal with similar but independent features?

    - by Koviko
    Let's say we have a feature request come in and we begin work on it, which we'll call feature-1. It introduces some new logic to the application, which we'll call logic-A and logic-B. A programmer branches from the release branch and begins work on the feature. Soon after, we get another feature request, which we'll call feature-2. It will implement logic-A and logic-C into the application. The logic A being implemented by this feature is the same logic-A as was implemented in feature-1. Let's also say that given logic-B, logic-A might be implemented slightly differently than it would have been given logic-C, and also differently given both logic-B and logic-C (eg. with only one feature, the code would be less flexible than with both). How should this situation be handled? Concrete Example (to help with any confusion in my wording) feature-1 is a feed from programmers.stackexchange.com. feature-2 is a feed from gaming.stackexchange.com. logic-A is the implementation of a feed at all (assuming the application currently has no feeds), which links to the content as well and gives related information. logic-B is that the feed's source is from programmers.stackexchange.com. Adds to logic-A that the related programming language is displayed. logic-C is that the feed's source is from gaming.stackexchange.com. Adds to logic-A that the related game's name and box art is displayed.

    Read the article

  • What is up with the Joy of Clojure 2nd edition?

    - by kurofune
    Manning just released the second edition of the beloved Joy of Clojure book, and while I share that love I get the feeling that many of the examples are already outdated. In particular, in the chapter on optimization the recommended type-hinting seems not to be allowed by the compiler. I don't know if this was allowable for older versions of Clojure. For example: (defn factorial-f [^long original-x] (loop [x original-x, acc 1] (if (>= 1 x) acc (recur (dec x) (*' x acc))))) returns: clojure.lang.Compiler$CompilerException: java.lang.UnsupportedOperationException: Can't type hint a primitive local, compiling:(null:3:1) Likewise, the chapter on core.logic seems be using an old API and I have to find workarounds for each example to accommodate the recent changes. For example, I had to turn this: (logic/defrel orbits orbital body) (logic/fact orbits :mercury :sun) (logic/fact orbits :venus :sun) (logic/fact orbits :earth :sun) (logic/fact orbits :mars :sun) (logic/fact orbits :jupiter :sun) (logic/fact orbits :saturn :sun) (logic/fact orbits :uranus :sun) (logic/fact orbits :neptune :sun) (logic/run* [q] (logic/fresh [orbital body] (orbits orbital body) (logic/== q orbital))) into this, leveraging the pldb lib: (pldb/db-rel orbits orbital body) (def facts (pldb/db [orbits :mercury :sun] [orbits :venus :sun] [orbits :earth :sun] [orbits :mars :sun] [orbits :jupiter :sun] [orbits :saturn :sun] [orbits :uranus :sun] [orbits :neptune :sun])) (pldb/with-db facts (logic/run* [q] (logic/fresh [orbital body] (orbits orbital body) (logic/== q orbital)))) I am still pulling teeth to get the later examples to work. I am relatively new programming, myself, so I wonder if I am naively looking over something here, or are if these points I'm making legitimate concerns? I really want to get good at this stuff like type-hinting and core.logic, but wanna make sure I am studying up to date materials. Any illuminating facts to help clear up my confusion would be most welcome.

    Read the article

  • how to write good programming logic?

    - by user106616
    recently I got job as a java developer, and now I have assigned project too. I want to know what is a good logic? when I check in the code my team lead is saying that its a good code. But when it comes to my project manager he is saying that its a bad code. And he is changing my code, after his changes if I see his code its really very very good and even simple. can you please tell me how to develop the good program, good logic? what is the best way to structure a problem in terms of code?

    Read the article

  • Are There Realistic/Useful Solutions for Source Control for Ladder Logic Programs

    - by Steven A. Lowe
    Version control for ladder logic (LL) programs for programmable logic controllers (PLCs) seems to be virtually non-existent. It may be because LL is a visual language and tends to be stored in binary files, or it may be because source code control hasn't "caught on" in process control engineering circles - or perhaps my Google-Fu is weak tonight. Do you know of any realistic and useful solutions for version control for such systems? Definitions: realistic = changes to the programs are tracked by user and subject to reversion and merges useful = the system integrates with visual LL designers, is not limited to LL from a single PLC manufacturer, and does not cost a ridiculous amount of money? Note: I have heard of people using SVN or Mercurial et al to track the binary files, but I don't think the diff/merge capabilities would display readable differences.

    Read the article

  • Which game logic should run when doing prediction for PNP state updates

    - by spaceOwl
    We are writing a multiplayer game, where each game client (player) is responsible for sending state updates regarding its "owned" objects to other players. Each message that arrives to other (remote) clients is processed as such: Figure out when the message was sent. Create a diff between NOW and that time. Run game specific logic to bring the received state to "current" time. I am wondering which sort of logic should execute as part of step #3 ? Our game is composed of a physical update (position, speed, acceleration, etc) and many other components that can update an object's state and occur regularly (locally). There's a trade off here - Getting the new state quickly or remaining "faithful" to the true state representation and executing the whole thing to predict the "true" state when receiving state updates from remote clients. Which one is recommended to be used? and why?

    Read the article

  • Splitting Logic, Data, Layout and "Hacks"

    - by fjdumont
    Sure, we all heard of programming patterns such as MVVM, MVC and such. But that isn't really what I'm looking into as Layout, Data and Logic is already pretty much split up (XML-Layout markup, Database, insert your language of choice here). The platform I am developing for is hard to maintain over the updated versions and older OSes. The project significantly grew up over the last few months and dealing with different platform versions really is a pain. For example simply disabling an user interface control for all existing versions took me around 40 lines of code in the logic layer, wrangling around with invocation, delegation, singletons that provide UI handling and so on. Is there a clean way to keep track of those "hacks" by maybe excluding it into separate classes or even packages? Should I overwrite existing framework code in order to handle my requirements correctly? If so, does that concept have a name?

    Read the article

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