instruction
stringlengths
34
19.9k
I have developed and deployed few ASP.NET applications. Sometimes I want to stop the users from either inserting or updating a record when: Maintenance is going on. Stop operations due to payment delay. In one of my recent application I have implemented this feature to first check the database operations for locked s...
I'm developing an iOS app, which is a prototype for a customer. They're expecting it to not be of production standard and are happy for a few rough edges here and there. Since this is my first commercial venture into iOS / Objective C (I'm an android developer that is trying to cross-train into iOS), my primary focus h...
I am new to Microsoft's SQL Server Analysis Services Cubes and MDX queries. Where I work we have a daily sales table in SQL Server 2005 that already contains an aggregate of sale information per store per day. At this time it contains only 164,000+ rows. We have a sales cube dedicated to this table that about 15 repor...
I have a switch statement switch ( $id ) { case 'abc': return 'Animal'; case 'xyz': return 'Human'; //many more } I am returning class names,and use them to call some of their static functions using call_user_func(). Instead I can also create a object ...
When writing tests for one piece of software, say a library, do you prefer to compile all unit tests into one, or separate them into several executables? The reason I'm asking is because I am currently using CUnit to test a library I'm working on. The tests are split up into separate suites that are compiled into one e...
Background: I have just started at a new shop, where there is one other developer. This shop was not historically a software shop, and their software development process really shows it. They recently started using subversion (although most of the code is not in a repository), and they do not have a bug tracker. The...
I have different data modules, which take a couple of parameters from a configuration list. Do you think it's ok to pass a configuration object as a whole module1(config) and let the module pick what it needs, or should I rather pass the individual parameters module1(config.a, config.c, config.f)? The first case doesn'...
For several years now I am a big fan of using static code analysis tools for checking the source code quality. We are mostly doing C# development so NDepend was the best way to go for me. Most of the time I manually perform the analysis, for example once every two weeks. Lately I have had a discussion with a colleague...
I have a large (at least for me - approximately 10k lines) project that is written in C#. I have a treeview object on the left of my form and i have many nodes on my treeview. When i click a node, i bring up a panel on the right side of form. Since i only do GUI item operations (filling textboxes, clicking buttons, sho...
The Eclipse Public License is not entirely clear for me. As I understand it, anyone who redistributes a Library whose code is licensed under the EPL is considered to be a Contributor. It then states that you are not required to redistribute source-code but you must make mention of where to obtain it. Other websites h...
I understand that linking to a program licensed under the GPL requires that you release the source of your program under the GPL as well, while the LGPL does not require this. The terminology of the (L)GPL is very clear about this. #include "gpl_program.h" means you'd have to license GPL, because you're linking to GPL...
Is it feasible to expect 100% code coverage in heavy jquery/backbonejs web applications? Is it reasonable to fail a sprint due to 100% coverage not being met when actual code coverage hovers around 92%-95% in javascript/jquery?
UML has a jungle of Diagrams. Profile Diagrams, Class Diagrams, Package Diagrams... However, (IMH-and-not-too-experienced-O) I quite see that doing each and every diagram is overkill. Therefore, which UML Diagrams are more suitable in a web context, more expecificly a blog (we want to build it from scratchs). I under...
Possible Duplicate: Are there guidelines on how many parameters a function should accept? I have got class with 30 variables (it is an application form), so I wonder what is the best practice to organize class creation. Should I use huge constructor: MyClass mc = new MyClass(a, b, c, d) Or setters: MyClass mc = new...
I have used the android:onClick attribute extensively in my XML layouts for my Android application. Example: <Button android:id="@+id/exampleButton" android:onClick="onButtonClick" /> Is it proper to create an Interface to enforce the implementation of those onClick methods in Activities that use that layout f...
I'm working on a bug at work. The app is written in Objective-C for iOS based device, for the iPad. I'm the new guy there and I've been given a hard task. Sometimes, the UIButton text property does not show the correct state when syncing. Basically, when the app is syncing, my UI control would say "Syncing" and when it...
I was wondering about the risks involved with hosting on Microsoft CodePlex and Google Code. Let's say I host a project on one of them and it ends up taking off and getting tons of downloads. I was wondering if it is possible (or maybe has already happened) for either Microsoft or Google to rebrand the project and turn...
I found that sometimes the script don't run properly when I add script tag in the head section. But when I add script right before the ending tag of body it works fine. What is the difference between adding script in head tag OR on just before ending body tag OR right after the control? I found this issue very often wh...
I'm working on a Canvas object in HTML5, and I am attempting to make some photos look "better". I tried VintageJS, an existing photo-retouching Javascript library, and Picozu, a web application cloning some Adobe Photoshop functionalities, but I'm still not happy. Can you help me with an algorithm or point to an exist...
This is the algorithm (pseudocode) I have right now for finding all subsets for a given set with length k: void allSubsets(set[]) { for (i = 0; i<k; i++) { for (j = i + 1; j<k; j++) { print(set[i...j]); } } } But it's run-time is O(n^2). Can anybody improve this?
Suppose users of application A want to see the data updated by application B as frequently as possible. Unfortunately app A or app B cannot use message queues, and they cannot share a database. So app B writes a file, and a batch job periodically checks to see if the file is there, and if load loads it into app A. I...
I like the extnesibility point of MVC, allowing view models to implement IValidatableObject, and add custom validation. I try to keep my Controllers lean, having this code be the only validation logic: if (!ModelState.IsValid) return View(loginViewModel); For example a login view model implements IValidatableObjec...
I have the following situation: I have a class (let's call it Main) encapsulating a complex process. This class in turn orchestrates a sequence of subalgorithms (AlgoA, AlgoB), each one represented by an individual class. To configure Main, I have a configuration stored into a configuration object MainConfig. This obj...
What are some ideas or structure I can use when assigning EventID to events that will be saved to the Windows Event Log? Some options I've considered Sequential (0... int.Max) Multiple of 10, where the "0" is replaced with how noisy the debugLevel is set. xxx0 may represent exceptions, critical information, star...
I'm now learning Gerrit (which is the first code review tool I use). Gerrit requires a reviewed change to consist of a single commit. My feature branch has about 10 commits. The gerrit-prefered way is to squash those 10 commits into a single one. However this way if the commit will be merged into the target branch, the...
I have around 15 templates (this will grow) and each template will have around 10-15 questions. Each question can have answers in different format like text box, list box, dropdown, radio button etc. I need to show one template in a page, at a time based on the input I am getting. What would be the best design approach...
My team shares a "work" branch and a "stable" branch. Whenever a particular work branch is approved for further testing/release/etc, we merge it into stable. No code is ever checked directly into the stable branch. Because of this, merge conflicts simply won't happen, and it seems silly to pull down the work branch and...
I'm mainly interested in opinions on the trade-offs between having a single central server all the websites connect to as opposed to each website mirroring a subset of the master database with all the products in it. For example, will I run into severe performance issues (or even security issues, or restrictions) makin...
At my current position, QA has become a bottleneck. We have had the unfortunate occurence of features being held out of the current build so that QA could finish testing. This means features that are done being developed may not get tested for 2-3 weeks after the developer has already moved on. With dev moving faste...
Background: 3 of 9 Barcode Alphabet A simple syntax for 3 of 9 bar codes What is the formula behind the alphabet and digits in a 3 of 9 bar code? For example, ASCII has a relatively clear arrangement. Numbers start at 33, capitals at 65, lowercase at 97. From these starting points you can infer the ASCII code for any n...
What is Scheme's dotted pair construct analogous to in other Lisp implementations? I can make a vector or list quite easily, and understand those in Clojure, even though the syntax is a little different, like Clojure's vectors use square brackets []. However, seeing a dotted pair for the first time threw me. It almost...
Well I'm working on a personal project that needs to check if a user has met certain requirements, and they come in a form of Requirement: [c1 OR c2] AND [d1 OR d2] Requirement: [c1 AND c2] OR [d1 AND d2] Requirement: c1 AND any dn(n can be any integer) I'm just not sure how to store these sorts of requirements, I'm t...
With languages Python and Ruby still having a good foothold in the market what is Microsoft's current stance on dynamic languages? Does Microsoft have any plans to incorporate or invent it's own dynamic language?
This Scenario: User copies large files to a local folder. I want to watch that folder and when a new file is dropped then go and copy it to Database, so later when coping is done I can actually use it in my application. ( A C# WinForms App). It would be awesome to also find a way to somehow get notified in the Applicat...
In PHP I have classes as below class Animal { //some vars public function printname(){ echo $this->name; } } class AnimalMySql extends Animal { static public function getTableFields(){ return array(); } } class AnimalPostgreSql extends Animal { static public function getTabl...
I work as a iPhone app developer now, so I know a bit of c, c++ and objective c. Also have fiddled with Java and many other. All of them have been just high level application/games development. My final goal is to make a handheld game console. More like a home made NES/SNES handheld console or even an Atari. I have fou...
I am just messing around, trying to figure out how stuff works and right now I have a couple questions about HTML, JS and CSS engines. I know there are two major JavaScript engines out there - V8 and JavaScriptCore (WebKit's JS engine as far as I know). Is that correct? And what are the main HTML + CSS renderers out th...
Our shop's size increases dynamically, so we are planning to hire a few new junior developers but we would not like to overwhelm the seniors with too much mentoring and training. How many (usually fresh out of college) junior developers could (and should) a senior developer mentor while the senior is still being able t...
I am writing an application that works with satellite images, and my boss asked me to look at some of the commercial applications, and see how they behave. I found a strange behavior and then as I was looking, I found it in other standard applications as well. These programs first write to the temp folder, and then cop...
Let's say I have {3, 1, 1, 2, 2, 1, 5, 2, 7} set of numbers, I need to split the numbers such that sum of subset1 should be equal to sum of subset2 {3,2,7} {1,1,2,1,5,2}. First we should identify whether we can split number(one way might be dividable by 2 without any remainder) and if we can, we should write our algori...
Consider one feed like this: http://feeds.feedburner.com/codinghorror It has the entire content inside the description tag of the feed, so you don't need to access the website to read the post. Now I have the problem of creating an interface for a feed like this on a desktop client. What's the best way to render the te...
This will be the first project of this scale that I have attempted, and the first time I have run a website at all (much less dozens) using an off-site database. In particular, I'd like to know: what sort of optimizations I should read up on to make this run as smoothly as possible? any pitfalls/gotchas wiser, more ex...
What the difference given they all exist 'once per class'. When should I use one over another, i.e. for what purpose? I use Ruby.
Ok, I understand what CamelCase is. This question is relating to how to CamelCase the shortened version of Property List (PList). I am asking this because I am working on a PList parser in C# and knowing how everything in .NET is CamelCase, I am wondering, should it be PList or Plist (also why)?
I have a conceptual model for an object system which involves combining Go/Obj-C interfaces/protocols with being able to add virtual methods from any unit, not just the one which defines a class. The idea of this is to allow Ruby-ish open classes so you can take a minimalist approach to library development, and attach ...
I faced this problem on a website and I quite can't understand the output, please help me understand it :- Bogosort, is a dumb algorithm which shuffles the sequence randomly until it is sorted. But here we have tweaked it a little, so that if after the last shuffle several first elements end up in the right places we w...
I am wondering when to use mixins? I have read about them. Many authors compare them to interfaces, abstract classes, etc. Mixins are modules that are mixed-in and modules are a way to group similar methods, constants and classes together. I have seen examples where a module for math functions is created. It makes se...
A programming language is said to be Turing Completeness if it can successfully simulate a universal TM. Let's take functional programming language for example. In functional programming, function has highest priority over anything. You can pass functions around like any primitives or objects. This is called first clas...
Edit: Making this even clearer as the bounty is about to expire: is there a way of importing history (pulling from different SCM) directly into a specific branch with Mercurial? I'm currently working in a company using Perforce and am making way for distributed version control with Mercurial. I've had success importin...
For the last couple of years I've been building static frameworks of common APIs for my iOS projects. I can build a universal binary containing all the architectures (i386, armv6, armv7) and wrap it up in a .framework directory structure. I then stored this in a directory based on the version of the framework. For exam...
I was wondering if anyone knows what is the operating system used in commercial airplanes (say Boeing or Airbus). Also, what is the (preferred) real-time programing language? I heard that Ada is used in Boeing, so my question is - why Ada? what are the criteria the Boeing-guys had to choose this language? (I guess Java...
What would be the easiest way to use git correctly in a small team of about 5 developers, with one server running the live application?
I'm building a sqlite database for an android app which will hold a list of items, each of which have different characteristics. Some of the characteristics are available for all objects, some are only relevant for a subset of objects. For example, all my items have a name, a description, an image. Some items will al...
We have a central server that sends and recieves messages from a number of PCs that are located on client networks in various locations. To facilitate this, currently I'm using WCF with TCPNetBindings, using duplex communication secured with certificates. Now, we have a number of issues with this - mainly that we are b...
I have an application that I am writing for both iOS and Android; this application will be served by a ReSTFUL API running on a cluster of servers on "the internets". I am curious how the rest of the world is going about securing their APIs so only specific applications running on iOS or Android can use these APIs. I ...
http://www.cairographics.org/manual/cairo-Transformations.html I have been using Cairo Vector Graphics Library for some work, and I can't quite understand some parts: What is the default value of the transformation matrix? When do I need the transformation matrix anyway? Suppose I don't want to rotate text, will I stil...
I am building a video server application that has multiple projects in Visual Studio. One project, the video server project, needs to call a shell script to generate documentation. This works fine when you build the video server project, because the script is simply cd "$(SolutionDir)" start documentationgenerator How...
I have started using BDD for a WordPress plugin i'm working on and i'm rewriting the js codebase to do tests. I've encountered a few problems but i'm going steady now, i was wondering if i had the right approach, because i'm writing test that should pass in a normal browser environment and not inside WordPress. I choos...
My company has a very broad range of products and there are a few that are not strategic to us so I wanted to open source them (so we can focus on what makes us unique and open source the products that every firm has). Our industry(hedgefund) does not open source(we would be the first firm to try this) and the feedback...
I find I tend to need intermediate variables. In Clojure that's in the form of let bindings, like cmp-result-1 and cmp-result-2 in the following function. (defn str-cmp "Takes two strings and compares them. Returns the string if a match; and nil if not." [str-1 str-2 start-pos substr-len] (let [cmp-result-...
I am working on a project that has around a hundred different files (.cpp & .h), and it requires around an hour to build the entire project on MSVC 2008, suppose that I now make a change to any one file, do I need to build the entire project once again, right from the beginning, or is there a way out ? I know it is ver...
One of the advantages of older version control systems such as CVS and SVN in enterprise development is that anyone can connect to source control and see all the projects that the company has. This can make it easier to get a high level view of what kid of development is happening outside your sprint and also keeps eve...
We're considering hiring a contractor or intern to work with us on our iOS project but this causes me to get really paranoid that we're giving somebody who doesn't work for the company access to our precious codebase. I mean, I could just give them access to the classes I'd like them to work on but that seems rude and...
Hi I'm intrested in using the apparently now defunct app-mdi libray in a flex application for a paying customer. http://sourceforge.net/projects/appmdi/ It appears that the app-mdi project has been forked from flex-mdi and indeed the code has so much in common it would appear almost identical to the origional code. Now...
I've really fallen in love with unit testing and TDD - I am test infected. However, unit testing is normally used for public methods. Sometimes though I do have to test some assumptions-assertions in private methods too, because some of them are "dangerous" and refactoring can't help further. (I know, testing framewor...
I am designing a simple logic analyzer, I know that the best way to decode a protocol like I2C, SPI, UART is whit something like an FPGA but I want to do it by software by now :) I am running on an OMAP4460 ARM proccesor. I would like to know if there is an special way of decoding protocols like I2C, SPI, UART or it is...
These days many apps support asynchronous updates. For example, if you're looking at a list of widgets and you delete one of them then rather than wait for the roundtrip to the server, the app can hide the one you deleted, giving immediate feedback. The actual deletion on the server will happen in the background. This ...
Recently there has been a lot of praise for Node.js. I am not a developer that has had much exposure to network application. From my bare understanding of Nodes.js, its strength is: we have only one thread handling multiple connections, providing an event-based architecture. However, for example in Java, I can crea...
I am trying to figure out the right way to encapsulate graphical information about mathematical objects. It is not simple. For example, a matrix can include square brackets around its entries, or not. Some things carry down to sub-objects -- for example, a matrix might track the font size to be used by its entries. ...
I forgot to write return 'a'; in the show function and return 0; in main function but it works fine in Code::Blocks. #include <iostream> using namespace std; char show() { cout<<"this is show function"<<endl; } int main() { show(); } I am using Code::Blocks 10.05 in Ubuntu 12.04. Why does this code work fi...
It's undefined because the it modifies x twice between sequence points. The standard says it's undefined, therefore it's undefined. That much I know. But why? My understanding is that forbidding this allows compilers to optimize better. This could have made sense when C was invented, but now seems like a weak argument....
Any one ever heard of the term collapsed Backbone? Could it be a virtual network that could be referred also to this term.
I've been thinking a lot about language design and what elements would be necessary for an "ideal" programming language, and studying Google's Go has led me to question a lot of otherwise common knowledge. Specifically, Go seems to have all of the interesting benefits from object oriented programming without actually h...
I have an Array with 1,000,000 unsorted elements. I need to calculate expected number of operations that needs to be performed to sort array using Quicksort algorithm in common situations (not the n^2 worst case). I am not sure how (n log n) is calculated - does it even makes sense to calculate this? If (n log n) = (n...
Most of the projects that I work on consider development and unit testing in isolation which makes writing unit tests at a later instance a nightmare. My objective is to keep testing in mind during the high level and low level design phases itself. I want to know if there are any well defined design principles that pr...
Lets say i have an off the shelf eccomerce cart. I put all the code inside subversion. I start to make changes and check the code changes back in. is it possible to then display each "check in" with the developer messages so that i can make release notes? I would like to use this for actual quoted time.
I'm looking for some guidance on how to architect an app with regards to modularity, separation of concerns and re-usability. I'm working on an application (ASP.Net, C#) that has distinctly generic chunks of functionality, that I'd love to be able to lift out, all layers, into re-usable components. This means the modul...
Iteration has already started, new programmer joins the team, task X has already been estimated to be 30 hours by a different developer. What is the best practice in this situation? new developer runs with the given estimate (the idea being that any discrepancy will be corrected for when velocity is calculated?) new d...
How do I configure Ninject so it injects an instance in a view model? PS. It is an abstracted service to help with validation, so I am not trying to burden the model with too much responsibilities.
I have a list of users, with minions, something like this: User52: minion10 minion12 User32: minion13 minion11 I've been keeping in an array where the "location" is the id, like this: Users: [52]User minions: [10]minion [12]m...
We currently have an application framework in which we automatically cache both entities and collections of entities at the business layer (using .NET cache). So the method GetWidget(int id) checks the cache using a key Widget_Id_{0} before hitting the database, and the method GetWidgetsByStatusId(int statusId) checks ...
I have an application who has text fields (not select, not checkbox or other types) where an user can enter some value, like this: ISBN and E-Mail are the label of each input. Now I have to automatically test these inputs according to their label. The question is: how to recognize that, for example, the first input re...
I'm attempting to drive my user interface (heavy on javascript) through selenium. I've already tested the rest of my ajax interaction with selenium successfully. However, this one particular method seems to be eluding me because I can't seem to fake the correct click event. I could solve this problem by simply waiti...
I need to write an algorithm in java (for an android app) to read a folder containing more folders and each of those containing images and audio files so the structure is this: mainDir/subfolders/myFile1.jpg It must be in java, something like perl script is not an option. It would preferably be for the compressed arch...
In my experience, most teams in the company review the code of team member with a small amount of code, always less than hundreds of lines. Is it appropriate to review large amount of code, for example a module, when the code is complete and ready to get reviewed once for all?
I want to build a desktop application which has google maps embedded to it. This app should have a thread to read coordinate data online a usb microphone to use. This application will move the google map markers to their new locations based on the data retrieved from online connections on each refresh. As far as I know...
There is a project on Github that I mostly like and want to use. There are a few things I want to do differently/remove that doesn't make sense for what I want/need. Also I want to add a few things as well. As I understand it, I should fork the project and I can make whatever changes I want and push back to my fork. Fr...
I'm developing an application that has methods of this kind: attackIfIsFar(); protectIfIsNear(); helpAfterDeadOf(); helpBeforeAttackOf(); etc. The initialization of my application for n players is something like player1.attackIfIsFar(player2); player2.protectIfIsNear(player4); player3.helpAfterDeadOf(player1); player4...
Even languages where you have explicit pointer manipulation like C it's always passed by value (you can pass them by reference but that's not the default behavior). What is the benefit of this, why are so many languages passed by values and why are others passed by reference ? (I understand Haskell is passed by refere...
The Apache License, v2.0 [..] 2. Grant of Copyright License Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perf...
I read this Gawker article about how a writer reused some of his older material for new assignments for different magazines. Is there any similar ethical (societal?) dilemma when doing the same thing in the realm of Programming? Does reusing a shared library you've accumulated over the years amount to self-plagarizm?...
Lets say you have a code promotion hierarchy consisting of several environments, (the polar end) two of which are development (dev) and production (prod). Lets say you also have a web application where important (but not developer controlled) files are created (and perhaps altered) in the production environment. Lets...
I'm working on an application in which I'm looking to employ the MVC pattern, but I've come up against a design decision point I could use some help with. My application is going to deal with the design of state-machines. Currently the MVC model holds information about the machine's states, inputs, outputs, etc. The vi...
The reason for doing it is to solve the case when a newer API is no longer backwards compatible with an older API. To explain, just say that there is an old API v1.0. The maker of this API decides it is broken and works on a new API v1.1 that intentionally breaks compatibility with the old API v1.0. Now, any programs w...
So recently, we've just finished the first phase of our project. We used agile with fortnightly sprints. And whilst the application turned out well, we're now turning our eyes on some of the maintenance tasks. One maintenance task is that all of our documentation appears in the form of specs. These specs describe 1 or...
Are there any standards for preparing a user manual of electronic device? I am trying to prepare a manual for a device. However, I could not find any format. If I find, I will take this as guide for me. If there is no standard, what should be in the manual or what should not be in?
I am looking at a new position with a new company. I have talked to some people in the past (in general, not at this company) that they had been given a yearly budget to buy new computer stuff to keep up to date. Now why I feel this question is worth asking here is that Joel comes right out and says an employer should...
I am developing software for communication with external device through serial port. To better understand the new functionality I am trying to display it in sequence diagram. Flow of events is as follows. I send to the device command to reset it. This is asynchronous operation so there is some delay between request and...
I recently came across this question: "You are given a boolean expression consisting of a string of the symbols 'true', 'false', 'and', 'or', and 'xor'. Count the number of ways to parenthesize the expression such that it will evaluate to true. For example, there are two ways to parenthesize 'true and false xor true' s...
A project has recently come to my attention, but I have no idea where to start or even if it's possible. The idea revolves around programming a clock that is displayed in a digital photo frame. The user would then be able to put different pictures corresponding to different times inside a USB pen, for example, which wo...