instruction
stringlengths
34
19.9k
I am a single developer working on a large system. I was recently informed that there may be an opportunity to recruit another developer or maybe two. I have incorporated source control into my approach using Subverison and Tortoise SVN. I was talking to another developer who I used to work with recently and he remin...
I need to come up with a data structure to keep information about English verb forms. In most cases a verb can be in one of 4 forms: base, present participle, past participle and past simple, for example: take taking taken took It's seemingly easy to define 4 types for each form and be over with it. However there ar...
I'm working on a website that will allow users to log in using OAuth credentials from the likes of Twitter, Google, etc. To do this, I have to register with these various providers and get a super-secret API key that I have to protect with pledges against various body parts. If my key gets ganked, the part gets yanke...
I have a TriggerCaller and a TriggerAction class. The Caller "calls" the do() method on the action, which is set with the TriggerCallers setAction() method. The rest of the program should deal with the Trigger class, which contains the caller and the action. I have two options: 1) Give the Trigger class the methods set...
I study multicore pipelining and the diagrams are not UML sequence diagrams for instance Why not remake this diagram like an UML sequence diagram, would not that be more clear so that we can see both how time progresses as well as the data paths since I do not think it is clear distinction between data path and time?...
I have a HTTP class that has a Get, and Post, method. It's a simple class I created to encapsulate Post and Get requests so I don't have to repeat the get/post code throughout the application. In C#: class HTTP { private CookieContainer cookieJar; private String userAgent = "..."; public HTTP() { ...
I am looking at configuration management and the idea of form, fit and function change can determine whether a change is minor or major. I wondered how this definition could be applied when doing software development. Is there a good guideline on whether a change to software is classed as a major or a minor change?
I saw lots of questions and explanations regarding empty catch clauses but I was never actually sure what "empty" means. Is a catch clause like this empty? It clearly isn't empty for the eye because there is one line of code. But the catch is not really handled. Instead the error is just logged. try { // do some wo...
From the official documentation... Modifier Class Package Subclass World public Y Y Y Y protected Y Y Y N no modifier Y Y N N private Y N N N The thing is, I can't remember having a use case where I needed ...
The following IMHO valid java program doesn't compile because the Oracle 1.7 javac compiler thinks there's a possible loss of precision in lines 5 and 6. If you uncomment line 3 and comment out line 4, it compiles fine. Would someone explain why the compiler believes there is a loss of precision on the assignment to ei...
I have a huge project that is using YACC and I would need to fix a bug in it. I might ask someone else who wrote that to fix it but I'm interested in how compilers work. Does it make sense to learn YACC nowadays? It was told me that it's old and obsolete. I would love to understand how compilers/llvm and other stuff li...
PhpServer will handle gSoap requests and http requests from clients. PushServer will push notifications to clients and act a file server. There are many server machines. Every PhpServer will communicate with a specific PushServer when needed. Every PhpServer needs to register itself to a PushServer letting the PushSe...
A co-worker and I recently had a discussion about Java versions and the JVM. I use Java 7 but we use Java 6 for our client (while he says that some are still on 5). My immediate thought was, why can't we target those VMs too? The Java VM is somewhat different than a real machine in that it has a bunch of runtime featur...
I'm new to using async calls in ajax. My problem is that I have two server "tasks": one that just checks if session is set (fast), and another that sets the session (slower). I want to check if the session is set and if not, set it. And I want to try X number of times (I'm unsure if I really need to but that, but that ...
The problem of Electronic Data Interchange over networks is well known and understood. Today, the most common formats for data interchange are things like XML and JSON. There are various pros and cons of using one format over the other, and certain formats lend themselves better to certain data-sets. I've been progra...
ASN.1 is a data format used on HTTPS certificates, and various other critical pieces of infrastructure. I need to analyze some potentially hostile ASN.1 data, and want to ensure my code is safe from any programmer error. I think the best way to do this is to use a managed language that does not use unsafe code. Are th...
The words invert or control are not used at all to define Inversion of Control in the definitions that I've seen. Definitions Wikipedia inversion of control (IoC) is a programming technique, expressed here in terms of object-oriented programming, in which object coupling is bound at run time by an assembler object...
I have found several functions in python 2.7.2 to be very useful and I recreated them in C++ for my own uses. How do I properly give python credit for them? Do I even have to? I never actually looked at their source codes. I just wrote functions that output the same values as the python versions of the function.
I have a question to somebody who is expert about "GNU General Public License version 2.0" license. I am making program and my code is using another program ("HoboCopy") inside which have this one license. I downloaded just a .exe of this one program and I am wondering if its ok with license if my boss will sell progra...
I'm building a search engine using Lucene.NET / Solr.NET, and I'm wondering should search hits be returned as a dictionary or strongly typed object. public class SearchResult { public string SearchTerm { get; set; } public List<Dictionary<string, object>> SearchHits { get; set; } ... } // where search hit ...
This question was brought up during a Standards discussion, which should revolve around SOLID Principles for Object Oriented Development. In your experiences, have you seen benefits or drawbacks in either code readability or performance based on whether variables are passed ByRef vs Module-Level Variable? Obviously: I...
I have been assigned to develop an integration to one of my employer's applications to an external system developed by our client. Our client's specification for the integration that has some blatant flaws related to security. The flaws would allow an unauthorized user access to the system to view restricted data. I ha...
I'm assigned to a project where the goal is to update an existing software. This software was developed in a totally ad hoc manner, which means that any documentation generated is outdated, confused and just plain useless. I do not want to retroactivelly produce all the missing artifacts, since this would just be a was...
In simple words, is it true that an average size of an encoded video frame would be FrameSize = BitRate/FrameRate? Because BitRate shows how much data we are transferring per time unit, and FrameRate shows how many frames does this time unit contain.
Firstly let me clarify that I know C and am learning Python. So my OOPS is kind of bad. I was reading the official tutorial and found this Although scopes are determined statically, they are used dynamically. At any time during execution, there are at least three nested scopes whose namespaces are directly accessible:...
The advantage is it protects your DTO against future "enhancements" ?
I need to create a graphical editor for our data model that works in an HTML5 compliant browser. I am looking for a proper library/framework to build on. The model is stored as xml, but that should be largely irrelevant for the front-end technology. To be more concrete, I am looking to build a kind of diagram editor to...
After reading a few articles about Newable vs Injectable objects and how these concepts relate to DDD's services, entities and value objects, I was left with some doubts about using newables in my code especially in my unit tests. Main candidates for newables were Entities and Value objects meaning that instead of inje...
This is my situation: I have a class called CueList, which is basically a wrapper around ArrayList. I have another class called TimeTicker that alerts all the Tickable (interface) in its list that a certain amount of time has passed. Since I need to tick all of the items in CueList, but I don't want to violate DRY by k...
I have a set of questions that bothering me, hopefully someone will be able to answer them here: What should be an optimal team (in terms of roles) to write a big enterprise nice-quality framework? What big frameworks could act as a good references in terms of documentation, architecture, quality of implementation et...
In chapter 24 of Code Complete the author says, in reference to encapsulate downcasting when returning from a method, "If a routine returns an object, it normally should return the most specific type of object it knows about. This is particurlarly applicable to routines that return iterators, collections, elements of c...
I am a web developer and at the moment am finding it hard to cope with long un-documented code written by previous developers in an organisation I work for. With the deadline gun always pointed at my forehead, it's doing my head in. I use aptana studio's search feature for some quick wins but it is becoming overwhelmin...
The C# community has so ubiquitously used the "I" prefix to denote an interface that even the most inexperienced programmers know to use it. Why is it then that we do not prefix enums, abstract classes or structs (possibly with "E", "A" and "S" respectively)? For example, if we did mark all abstract classes with an "A"...
I'm planning to write an e-commerce app using PHP & MySQL with lots & lots of custom rules. Say for example, I want to have a rule like "Give Customer X, a 10% a discount for Product Y if he bundles it with Product Z" I've heard about Business rules engine(in Java and others). I intend to implement a flexible business...
PHP supports the list() language construct which, in short, allows you to return multiple values from a function and then attach them to different variable, eg: function myBigReturn(){ return array("foo", "bar"); } list($fooer, $barer) = myBigReturn(); echo $fooer; // echoes "foo" echo $barer; // echoes "bar" I ha...
Function A() calls B() calls C(), which encounters an error. Which function writes to the log and which function reports to the user? My first inclination is that all functions should write to the log, and that the inner-most UI-facing function should be responsible for outputting the error to the user. However, the fi...
I recently was assigned to a task, but it says only a couple of words, like, do it as it made there, with no actual spec attached. What is the best thing to do in that circumstances?
Teams in our company deal with Product Owners who are in such a position that they cannot spend as much time with us, as we would like, to do proper Backlog Grooming. Thus in order to alleviate some of the time constraints we have begun implementing the art of getting stories "Ready for Sprint" or in other words gettin...
While practicing TDD, I came across this specification: A user should be created with its password hashed, be persisted and an activation token should be returned. Should my first unit test, (aiming to begin to test this scenario) should encompass the whole needs? : shouldPersistTheNewlyCreatedUserWithAHasedPasswordAnd...
I recently read this question that features, the arrow anti-pattern. I have something similar in code I'm trying to refactor except that it branches. It looks a little something like this: if(fooSuccess==true&&barSuccess!=true){ if(mooSuccess==true){ ..... }else if (mooSuccess!=true){ .......
I'm involved in a project for a redesign of an existing site. The Designer Team delivered us -the Engineering Team- four separate HTML/CSS prototypes of how the site should look: On a Desktop Browser. On a Table Device, a similar but simplified design of the Desktop View A High-Tech Smartphone, the design is mobile-ap...
I'm currently working on a code base that has many classes that implement a Start method. This seems like two-phase construction to me, which I had always considered a bad practice. I can't tell the difference between this and a constructor. When is it appropriate to use a start method instead of normal object constr...
The company I'm working on has a RUP-like software development process, with very heavy documentation. Right now we're doing a Multi-Channel web site -it's intended to be seen in Desktop, Tablets and Smartphones- and every version of the site has a particular flow of events and content. I don't see in RUP an artifact w...
Specifically, I am working on a tool that integrates a DVCS and build system, but I image the challenge I am facing would arise for anyone developing a "meta" tool (compiler, VCS, build system, test runner, etc.) that they wish to develop through "dogfooding". My question is: in a scrum-style release process using the ...
Despite being very stakeholders friendly, ATDD aimed to provide a "stop" line when a feature has just been done. This avoids wasting time to add non-focused (and sometimes useless) code. That's why some teams start by establishing a walking skeleton of the application, and directly specifying with an acceptance test th...
I'm trying to decide on what format I should save data in, and hopefully this question will help me come to a decision. The program I'm writing uses 'databases' in which word=meaning (not a dictionary, that was just an example). I don't really want people to be able to manually edit these 'databases' without my program...
It's current to see the terms callback, trigger and handler in some API documentations. It is just synonymous or each term correspond to a specific concept? I used to think that this terms are just synonymous, but I must be wrong ... Thanks !
I'm not coming from web-development at all, but am looking to build a web application. So far, I've looked into all the server-side stuff (for example, I think my stack will be Linux + node.js + ExpressJS + MongoDB), and have learnt a lot! At this point, I'm comfortable setting up an HTTP server, routing requests, usi...
I understand that in the earlier days of computing, shorter method names like printf made sense, because storage was limited. But why do modern languages like Python and Go still use the less readable names from the C APIs? Why don't they switch to a more readable form like print_format, the same goes for other names. ...
It always happen to me that if I leave the stuff for 1-2 months I forget the stuff. 5 months back I had symfony project and I did that. At that time I was very much confident that I can do any project in symfony2. Then we got one Python project in django and I worked full time on that for few months. But now when I had...
I have a customer who has a client app and when they log in to their client app, they will see a link to my website. When they click on the link, it should log in them in automatically to the website without asking for the credentials. Is this only possible if the username/password are the same between the client app...
I'm new to Android and while going through a tutorial on saving Activity state to a Bundle, I noticed that instead of accepting the more generic List interface, Bundle's put methods are expecting ArrayLists. Example: Bundle.putCharSequenceArrayList(key, value) Bundle.putIntegerArrayList(key, value) Bundle.putParcelable...
I'm aware that most modern languages use reserved words to prevent things like keywords from being used as identifiers. Reserved words aside, let's assume a language that allows keywords to be used as identifiers. (For example, in Ruby a keyword can be used as a method name). During compilation, how would you deal with...
could you please help me understand this ternary operator public static <E> void replace(List<E> list, E val, E newVal) { for (ListIterator<E> it = list.listIterator(); it.hasNext(); ) if (val == null ? it.next() == null : val.equals(it.next())) it.set(newVal); } i thought the part after ? is j...
Consider the following code: a.py import os def print_rand(): print os.urandom() And another module: b.py from a import * In this code, I end up with an os variable getting imported from a. I could prevent this with a small change: a.py import os as _os def print_rand(): print _os.urandom() Since from a im...
There are some design guidelines about testable code in “The Art of Unit Testing”. The first one is “Make methods virtual by default”. I’m curious to know your idea about non-virtual-by-default behavior in C#. I’ve read about Hejlsberg opinions but I think one the most important reasons could be that it may lead us to ...
I just started a new job, I have to create a web app for them and host it on their intranet on an Windows 2003 R2 server with SQL server 2008. As said in the question, I'll work on a MCV3 with Razor syntax application. I know that it won't work easily or even not work at all. On a recent server you have to install some...
I'm trying to adhere to PEP 8, with a 78 character limit on the length of my lines. I have the following statement: startTime = time.strptime(request.GET.get('st', (dt.datetime.now() - dt.timedelta(days=1)).strftime("%d/%b/%Y:%H:%M:%S")), "%d/%b/%Y:%H:%M:%S") How should I format it so that it adheres to PEP8 (where sh...
I'm investigating the legal issues of using LGPL native libraries in a closed source Android software. As for now, my research on the subject shows that using LGPL libraries in closed source software is doable, and that the requirements are not specially high. On a regular application (for example a C closed source app...
Normally TCP/IP Sequence and Acknowledge numbers are 32 bit. However, I need a way to shorten them to be 24 bit (it's an experiment in deep inspection firewalls). Question: Is it possible to shorten the bit resolution of the Seq/Ack numbers in windows without the knowledge of the application? (which in this case is IIS...
I'm learning about REST and had the chance to build a basic REST API. After doing so, most of the material I read was internalized and I now have a better understanding of it. However, I do not see any real difference yet as to the tangible benefits of using REST over the old way I was doing things, which was simple...
if I had a boolean (property) shouldAutoLogin is it better to name the getter getShouldAutoLogin or just shouldAutoLogin so that it reads more like English? ex : if(shouldAutoLogin){ ... } or if(getShouldAutoLogin){ ... }
I work in a fairly large and old solution that has many entry points for different kinds of clients, with web sites for public access, web sites for internal access, some web sites and web services for partner companies access, etc. All those applications use different (Microsoft-based) technologies, such as Classic AS...
I think this question should apply to most programs that load settings from a file. My question is from a programming point of view, and it is really how to deal with the loading of settings from a file in terms of different classes and accessibility. For instance: If a program had a simple settings.ini file, should i...
Recently I have started using a new(to me) paradigm for web services. I use the controller to accept JSON strings sent over POST, process it and return JSON strings. GET, PUT, DELETE and other methods throw HTTP 405. This pattern is proving to be very efficient from the point of view of asynchronous web frameworks (ver...
Say I have a class like this: public class MyObject { public List<string> MyCollection { get; set; } } And a method like this: public void DoSomething(MyObject object) { if(object.MyCollection == null) { // MyCollection must not be null // Should I... // a) object.MyCollect...
We are basically using Waterfall life cycle methodology. Requirement Analysis: I get a use case created by some one else. Design (talking only about Low level design): I get some little feeling about how would I design it, may be either instantly/ or after some time. Coding+Unit Testing: In case of unit Testing I am no...
I'm currently setting up a MongoDB database for a web-app. I'm running node.js and using Mongoose to help manage mapping, validation ect. I'm wondering if it's a good idea to really decouple MongoDB from my code, just on the off-chance we want to switch to something like CouchDB a little later. Specifically, I'd make ...
For my job we have a nice RESTful webservice we've built out that we use to drive a couple websites we have. Basically the webservice lets you create and work with support tickets, and the website is responsible for the front end. Any webservice requests use an auth header which we use to validate the user and their ...
What does "(say)" mean in this Java method? Since Mapper and Reducer are separate classes, the type parameters have different scopes, and the actual type argument of KEYIN (say) in the Mapper may be different from the type of the type parameter of the same name (KEYIN) in the Reducer. For instance, in the maximum tem...
I have the following field in Flex: [Bindable] public var zIndex:uint; And I was trying to create the methods to process the calls in Java and I ran into a problem. 1. public int getZIndex(); // Does not work. 2. public int getzIndex(); // Works. I thought that the letter following the get/set was supposed to be capi...
I'm trying to test this wrapper to request that I made: // lib/http-client.js var app = require('app'), request = require('request'); exports.search = function(searchTerm, next) { var options = { url: 'https://api.datamarket.azure.com/Bing/Search/Web', qs: { 'Query': '\'' + searchTerm + '\'', ...
On my web page, if I wish to display dynamic dropdowns (e.g city names based on country selected), I can do it using AJAX. But I can also do it using a REST call. So which should I use? My problem is I really don't get the difference between REST and any other HTTP browser request.(a.k.a a form submit). I have looked a...
I'm making a facebook app and I'm trying to follow MVC properly. But I was wondering if I had a class that was a bunch of fql queries (getting data from facebook) should I have keep these in a controller or a model? According to Codeigniter's user guide "Models are PHP classes that are designed to work with information...
In my org, we use SVN for version control So for each build (done periodically), we merge the code to trunk from the development branch (all the developers checks in to this branch). So when we want a new branch say for a new release, we create from the trunk doing a svn copy. Now in the new branch we have the histor...
I'm having a set of data's, say Question, Question's Main Category,Main Category followers, Question's Related Categories,Each Related Categories followers, Whether it got answer in 24hrs [Yes/No] Now, I need to analyse a database with thousands of sets of data's like given above and predict whether the new given qu...
I wonder if there are benign use-cases for simulating mouse clicks using event.initMouseEvent. I found that it is used for creating pop-under ads in the following way: var e = document.createEvent('MouseEvents'); e.initMouseEvent('click', true, true, window, 0, 0, 0, 0, 0, true, false, false, true, 0, n...
I have just moved to a new company and they are using TFS 2010 (2012 in a couple of months) as their version control system and recently started to use it as a work tracking system for the developers. However, there doesn't seem to be a bug tracking system for use by people outside development & test. Production suppo...
I work in a company where there are Excel spreadsheets everywhere. As my colleagues are non-programmers, I'm sure they haven't contemplated that there might be a better/easier/more productive way of managing their data. Naturally, I advocate an application of sorts that can leverage the features you find in relational ...
I know there is a difference between INNER JOIN and FULL OUTER JOIN, I can see it, but, what is the difference between the two following: JOIN ... ON... and INNER JOIN...ON... and still yet JOIN...ON... vs FULL OUTER JOIN...ON... Reason being is I think maybe just using JOIN is messing up a query I am working on that i...
This is my first project related to SMS verification. How to implement SMS verification in online ordering web application? For example:- when we try to reset the password in amazon's website, it sends an sms verification code and after entering the code it proceeds with changing the password. I want to implement the s...
I can't decide what to name my class. So far I've labelled it up as a Factory, but I am not sure. Here is the class. As you can see, it exists to return a concrete type of an Interface (ResolveRegistrationIssue) based on the argument supplied to the getter method (ResolutionFamilyEnum): @SuppressWarnings("serial") @Man...
I want to write a function that return random unique pair numbers every time call it from a range until resetting it. Something like this: function randomUniquePairs($ranges, $reset = false){ if ($reset === false){ // some code for reseting } /* some code for creating random unique pair numbers *...
I'm in process of making an open source application for Windows. In the end I would require an icons for my app and its gui. I'm huge fan of Tango styled icons, but its pack doesn't provide all icons I need. Gnome project seems to provide ones for more mature projects that run on linux. What is the general way, procedu...
A team has decided that every morning someone should bring croissants for everybody. It shouldn't be the same person every time, so there should be a system to determine whose turn it is next. The purpose of this question is to determine an algorithm for deciding whose turn it will be to bring croissants tomorrow. Cons...
I'm confused by this post by Mark Seeman. And his comment on IInitializable below: The problem with an Initialize method is the same as with Property Injection (A.K.A. Setter Injection): it creates a temporal coupling between the Initialize method and all other members of the class. Unless you truly can invoke a...
The titled basically states it. If I have a bigint column with primary key and autonumber, and a record is deleted, will SQL Server ever reuse that now available value? The underlying issue is that I have a multi-user environment, and if I retrieve a record from the database into memory, then another user makes changes...
Recently I've started to work with object oriented analysis and design and it seemed very interesting to me as a way to get work done better. But I'm still in doubt with one kind of situation. If this is not the correct site to ask about it, sorry for that. Well, if I have to design a system that allows one user to reg...
I have recently inherited a large, legacy system with a complex codebase that has a lack of documentation. I'm the sole internal developer embedded with the core users, taking some responsibility from an external contractor. While modules and functions are documented well enough, there is no documentation around the sy...
Imagine I have a rich data model that is represented by a hierarchy of objects. I also have a view hierarchy with views that can extract required data from model objects and display the data (and allow the user to manipulate the data). Actually, there could be multiple view hierarchies that can represent and manipulat...
In a language like Python or JavaScript (NodeJS), is there anything wrong with defining "the configuration file" as a file which essentially hard-codes the configuration settings? For example: options.py: OUTPUT_DIRECTORY = 'out' LOGLEVEL = 'debug' options.js: outputDirectory = 'out'; logLevel = 'debug'; Does this co...
I can write PHP application in linux platform. However, I getting a request to explore the idea to run PHP application into .NET. I have zero .NET knowledge. So wondering, is it possible? Is it advisable? Implication ? Or maybe I should just install a .NET to playaround first? In short, zero code changes, except setu...
I'm designing an append-only ("journaled") file format, and I'd like it to be friendly towards being stored in VCS (git/Mercurial/...). On one hand, I'd like if after each change, only delta (difference) from previous file state was added into the repository (i.e. some trailing bytes), not the whole contents of the fi...
I was going through the answers to this question: What information must never appear in logs? And noticed that nobody mentioned this particular attribute. It's something I find useful- whenever any logging is added to the system as a result of tracing a particular issue raised in the bug tracker, or adding a feature, I...
I have come to python from C++ (I also know a little Java). I am writing code to exercise a server so I basically use http methods to send a load of requests to the server. As part of my code I created a class and called it testdata. This contains basically test input data (to send in requests) and output data to ch...
Internationalized applications usually display links in header for translating in different languages, e.g.: Spanish | English | Italian. These links usually translate current page in the selected language, and usually the url includes the language: http://www.mysite.com/myapp/es/somePage. Questions: Does this only a...
We have Development department and the department of System Engineers that works on a big project (development of J2EE application). We are using Build management system, Bug tracking system and a Wiki engine in our work. Sometimes we have a situation when some developer initiate a server restart or an application buil...
If I have a method taking input and giving output, it's a no-brainer that tests should be written. But what about things like validation rules? For example, I add a validation rule that a certain property must be at least 5 characters long. Should I then write a UI test to check for an error message when the form field...
We are moving our software project from the practically auto-creating Visual Studio Installer in Visual Studio 2010 to a WiX installer. I'd like to use this change to make sure things are right. The application is a subsidiary to our company's main app that will already be installed in its own folder. The main app ha...
I recently looked a Flow-Graph question. Consider 8 boxes with following values Box 1 = 2 Box 2 = 7 Box 3 = 2 Box 4 = 1 Box 5 = 5 Box 6 = 7 Box 7 = 1 Box 8 = 4 Now follow the instructions: Put the number from Box 7 into Box 1 Add the numbers from Box 1 and Box 2 , and put the result in Box 1 Change Instruction 2, Inc...