instruction
stringlengths
34
19.9k
Our current Information System (complete with path for pictures for records stored in db) has the following specifications: A desktop application was developed in vb.net We use SQL server 2008 r2 as the database Server specs: Intel xeon processor clocking in at 2.40 ghz, 2 GB RAM and Operating system of 2008 R2 Hamach...
Let's say I have a model of some data: public class User { public String name; public String password; } And some other class to work with this User: public class ClassB { public static void saveUser(User user) { // Something } public static void saveUser(String username, String passwo...
I built a web-applicationg using struts2. Then I built a small admin interface in the same war. With time the webapp grew and so the admin-interface. Now, I'm thinking to separate the admin interface from the rest of the app in a separate war Is it a good idea ? Is there any performance benefit that I can get due to se...
I have never seen the use of "are" for boolean methods, but the use of "is" is very common. When I want to use "are" is usually because I am passing multiple variables, or a list of objects. I suppose I could rationalize my list of objects or multiple variables as one thing, such as "isSetupParametersValid", but that w...
In DOM, why is childNodes defined in the Node interface if only some node types such as Element, Document and DocumentFragement, can have childNodes? Is this considered a good design? In what cases this is admissible? I mean, isn't this like defining a radius on an interface Shape even though we know that not every Sh...
It would seem to me that the cost of having a team of developers build and maintain all the components necessary to provide routing, workflow orchestration, durability, security and the other features provided by a commercial ESB would be equivalent to, or even more than, licensing a commercial ESB. Other than up fron...
I’m working on an Eclipse plug-in project. Using this plug-in, users can create Eclipse Java projects with some specificities. For example, they can add Java classes’ names which will be saved in a file. These Java classes can be created on the src of the project or used from a jar file which must be added to the proje...
I'm just curious. If I'm a lead dev in a company of a dozens of developers is there any way I can prevent a newbie developer from creating a fat view? By fat view I mean to have an empty controller, empty model and having all database and business logic in the view along with the html/js.
I'm trying to design a web-application - and after doing a lot of reading on REST + design patterns, I'm at a loss on how to handle my requirements. I think I may be getting caught-up in all the design-patterns, but at the same time want to produce a well-architect-ed design. I have 2 major business-objects, Customer a...
I have a collection of clients on server's side. And there are some objects that need to work with that collection - adding and removing clients, sending message to them, updating connection settings and so on. They should perform these actions simultaneously, so mutex or another synchronization primitive is required. ...
I'm developing an application where I'd like to use credentials from external websites. This will be used to login with the website API and get information for the user. Example: I want to use the user Reddit's account to warn him if more than X people reply to one of his comment. How would I go about storing the use...
I don't know if this question has a simple answer or not, but I just have to ask. I'm reading this tutorial (I don't know if this is a well-known series, but it's name is 'Let's build a compiler!' by Jack Crenshaw). It's a nice series where you gradually learn how to construct a compiler (it is a learn-by-doing thing, ...
When working with git in a team using feature branches, I often find it difficult to understand the branch structure in history. Example: Let's say there was a feature branch feature/make-coffee, and bugfixing continued on master in parallel to the feature branch. History might look like this: * merge feature/make-...
I'm taking on an opportunity for a local business to develop a small, simple timesheet manager (they still record time by hand) and am currently in the planning phases. It will include basic functionality such as managing employee information, logging time worked on a weekly basis for payroll, and generating reports fo...
I've read about meta-circular interpreters on the web (including SICP) and I've looked into the code of some implementations (such as PyPy and Narcissus). I've read quite a bit about two languages which made great use of metacircular evaluation, Lisp and Smalltalk. As far as I understood Lisp was the first self-hostin...
I am currently working for a small startup. I was previously under contract, now I am working for equity (no pay). The thing is, there is not yet a signed agreement in place as the details are being worked out. I may finish development before the contract is ready. I'm not currently under any contract or agreement, so ...
I wanted to teach myself to use the TDD approach and I had a project I had been wanting to work on for a while. It wasn't a large project so I thought it would be a good candidate for TDD. However, I feel like something has gone awry. Let me give an example: At a high level my project is an add-in for Microsoft OneNote...
I have a function that takes in a set of parameters, then applies to them as conditions to an SQL query. However, while I favored a single argument array containing the conditions themselves: function searchQuery($params = array()) { foreach($params as $param => $value) { switch ($param) { case ...
Recently I have started experimenting with some of the newer W3C specifications such as WebGL and the Web Audio API that are not yet widely supported in browsers. As I want my page to look professional, I need a way to treat the unsupported browsers gracefully. Now I was wondering: Is there a standard or a guideline ...
I was browsing around wikipedia on REST, reading specifically the section on REST APIs Reading the different ways to treat elements from collections I read that POST is not generally used. How does that work in practice? When successful REST APIs are developed, when it comes to elements, does POST just not exist or re...
One of the "Service Locator" pattern drawbacks is that a caller can be misleaded about dependencies of a callee. Ok, but what if I put dependencies as generic parameters at a class level: class Node<T> where T : ISomeInterface, new() { ISomeInterface obj public Node() { obj = new T(); } } I have found a c...
I was at a company that switched us over from Hours to Story Points for our estimations. I remember it being difficult to understand it, and we all chaffed against the idea. However, once we figured out how to do it and started doing it, I think our estimations became much more accurate. We were much better able to ...
Say I have a viewmodel like this: public class EmployeeViewModel { private EmployeeModel _model; public Color BackgroundColor { get; set; } public Name { get { return _model.Name; } set { _model.Name = value; NotifyPropertyChanged(Name); } } }...
This morning I began writing a minimal chat using Java socket and threads but it took some minutes for me to experience a lot of problems in the MVC management. Currently I have 3 classes: Main, this is just the main class used for starting the Control. ChatController, I use this for managing Model and View classes (t...
Every now and then when I have a complex lambda, I do something like this: Func<SomeObject, bool> equals = o => o.ID == someID && o.Name == someName && IsAdd || ... var myList = MyThings.Where(equals).ToList(); Let's assume that the logic in equals can not be simplified. Does extracting the lambda from the linq qu...
I have rectangular regions in a plane. I want to consistently order them in a human-friendly way that a typical y-x sort won't work for. Basically I want (0,0), (1,0), and (0,1) to sort the same as (0,0), (1, -0.1), and (-0.1, 1). Ideas? From comments: The obvious answers, y-x and x-y sort, result in different order...
I'm designing a simple OO programming language. It's statically typed, compiled, and executed by a VM - similar to Java. The difference is that I don't want to have such a strong emphasis on OOP. The code itself will mostly resemble C++ (classes, functions, and variables allowed in the file scope). One of the things th...
I am trying to distribute a small PC program, but have run into a few problems. I first tried to upload it to cNet, and then to softonic, but the problem with these sites, and all that I have seen like them is that they require a direct link(which I can't get, see below). After running into that problem, I simply uploa...
I am writing an MVC4 application to track documents we have on file for our clients. I'm using code first, and have created models for my objects (Company, Document, etc...). I am now faced with the topic of document expiration. Business logic dictates certain documents will expire a set number of days past the documen...
So I've been reading a lot on RESTfull design - specifically dealing with resources. Taking the canonical example of Users, Posts, and Comments, with relationships as: Users ---(hasMany)---> Post ---(hasMany)---> Comment One may initially think to expose something like: GET /users GET /posts ...
What is the best way to provide popups that contain asp.net server controls? I am working on a .net site. I have search functionality where if someone presses a button a panel appears where they can input the search information. I would like this to be a popup instead. Normal JavaScript won't work because the controls...
If you look at XContainer.Add(object content) method you can see that id does not require content to be not null. It just does nothing in case of null. However List.AddRange(IEnumerable collection) requires instance and throws ArgumentNullException otherwise. Here author of the code decided that exception was more appr...
I am testing a resource management class that is interacting with a database or a file system, or a combination of both. I was wandering if it is the norm to test all possible permutations of read and write for all columns of a data-set when a database is involved. What I mean is: Database table of test case: +--------...
We lease an appliance to our clients (4 physical servers running 12 VMs). One of the servers exposes a website which in turn uses the other VMs. Clients have no access to the VMs or the software which runs on them. One of the reasons is that we process classified documents (and while security through obscurity is no de...
I understand that ssh keys are a cryptographically secured way of authenticating yourself to a service or to another person, but beyond that I'm frankly at a bit of a loss. What confuses me is that I see many developers mention their public key on their site, but how does one have just one key? I have a few for differe...
I'm working with a binary structure, the goal of which is to index the significance of specific bits for any character encoding so that we may trigger events while doing specific checks against the profile. Each character encoding scheme has an associated system record. This record's leading value will be a C++ unsigne...
In our work, we have several different .net applications that share a lot of base functionality. We've built these applications using a clean n-tier architecture, but we've hit that moment where we realize that we've re-implemented the same functions several different times. Obviously this violates DRY, and we would ...
The Sleeping Barber Problem is a classical synchronization problem that many of you may be familiar with or at least heard of. It's based on the premise that a barber (a thread) sleeps when there are no customers (each customer is a thread) in the waiting room (which is a semaphore). If there is someone, he cuts his ha...
Many programming languages permit natural manipulation of strings, and some languages permit the manipulations of lists too. More often then not (always?), these operations are done as procedure calls, or as member functions. Many programming languages do implement in syntax the fairly typical set {prepend, replace, ap...
I am a bit in a dilemma: Let's suppose I have a very general function and a specialization of it for convenience reasons. Let's also assume that the specialized function is used 90 per cent of the time, hence being "the common case". Should I use a shorter function name for the general case (e.g. do) and a longer one f...
Say I want to assert that a certain option menu is displayed in the front-end of a project. The menu is on screen X and I have to first select data in Y to get to X. Now, it doesn't matter at all what data I select in Y, it will always lead to X. But sometimes, depending on the data, I will get a screen Z which I can ...
I am writing a Windows Phone application which I intend to release into the public domain (the source code and releated resources, that is). My application does, however, use a few third party open source libraries (statically linking to them). Does releasing my code into the public domain make any difference regarding...
I have noticed where I work people are keen on storing information in file names, and parsing the file names. To me this doesn't seem to be especially good practice. I already see the occasional issues with scripts globbing for a file, and getting the wrong one because another file matches first.We are also discussing ...
Often I am writing a function that returns multiple values, such as a pair of coordinates: function get_coords() { return ???; } If I was using a language like Python, I would use a tuple: return (x, y) Or, in an OOP language like Java, I would create a custom coordinate class: class Coordinates { public int x; ...
It's a good practice to let a client specify the format in Web REST API: GET /api/items/123.csv However, not only GET can return some answer, but POST also can do Status: 201 Created { mgs: "Your item has created successfully", href: "/example.com/items/123" } How should URI look like for a POST (PUT or whatever...
I am sending a huge amount of data to server. Now while I have sent the data and waiting for server response, suddenly my android device gets internet connection lost. So what I used to do is, showing an alert dialog of connection lost, but at server side the data was already processed and it updated somewhere e.g. on ...
I need some help or maybe only a hint for the right direction. I've got a system that is separated into two applications. An existing VB.NET desktop client using Entity Framework 5 with code first approach and an ASP.NET Web Api client in C# that will be re-factored. It should be possible to deliver OData. The system a...
I'm sort of torn on what to do for implementation of my distributed genetic algorithm problem. I would like to be able to have nodes join and part at will and not take down the whole system. But this introduces the problem of mismatch of generations. Often times a genetic algorithm simulation is capped by a certain amo...
I have a homework problem for an Artificial Intelligence course that I am having trouble answering. Consider solving the Sudoku problem using A* search. The start state has some number of cells filled in, and the successors of each state are all legal ways an additional cell can be filled in. At any time we know...
What are the real life use cases for tagged pointers? This is mostly coming from reading about small 64-bit systems and possible uses of 64-bit word pointers. To my understanding tagged pointers are addresses which can containing extra information in bits due to possible address space on that particular architecture is...
It seems that Helgrind treats atomics the same way as normal read/write operations. So, using atomics will result in lots of false positives. I don't know exactly how ThreadSanitizer deals with atomics, but I have found a method called tsan_atomic32_load. I assume that it can distinguish between atomics and normal read...
I have a class, but every method in it should be private (apart form __init__ and __str__). Should I denote every method with a double underscore, or is that deemed bad practice?
I'm a java developer and I want to develop an android app that capture a photo and extract its bags of visual words. To extract those bags of words I use the TOP-SURF toolkit which is written in C++ I'm new to C++ development and I want to know how to develop an android app that use this toolkit I read about the NDK. ...
I've been self employed for a long time now and have recently decided that PHP development within a company is the route I'd like to go down. I had an initial interview/meeting yesterday with a potential employer and It seems like a great place to work... so I wake up today and start to do a bit more research on the co...
I have two Classes, with very similar behaviors, both from a third party library. Both needs to be populated with some value object and sent to specific queues in order for logging. Please note both of them does not have a common parent. I am scratching my head to find out ways to refactor this. Here is the sceanrio. C...
Whenever a software license reads: ... The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. Does this mean you have to include it with the executable (the version customers get) or just the source code (for the programmers)? Sorry if this is a si...
Say someone puts their code on GitHub, under the MIT license. Then I forked it and use it in my project. Then they change the license so that it has a strict license that does not give permission to modify, sell, etc... Would the new license apply to my code, since the code I have was from before they changed the lic...
I am browsing some online coding challenge online and got struck somewhere . Objective of program is to find maximum number of swaps required in sorting an array via insertion sort in efficient time the first approach that is brute force approach gives the O(n^2) complexity The next i can think of is merge sort algor...
I'm about to take on a new project for a client designing a server-side python program that will poll a number of XML streams at regular intervals and populate a Postgresql database with results. The system will basically act as an XML cacheing daemon and populate a database. That database will then be accessed by a se...
Now that Lucene supports joins (at indexing time and at querying time) can one use Lucene as a databse (a NoSQL one, with Eventual Consistency)? Note: I was pondering on that for sometime and this is an idea that comes around again and again from time to time and there are proof that on actually can do that - to some e...
Most often, in a general-purpose imperative language - semicolons as statement-delimiters are either required, or completely disallowed (e.g. C and Python). However, some languages, like JavaScript, allow you to opt out of delimiting your statements with semicolons, in favor of other delimiters (such as a newline). Wha...
I'm developing an ERD for a graduate student manager program (it's for a university class, so it's a fairly trivial implementation). In this snippet of the model, I'm trying to work out the 'application' and 'committee' entities/relationships. Basically, a committee - comprised of staff members - can be formed and ass...
tl;dr Rich Hickey describes datomic as a system which implicitly deals with timestamps associated with data storage from my experience, data is often imperfectly stored in systems, and on many occasions needs to retroactively be corrected (ie, often the question of "was a True on Tuesday at 12:00pm?" will have an inco...
We all know these fields, database admins so like to add: UserCreated & DateCreated UserUpdated & DateUpdated They need to be displayed in the UI so I want to put them in some ValueObject but I can't come up with a good name to call the class...
I see a lot of source code that uses PImpl idiom in C++. I assume Its purpose is to hide the private data/type/implementation, so it can remove dependence, and then reduce compile time and header include issue. But interface/pure-abstract classes in C++ also have this capability, they can also be used to hide data/type...
I have a PHP program running right now that is processing database rows of over 6 million. Considering the speed at which number of records have been processed so far, it looks like the whole process might take few days to complete (due to hardware limitations). I was thinking if I could make changes in the program to ...
We are currently working on using an API provided by Mercado Libre which is a maket place for selling various goods. Their APIs use OAuth 2.0 for authentication. The problem is that OAuth 2.0 as implemented by Mercado deals with the case that the Client application and the Resource owner are different entities. So if ...
I've realized that I refer to <%@ as 'angle bracket percent at' and <%$ as 'angle bracket percent dollar', But this is very clumsy. I think <%$ should be referred to as some sort of bind, I'm not 100% sure what <%@ does, and Google doesn't like that as a search term. How do programmers normal label these terms?
I'm taking a legacy classic asp project up to more modern technology (I've been working with ASP.NET MVC lately so using this concept is stuck in my mind), but I'm trying to think of how to structure the project. The idea is that the company provides a service to clients, but the service is housed on the company's web...
My course text suggests creating a 'facade' class to completely abstract the user interface from the domain layer. That is, the UI uses only basic types, and if it needs a reference to a domain object, it only knows it as an Object. To give you an idea, this is what it might look like (example in Java but could equally...
Say, I have a class A which has methods m1,m2,m3,m4,m5.... m100. I am making another simpler class B and I require only m2,m3 and m5 in B. Should I be ideally using compositions and put a reference of A inside of B and just delegate the functionality ? or I should just re-write[copy=paste] those 2-3 methods out of clas...
So I thought about this, and I don't know if it's included or not in any methodology. I think the advantages of this coding style is that, at the lowest level, the code is extremely testable, and then the integration tests should also be very easy to build. I also think this would make the code more readable and the UM...
My company wants to release the code for a Ruby on Rails demo app, which includes our own LGPL'd library code. It it legally kosher for me to state that the contents of the entire repo are released under the LGPL, although it includes "stock" Ruby on Rails files which are generated with every app, like boot.rb and appl...
I am writing a lot of software and I feel that writing good documentation is very difficult. Since I am not aware of any structured theory about software documentation I started to organise my knowledge in this field and hope that doing this will help me to break down information in sensible units and organise documen...
I'm developing a simple text editor, just to practice a little bit. I'm developing it under Linux but since I am using Qt as GUI Framework I can easily compile this on a Windows or Mac with the same code (in other words, it's cross-platform). Qt offers a function QIcon::fromTheme(). This function allows me to get the...
I am developing an RESTish web service. I think I got the idea of the difference between aggregation and composition. Aggregation does not enforce lifecycle/scope on the objects it references. Composition does enforce lifecycle/scope on the objects it contain/own. If I delete a composite object then all the objects it ...
The main language I'm interested in doing object pooling in is AS3, which is known to need it in many cases. In the past I've always made a brand new factory class for every type I was going to try to pool, the parameters of its "object-producing" function being the same as those of that type's constructor. Essential...
Recently, I've become deeply interested in Haskell. While attempting to learn new concepts (e.g. the forall keyword and ST monad) and Haskell's type system in general, I continually run into concepts from category theory and lambda calculus. So, I wonder: What other branches of mathematics are important to a strong u...
Perhaps there's a name for what I want, but I'm not aware of it. I need something similar to a LinkedHashMap in Java, but where it returns the 'previous' value if there's no value at the specified key. That is, I have a list of objects stored by an integer key (which is in units of time in my case): ; key->value 10->A ...
Primer: We have a mobile app being served by an API (written in PHP). The main point of the app is to display products from a large items table in the database, in a multitude of different configurations. Categories, suggested items, user compiled feeds, "similar to" feeds. Basically most, if not all of the display dat...
I was looking at wikipedia - Category:XML-based programming languages. Why would someone take this approach for designing a language? What are the advantages of it? I can only think of disadvantages. hard to maintain hard to read hard to write
When planning the architecture for a mid-large scale MVC web application how do you implement the layers to be as decoupled as possible and easy to test? (basically follow best practices) Let's say I'm using code first as my data access. I struggle with what to define "business logic" as, and how it is meant to interac...
I'm working on a simple in-browser 3D model constructor using THREE.js. The user picks a plane body, and adds wings, cockpit, tail etc of their choice, choosing from multiple options. I need to be able to define relationships between many bodies and many add-ons, and of course I don't want to manually have to define th...
https://stackoverflow.com/questions/10941249/separate-rest-json-api-server-and-client In light of this post, I wanted to ask questions regarding Django and specifically the implementation methods of getting one of these client side technologies to work with Django. Currently, I have a backend that is setup that uses Dj...
I have taken a small chunk of open-source code, around a hundred lines, and found that for whatever reason, I have modified it so drastically that my end result has essentially no resemblance to the original. Maybe a line or two, and a few variable names, are carried over, but the diff is just one or more big chunks of...
Is it bad coding practice/design to make a class which will only be instantiated once? I have some variables and functions that can be grouped together under a class to "look good" (for a lack of a better description) since they are somewhat related, but they can just be global variables and global functions. (Btw, I a...
I now have a Python project that is in charge of generating the simulation data and visualizing the simulation and processed data. A C++ console application is already available in my Visual Studio. The processing sequence is as follows: Python project generates the raw data into data.txt. Visual Studio C++ console ap...
I'm having difficulty finding resources on how to write programs in a functional style. The most advanced topic I could find discussed online was using structural typing to cut down on class hierarchies; most just deal with how to use map/fold/reduce/etc to replace imperative loops. What I would really like to find is ...
I am a hobbyist programmer who makes and maintains one production system, largely coded in Python, which now has to be ported to Android. I don't know Java at all. However, SL4A in Android makes Python a bit of a second class citizen re APIs, such as Google Cloud Messaging etc. However, for me, Java appears intimidati...
I have records that have dates against them and an occurring field that contains none,yearly and monthly id status note date last_updated occurring 1 open --- 01/01/2011 01/02/2010 yearly 2 open --- 05/05/2011 03/05/2011 monthly 3 open --- 06/06/2011 05/06...
I have an if/else if structure that on some cases does nothing. From the code I have seen in my career, the "empty" case is normally left out. But when I wrote my code, it just doesn't feel right to leave this case out, but to show it as a real case that simply does nothing. For example, in a case where something is do...
Say I have a variable name len in a function and several strings. Can I use this to store length of those strings one after the other or should I create separate variables? Basically this: size_t len; len = string1.size() ....//some code len = string2.size() ...//more code versus size_t str1len, str2len; str1len = str...
Whenever a new framework is released it is a given that someone somewhere will benchmark it against other available solutions. One interesting benchmark is the "Requests per second" benchmark. For example look it this benchmark: Now AFAIK Zend framework and Symfony are 2 of the biggest frameworks out there with major ...
I have developed a web application using zend framework, mysql, and other client side technologies like javascript, jquery ajax, kendo grid, and so on. I have completed development and have done several rounds of testing to make sure the functional part is correct. Now I would like to check for the vulnerabilities in ...
I wrote a Python program that has to perform some expensive spatial searches while holding lots of data in memory. I tried to improve the performance, that is tried different approaches (see my question here for example). First, and maybe not so surprisingly, I found great performance differences when running the same...
I have a php website that will be experiencing high levels of traffic in a few weeks. We scaled the servers to accept the traffic, but want some sort of fallback page in the event that something happens. Does anyone know of an easy way to implement this? My initial thought is to check for the headers when the page is r...
I would like to create a web application (meaning that will run from browser). The point is that I want to write just the UI in HTML5 + CSS + JS (or maybe even some PHP). On the other hand, I want to write the functionality of the application in C or C++. Then, I want to combine the code about the UI and functionality....
It is commonly agreed that team managers should not be scrum masters, but I am struggling to see why. For context, I am an Application Development Manager with 4 devs in a Scrum Team. I come from a Scrum Master background, and have introduced scrum to the organisation. I have built the team from scratch and made it ...
As in the question above: What the best way to wire up Entity Framework database model (context) to viewModel in MVVM (WPF)? I am learning MVVM pattern in WPF, alot of examples shows how to implement model to viewModel, but models in that examples are just simple classes, I want to use MVVM together with entity framewo...
I've been working in a relatively complex application with 10's of database tables (Aggregates, Entities/Value Objects) and applying DDD. At this point it appears to be basically DDD-Lite meaning that there are Application/Domain Services, the Domain Model (Entities, Value Objects), and Repositories. I picked up a boo...