instruction stringlengths 34 19.9k |
|---|
Some higher-order functions for operating on lists or arrays have been repeatedly adopted or reinvented. The functions map, fold[l|r], and filter are found together in several programming languages, such as Scheme, ML, and Python, that don't seem to have a common ancestor. I'm going with these three names to keep the... |
In WPF's XAML, we can tell an element to fill its container like this:
<Button HorizontalAlignment="Stretch" VerticalAlignment="Stretch" />
Why is it that when we set an element to Stretch, we do it via the HorizontalAlignment and VerticalAlignment properties? Why did the WPF design team decide to take this approach o... |
I am developing an SWT application (it's basically an Eclipse plugin, so I need to use SWT). Currently my design is as follows:
Model: In model, I have POJOs which represents the actual fields in views.
View: It is a dumb layer, it contains just UI and contains no logic (not even event handlers)
Controller: It acts as... |
in iOS development, I have often seen people creating a networking module to interact with their APIs.
This module generally sits on top of a networking framework like MKNetWorkKit or AFNetWorking.
In most of the cases, It's all about sending GET,POST request and parsing the response which is in most cases JSON.
What ... |
In Ruby, I'm creating a small game development framework. Just some personal project - a very small group of friends helping.
Now I am in need of handling geometric concepts. Rectangles, Circles, Polygons, Vectors, Lines, etc. So I made a class for each of these.
I'm stuck deciding whether I should package such classes... |
I'm a Python beginner. I started programming with Python 1.5 months back.
I downloaded the Python docs and read some parts of the tutorial. I have been programming on codechef.com and solving problems of projecteuler. I am thinking of reading Introduction to algorithms and following this course on MIT opencourse ware ... |
When designing and writing documentation for a project an architecture needs to be clearly defined: what are the high-level modules of the system, what are their responsibilities, how do they communicate with each other, what protocols are used etc. But in this list, should the concrete technologies be specified or thi... |
I have the following SHA256 wrapper.
public static string SHA256(string plainText)
{
StringBuilder sb = new StringBuilder();
SHA256CryptoServiceProvider provider = new SHA256CryptoServiceProvider();
var hashedBytes = provider.ComputeHash(Encoding.UTF8.GetBytes(plainText));
for ... |
I've never thought it was necessary, but a client has requested that all webpages served to logged in users be delivered over HTTPS.
Aside from the implementation standpoint, which I don't think I'm going to pursue is there any real reason for this request ?
For clarity, the login / logout process, account settings, re... |
jQuery is a Javascript library and framework, but when we are programming
with jQuery into DOM problems/solutions,
we can practice a style quite different of programming... We can read about jQuery at Wikipedia,
The set of jQuery core features — DOM element selections, traversal and manipulation —, enabled by its sele... |
As I understand it, and I may be wrong, but GAE's remote_api allows one application to access another application's datastore. I'll be blunt I don't understand how this works. I have read the article that everyone likes to point to, but I still don't understand how you can link two applications. Can someone explain it ... |
I want to achieve a database synchronisation between my server database and a client application. The server would run MySQL and the applications may run different database technologies, their implementation isn't important.
I have a MySQL database online and web accessible via an API I wrote in PHP (just a detail).
My... |
So I am working on an MVC ASP.NET web application which centers around lots of data and data manipulation.
PROBLEM OVERVIEW:
We have an advanced search with 25 different filter criteria. I am using a stored procedure for this search. The stored procedure takes in parameters, filter for specific objects, and calculates ... |
What is a good practice to name an URL if it contains repetitive letters. For example, /info/foossite
The two s looks kind of odd and if this was access point for a Web-Service, this could lead into misspelling. In most programming languages, we have Camel notation. However, as URLs are case insensitive, we don't have ... |
In some data entry contexts, I've seen data typists, type really fast and know so well the app they use, and have a mechanic quality in their work so that they can "type ahead", ie continue typing and "tab-bing" and "enter-ing" faster than the display updates, so that in many occasions they are typing in the data for t... |
We (a contractor, actually) are implementing an off the shelf system to replace a legacy homegrown system for the core domain of the company (designing widgets). Unfortunately both systems will have to run concurrently for some time, as the product just isn't ready yet. Also, the decision was made to only migrate some ... |
I'm working on a small project (not production) where I'm needing to store enough data that something like a CSV would be inefficient to process and an SQL/MySQL server would be too much. Does .Net have any way to efficiently store several entries of data with the ability to query without having to manage and connect t... |
I have heard that a desirable quality of unit tests is that they test for each scenario independently. I realised whilst writing tests today that when you compare a variable with another value in a statement like:
assertEquals("foo", otherObject.stringFoo);
You are really testing three things:
The variable you are te... |
For 4 or fewer elements, something like this works (or at least compiles):
import scala.collection.immutable.Map;
Map<String,String> HAI_MAP = new Map4<>("Hello", "World",
"Happy", "Birthday",
"Merry", "XMas",
... |
For example, there is a common snippet in JS to get a default value:
function f(x) {
x = x || 'default_value';
}
This kind of snippet is not easily understood by all the members of my team, their JS level being low.
Should I not use this trick then? It makes the code less readable by peers, but more readable than ... |
Is there a reason why functions in most(?) programming languages are designed to support any number of input parameters but only one return value?
In most languages, it is possible to "work around" that limitation, e.g. by using out-parameters, returning pointers or by defining/returning structs/classes. But it seems s... |
In my breakdown of work I have to define work against 'Functional' and 'Non-Functional' design elements / work in my applications. I read the description from Wikipedia here: https://en.wikipedia.org/wiki/Non-functional_requirement but as typical the description did not speak exactly to me to clear up my understanding.... |
At http://www.codeproject.com/Articles/552846/Why-s-How-s-of-Asp-Net-MVC-Part-1, I read this: "You should not use Asp.Net MVC if you rely on 3rd party vendor controls for of the UI."
The author doesn't seem to say why (maybe the explanation is too subtle, or I'm too dense). Thoughts? Is it true? Why would this be?
|
I am working on a project and after arguing with people at work for about more than a hour. I decided to know what people on stack-exchange might say.
We're writing an API for a system, there is a query that should return a tree of Organization or a tree of Goals.
The tree of Organization is the organization in which t... |
In my quest to understand closures in the context of JS, I find myself asking why do you even need to use closures? What's so great about having an inner function be able to access the parent function's variables even after the parent function returns? I'm not even sure I asked that question correctly because I don't u... |
I planned to slice in backend development into to the user stories vertically.
But a backend guy on our team started to complain that this makes their work invisible.
My answer was that
at the sprint planning and review meetings we discuss backend tasks
in front of stakeholders so it makes it visible, and
maintaining... |
My customer has his own graphics designer he wants to use to style his web application we're building in ASP.NET MVC 4.
Our solution is in Bitbucket, but if he can't run it what choices do we have? I doubt he uses Visual Studio 2012.
One idea is for us to publish to our solution to a file system, send it to him, have... |
I want to write a class A that has a method calculate(<params>). That method should calculate a value using database data. So I wrote a class Test_A for unit testing (TDD). The database access is done using another class which I have mocked with a class, let's call it Accessor_Mockup.
Now, the TDD cycle requires me to ... |
I've been working on a personal closed source project for some time and would like to make it open source. I've never created my own open source project before so it will be a good learning experience. I have been using GitHub as source control, so once I've written some decent docs on how to use and develop for it etc... |
I am trying to get my head around object oriented programming as it pertains to web development (more specifically PHP).
I understand inheritance and abstraction etc, and know all the "buzz-words" like encapsulation and single purpose and why I should be doing all this.
But my knowledge is falling short with actually c... |
This question is in reference to the IEEE's CSDA and CSDP certifications.
I've already taken the CSDA course, which covered all of the knowledge areas in the Software Engineering Body of Knowledge (SWEBOK).
I'm thinking about doing the CSDP certification as well, but I can't find anywhere that tells me how it differs f... |
Assume that you are developing a functionality and are 90% sure that the implementation class will stay alone. If I was in this position in Java I would probably not use the interface right now to keep the things simple. In Java it is easy to refactor the code and extract the interface later.
In C++ the refactoring is ... |
While developing a product, I've come across a situation where my group wants to store meta data for data entry forms (questions, layout, etc) in a different database then the database where the collected data is stored. This is mostly for security because we want to be able to have our meta data public facing, while ... |
I need to fairly assign 2 experts from x experts (x is rather small - less than 50) for every n applications, so that:
each expert has the same number of applications (+-1);
each pair of experts (2-combination of x) has the same number of applications (+-1);
It is simple to generate all 2-combinations:
for (i=0; i<n;... |
I am not able to understand how bytes in memory are being mapped into a struct.
My machine is a little-endian x86_64. The code was compiled with gcc 4.7.0 from the Win64 mingw32-64 distribution for Win64.
These are contents of the relevant memory fragment:
...450002cf9fe5000040115a9fc0a8fe...
And this is the struct def... |
I have an application that runs through various tasks as an automated process.
My client would like me to create a file in a given folder for each task as a way to flag when each task completes. They prefer this to a database flag because they can be notified by the file system rather than continually polling a databa... |
While creating a 'search' form I've been faced to an overwhelming complexity and I was wondering whether there is a well-known way to accomplish such task.
Fields of the form in question can be seen here: http://developer.echonest.com/docs/v4/artist.html#search
Here are a few issues I've been faced to and tried to solv... |
From what I know, most banking applications periodically store the account balance at a certain point in time as it would not be plausible to calculate it over the entire history of transactions every time it is needed. In order to find the account balance, the application would first load the latest balance saved and ... |
We have a module in an application which stores data in multiple files and multilevel directories and access them from multiple threads (both reads and writes). The directory structure is based on a splitted hash value, like:
b1/94/6a/92/a.txt
b1/94/6a/ee/a.txt
a1/0e/db/bb/b.txt
...
If a caller removes a file the modu... |
I'm working through K&R and I notice that their code is extremely tightly spaced.
I haven't developed C since at University, but professionally most source from other languages I've worked in has used blank lines to aid readability.
Is C generally more tightly packed or is it a historical matter related to display size... |
I was looking at this thread on Stack Overflow and thinking about the functional programming I've been learning, and how immutability is so key there, and it occured to me that maybe some language has gotten the idea to have variables start out "null", then go to a "building" state, and finally become the same as any o... |
Recently the software team in my company decide to use VS2012 (upgrade from VS2008) but we found out that VS2012 does not provide a nice support for Windows XP (e.g. really hard to deploy .Net 3.5 managed C++ project).
So we want to convince our manager to drop Windows XP compatible development and and target Windows 7... |
I'm working with a team i just met.
I've been using the normal native generic php for coding up until now,
and built several webapps with it.
But a team member suggests we switch to using a framework for development.
I personally prefer going the normal way, using native generic PHP codes,
but he Suggests we use a fra... |
A project I work on uses source code that's been purchased from a third party. The source code is delivered to us in a zip file. We store this source code in version control (TFS 2010) and routinely make modifications to it.
When the third party releases a new version of the product we've purchased, I need to merge t... |
I was shocked today to discover that this code compiles cleanly in Java:
public class A {
public static class B {
private static void x() {}
}
private static class C {
private /* So, private to what exactly? */ static void x() {}
}
public static void main(String[] args) {
B.x(); C.x();
}
}
It... |
Question
Given two cloud services, Sender A & Receiver B, communicating over HTTPS, what options do I have to ensure that Receiver B only response to Sender A? For the purposes of
Background
The receiver is generating activation keys for some hardware from a serial number. Our support team is using Salesforce and we... |
I'm a developer and I have had several experiences in web application deployment which are the following:
Deploy all files then apply configuration values as appropriate to the environment. We've used this style of deployment for larger softwares with long development cycles and quick releases aren't needed or allowed... |
I've been doing TDD for a while now, I feel pretty good about it, I love my test suites and all. However I've noticed that lately I've been doing a lot of mock call verification. For example I'd have a Service that will have a Repository injected - in my unit test I'd pass a mock of the Repository and verify that it wa... |
Suppose that I have the following logical information:
(tag_name, id). For example: (food, 1),(food, 2),(food, 3),(drink, 1),(drink, 2)
I'm trying to decide what is the best way to store it in a database. I can simply use a (STRING, INTEGER) table like in the example, or a more compact (STRING, INTEGER_LIST), like so: ... |
In languages where cons lists are a major datatype, it is very easy to create a list from last to first by prepending items. When doing processing from some input file, however, one is most likely to encounter items in first to last order.
Do languages like these typically recurse?
(define (parse file)
...
(cons da... |
On software company websites I visit the first time, I often open the "Contact us" page and try to submit the contact form with all fields empty. I am just curios if they validate the user input.
If it is just submitted or only validated poorly (e.g. only Javascript validation), I often hear myself thinking
Oh, look h... |
If I abandon creating model objects which I only use to pass information and use NSDictionaries instead and have constant for keys in the same place where I am using the model, then does it have any impact on performance ?
For example: If I start passing NSDictionaries to custom cell's instead of creating Model classes... |
Our team is learning to work with MongoDB. We have to model the user among other things for an OAuth-based application. We know how to model in the relational world, but are unsure about how to do it in NoSQL.
In our application we identify the user uniquely by her email address. Email addresses are naturally unique an... |
I recently got interested in Artificial Intelligence. In my daily life I am a software engineer at a company that develops mobile apps. I am wondering what is the best way to read up on AI? What are 'must-read' books for information about AI?
|
So I've done a lot of research and found that Codecademy has been mentioned several times on other forums. I got stuck in and chose JavaScript through Codecademy most probably thinking it was 'Java' and I'm now slightly concerned that I have made a bad choice.. due to the fact that I see posts mentioning JavaScript tea... |
Which of these programming styles is better?
var result = methodOne(methodTwo(a, methodThree(b)), c, d);
or
var result3 = methodThree(b);
var result2 = methodTwo(a, result3);
var result = methodOne(result2, c, d);
|
I'm writing a web app that requires the usage of drag and drop as well as other jQuery/HTML5 features.
There are two options for saving a user's changes to a database
Implicit: database save on the end of an event, such as drop, hover, ect.
Explicit: save changes to local array and submit on submit button click even... |
I'm working in a REST JavaScript client, and I'm trying to follow the MVC pattern, but a very basic question came to my mind: who should make the http request and load the data into the model?
My intuition tells me that the controller should do it, but in lots of examples (the ember.js documentation, by example) it's d... |
I have a quite specific question regarding Subversion structure, different permission levels and Visual Studio projects and solutions: We develop a framework with external partners with functionality the partner is not allowed to see.
Consider following structure of a VS solution:
example.sln
|_ /unit1/unit1.csproj (in... |
I'm new to TFS branches, and have opted to set up a \Dev and \Main branch (ultimately there will be release branches too). I'm using TFS2012. My understanding is that I will work on the \Dev branch on a day to day basis. When a bug is fixed or a user story is completed, I will merge \Dev to \Main, build, and give that ... |
When building a REST service with the HATEOAS constraint, it's very easy to advertise the existence of resources through linking. You make a GET to the root of my site and I respond with the root document listing all the first-tier resources:
{
users: { href: "/users" }
questions { href: "/questions" }
}
Clien... |
Let's say that we have some values, represented by power of 2:
TYPE_1 = 1
TYPE_2 = 2
TYPE_3 = 4
TYPE_4 = 8
...
I need to store some of these types in one value.
Example:
To represent TYPE_1 with TYPE_3, the value is 5.
What operation is used to identify that value 5 represent TYPE_1 with TYPE_3?
|
I'm working on a .net web app project where we develop on our personal machines, but our testing and production environments are in a corporate intranet. The problem is I run into bugs that only present in the testing/production environment, but not in dev. I find this makes it really difficult to track down the cause ... |
We are porting our Java API library to C++. (Our target platforms are Linux and Windows.) Since we have minimal C++ experience, the learning curve has been pretty steep, but overall we have been able to make a clean port so far.
In Java we use log4j, and are looking at to use log4cxx in the C++ version. It took us ... |
I've read in many places (heck, I've even written so myself) that garbage collection could (theoretically) be faster than manual memory management.
However, showing is a lot harder to come by than telling.
I have never actually seen any piece of code that demonstrates this effect in action.
Does anyone have (or know wh... |
The Evercookie project has several contributors and there is no explicit license for the code. There is currently discussion on the dev mailing list trying to figure out what the licensing options are.
Is there any tool or process that can be used to find consensus among the various licenses?
What can be done if some... |
I'm reading through Mark Seeman's Dependency Injection in .NET (excellent read so far) and something is escaping me.
If the application's architecture is like [DAL] => [BLL] <= [UI], with the Business Logic Layer free of dependencies upon Data Access and UI layers (and both dependent upon the BLL), and if the compositi... |
I'm working on a new point of sale for a company that products for different prices depending on the product mix.
All products have a base price.
To explain my problem, I will use the following info:
Product Category Price
A 1 45
B 1 70
Q ... |
I'm on my first real software project following the whole SDLC and am a bit confused. We have a requirement that states something like "The battery will be monitored each second" which needs to be verified. This is something that can't really be checked in the system since it happens "inside", i.e. there's no output th... |
From what I've gathered, big O notation is used to describe the length of an operation. However, that's as far as I've gotten. What exactly is big O notation and how do the most common ones (O(n), O(2n), O(n^2), O(log n), etc)?
|
We've just finishing up the first release of a database driven web application, which is now in regression testing. The application has an advanced search with many different filtering criteria. When the search is first used with only the 3(of 28) minimum required search criteria it takes like 15-20 secs to calculate a... |
I prefer Single Page Application to server side generated HTML.
I am sensible to the pitch of "high productivity" delivered by Play.
Now if I don't use the HTML generation part, is it still valuable? Is it worthwile to learn it? For the controller (REST or other), business logic, persistence.
Does it help generating u... |
Using macros readers, it's possible to interpret JavaScript, and have it compiled just like normal Common Lisp code. Hence getting the benefits of Lisp implementations, notably their performance. Which would mean having native performance in the browser, without cheating.
Would it be technically possible to build this ... |
I'm working on an automated update system for a legacy server/client software package written in Delphi. The way I'm designing it is so the client's (customer's) server machine runs a service which...
periodically checks online for new versions
automatically downloads files
hosts latest version information for all cli... |
I need to design a DB for storing key-value data. List of Key names isn't fixed and should expand at later point.
I don't want to create a table with a column for each key, because I'll need to add columns frequently and it might grow too big, and I understood that the Entity-Attribute-Value design isn't efficient.
I t... |
I am building a GUI to interface an embedded device to a PC host. The GUI provides control over the device parameters and displays some feedback from it. The GUI also has to emulate some of the device functionality and present it to the user.
I have been advised to use a Model-View-Controller pattern, so that if the de... |
I'm working on development of SMS parking software, and I'm stuck at one point for a month... I need to implement periods of payment (or work time, of a work day, if you will). Here's the problem:
For an example, traffic wardens work from Monday to Saturday. From Monday to Friday, the work times are from 07:00 to 21:00... |
Does anyone have a diagram showing all significant programming paradigms. Something like this but with paradigms as titles would be ideal:
|
I don't know whether this is even possible or I imagine (according to my habit of over thinking) will bring through numerous issues but let me give it a go.
I have an idea where I would like a single web service which a user will send a request to, for example logging in. The response back dictates a URL where they get... |
So I'm in a little bit of a pickle. I suppose some people have gotten in my situation at some point, I know but at least as many have kept going for various reasons. To put the problem shortly; I am stuck in a project which I have after several attempts of "new fresh attitude" ended up drained out of energy and creativ... |
We have a point-of-sale system that was developed using ado.net, our current concern is to make the application real fast in creating transactions (sales). Usually there are no performance concerns with high end PCs but with with low end PCs, the transactions take really slow.
The main concern is on saving transactions... |
I had an interview few weeks back, and I was asked to write a code with Setters and Getters. I had written the following code;
// Just an example
Class ABC{
private int num;
public void setNum(int givenNum){
this.num = givenNum;
}
public int getNum(){
return num;
}
public ABC... |
So I am working on creating a Google App Engine Application, and I've come across the term "expose" a number of times, e.g. "your first app can expose objects using an HTTP based API" and "expose this datamodel class through a REST API". What does "expose" mean? Is there a particular action associated it, or is it an a... |
Would love to know your thoughts on a curriculum that will be developed for people that want to get started in the programming field. The goal of the course is to help it's students to ensure that students have an understanding of the theory and skills required to be a programmer, and have enough skills to get entry-le... |
I have a problem I was hoping I could get some advice on!
I have a LOT of text as input (about 20GB worth, not MASSIVE but big enough). This is just free text, unstructured.
I have a 'category list'. I want to process the text, and cross-reference the items in the category list, and output the categories for each mat... |
I am designing an API and am having a couple of problems with certain parts of the resource modelling.
I have the notion of a SurveyItem which as a collective form a Survey:
Survey Resource Endpoint:
http://api.somewhere.com/survey
Accessing Survey Items
http://api.somewhere.com/survey/1/surveyitems
Pretty basic and ... |
So I am still fairly new to ruby, though I have noticed that it is very hard to create 2d-array and that hashes seem to be more of the go to data structure than arrays.
I was wondering why the Ruby community is so focused on Hashes and maybe if there is something more ruby-idiomatic than a 2d-array when trying to creat... |
I want to create my own website that would allow me to acess a database in the server and do inserts and lookups in a user friendly way. I am a seasoned user of linux and C/C++, and also have experience with Python and sqlite3, but i don't have any experience in Web development, so i have no idea where to start.
I have... |
We have a 3-tier application with a C# client that connects to a C# web service via WCF and requests data from a SQL Server database.
One feature in our application is a user-created form app in which our customers setup forms that have fields. The fields refer to values that can be imported, entered by the user, or c... |
I'm trying to wrap my head around models, views, and controllers, but I feel as though the more I read, the more conflicting information I seem to encounter. I guess the general goal is--as far as I've seen--to shoot for fat models and thin controllers, but I'm still a bit baffled by where to put what. Can I give an ex... |
I have always avoided duplicating code regardless of the circumstance. For example, if I have a working piece of functionality that needs to be re-used by different entities, I always refactor to make this functionality available. Under no circumstance would I duplicate code. I am probably a little rigid when it com... |
Let's say I have
procedure1() {
--body of first procedure--
}
Then I rename it into procedure2 and create a procedure1 above it:
procedure1() {
--body of second procedure--
}
procedure2() {
--body of first procedure--
}
Not once a line-based diff tool has highlighted the code from --body of second proced... |
I'm having a funny but also terrible problem. I'm about to launch a new (iPhone) app. It's a turn-based multiplayer game running on my own custom backend. But I'm afraid to launch.
For some reason, I think it might become something big and that its popularity will kill my poor lonely single server + MySQL database.
On ... |
I've been working in the software industry for a few years now. I've seen Waterfall in practice, and I've seen several projects attempt Agile with varying degrees of success... which got me thinking.
What are the bare-minimum requirements for an Agile startup to be successful? I'm thinking in terms of tools, practice... |
I'm creating an open source PHP project that reuses other open source code instead of reinventing the wheel. I'm using composer to pull these projects into my vendor folder. What happens if these vendors delete their repository & all traces of their code from the internet? Now composer can't download the project. Shoul... |
I have VB.Net project, with a class with a couple of abstract (mustoverride) properties, that I am thinking about moving into an interface.
My question, is structurally how do I do this? Currently all of the classes that would be implementing this are derived from this base class, so it might make sense to put it in t... |
On hackernews and /r/programming I've heard several reports of how the games industry is incredibly harsh on programmers. Someone on this site also linked this blog post in an answer I read recently. According to various reports, programmers in the games industry are severely overworked. Perhaps not when working for... |
How do interpreted languages typically go about representing floating-point numbers in their bytecode? For example, suppose I've got a Java program with the line
double a = 3.0;
What does 3.0 look like in the program's bytecode? I see two possibilities:
1) Writing the bit-level representation of the in-memory number ... |
I'm not talking about countryside colleges/unis.
Are there any thought-out procedures in top-ranking institutions based on formal criteria, actual statistics or demand from the industry?
If so, what are the criteria used?
Are the decisions to drop certain languages and introduce others made systematically or in a haph... |
I see that Java has Boolean (class) vs boolean (primitive). Likewise, there's an Integer (class) vs int (primitive). What's the best practice on when to use the primitive version vs the class? Should I basically always be using the class version unless I have a specific (performance?) reason not to? What's the most... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.