Search Results

Search found 16192 results on 648 pages for 'programming terms'.

Page 98/648 | < Previous Page | 94 95 96 97 98 99 100 101 102 103 104 105  | Next Page >

  • How do functional languages handle a mocking situation when using Interface based design?

    - by Programmin Tool
    Typically in C# I use dependency injection to help with mocking; public void UserService { public UserService(IUserQuery userQuery, IUserCommunicator userCommunicator, IUserValidator userValidator) { UserQuery = userQuery; UserValidator = userValidator; UserCommunicator = userCommunicator; } ... public UserResponseModel UpdateAUserName(int userId, string userName) { var result = UserValidator.ValidateUserName(userName) if(result.Success) { var user = UserQuery.GetUserById(userId); if(user == null) { throw new ArgumentException(); user.UserName = userName; UserCommunicator.UpdateUser(user); } } ... } ... } public class WhenGettingAUser { public void AndTheUserDoesNotExistThrowAnException() { var userQuery = Substitute.For<IUserQuery>(); userQuery.GetUserById(Arg.Any<int>).Returns(null); var userService = new UserService(userQuery); AssertionExtensions.ShouldThrow<ArgumentException>(() => userService.GetUserById(-121)); } } Now in something like F#: if I don't go down the hybrid path, how would I test workflow situations like above that normally would touch the persistence layer without using Interfaces/Mocks? I realize that every step above would be tested on its own and would be kept as atomic as possible. Problem is that at some point they all have to be called in line, and I'll want to make sure everything is called correctly.

    Read the article

  • Sites with overlapping code-bases. Developing multiple sites with little changes

    - by Web Developer
    I have to develop 3 different sites video.com for hosting video audio.com for hosting audio docs.com for hosting docs. domain names for example only Almost 80% of the functionality is the same for all the three, with remaining 20% being completely different features... How do I handle this? How does sites like SO handle this? I am developing this in YII framework and was thinking of having these different features as modules but in this case the menu/code links in html code can become difficult.

    Read the article

  • How do you keep track of the authors of code?

    - by garbagecollector
    This is something I was never taught. I have seen alot of different types of authoring styles. I code primarily in Java and Python. I was wondering if there was a standard authoring style or if everything is freestyle. Also if you answer would you mind attaching the style you use to author files that your create at home or at work. I usually just go @author garbagecollector @company garbage inc.

    Read the article

  • Asynchronously returning a hierarchal data using .NET TPL... what should my return object "look" like?

    - by makerofthings7
    I want to use the .NET TPL to asynchronously do a DIR /S and search each subdirectory on a hard drive, and want to search for a word in each file... what should my API look like? In this scenario I know that each sub directory will have 0..10000 files or 0...10000 directories. I know the tree is unbalanced and want to return data (in relation to its position in the hierarchy) as soon as it's available. I am interested in getting data as quickly as possible, but also want to update that result if "better" data is found (better means closer to the root of c:) I may also be interested in finding all matches in relation to its position in the hierarchy. (akin to a report) Question: How should I return data to my caller? My first guess is that I think I need a shared object that will maintain the current "status" of the traversal (started | notstarted | complete ) , and might base it on the System.Collections.Concurrent. Another idea that I'm considering is the consumer/producer pattern (which ConcurrentCollections can handle) however I'm not sure what the objects "look" like. Optional Logical Constraint: The API doesn't have to address this, but in my "real world" design, if a directory has files, then only one file will ever contain the word I'm looking for.  If someone were to literally do a DIR /S as described above then they would need to account for more than one matching file per subdirectory. More information : I'm using Azure Tables to store a hierarchy of data using these TPL extension methods. A "node" is a table. Not only does each node in the hierarchy have a relation to any number of nodes, but it's possible for each node to have a reciprocal link back to any other node. This may have issues with recursion but I'm addressing that with a shared object in my recursion loop. Note that each "node" also has the ability to store local data unique to that node. It is this information that I'm searching for. In other words, I'm searching for a specific fixed RowKey in a hierarchy of nodes. When I search for the fixed RowKey in the hierarchy I'm interested in getting the results FAST (first node found) but prefer data that is "closer" to the starting point of the hierarchy. Since many nodes may have the particular RowKey I'm interested in, sometimes I may want to get a report of ALL the nodes that contain this RowKey.

    Read the article

  • How to organize functional programs

    - by bleakcabal
    In OOP, your basic unit of organization for code is the class. A frequently used methodology in Java, C# and similar languages is to organize your code around having one file for each class with the file name following the class name. You can consider each of these class as a unit of organization to group a single concept. These classes are in in namespaces which often follow the directory structure of the files in the solution/project. Namespaces are another level of organization. How are large projects in functional languages typically organized? How to you determine how to split your functions into different files? Are other units of grouping beside files used? How is code typically organized within a single file?

    Read the article

  • I just received a complaint from a user of the website I maintain. Should I do anything?

    - by Chris
    I was sent sent a large wall of text from a user of the website I maintain at my job. They are clearly upset for having to deal with a horribly outdated web application that has not seen any serious updates in over 6+ years. No refactoring has been done, the code quality is terrible, the security unchecked, policy compliances ignored, in addition to being ugly and frankly embarrassing. Keep in mind this is a small business but the website is used by hundreds daily. I'm one of two programmers there, and I've been working there for two years. This person says they are about my age (22) and understand technology (but can't use proper grammar). The complaint mentioned awkward pages and actions on the website, but they don't even have a clue as to the depth of the flaws in this website. Now, I would love to honestly tell them that there's a lot wrong with this company and that this application was built when we were in high school. And that while it's not my fault that the website is terrible, I'm the one in position to fix it. But on the other hand, I could just say nothing and ignore it. Would doing this publicly have any advantage to future employees (showing integrity) or would it just be a completely pointless mistake? Odds are, even if I respond only that one person will ever read it. Regardless, I'm probably just going to ignore it and continue starting my project to refactor the website.

    Read the article

  • A Tale of Identifiers

    Identifiers aren't locators, and they aren't pointers or links either. They are a logical concept in a relational database, and, unlike the more traditional methods of accessing data, don't derive from the way that data gets stored. Identifiers uniquely identify members of the set, and it should be possible to validate and verify them. Celko somehow involves watches and taxi cabs to illustrate the point.

    Read the article

  • What are the Starting Games I need to make?[Best steps for a beginner Game Developer?] [closed]

    - by Man With Steel Nerves...
    Possible Duplicate: What are good games to “earn your wings” with? Hai, I'm new to the genre "Creating Games".Previously i had done only porting.I need some suggestion's for making a game. What are the basic game logics i need to start with? - Should i write Tic-Tac-Toe game? - Actually this seem very basic to me. I'm totally confused on where to start with.I like to create big games but after starting i feel the game is too heavy to handle. Can any one list out the basic needs of a Game Play programmer? I don't mind using any platform (Flash,c++,objective-c) but i need to know what are the game logic's i need to know before i start a big game.

    Read the article

  • Fewer SQL Developers needed?

    - by Mercfh
    According to Tiobe, http://www.tiobe.com/index.php/content/paperinfo/tpci/index.html (not exactly reliable but still) and just noticing around here. I see less talk about SQL in general? Has there been a slump in web development that uses databases like Mysql, or Data Warehousing here recently? Or have alternate solutions like NoSQL/CouchDB/MongoDB started to take over or what? or have I just been missing something?

    Read the article

  • What are invariants, how can they be used, and have you ever used it in your program?

    - by gablin
    I'm reading Coders at Work, and in it there's a lot of talk about invariants. As far as I've understood it, an invariant is a condition which holds both before and after an expression. They're, among other things, useful in proving that loop is correct, if I remember my Logic course correctly. Is my description correct, or have I missed something? Have you ever used them in your program? And if so, how did they benefit?

    Read the article

  • Can Anything be Done to Make Improv (a 1993 Win 3.1 App) handle larger Files?

    - by user75185
    My very favorite spradsheet is Improv, a 1993 Windows 3.1 application. It still puts Excel to shame for building spreadsheets and writing formulas. The only problem is because Improv was written when 1 Meg of RAM was state of the art, it becomes unstable when working with larger spreadsheets and often crashes and/or corrupts the data file. I am working on a project that greatly exceeds Improv's limits. Although it will ultimately require more robust databasing capability, I could save a lot of critical time if I could delay that headache and continue working in Improv for now. To that end, I moved to the only product I could find that comes close, Quantrix, which is nothing more than Improv updated to handle large spreadsheets and utilize today's technologies. The problems with Quantrix are its speed (significantly slower than Improv) and its $1000 price (which I cannot afford). I have already had 3 15 day extensions after the initial 30 day trial, so my time to use Quantrix as a bridge is at its end. Searches for Improv over the years have gotten me nowhere and, not surprisingly after reading some posts on this site, I got nothing for the money and time invested to find a programmer to write code to "fix" this problem. Improv is freely available as "abandonware" at http://vetusware.com/download/LotusImprov2.1/?id=5797 , and the best background info can be found on Wikipedia and at "Moose's Greatest Software Products of All Time - Lotus Improv" http://moosevalley.fhost.com.au/mooses_review_page_lotus_improv.html It is critically urgent for me to focus on analyzing the data asap. Working in a stable Improv would, without question, be the fastest route. To that end, I am looking for answers to the following questions and anything else that might be helpful: 1) Is it lawful to hire someone to fix Improv for my own use? If so, 2) About how much should it cost? 3) About how long should it take? 4) What skills should I be looking for &/or how should a post be worded? 5) Is there a niche site where it should it be posted? 6) What questions can I ask to quickly screen candidates? Since I am not a programmer, I need questions the answers to which leave no room to confuse me, whether intentional or not. For example, what tools or players should someone with an acceptable competency level have knowledge of?

    Read the article

  • returning null vs returning zero, which would be better?

    - by Dark Star1
    I inherited a project that I am managing and having to maintain pending the redevelopment of the code base. At the moment I am being tasked with adding little feature all over the place and have gotten into the habit of returning null instead of zero in parts of the code where I am working on. The problem is we have a client that is using this code and parts of code that require data from my implemented features recieve a null and dump the stack trace in UI. I would like to avoid this entirely from my input but without the nullPointer exceptions there's the potential that errors would be introduced into the client's data which may go un-noticed. Usually I would have come up with my own error notification system but I have never inherited a project before. so I am unsure whether to continue down this path. I still believe that the stack dump is preferable to un-noticed data corruption/inaccuracies.

    Read the article

  • What's the reason exceptions are heavily used in managed (C# and Java) languages but not in C++? [on hold]

    - by ZijingWu
    AFAIK, a lot of C++ projects don't allow exceptions and deny them in coding guidelines. I have a lot of reasons, for example, exception is hard to handle correctly if your binary needs to be compiled by separate and different compilers. But it doesn't fully convince me, there is a lot of projects which are just using one compiler. Compared to C++, exceptions are heavily used in C# and Java and the reason can only be that exception are not bringing enough benefit. One point is debugbility in practice. Exception can not get the call stack in C++ code, but in C# and Java you can get the call stack from exception, it is significant and makes debugging easier. No-callstack is not the fault of the exception, it is the language difference, but it impacts the exception usage. So what's the reason that exceptions are frowned upon in c++ programs?

    Read the article

  • How to deal with elimination of duplicate logic vs. cost of complexity increase?

    - by Gabriel
    I just wrote some code that is very representative of a recurring theme (in my coding world lately): repeated logic leads to an instinct to eliminate duplication which results in something that is more complex the tradeoff seems wrong to me (the examples of the negative side aren't worth posting - but this is probably the 20th console utility I've written in the past 12 months). I'm curious if I'm missing some techniques or if this is really just on of those "experience tells you when to do what" type of issues. Here's the code... I'm tempted to leave it as is, even though there will be about 20 of those if-blocks when I'm done. static void Main(string[] sargs) { try { var urls = new DirectTrackRestUrls(); var restCall = new DirectTrackRestCall(); var logger = new ConsoleLogger(); Args args = (Args)Enum.Parse(typeof(Args), string.Join(",", sargs)); if (args.HasFlag(Args.Campaigns)) { var getter = new ResourceGetter(logger, urls.ListAdvertisers, restCall); restCall.UriVariables.Add("access_id", 1); getter.GotResource += new ResourceGetter.GotResourceEventHandler(getter_GotResource); getter.GetResources(); SaveResources(); } if (args.HasFlag(Args.Advertisers)) { var getter = new ResourceGetter(logger, urls.ListAdvertisers, restCall); restCall.UriVariables.Add("access_id", 1); getter.GotResource += new ResourceGetter.GotResourceEventHandler(getter_GotResource); getter.GetResources(); SaveResources(); } if (args.HasFlag(Args.CampaignGroups)) { var getter = new ResourceGetter(logger, urls.ListCampaignGroups, restCall); getter.GotResource += new ResourceGetter.GotResourceEventHandler(getter_GotResource); getter.GetResources(); SaveResources(); } } catch (Exception e) { Console.WriteLine(e.InnerException); Console.WriteLine(e.StackTrace); }

    Read the article

  • How to write comments to explain the "why" behind the callback function when the function and parameter names are insufficient for that?

    - by snowmantw
    How should I approach writing comments for callback functions? I want to explain the "why" behind the function when the function and parameter names are insufficient to explain what's going on. I have always wonder why comments like this can be so ordinary in documents of libraries in dynamic languages: /** * cb: callback // where's the arguments & effects? */ func foo( cb ) Maybe the common attitude is "you can look into source code on your own after all" which pushes people into leaving minimalist comments like this. But it seems like there should be a better way to comment callback functions. I've tried to comment callbacks in Haskell way: /** * cb: Int -> Char */ func foo(cb) And to be fair, it's usually neat enough. But it gets into trouble when I need to pass some complex structure. The problem being partly due to the lack of type system: /** * cb: Int -> { err: String -> (), success: () -> Char } // too long... */ func foo(cb) Or I have tried this too: /** * cb: Int -> { err: String -> (), * success: () -> Char } // better ? */ func bar(cb) The problem is that you may put the structure in somewhere else, but you must give it a name to reference it. But then when you name a structure you're about to use immediately looks so redundant: // Somewhere else... // ResultCallback: { err: String -> (), success: () -> Char } /** * cb: Int -> ResultCallback // better ?? */ func foo(cb) And it bothers me if I follow the Java-doc like commenting style since it still seems incomplete. The comments don't tell you anything that you couldn't immediately see from looking at the function. /** * @param cb {Function} yeah, it's a function, but you told me nothing about it... * @param err {Function} where should I put this callback's argument ?? * Not to mention the err's own arguments... */ func foo(cb) These examples are JavaScript like with generic functions and parameter names, but I've encountered similar problems in other dynamic languages which allow complex callbacks.

    Read the article

  • Is the Entity Component System architecture object oriented by definition?

    - by tieTYT
    Is the Entity Component System architecture object oriented, by definition? It seems more procedural or functional to me. My opinion is that it doesn't prevent you from implementing it in an OO language, but it would not be idiomatic to do so in a staunchly OO way. It seems like ECS separates data (E & C) from behavior (S). As evidence: The idea is to have no game methods embedded in the entity. And: The component consists of a minimal set of data needed for a specific purpose Systems are single purpose functions that take a set of entities which have a specific component I think this is not object oriented because a big part of being object oriented is combining your data and behavior together. As evidence: In contrast, the object-oriented approach encourages the programmer to place data where it is not directly accessible by the rest of the program. Instead, the data is accessed by calling specially written functions, commonly called methods, which are bundled in with the data. ECS, on the other hand, seems to be all about separating your data from your behavior.

    Read the article

  • Why are effect-less functions executed?

    - by user828584
    All the languages I know of would execute something like: i = 0 while i < 100000000 i += 1 ..and you can see it take a noticeable amount of time to execute. Why though, do languages do this? The only effect this code will have is taking time. edit: I mean inside a function which is called function main(){ useless() } function useless(){ i = 0 while i < 100000000 i += 1 }

    Read the article

  • How do I make this ad execution?

    - by Maggie
    I am doing research on replicating an ad execution - http://www.digitalbuzzblog.com/gol-airlines-mobile-controlled-banner-game/ It's a simple "game" involving using the phone as a forward/back/left/right controller for a car in flash on the internet. I've started reading on P2P, but I'm finding such a vast amount of information and non specific to what I need that it's hard for me to sort through. Does anyone know any tutorials or can shed some light on how I might go about making a very simple mobile controller for a flash game?

    Read the article

  • Help with a formula for Google Adwords [closed]

    - by XaviEsteve
    Hi guys, This question is more about maths and algorythms in Google Adwords but guess it's the most appropriate community in SE to ask this. I am creating a spreadsheet to calculate Adword formulas and I am stuck in how to calculate the Monthly Net Income for each keyword. I have created a formula which calculates it but can't figure out how to limit the Monthly Budget. The formula I've created is this one: Monthly Net Income = ( DailyClicks x ConversionRate x SaleProfit) - ( CPC x DailyClicks ) There is an example of the formula in the file which is a Google Spreadsheet publicly available here: https://spreadsheets.google.com/ccc?key=0AnQMyM9XJ0EidDB6TUF0OTdaZ2dFb2ZGNmhQeE5lb0E&hl=en_GB#gid=2 (you can create your own copy going to File Make a copy...) I am releasing this set of tools as Public Domain so feel free to use it :) Any help is much appreciated!

    Read the article

  • Is there a language offering LISP-like macros with a more complex syntax?

    - by blubb
    LISP's macros are extremely powerful constructs, and the inability to introspect and modify the program itself beyond the method signature level has always struck me as a limitation. Yet I favour "complex" syntax because it tends to be closer to natural language. So far I have failed to find a language which combines a powerful macro mechanism such as LISP's with a naturally looking syntax (1). Is anyone aware of such a language? Footnote: I would consider python to have a naturally looking syntax as it allows constructs like this: if 0 < a < 5 and b in list. The avoidance of braces to structure blocks is irrelevant in this case, though.

    Read the article

  • How many textures can usually I bind at once?

    - by Avi
    I'm developing a game engine, and it's only going to work on modern (Shader model 4+) hardware. I figure that, by the time I'm done with it, that won't be such an unreasonable requirement. My question is: how many textures can I bind at once on a modern graphics card? 16 would be sufficient. Can I expect most modern graphics cards to support that amount? My GTX 460 appears to support 32, but I have no idea if that's representative of most modern video cards.

    Read the article

  • Should HTTP Verbs Be Used Semantically?

    - by Xophmeister
    If I'm making a web application which integrates with a server-side backend, would it be considered best practice to use HTTP methods semantically? That is, for example, if I'm fetching data (e.g., to populate a menu, etc.), I would use GET, but to update data (e.g., save a record), I would use POST. (I realise there are other methods that may be even more appropriate, but we need to consider browser support.) I can see the benefits of this in the sense that it's effectively a RESTful API, but at a slightly increased development cost. In my previous projects, I've POST'd everything: Is it worth switching to a RESTful mindset simply for the sake of best practice?

    Read the article

  • Torvalds' quote about good programmer

    - by beyeran
    Accidentally I've stumbled upon the following quote by Linus Torvalds: "Bad programmers worry about the code. Good programmers worry about data structures and their relationships." I've thought about it for the last few days and I'm still confused (which is probably not a good sign), hence I wanted to discuss the following: What interpretation of this possible/makes sense? What can be applied/learned from it?

    Read the article

  • reading k&r(c book) and confusing 1st chapter code [closed]

    - by DarkEnergy
    #include <stdio.h> /* copy input to output; 2nd version*/ main() { int c; while ((c = getchar()) != EOF) putchar(c); } this is very confusing... since you never escape the while loop. I've learned that EOF is -1. i type -1 but it just reprints it. It's a never ending loop. Over time did the library get changed and differs from what the book intended it to be? when i say library i mean the putchar()/getchar() that's in the library... sorry.

    Read the article

  • How do I daemonify my daemon?

    - by jonobacon
    As part of the Ubuntu Accomplishments system I have a daemon that runs as well as a client that connects to it. The daemon is written in Python (using Twisted) and provides a dbus service and a means of processing requests from the clients. Right now the daemon is just a program I run before I run the client and it sets up the dbus service and provides an API that can be used by the clients. I want to transform this into something that can be installed and run as a system service for the user's session (e.g. starting on boot) and providing a means to start and stop it etc. The problem is, I am not sure what I need to do to properly daemonify it so it can run as this service. I wanted to ask if others can provide some guidance. Some things I need to ask: How can I treat it as a service that is run for the current user service (not a system service right now)? How do I ensure I can start, stop, and restart this session service? When packaging this, how do I ensure that it installs it as a service for the user's session and is started on login etc? In responding, if you can point me to specific examples or solutions I need to implement, that would be helpful. :-) Thanks! Jono

    Read the article

< Previous Page | 94 95 96 97 98 99 100 101 102 103 104 105  | Next Page >