instruction
stringlengths
34
36.1k
I'm making an iPad app that will display a few choices and based on your choice will display a series of questions with each question triggering a different set of questions. I was wondering if there was a name for this or any open-source library that someone has made for this kind of app. If not, would it be best to h...
I'm not trained programmer, so be gentle with my ignorance. I'm trying to search changelog files for where an open source project dropped a feature I need. I was just wondering if there may be a good set of terms to describe this. Bugzilla has detailed bug reporting forms. Are design changes also logged using rigorous...
I realize the above question probably raises a few 'what??'s, but let me try to explain : I'm trying to wrap my head on a couple of related concepts, basically the Saga-pattern ( http://www.rgoarchitects.com/Files/SOAPatterns/Saga.pdf) in combination with Event-sourcing (A DDD-concept: http://en.wikipedia.org/wiki/Doma...
I'm implementing a machine learning structure to try and predict fraud on financial systems like banks, etc... This means that there is a lot of different data that can be used to train the model eg. card number, card holder name, amount, country, etc... I'm having trouble deciding which structure is the best for this ...
In my company, I'm the only developer, but we plan on expanding the team by hiring a second programmer. I know there are a lot of implications to that (especially around source control). I've Googled a lot, but haven't found a good tutorial/article on how to grow the team from one to many developers. Do you have any r...
Initially I started learning OOP and later started grasping concepts of Design Patterns. I wonder whether it is the Design Pattern which is the SuperSet of OOP or it is the OOP itself.
TL;DR Writing good, useful tests is hard, and has a high cost in C++. Can you experienced developers share your rationale on what and when to test? Long story I used to do test-driven development, my whole team in fact, but it didn't work well for us. We have many tests, but they never seem to cover the cases where we ...
we have some API which will be called either by client A, B, C or D Current code doSomething(String client){ if (client.equals("A")){ ... } else if (client.equals("B")){ ... } Proposed refactoring 1 separate into multiple methods and have each client call the dedicated method such as doSomethingForClientA() doSometh...
I am successfully able to scale all my old applications which were not using documented Design Patterns. Whatever pattern it is I don't know. To a large extent, I only felt a need to use simple OOP concepts. The Design Patterns concept is complex and hard to understand. When implemented, how to determine whether the i...
In many languages, the substring function works like this: substring(startIndex, endIndex) returns the substring from startIndex until endIndex-1 (if you view startIndex and endIndex as 0-based) / from startIndex+1 to endIndex (1-based) This is confusing. I understand that the two parameters can be interpreted as "star...
I know that default arguments are created at the function initialisation time and not every time the function is called. See the following code: def ook (item, lst=[]): lst.append(item) print 'ook', lst def eek (item, lst=None): if lst is None: lst = [] lst.append(item) print 'eek', lst max = 3 f...
I've been working with the XMLHttpRequest object in JavaScript recently, and I couldn't help but notice that the casing of this name makes no sense. Why is 'XML' all in caps while 'Http' is not? They're both acronyms! Surely it'd make more sense for the name to be one of the following: XmlHttpRequest (PascalCase, be...
I am currently writing a grammar for a programming language (PowerBuilder) and I am also collecting documentation about parsing and compilers creation. Now I would like to add in my grammar (that looks roughly like Visual Basic) the possibility to handle embedded SQL statements that are supported inline by the languag...
At first, hopefully following terms project and product won't be confused. Traditionally, we used to have a code base, which usually was a main project. For our products, we created one project for each product, and these projects surly depended on main project (code base). When product was released, we created relea...
I'm studying YAML as a replacement for XML, but I'm experiencing difficulties when dealing with elements containing free-flowing text with embedded elements. For instance, the following XML document: <text> This is an example text, spanning multiple lines, and it has embedded elements like <a p="value">thi...
I have seen this article: CSS3 Loading elements at HTML5 and CSS3 Tutorials pages. How did someone made this calculations? what angle, how much space, how much rotation to give? If I do it with hand, starting number one, I fear it takes too long as a process to complete. Is there some tool, or some trick that do this ...
I want to know what is considered better way of returning when I have if statement. Example 1: public bool MyFunction() { // Get some string for this example string myString = GetString(); if (myString == null) { return false; } else { myString = "Name " + myString; // Do somethi...
As I'm trying to get better at designing good software I'm wondering if there are out there good (as in well written) open source software with lot of code documentation that aims to explain details about why this or that design choice was made in the context of that specific problem set. I'm interested in OOP and I do...
When I started learning programming with the .NET framework, I started by using WinForms as a UI technology. It uses “classic” menus just like this office 2000: A few years later Office 2007 was released, the ribbon was born: And even some years later Office 2010 was released, which also added new features like the s...
I'm learning Clojure to see if it's something I can leverage at my current job, and more importantly, how I can convince my bosses that Clojure has a 'killer feature' over java that makes it worth the investment1. The feature that I'm guessing most clojure evangelists would tout is state management and concurrency. The...
From time to time I've encountered scenarios where several complex conditions need to be met prior to triggering an event. Furthermore, most listeners also run additional checks to determine the course of action. This got me thinking whether a better solution would be to think in terms of smaller events and let them tr...
In c++, the * operator can be overloaded, such as with an iterator, but the arrow (->) (.*) operator does not work with classes that overload the * operator. I imagine that the preprocessor could easily replace all instances of -> with (*left).right, and that would make iterators nicer to implement. is there a practica...
I am writing a utility that runs on RHEL5 command line. I need my command line options to be simple but powerful. I looked at the various UNIX utilities to get an idea of how simple command line utilities have to be. Do you guys suggest any documents/links that talk about command line etiquette? I am modelling my util...
Its very interesting for me which advantages gives "global root class" approach for framework. In simple words what reasons resulted the .NET framework was designed to have one root object class with general functionality suitable for all classes. Nowadays we are designing new framework for internal use (the framework...
I was going through this heavily discussed and highly voted question on SO and stumbled across one comment that got 5 upvotes. So I assume this was a great comment.But it got my head spinning at the same time. Can any one explain this comment? The comment says: You can't compare big-O values directly without thinking ...
I want to split poker pot to chips. Example: Pot = $17.500. I have the endless piles of chips. I have the following types of chips: ChipsTypes = [$1, $5, $10, $25, $100, $500, $1.000, $5.000, $10.000, and so on]. Index starts from 0. I want to get an array that says which chips I have to take to divide the pot and in w...
I am currently adding some functionality to a popular open source project. It written in C and in Every file GPL license text is embedded. The functionality I am adding is not supported by the project. So you can say its some sort of extending. My code gets compiled when the main project is compiled. My code is inside...
I'm designing a tiered .NET application, and I want to use the Code First approach. I'm new to this, so I'm struggling to envision how it ought to be designed. Would the following be a reasonable approach? What problems or limitations might I run into? Write DTO classes for my domain. These will be used for data t...
Is the ISC license suitable as a MIT or Simplified BSD license replacement? What are the pros and cons of ISC compared to MIT or BSD?
My company is exploring the move from Perforce to a DVCS and we currently use lots of Perforce proxies because the software development teams are spread over Germany, China, USA and Mexico and sometimes bandwidth from one place to another is not that great. Speaking with IT, we started looking for a way to keep things ...
I recently encountered a situation in our codebase where a different team created a 'god class' containing around 800 methods, split across 135 files as a partial class. I asked the other team about this. While my gut reaction was to nuke it from orbit, they insist that it's a good design, a common practice, and that ...
My service has a large ongoing number of user events, and we would like to do things like "count occurrence of event type T since date D." We are trying to make two basic decisions: What to store? Storing every event vs. only storing aggregates (Event log style) log every event and count them later, vs. (Time-series...
My team is currently locked into using a tool we dislike that takes the form of a Eclipse plugin and a .jar; the plugin gives us a button to quickly run a single file's code (via invoking the main .jar and passing to it the current file). We want to move to C#.net. Is there any way to get Visual Studio to replicate th...
In PHP you can have a function take an infinite number of arguments like /** * Do abc... * * @since 1.0 * @param mixed $arg1 Arg description * @return string Results */ function abc($arg1 = null){ $args = func_get_args(); // do smth with $args } How should I illustrate thi...
I am creating a software package that will be useful to programmers, engineers and scientists. List price will be in the region of $1,000 -- way beyond the budget of most open-source developers, hobbyists and enthusiasts. So I am considering two things, the first generous, the second maybe a little greedy: Offering ...
I'm a python programmer who sees a lot of C++ code but doesn't know the language and there seems to be two ways to initalize a class. I was hoping that someone can tell me the difference. class Point { int x, y; public: int get_x(); int get_y(); Point(int, int); } // ok we are goin...
Is it normal and still proper (in agile/SCRUM-based software development) for a product owner to be in charge of more than one product?
I'm basically trying to wrap my head around the concept of CQRS and related concepts. Although CQRS doesn't necessarily incorporate Messaging and Event Sourcing it seems to be a good combination (as can be seen with a lot of examples / blogposts combining these concepts ) Given a use-case for a state change for somethi...
Part of the FSF's instructions for placing a program under the GPL is including the following "copying permission statement" at the top of your file, under the copyright notice: This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the ...
This blogpost was posted on Hacker News with several upvotes. Coming from C++, most of these examples seem to go against what I've been taught. Such as example #2: Bad: def check_for_overheating(system_monitor) if system_monitor.temperature > 100 system_monitor.sound_alarms end end versus good: system_monitor....
currently, we have a closed source project on hand. However, we would like to have a communication channel together with our end users. We would like to have our end users to know, what features we are currently working on, and what features they are going to get in next release. We would like to know users' thought, ...
I'd like to find a way to write an API that can be accessed from any other programming language via language bindings (or some other framework). Is it possible to do this? If so, which programming language would be the most suitable for writing a "cross-language" API? My goal is to create a single set of functions that...
My team has been developing a web business application for more than a year. It started quite small, but now it is growing bigger and bigger. I think it's time for refactoring. Looking at the code, I see the below situation: IUserService addUser deleteUser updateUser addMember deleteMember updateMember registerMember ...
I am lucky in the sense that I have been given the opportunity to be a 'Technical Troubleshooter' for our offshore development team. While I am confident and capable of dealing with most issues, I have come across something that I am not. Based on initial discussions with various team members both on and offshore, a re...
I can't figure out what would be an appropriate data structure for my problem. I need to write a script that will count some events. Input is a list of events (thousands of them). Each event is an object with following attributes: class Event company city office department You can look at it like this: „Each e...
I often read/overhear that good commit messages should be written in present tense or to use imperative mood when describing the change eg. Fix xyz instead of Fixed xyz. What are the advantages of doing so? Are there differences between the various VCS (I mostly read these about git but that maybe because I mainly work...
I'm in the process of coding a game and almost done with the game mechanics to the point where it's pretty playable. I later discovered an open source version of the kind of game I'm making with the same mechanics, whereas I coded mine from scratch. However, in the interest of optimizing later on, I may want to adapt a...
I was doing my ER diagram for a rails application I'm about to begin with and there I have an entity called Class News so I'd have a model ClassNew but I don't know if I will have problems in the future with the New part or what would be the right way to do this o how should I call the model? since the right thing woul...
You can indicate that XXX is method name by writing XXX(). But in Objective-C, you can not write XXX() for XXX method. If you write XXX, you can't tell if XXX is method name or other type of identifier. How can you indicate that XXX is method name of Objective-C class? EDIT Method call of Objective-C is different from ...
I would have this asked on StackOverflow if it had code, but it's more on the idea/concept so I asked here. I am working on the UI of our inventory system when I found out that when registering a user in the system, the username and password of the user is optional. I asked our supervisor why is this so. He said that i...
Ok, I have used the word python in the question, but it well could be language agnostic in that: If a language X has a well optimised compiler targeting assembly and an OS is written in that language, then will it compete favorably with C in benchmarks? This comes from two conceptions I have (could be wrong): Langua...
If we have a large development team, say 100, and we would like to keep our encryption key hidden from developers who are not directly involved in the encryption module/algorithm, what are some best practices to keep this key as secret as possible while still allowing for development and debugging?
Consider a logging system - used absolutely everywhere in your codebase. (note - logging is just an example, don't take it too literally and point me at your favourite logging system). public interface ILogger { void LogMessage(string message); } // Just used for testing, do nothing public class NullLogger : ILogg...
I am tasked with building a piece of software that interfaces with a MySQL database, in order to allow the user to pick songs to play and que using a touch screen, and then they are shown simultaneously on a second monitor as videos. Questions: To allow both displays to work, would it be best to write two pieces of...
I'm working on some project where I have to make a database to store data which is currently kept in Excel files, so I have to do some changes before writing the data into the database. I'm going to read those files using Java and write them from Java into the database. Should I use Hibernate for that job? Or how else...
I'm trying to find a way to write an application with lock-free IPC on Linux, in C, with multi-core processors. Let's assume I have process 1 and process 2 that write to a FIFO or shared memory. Then process 3 and process 4 will read from that shared memory or FIFO. Is this possible with a lock-free algorithm? Your gui...
I've only worked at once place since graduating my CS degree. This is a pretty basic architecture question but i don't know any better since i've only worked at one place. Where i work we maintain a large number of code tables. For example say you have a Sales/Order system and you have an Order Status. We would maintai...
So this is the first time I am trying to work with an Open Source Project. I created a Code Plex Account browsed for a project that I thought I might become a part of. I sent a request to join the project.The project head accepted my request. I have already downloaded the source code of the project. Can some one just s...
I am exposing a few REST methods on a server for an mobile app. I would like to avoid that users can sniff how HTTP methods are built (from the mobile app) and then send them again to the server. Example : The mobile app send a request The user uses a proxy and can check what's going on on the network The user see...
Clojure does not perform tail call optimization on its own: when you have a tail recursive function and you want to have it optimized, you have to use the special form recur. Similarly, if you have two mutually recursive functions, you can optimize them only by using trampoline. The Scala compiler is able to perform TC...
I've been making small improvements to a public ASP.NET site that I have and have ran it through Google's online Page Speed several times. I have a specific problem, but something that really threw me off was that even if I didn't make any changes and just kept running it time after time (5 minutes intervals) I'd keep ...
The following is from the preface of Jon Resig's new book : Secrets of JavaScript Ninjas The portions of this book that cover features that are relatively un-changing, such as code evaluation, with statements, and timers are continually being used in interesting ways. There are now a number of active programming lang...
I'm making an indexOfReverse utility function in my C++ program, and I have caught a bit of a snag. Implementing the offset and maxOffset in my indexOf was very intuitive to me.. These start from the beginning of the string (+offset), and go forth to the end of the string (or maxOffset if given). While implementing off...
So In my app (iOS), you have to register in order to use the service (a food service). But in order to change details about your account (username, password, and email), you have to reenter your password. Except for if the user logged out, this is the only time you need your password to use the app. So I was wonderi...
Many a times I have to deal with code files which are quite long - about 5 screen pages at the minimum. Almost always there is something towards the top/bottom that I need to refer when I'm at the bottom/top (respectively). It's a mammoth overhead to constantly scroll back-n-forth between the file parts. It's a cognit...
When you download and install asp.net MVC, does it just add code to the .net framework class library? Or does it also modify the installed Visual Studio editions? Another question: If it is just adding code to the .net framework class library, why can it not be installed on top of .net 2.0?
I have lots of ideas for products to be built. The problem is that I have less than a year of professional work experience and I am afraid of getting judged negatively in the future based on what I produce now. I have no clue if my code is any good. I am not familiar with any of the coding patterns. All I know is to bu...
Is it better to use multiple html pages and link them together with href or just change content on the same page using JavaScript? I am thinking of how to layout a page and I don't have a lot of content. It would probably be about three of for pages if I just used all html. If I toggled and swapped bits of html around ...
I started learning arrays in C++ and came over a little side note in the book talking about 2D arrays in breif. I tested it out and i was amazed that it could give the programmer the ability to store data or information and lay it out infront of him in a spread sheet format. In a normal array to access elements i would...
I was asked this question in an interview. I'm somehow supposed to "read" a file into my C program as input without using a file pointer (including "f" functions, e.g. fgets, fscanf etc.). I'm also not allowed to redirect it using the terminal, i.e. no system or exec calls. The program will not get the file during runt...
On my way to learn Lisp I have discovered the all powerful and feared so called Macros, then after spending a hard time trying to understand them and their usefulness I said to myself, I FINALLY GOT IT. I couldn't be more wrong, I was thinking that the only purpose of Macros was to define new control structures and tha...
I've always used git before, but I want to contribute to python so now I have to learn mercurial and I find it very frustrating. So, I've made a couple of small patches and I wanted to track them as commits in my local mercurial repository. Apparently there are 4 ways to handle branching in mercurial. 1 and 4 looked co...
I am looking at some C/C++ code that appears to have functions that are defined, but never used. This is a pretty tedious process to trace through the code and verify. I've done some surveys and there are a number of tools that can do this type of analysis. Can anyone share any experiences or tips on which tools and te...
I'm working on an application which will run on multiple Amazon EC2 instances. I wish to incorporate auto update feature for my application. The updater should update all the Ec2 instances. Also, there is a central server which governs the creation/termination of EC2 instances as per load. The central server creates a ...
Well, I am reading Programing Windows with MFC, and I came across Unicode and ASCII code characters. I understood the point of using Unicode over ASCII, but what I do not get is how and why is it important to use 8bit/16bit/32bit character? What good does it do to the system? How does the processing of the operating s...
We already have a fully operational web service which caters requests from multiple paltform devices. Each device sends only one request at a time and immediately after a response for the request the device sends an applicative ACK, this ack message is like a regular request message, and it's all via http. During a pe...
My development on Android is based on scientific programs and while I'm building these most of the code is in one or two long classes. When I come to deploy these programs I try to decouple everything and use classes and objects like I would on a Java desktop application. However reading guide Designing for Performanc...
I am using Java. How does an event source like a (button in a GUI) knows which method to call in an interface? For example, I am listening to Mouse Events and have implemented a Mouse Listener interface in my class then how would the event source know whether it should call mousePressed(), mouseReleased() or some other...
I currently developing some M2M-transformations with the Atlas Transformation Language (ATL). During studying the language constructs and properties I have often read, that ATL is a prototype for QVT, but was not used for QVT. This leads me to the question, if ATL is a deprecated language. Personally, I claim that ATL ...
I mean everything, not just schema changes. Even a simple SELECT on a primary key can't go into production, even though it has been code-reviewed by other developers (in context), without a DBA review of every statement, extracted from the code and submitted with EXPLAIN output, details of how often it will be called, ...
Background I'm currently designing my own programming language as a research project. I have most of the grammar done and written down as context-free grammar, and it should be working as is. - Now I'm working on the actual compiler that should translate the language into x86 binary assembly code, more specifically, I ...
On a project I'm working on, I'm trying to find a noun to describe the different parts of the application dependent on user interface. There are three parts: super admin, admin and regular users. Each of these parts consist of modules, interfaces with users, interfaces with the other parts. I've tried "sub-system", "mo...
Important: we have no issues whatsoever with source code documentation. This belongs to regular code audit and is kept up to date. Our problem is with developers documentation (or, "external" if you like), little blog-like tips from programmers to programmers which tend to be once written, often left behind. We use wi...
I am thinking about introducing my 12 year old son to hardware programming. I built a robot with the .NET Micro Framework and while he was fascinated with controlling the robot, his eyes glazed over when I attempted to explain how the code worked. And to be fair, it's quite complex for a beginner, requiring knowledge...
I wrote a little app to manage an arbitrary series of tasks (e.g., call a SQL sproc and capture out-vars, run another app, run an SSIS package) with dependencies between tasks. Each task has a status (waiting to start, failed and waiting to retry, failed and abandoned, succeeded, etc.). Internally, each Task object h...
I have written various user stories that describe functionality at a pretty high-level. For example: As an analyst, I want to view the current share price, so that I have quick access to an up-to-date valuation of stock across the Euronext, London and New York stock exchanges. This requirement is based on existing fun...
One of the few things that most software developers agree on is that you shouldn't rely on code to work correctly unless you test it. If you don't test it, it may have hidden bugs that are only going to cause you more work down the road. I understand how to test my normal code, but how should I test my test cod...
I am new to BitBucket. I have my repository. And 2 people working on it me, Admin and another developer with Read only access. So in order for him to do changes he forked repository and made changes, uploaded to his repository and created pull request. Now I merged this pull request with my repository. And made few sma...
I work for a large company which has several non-RESTful APIs. I am tasked with building a web application to interact with these APIs. Each API handles and provides very different business processes and data. I'd like to build RESTful (a) interface(s) fronting the APIs so as to make them reusable by other future web a...
I have a friend who has a slightly greater amount of programming experience as me. We were talking about all the different programming technologies we use and Interface Builder came up in conversation. Being of no programming background except for what I've taught myself, I personally believe that IB and all it's featu...
I'd like to see some valid examples of needing to let a thread enter a locked, non-re entrant mutex, then destroying the mutex (which supposedly terminates the thread). I can't think of any good reason to do this. I can't remember precisely what we were arguing about earlier today, but my colleague insists such techniq...
Have a very large project more than 70k LOC. The project definitely needs some code refactoring in Core Framework and in other parts as well. There was NO time set in the beginning of the project for refactoring. However with time and more than 40 developers joint and left the project. From my perspective is indispensa...
I have my own ideas about how a pointer-sized mutex could be made: The integer is used as a set of flags, counter, index, and a spinlock that guards an entry in a table of pre-allocated kernel objects given to mutexes only when threads are contending, and released afterward (only need at most N table entries for N thre...
I've started reading the design pattern book by the GoF. Some patterns seem very similar with only minor conceptual differences. Do you think out of the many patterns some are unnecessary in a dynamic language like Python (e.g. because they are substituted by a dynamic feature)?
Over at this question in the comments I mentioned that I heard that partial classes are best avoided if possible. What if any is the reason for this sentiment? Or If this is an invalid sentiment, how are the perceived detriments overcome?
What are the best practices to store and maintain serialized objects in C#? Any strategies or patterns that apply? What I have come to believe so far is this: Prefer Json over XML, both for space and for speed, but xml is easier to query/mine data via LINQ to XML for bigger data sets. For every single property, map ex...
When using the command line/terminal svn client, a colleague is getting "svn: OPTIONS of " [repo] "...authorization failed" error message when they attempt to checkout the repo to be their local working copy. They used to be able to do this but have recently had to change their password (periodic routine security polic...
I'm working on, and adding to, a GitHub-hosted project that includes this LICENCE.md (apparently the MIT licence verbatim): Copyright (c) 2012 [Acme Corp] Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the So...
On a project that I am working on we encountered some performance problems. We decided to drop hibernate in favor of plain Jdbc to gain database performance. By converting our code to Jdbc we achieved the performance that we aimed for but the code quality seems to have deteriorated. And it took us three months to imple...
I’ve been working in an eXtreme programming team and doing pair programming for over 7 years in a windows environment. When we first started doing it someone would log in with their windows credentials and therefore all access to domain resources, and more specifically version control, would be accountable to that wind...