instruction
stringlengths
34
19.9k
I am very interested in network programming and I want to build a VNC client for fun and for learning purposes. I have been Googling for resources about VNC client and server, but most of time, resources found were about how to use VNC not how to build or how it actually works in business layer so I can get an idea abo...
It has been my experience, when building websites, that most of the logic of a system is executed when user input is accepted, be it via POSTs, GETs etc. I would like to know what processes or methodologies exist in Python (leaning towards using Python), PHP, and Ruby that allow web applications to perform tasks autom...
I am using simplexml_load_string for xml string interpreting to object from results of a REST API. It's working fine in my local server, which is using PHP5. But my hosting is in Yahoo and the service provider is giving me PHP4. For that I need to change the way of interpreting XML string to object to another method, w...
Does anybody have an experience in combining KanBan in SCRUM, could this work, would this make sence or would it be an overdesign?
In every Website you read about BDD (Behaviour Driven Development) you find a very simple nice example showing you how obvious and easy is it to define your requirements. But trying to implement this process in a big product (not a calculator example) showed me that things can get (or will get) pretty complex and unrea...
Consider a module that is responsible for parsing files of any given type. I am thinking of using the strategy pattern to tackle this problem as I have already explained over here. Please refer to the linked post before proceeding with this question. Consider class B that needs the contents of the product.xml file. Th...
We have someone (let's call him Ted) that is responsible for testing new features and bug fixes. We're using Git and GitHub. master should be/is always deployable and development is where we commit/merge new features or bug fixes, but only after they have been tested by Ted. The project is in PHP. I'd like the testing ...
I recently ran into a rather annoying (confirmed) bug in an open source software package that I have integrated into my application. According to the public issue tracker this bug has been resolved in the latest release of the software. Occasionally you NEED that bug fix to avoid an expensive refactor of a particular ...
I am wondering, What would be the correct condition coverage test cases for the following condition: if(A && E && (B || C || D)) Considering short circuiting, what cases would I need? EDIT: Sorry I put only a half of the expression
We are at a planning & redesign stage of our loyalty card application. As it is understood it will be a multi-tenant application. And I need to take your thoughts. Here are the some key points we should take in to account to redesign logical and physical data structure: Campaigns: We may organize cross tenant campai...
It seems like when web site lists requirements as to what characters MUST be in the password they're only providing a password map for someone who wants to hack their system. For instance, fsd.gov requires: The password must be 10-14 characters in length. The password must contain two each of the following: Upper/low...
I'm in a team of two developers and currently we have no formal processes for software development and testing - I'd like to adopt one solo initially. Where I need some opinions is really on the matter of where to begin? Having read various books it isn't terribly clear what the best starting point would be. Recently I...
I just came out of University and have been working at this company for roughly 8 months, while I was given the title of developer, most of the time I have spent on is fixing and debugging other people's codes. I always wonder why isn't the original developer's responsibility for fixing his/her code. I understand that ...
Suppose I have code which retrieves an object and modifies it and submits it via any ORM from a web application. Below is the pseudo code: First request var objCust = _dbContext.Customers.Where(c=>c.CustomerId == "ALFKI").SingleOrDefault(); objCust.Address ="test address 1"; //and add some orders _dbContext.SubmitChang...
I'm not a web programmer at all so I really have no idea: You'll notice that websites like Stack Exchange have links like this: http://programmers.stackexchange.com/questions/188078/policy-and-practice-on-code-maintenance As you can see, the link includes the "page name" (Policy and practice on code maintenance). We k...
In the Noda Time User's Guide, the rationale section states: the public API has been largely rewritten, both to provide an API which is more idiomatic for .NET, and also to rectify some of the Joda Time decisions which the Noda Time team view as "unfortunate". (Some of these are simply due to having different goals; o...
I am dealing with some old, sloppy C++ code in which there is a structure with a lot of data members and functions. I want to test a class that I have implemented which uses the struct, but this dependency is going to make the unit tests extremely ugly. Inspired by Michael Feather's discussion of preprocessing seams in...
I'm working on Android application development. There is a question that always comes to my mind that: How XML interacts with Java code?. I mean Button inside XML is a view, but Button inside Java is a class. For populating and XML layout we use setContentView(R.layout.name). What I want to know is how this XML code i...
I'm programming a decision tree in C++ using a slightly modified version of the C4.5 algorithm. Each node represents an attribute or a column of your data set and it has a children per possible value of the attribute. My problem is how to store the training data set having in mind that I have to use a subset for each n...
In an OS book I just read that, "Public APIs are forever: Only one chance to get it right". Is it true? Is it applicable only in APIs of Operating Systems or other APIs too? For example, will this be true for the APIs of Android Applications such as Tasker, Locale and Pushover?
What things need to be considered for a Website that contains International strings, for instance Simplified Chinese and English mixed. UTF8 seems to me a natural choice, including a meta tag. Still, some users may only see white boxes. What is the best solution do deal with this? Currently I am thinking to provide a...
I have been studying condition coverage for last few days. In a book "The Art of Software Testing" they highlight that it does not assure decision coverage, because for example IF(A && B) A=True, B=false and A=False,B=True satisfies the condition coverage but the decision is always False. I wonder, how can this satis...
I am developing an application for Android in JAVA which calls GPLed C-code via JNI. I have modified & capsulated a GPL-software under a JNI-interface and compile it as a shared library (.so) which I can use via JNI from my JAVA-part (the commercial part with closed source). Because I have stripped the original GPL-sof...
I have code using a third party library, QrCode.Net, in the form of a dll file. The library is licensed under the MIT License. Do I have to include the license in my project if I did not use or modify the source code? Full license text: The MIT License (MIT) Copyright (c) 2011 George Mamaladze Permission is hereby gr...
I would like to hear other people's opinion on what to unit test in JavaScript. I've been thinking about it and experimenting and let me present what seems to me the right thing. First of all, in order to be able to unit test your production code you need to divide the productin code into three layers: (1) DOM/jQuery, ...
Consider a benchmark of a C++ application. It does little or no I/O in proportion to its overall runtime -- it is compute-intensive. It is a single-threaded program. It pages/reads in all of its data at the outset, and then runs many iterations of the core task at hand, so as to average out cache or other ephemeral var...
First off, I know this is a question asked by MANY other programmers before me. But I couldn't find any usable resource that could help me. Well, I'm creating an programming language called "Light" the syntax is comparable to python but it has a strict object-orientated concept. I have made an interpreter ( in C++ ) fo...
As a learning exercise (I am not in school - just an old guy trying to learn something new), I am trying to write a logic gate simulation that incorporates propagation delay. The user should also be able to group gates together to create higher-level objects. I want to apply design patterns to my problem, but I am havi...
I have been working (~ 5 years & first IT job) as an application developer at a large financial institution with a strict corporate hierarchy, multiple LOBs, and heavily process-laden IT departments. Now, one aspect of this culture is to use a lot of external contractors and vendors to port legacy code to current tec...
I want to write a server side application which allows several users to exchange files (not above 3MB) in the following way: user A connects to (server) S. User B connects to S. User C connects S. User A sends a file. Users B and C "see" that a file was/is being uploaded and start downloading it. My main concern is res...
In my JavaEE project I have an interface like this: @Local public interface DataAccess { ... } And two stateless beans implementing it: @Stateless public class DataAccess_Online implements DataAccess { ... } @Stateless public class DataAccess_Offline implements DataAccess { ... } And I get the exception: Cannot re...
I am looking for advice on the neatest way to structure my code. class Password { private string cipher; Password(string cipher) { this.cipher = cipher; } public string HashPassword() { } public bool VerifyPassword() { } } The idea behind the class is to abstract aw...
The documentation for ref shows a :max-history option and states that "refs accumulate history dynamically as needed to deal with read demands." I can see that there is history at the REPL, but I don't see how to find previous values of a ref: user=> (def the-world (ref "hello" :min-history 10)) #'user/the-world user=...
In cluster the Amdahl's law, Gustafson's law exists. I though that there might be some law which states the relation between CPU Hz's and network speed: maximum network speed after which no additional Mbps would increase the calculations. Does such limits exists and what it depends on?
I thought that in .NET types are either value types or reference types. But this guy, when asked about .NET types, talked about "primitive types" and "complex types". I understand that people sometimes use different names to refer to the same concepts, but isn't it strange that a Microsoft certified professional would ...
I would like to know what is going on "under the hood" if I use remote interfaces in JavaEE. In the project I use a stateless enterprise bean that implements a remote interface. And I can call methods in this remote interface from a client (it all runs on the same glassfish server but it should work from a different ma...
There is C# code, VB.NET code... Can I also say ".NET code" as an umbrella term that covers all the languages you can use with the .NET framework? I've seen people using it as well as people saying it shouldn't be used...
The official tutorial uses the term symbol table in a few places where I would expect the term namespace. 1. Defining functions The execution of a function introduces a new symbol table used for the local variables of the function. More precisely, all variable assignments in a function store the value in the loca...
I have a MVC architecture, and I have the basic views completed. I now need to add the first user tutorial mode into the project. I don't want to add checks for first user state in all the views that need it, but the only alternative I can think of is to subclass everything and use those subclasses on first open. Is th...
How do I correctly include copyright statements for included libraries? I have a program that uses libraries which are licensed under the GPL and MIT (either jointly under both, just only MIT) licences. How do I specify this at the top of a combined and minified file? I have this currently: My Program (GPL) Copyright ...
Recently Windows Azure Storage SSL certificate unexpectedly expired and since a lot of dependent services defaulted to "refuse to connect to a site with expired SSL certificate" that became a serious problem. Now the SSL certificate of any web service can be retrieved by anyone at any time for validation. The picture i...
In order to sign an application for the Apple App Store, we need to create a certificate by saving a certificate request file from keychain and then upload it to the Apple store. I was wondering, what does this certificate request file contain? Does the certificate contain any information (like a finger print) about t...
My manager has tight deadlines to meet. The current project I am working on is currently on schedule, but I've noticed a couple of quite significant areas in the code that are really badly written. (Bits of code get called two or three times, when they only need to be called once.) The problem is, as far as my manager...
I've often come across the situation when the same mistake is made in many places in an application. For example, in a web application when the user creates an item and clicks the Add button to save it. If they click the button several times, multiple items are added instead of one because UI wasn't blocked and backend...
I have a private method in my test class that constructs a commonly used Bar object. The Bar constructor calls someMethod() method in my mocked object: private @Mock Foo mockedObject; // My mocked object ... private Bar getBar() { Bar result = new Bar(mockedObject); // this calls mockedObject.someMethod() } In some...
Lately I am seeing quite a few application development job ads asking for experience with this or that Java EE server. I can understand this if it is for a server administrator, however I find it stupid and ridiculous to ask for some one with a specific server implementation experience when the job is Java software dev...
I am integrating with a Financial Management System (FMS). I have a class that prepares a set of objects (each of these objects is called a TransactionEntity). These are then passed to the FMS. I give particular importance to correct terminology. What should I name this class that prepares the transactions? I am thinki...
I have a function evaluate() that parses a String for some variables and replaces them with their corresponding value: public String evaluate() { String result = templateText; for (Entry<String, String> entry : variables.entrySet()) { String regex = "\\$\\{" + entry.getKey() + "\\}"; result = re...
I've been reading a bit about Literate Programming recently, and it got me thinking... Well-written tests, especially BDD-style specs can do a better job at explaining what code does than prose does, and have the big advantage of verifying their own accuracy. I've never seen tests written inline with the code that they...
Do iterative methods such as are commonly found in modern languages such as C#, JavaScript, and (hopefully) in Java 8 reduce cyclomatic complexity's impact on understandability and supportability of code? For example in C# we might have the following code: List<String> filteredList = new List<String>(); foreach (Stri...
I am working on a user driven cms site. Think of it like stack overflow. The users can write posts, and publish them to the web. I am using a WSGI editor to generate the content. One of the features I am implementing is the ability for users to comment on particular section of a user post. I am trying to think of a ...
I'm trying to name a component that will be capable of both reading from an InputStream (file or otherwise), and writing to an OutputStream; thus serving both as a Reader and as Writer. So far the best I've come up with is: ReaderWriter IOStreamManager StreamManager Any good ideas?
In my current role as a software developer in a Java/Spring/Hibernate/JSF shop, I am sometimes asked to develop large-scale web apps with many interfacing systems and/or large databases as well as small-scale web apps with low traffic and/or simple databases. To accommodate this variation, I would like to have 2 techn...
I have a tree: a / \ b c / \ d f / \ g h And the pattern: x / \ y z / \ q p As output I would like to have: x: a y: b z: c q: d p: f and x: b y: f z: c q: g p: h Is there any algorithm I could look at?
I need help understanding what user stories should look like for a web testing framework we are building for our organization's QA department. We are trying to run this project using Scrum. The product will have 3 layers: utility classes to make working with underlying web automation tool easier. a page-object API lay...
Today I experienced a first in a technical interview. The candidate refused to use the whiteboard to solve an algorithm question, as I requested. There was no sort of disability at play or anything (outside of nervousness). He simply said that he is uncomfortable using a whiteboard for difficult questions. Oddly enough...
I came across below style of writing if statements in C#, on msdn code examples. Usually when I write if statements, the conditions I would write `(Customer != null) I want to know if there is any difference/gain in writing statement like below: Customer customer; if (null != customer) { // some code } Or if ("" !=...
I'm building a parser using a parser combinator library. I need to keep track of where AST nodes started and ended in the textual input -- line and column numbers. How is this problem approached and/or what are strategies for dealing with it? Clarification: I'm asking about how/when/where the line and column data is...
Let's say we're designing a video game. We have some sprites on the map and we want to call some method of the particular sprite at some particular position. We are using one broadly-known C++ framework. It has an GraphicsItem class, and ALL our sprites are derived from it. Now, framework has a method to get a pointer ...
My boss found out I'm not as smart as he thought. An example from my experience: I'm a junior programmer, and I work in a team of two, my boss (senior programmer) and myself. I was tasked with developing an internal web-application for the company we work at. I wrote the back-end to the front-end (the database design w...
In general, should I use some sort of convention for structure names which is distinct from other type name? I was thinking about this when my professor started talking about structures. I had the following discussion with myself, and since I do not want to come to any unreliable conclusions. How would you answer the q...
As a Lead Programmer my responsibilities include calculating the deadlines of the projects. To do this I have discussion with related team players and calculate a deadline estimation. Sometimes, I got a scared voice from CTO saying that the estimated deadline is too much. Then I have to shorten the deadline. With a sh...
We have a client-server application with a thick client (GWT). There are client-side MVP presenters (MVC controllers) which hold references to some objects viewed in the GUI. Some user actions cause these objects to be updated on the server. After that we can send updated objects back to the client and reassign them to...
I am working on a website (C#, ASP.Net MVC 3) which reads some RSS feeds from multiple sources and put feed title and summary in a database table(Sql Server). What I want to do is: Put an algorithm in place which can relate multiple feeds. For example if each feed is a news item, I would like to relate all news which ...
As part of my work on a legacy C# application I've come across a novel (to me) use of an interface & concrete implementations. I can't think of any reason why you'd do the following, but I'm pretty thick, so maybe someone else can? public interface IContract { ContractImplementation1 Contract { get; } bool I...
I am wondering if there exists a way to half way synchronize javascript functions, where data is requested on the fly. I don't want to make it purely blocking (which I guess is impossible), I just want a nice way to write the overall algorithm in one piece. Let's take the following example: function(){ command1; ...
I've had a bit of experience with unit testing before, in what I call (not pejoratively) the classic software engineering project: an MVC, with a user GUI, a database, business logic in the middle layer, etc. Now I'm writing a scientific computing library in C# (yeah, I know the C# is too slow, use C, don't reinvent th...
The background One of the functionality of a product that I am currently working on is to process a set of compressed files ( containing XML files ) that will be made available at a fixed location periodically (local or remote location - doesn't really matter for now) and dump the contents of each XML file in a databas...
What is the general solutions to allow the client to choose the concrete instance of a method output? For example, in the Lucene API the search method receives and modifies the collector input parameter, but this is generally regarded as a bad practice: IndexReader reader = DirectoryReader.open(index); IndexSearcher se...
The definition of "C-Style language" can practically be simplified down to "uses curly braces ({})." Why do we use that particular character (and why not something more reasonable, like [], which doesn't require the shift key at least on US keyboards)? Is there any actual benefit to programmer productivity that comes ...
When making changes to large systems, I often face the problem that some piece of functionality needs to get some data from another piece, but they're in different parts of a deep and branching call tree, possibly flowing through event listeners, deferred calls, etc. In this way a simple change can balloon quickly. A r...
If we assume that it is not desirable for the base class to be a pure interface class, and using the 2 examples from below, which is a better approach, using the abstract or virtual method class definition? The advantage of "abstract" version is that it is probably looks cleaner and forces the derived class to give a...
I am new to C# development and wish to create a more responsive UI. In my preliminary research, I have seen two methods for achieving this: Multi-threading in conjunction with the BackgroundWorker class. The newer Async/Await modifiers. Does newer mean better? What's the difference between the two methods? If I wish...
In our company we have two large systems, basically they are scoring and CRM. Both have large SQL Server databases running on Windows servers on the intranet. These two databases are managed by other department, which we have a direct contact with. Neither of those systems have any external APIs except for some stored ...
I want to fork on Github the TestNG java testing framework (Apache 2 license) so I can add/change some minor things to suit my needs. It's unlikely that all of my changes would be approved in the main project or that other people would use my fork. This would in no way be a competition to the main project. Now, in term...
So, I am working on a project with a team and we are using Entity Framework. We basically want to use linq to entities, and not use stored procedures. I use quite a bit of lists and IEnumerables and so does everyone else. My question is, will converting the dataset produced by a stored procedure to an IEnumerable dram...
I have a ASP.NET MVC4 project in which I would like to use the SimpleMembership. The application has a Person table that holds relevant information about users in the system. I would like a link between the currently logged in user and the Person information. So I have made a foreign key in the Person table to the User...
We're looking into improving our testing process for some of our applications, and the idea that's been put forward it to write unit tests in Groovy and automatically run them with Maven. The first application to get this treatment is written in Java, but I've been told that some of the classes being tested need to be...
This is a follow up to this question. There I was asking how to do unit testing when you have a library of scientific algorithms. I have a similar problem now but with a different project. I'm working on a 3D graphics engine framework abstraction for DirectX, OpenGl, WebGl, Silverlight, WPF, and basically whatever 3D A...
We are writing software to track Foo Widgets. Each Foo Widget has a serial number. The serial number is an 32-character alphanumeric string. The string is separated into five sets. Each set is separated by a dash (so the s/n is 32-characters NOT including dashes). So for example: 11111111-1111-1111-1111-111111111111. ...
We currently have 3 similar, but slightly different applications that use the same data. We load the (same) data into each application that uses it. The applications are similar and use the same technology (Ruby on Rails) but were developed by different programmers. In consolidating this data, our management seem the...
I often need to do some operations in a loop and some other operations between the iterations. A simple example would be collecting words from an array into a string, spelled backwards and separated with commas. Is there an idiom or language support for this in any language? (For now i am mostly interested in Ruby.) I...
If I am selling software commercially and I offer users free upgrade for 12 months after purchase, can I make them agree to a new licence when they download an upgrade? What should the original license say in order to stipulate this? And if I can do this, then wouldn't it be possible to put in the new license that th...
Right now creating a new service that will integrate into our company's existing platform. The service will be responsible for tracking "points" that a user can generate over time through certain activities. I am caught between two different methods of approach. I'm not sure whether to choose one of the following struc...
As a relatively new (self-taught) web developer, I've heard the terms front-end, client-side, back-end, and server-side quite often. To me, front-end and back-end were always synonymous with client-side and server-side, respectively. However, as I've begun working with MVC frameworks like CodeIgniter, I've come across...
The feature is in many different types of editing programs where a mouse click may have completely different commands to execute (using the Command Pattern) Currently I have an overarching determineClickCommand(clickFocus) function. The body essentially looked like this: var command = null; var args = null; if (cli...
I am working with MATLAB on a model reduction algorithm. It is basically a data processing pipeline. ckt = generate_ckt(ckt_properties); freq = generate_fpoints(fconfig); result = freq_dom_sim(ckt,freq); red_ckt = run_PRIMA(ckt, red_order); Each of these are potentially time consuming activities, being that the data I...
I'm building a proprietary file format for an application I wrote in C# .NET to store save information and perhaps down the line project assets. Is there a standard on how to do this in any way? I was simply going to Serialize my objects into binary and create a header that would tell me how to parse the file. Is this ...
I'm implementing a Java app that includes an Undo/Redo stack. I've noticed that some apps (such as TextEdit on Mac OS X) let you choose "Undo Typing" from the Edit Menu after typing some text. I'd like to implement that sort of thing into my app as well, but I'm having a really hard time finding guidelines about how it...
In my current job, I've been tasked with cleaning up old code a few times. Often the code is a labyrinth and the data behind it is even more tangled. I find myself combing out things into nice, neat, modular methods. Each method does one thing and does it well. That's when things start to go south... Invariably, I ...
I have a GWT website that displays some data onto the client in a tabular form. Some of the fields are editable, when any change is made the save button becomes active. There are multiple properties that may have changed, how would I go about updating them on the server? Additionally I'd like to provide an undo button ...
I'm looking for a simple definition of the concept of “client-server” I'd like something similar to this definition of state. ... That "thing/information" that you need to remember is called "state". Edit - This isn't a homework question (nor am I a student). My goal is to come up with a compact way of explaining RES...
Below is Java code. I need to cover the below function. I searched for many websites, but I still have no ideas. Is there any methods to cover the override anonymous classes? public static void addEnterListener(Text text, final String methodName, final Object callee) { text.addKeyListener(new KeyListener() { ...
I wrote the following function to validate emails for a web app I'm working on: function validate_email($email) { $valid = true; if(!filter_var($email, FILTER_VALIDATE_EMAIL)) { $valid = false; } $email_parts = explode("@", $email); if(count($email_parts) < 2) { $valid = false; ...
I don't like singletons, but I have to compromise now (but only as temporary measure). However I don't want to go completely singleton. I'd rather want to use this pattern: interface NameThisInterface { //Returns the currently centralized object. static function current(); //Centralizes the instance. function...
I am reimplementing some component and noticed that the original version has a Liskov Substitution violation. It's not all that critical, though I'd like to get rid of it in the new implementation . It is however not clear to me how to do this. I have a component defining very simple value classes used by the system. T...
How should my web application handle common errors such as incorrect password, session timeout, etc.? I have a class called Hotmail that contains various method such as login, logout etc. To illustrate the confusion, I have a login method that logs the user into Hotmail via my software. The login method returns a HttpW...
I was recently discussing with some friends which of the following 2 methods is best to stub return results or calls to methods inside same class from methods inside same class. This is a very simplified example. In reality the functions are much more complex. Example: public class MyClass { public bool FunctionA(...
Some time ago I read a kind of "rule of thumb" about the concreteness of method parameter types, return types and property types, but I just do not remember it. It said something about keep your return types as concrete as possible and your parameter types as abstract as possible... or vice versa. I don't know if it wa...
I have a web application which I want to make RESTful. Here is the structure of the app: Top level has a bunch of search screens, they are basically tabs which search different parts of database with different parameters. After the search is done we display search results in a new tab, inside this tab is a table with ...