instruction stringlengths 34 19.9k |
|---|
Many mathematical operation (such as division, multiplication, etc.) are supposed to be computed faster when dealing with power of two numbers (C++, C#?, ...)
For instance 15 * 256 = 0x0e right shifted (fast) 8 bits = 0x0e00 = 3840
Whereas 15 * 255 = 0x0e multiplied by (slow) 0xff = 0x0ef1 = 3825
Does this kind of opti... |
I am not a professional coder, but rather an engineer/mathematician that uses computer to solve numerical problems. So far most of my problems are math-related, such as solving large scale linear systems, perform linear algebra operations, fft, mathematical optimization etc.. At smaller scale, these are best handled by... |
I'm creating a database to store words. The intended usage is to query the database to find a word matching a set of filters. E.g. if I wanted to find a word with < 10 letters, < 3 syllables, rhymes with 'at' and matches the tag 'animal', it would return 'cat', 'bat', 'wombat'...
Unnormalised, the table would look like... |
I never developed for the Cloud, and to tell you the truth I am not fully 100% sure of what Cloud is when coming down to servers and services.
I am starting to develop an App where I will need to be able to scale as needed. The App has a lot of User entries as well as file uploads. Think is as a "forum" (this is the ... |
I have several projects in my solution:
Logan.Web.DBContext defines the DbContext for the database and builds the data model
Logan.Web.Objects defines the classes that will represent the tables in the database
Logan.Web.Data defines the data layer that the application will use
LoganMVC is the actual MVC website
Obvio... |
Currently we're starting to work on a project for which we're going to need image processing libraries. The problem is some of the libraries are GPL licensed.
I'm reading through GPL licence and quite a lot of other ones (FreeImage public licence etc..) and I'm a bit confused of all the long text. So I'll ask bluntly:
... |
According to this post, we should never rely on the finalize method to be called. So why did Java include it in the programming language at all?
It seems like a terrible decision to include in any programming language a function that might get called.
|
I have an AppHarbor site where I need to do weekly updates to some of the data. I don't want to go the route of deploying an exe and adding an additional "webworker" to my site because those cost money. My thought is to add a web service/REST api service to the site so I can just call it, it will execute the "batch job... |
My group has been developing an R package to simulate plant growth (see GitHub repository). The R package uses .Call to interface with C.
We have decided that it would be worthwhile to create a standalone C library. The two key reasons are 1) to use familiar C debugging tools and 2) a large portion of the developer / u... |
I need to use some software under the AGPL to populate a database with some data. This software has a web interface, which I shall disable.
Then the data will be used "at arms length" with closed-source software by reading the database. I may also use some IPC, like datagram sockets to provide a bridge between the AGPL... |
I need to create a simple web application for track expenses, with some basic actions (user must be able to create an account and log in, list expenses, edit them, etc) with a REST API for each one, and the trick is that I need to be able to pass credentials to both the webpage and the API.
So, after some research I'v... |
I'm trying to understand the differences between a traditional interpreter, a JIT compiler, a JIT interpreter and an AOT compiler.
An interpreter is just a machine (virtual or physical) that executes instructions in some computer language. In that sense, the JVM is an interpreter and physical CPUs are interpreters.
Ahe... |
I'm writing a application that will decide the scheduling plan for a few dozen people according to their occupation (role) and availability (week day and hours).
I've used a excel spreadsheet to help solve this problem, I was then able to devise a logical and decision based approach to assign these people to shifts and... |
As I'm finishing a web development course with a few friends with whom I have worked in many projects we're aiming to begin a professional team of developers. Functions are well defined between programmers, analysts and designers, and the team shouldn't get to a much larger number than six members.
To quicken developme... |
Disclaimer: I'm not 100% sure I understand some of the practices and concepts in DDD, so this question may actually be answered by clarification of the ideas
I'm working in a legacy system (written in PHP) in which the database tool provides no object relational mapping, and thus objects coming out of the database acce... |
The GPL font exception allows the font to be embedded within a digital "document" file without requiring the "document" itself to also be shared with GPL.
Now I wonder, what is considered a "document"? If the GPL+FE font is embedded in a software to render a user interface, the software can be released with a non-GPL l... |
I have a hypothetical scenario where I need to pass data to APIs from multiple different providers, depending on the 'vendor identity' provided by one of the pieces of data.
If I have the data as objects within an enumerable parent object, what would be a good way to pass the objects to the appropriate API in a reason... |
My company has a client-side web application that we would like to open-source. We don't want to impose any restrictions on usage, except that any modifications and derivative works should contain a visible attribution, e.g. show our name and/or logo - we want it to be visible that our code is being used in the applica... |
In our working group we had a discussion on using git tags in our projects. Some people argumented pro tags and some argumented against using tags.
The crux is that we are talking about Magento projects which aren't really using version numbers, hence the tags only consist of 20140624 date references.
The pro side was ... |
I've been working for a year now in an agile project to redesign an insurance application.
I really like working in an agile environment, although management and analysts I work with still have waterfall thinking ingrained and makes it a little complicated to embrace the new paradigm shift to agile.
From a developer ... |
Assume that the source file A contains the following license notice:
"This code is Copyright 1234 by XYZ. It may be freely redistributed in its entirety provided that this copyright notice is not removed."
Can I combine it with a project B published under the GPL version 3 license? In particular, does the lack of a per... |
I am familiar with basic C pointers. Just wanted to ask what is the actual use of double pointers or for that matter n pointer?
#include<stdio.h>
int main()
{
int n = 10 , *ptr , **ptr_ptr ;
ptr = &n;
ptr_ptr = &ptr;
printf("%d", **ptr_ptr);
return(0);
}
**ptr_ptr is printing 10 but how?
|
How is testing handled within the same sprint as coding, if all or most of the coding is not done until the end of the sprint? (I'm referring to the "soup-to-nuts" development and testing of a single PBI within a sprint.)
Most of the answers I've seen online involve QA automation, but even that isn't really possible si... |
Terminology
Element/Form Element -> Fields such as text list, combo_boxes, push buttons, etc.
Problem
I have a program that is basically a fat client that interfaces into a system that keeps track of traffic lights.
In this program exists a form. The form contains several subforms. As it is right now, some of the subf... |
I'm trying to understand why the output file sizes are significantly different when using a C and a C++ compiler.
I was writing a small hello world program in C and C++, I noticed that in C version, the size of the executable was 93.7KB and in C++, the size of the same hello world program was 1.33MB. I am not sure why ... |
I am working on an application with over one million lines of code. OPTION STRICT is set to off!.
I want to set it to ON during the next work iteration. I believe the only reason OPTION STRICT should be OFF is when converting a legacy system e.g. VB6 to .NET. You should then set OPTION STRICT to ON ASAP.
Am I right ... |
How could an expert system tell following scenarios apart? How could we include some meaning of a sentence, if at all?
A machine needs 1 day to produce x units, and,
we know that two machines like the first would need 1/2 day for x units.
However, if:
a truck transports a container from a to b in 1 day,
but two... |
Currently our model, with respect to SVN and automated build, looks like
Which, as far as I know, wasn't the way SVN was meant to be used. But the process works okay from a technical standpoint. The goal is to be able to run these chains in parallel, with different people working on new features, others fixing new bug... |
I'm trying to model nWoD characters for a roleplaying game in a character builder program. The crux is I want to support saving too and loading from yaml documents.
One aspect of the character's is their set of skills. Skills are split between exactly three 'types': Mental, Physical, and Social. Each type has a list of... |
I am a beginner and am currently developing a kind of cms using PHP. The number of libraries that we can potentially use in the front end is large. I have a question about properly selecting, managing and using front end asset libraries.
I don't think just including a bunch of front end libraries like this is the bes... |
Suppose there are n lines for a hotline.
Whenever a customer calls the hotline, the call is forwarded to one of the n lines. And I want to assign percentage of calling to each of the n lines. Suppose there are two lines and one line is assigned 60% and other is 40%, the total number of calls is 10 so the first line wo... |
Is there a known standard data structure which is a hash table that resolves collisions using a binary tree?
If so what is the name of this data structure?
I imagine such a structure would be useful as it should reduce the worst case search time down to O(log(n)) compared to O(n) in a hash table, and the best case woul... |
I am currently studying the refactoring methods defined by Marting Fowler (http://refactoring.com/catalog/).
He states a tip for replacing chunks of code by a single method that does that job. So far, I agree, as we all learned about the downsides of Spaghetti-code. But the example for this rule looks as follows:
Repl... |
Having a larger WinForms application with several classes I currently pass references to several "central" objects around to function calls.
This leads to more method parameters.
Example:
public static class Program
{
private static MyCentral _central;
...
}
...
public class SomeController
{
public objec... |
When I write an unit test I usually provide a context (plain object or mocked/stubbed object) that I setup in some ways and then I can run assert statement on the context:
note: code is in pseudo-code; groovy like syntax:
test myTest() {
def o = getTestContext();
o.string = "testme"
o.number = "2"
assert o.mul... |
Say I have a list of 50 DNA sequences all of the same length (6, 8 or 16 bps/ chars).
I want to group these to sets of say 5 or 6 sequences per set.
I have some criteria that need to be met based on the sequence:
1) There has to be at least three mismatches (different characters),
ACGTAC
ACTTAT
has 2 mismatches -... |
I'm new to web development and I've started working on a project in my company that uses DJANGO. I feel it flexible to start my development straight first from the templates. I think it will be easier if I visualize things first. So my question: Is it okay to start with a template rather than starting with models first... |
In have written a function which expects the caller to pass in a configuration file like XML. Then I parse this given file and extract something which i then return.
In this function (at least) two "bad" things can happen:
The given file does not exist or is not accessible in any way
While parsing/validating the file ... |
I am developing software where each action in my entities need create tasks that will be execute in my infrastructure. When I create a task it is only records in the database. Afterwards, a windows service will execute it.
Actually, I use a Service and my Entities are Anemic, then when I change the state of my entity I... |
Background
I work in the Language Resource Center on my campus. It's a relatively small lab, and our job is to help students, not code software. Being a Computer Science student, I took the initiative to start coding useful utilities to make our jobs as lab assistants easier.
Recently, Google declared a shut-down of ou... |
I believe that the "Definition of Done" is created by the Team and the "Acceptance Criteria" is created by the Customer. Am I correct?
Can a customer define the Definition of Done to the agile team?
|
I originally asked this question on StackOverflow, but I was directed here, and I think my problem is perhaps as much conceptual as technical, so here goes.
If you’re defining a hierarchy of abstract class in C++, and then creating concrete subclasses with implementations, you could end up with abstract classes somethi... |
At work, one of my projects is mostly about taking data passed in from an external client and persisting it in a database. It's a Java enterprise app using JPA and most of our logic revolves around CRUD operations.
The majority of our bugs involve JPA in one way or another.
Example 1: If you click the save button... |
Lately I've been in the habit of "masking" Java collections with human-friendly class names. Some simple examples:
// Facade class that makes code more readable and understandable.
public class WidgetCache extends Map<String, Widget> {
}
Or:
// If you saw a ArrayList<ArrayList<?>> being passed around in the code, woul... |
I m trying to get the possible combinations of a given set of numbers say for example 123
The possible combinations would be
123
132
213
231
312
321
For this i have written a code as below -
import java.util.ArrayList;
/* Name of the class has to be "Main" only if the class is public. */
public class Main {
/**
* ... |
Should a view call a helper function?
Say I pass in data from the DB to the view. The data is a unix timestamp. Should I make a call in my view to convert it to a human readable TS or should I convert it in the controller before passing it in? OR should I make a method in the model that converts...
Looking for a "best ... |
I have a java/swing application in (hopefully good) MVC structure. Here is a overview of my model classes:
One or more workers may work at one working location and one worker may work at different working locations (not at the same time, of course). A worker may have different types of a date assigned. The working loc... |
I'm designing a library that binds to html elements on a page. In this particular case the input[type='checkbox'] will be checked if the likeItem property returns true and unchecked if the likeItem property returns false. What's the best practice for naming properties?
input { check: likeItem }
or
input { checked: like... |
Reading http://www.scala-lang.org/api/2.11.1/index.html#scala.collection.TraversableOnce:
Directly subclassing TraversableOnce is not recommended - instead, consider declaring an Iterator with a next and hasNext method, creating an Iterator with one of the methods on the Iterator object, or declaring a subclass of Tra... |
I'm working on an app which talks to a bluetooth low energy (BLE) device and exchanges customized data with it. Our team has defined the data models and there's a method that will parse the data payload and assign values to the corresponding characteristics. It works all fine until we have introduced a new firmware.
In... |
My .NET application does its work and then creates a report (an Excel worksheet). That report contains thousands of short text strings [KEY - VALUE]. So Excel worksheets suites very well, one column holds the keys and another holds the values. It's easy to examine this reports.
But because of performance issues now, I'... |
I am new to using nodejs completely, and it seems to be pretty much the go to thing for everything right now. But I program in Visual Studio, and I'm a bit confused about how this works. I will cite an example;
One task I want to do is to get a list of all the files in a directory and all of its sub-directories, and re... |
Our team has been using Git for a couple of years. I love it, after previously using Visual Source Safe, SVN and TFS. However, my manager has been getting increasingly agitated about it and is threatening to go back to SVN or TFS.
The problem is human nature: Developers forgetting to push up to the origin every day... |
Comparable questions have surely been asked before but I'd like to hear some words about my specific way of implementing Javascript classes.
Let me first start with a Javascript example taken from a real-life application I've been working on recently.
Example
PageControl= new function() {
var self= this;
// exampl... |
I am designing a REST API coupled with a service layer that takes DTOs as input and produces them as output. This works fine for most service calls where the DTO is used to access an underlying library (an embedded OLAP server) that does the work.
There is one service, however, where something seems wrong. The service... |
What is the best practice, when it comes to views' translation in MVC design pattern, in multilingual website:
Always have only one view file and translate its particular strings with a framework translation function.
Always have as many views as website supports, directly translated, one for each language, and let fr... |
I am creating app(script) that is used similar to RSS reader for specific webpage that doesn't have RSS.
So my app downloads that html page in defined intervals, checks new items and parses them into messages that are sent over network.
But my app prototype is written in Bash (Linux is my primary OS), and I was asked t... |
Often in my designs I define an abstract superclass whose subclasses will vary mostly in their values for the fields defined in the superclass.
For example, in a game I'm developing there's an abstract class Missile with a number of subclasses. Each one defines a different value for member variables such as MAX_SPEED, ... |
I've been convinced for awhile now that some strategies in functional programming are better suited to a number of computations (i.e immutability of data structures). However, due to the popularity of imperative languages, its unlikely that I will always be working on projects that are functionally implemented. Many la... |
I have a task to convert CAN protocol Driver from Basic CAN to Full CAN. The project contains CANopen stack used in it. I have initiated the study of CANopen stack.
I want to know is it necessary to study CANopen Stack and to how much depth should I study CANopen stack?
Please note- Major task is to improve the drive c... |
I am working on a project in MVC that has mobile application so one thing is clear that we have to use Web API so it can used in mobile application.
After creating API when we started to develop Web site we are confused and had discussion on whether to use API or directly access to the Business object. And we ended up ... |
In my nodejs project, I have functions like this for socketio.
socket.on('draw', function (data) {
socket.broadcast.to(socket.room).emit('draw', data);
addEvent(socket, ["draw", data]);
});
I'd like to rewrite them to something like this:
function onDraw(socket, config) {
return function (data) {
s... |
Is there any legitimate use for bit manipulation hacks in higher-level languages such as Java?
I can see them being useful in speed-sensitive low-level and computation-intensive programs, e.g. graphics processing or crypto functions. I guess that's why all collections of them are in C. However, getting to think about t... |
I've got long standing developers in my sprint team. They know the domain, they've been with the company 5+ years and as a team we have a pretty good burn down rate.
There are other sprint teams, some with equally knowledgeable developers and others with newer developers who are trying to get up to speed.
My manager is... |
I have someone who wants me to develop a game for them. I do not intend to continue developing the game after its first release (he wants me to develop it for commercial use). To make the project easy, I was thinking of using the Unity game engine. I am going to say right now, I am a kid heading into college, he wants ... |
I use Spring Framework to code my Web Service, using Dependency injection to inject a DataSource bean into the DAO bean that will be used by the Web Service. I have all the database properties(Url, Password, Username, the stuff I don't want people to see) written in the DataSource Bean XML!
I have git setup to commit m... |
From W3C Software Notice and License:
Permission to copy, modify, and distribute this software and its documentation, with or without modification, for any purpose and without fee or royalty is hereby granted
My app depends on the xml-apis 1.4.01 library that in turn includes W3C software and I need to distribute it ... |
I'm doing a J2EE web application with Struts2, MyBatis and a MySQL database, so what I want is to allow the user to be free to choose different parameters to perform a select to a table in the database.
For example, I have a Table called SALES, so I want that user to be able to select different parameters according to ... |
I came across some code recently where in many, many places, expression evaluations were being assigned to different arrays one index at a time. A psuedo-code example:
array[0] = item1[0] + item2[0];
array[1] = item1[1] + item2[1];
array[2] = item1[2] + item2[2];
or
array[0] /= variable;
array[1] /= variable;
array[2... |
It is one thing to say that agile methodologies are good in settings where requirements are poorly understood, or that significant novelty is involved. But should it be applied where outright innovation is required? If yes, how?
If what you are contemplating is unknown in the industry, or even thought to be impossibl... |
In Purescript, IO an other effects are managed with the Eff monad, and extensible effects, which are declared like this:
main :: Eff (trace :: Trace, random :: Random) {}
So if I understand well, this main declaration only allows to log to console, and generate random numbers. The trace :: Trace, random :: Random is ... |
I am new to DI and I would like to know how DI might be used to help resolve this problem.
If I have an ILatLongLocation which implements a Latitude and Longitude, then given two of these I can produce a Distance using a variety of algorithms, but I can also reasonably pick one of these as the "best" algorithm at desig... |
I've inherited some Java code which I suspect harbours some concurrency bugs when synchronizing between a thread that queries data and an IO event that updates the same data. I'm trialling a static analysis tool called ThreadSafe which indeed detects various concurrency issues (i.e. field accessed from asynchronously i... |
I am working on a multiplayer game, where a player has many storages to store items in.
Storage
Storage is the system that allows the user to deposit items, and take them back. Example of storage types:
Inventory: Same as WoW inventory, you can add items, drop items, move items from slot to slot.
Bank: Bank is what y... |
We have a job table that triggers a notification when a new job gets inserted.
Clients that can handle such jobs may subscribe to those notifications.
When a client receives a notification, he can "lock" the job, so no other client will try to process it. We have also take care of errors and if a job takes to long to p... |
I have a long list of IP addresses that show some pattern of closeness
Example:
XX.249.91.16
XX.249.91.21
XX.249.91.32
XX.249.91.160
XX.249.91.165
XX.249.92.15
XX.249.92.25
XX.249.92.51
XX.249.92.234
and sometimes a whois reveals a range like this
XX.163.224.0 - XX.163.239.255
I would like to create... |
One of the things I like about the new Apple language Swift is that it combines procedural programming with algebraic data types. What other languages do this?
|
The usual example of Data Oriented Design is with the Ball structure:
struct Ball
{
float Radius;
float XYZ[3];
};
and then they make some algorithm that iterates a std::vector<Ball> vector.
Then they give you the same thing, but implemented in Data Oriented Design:
struct Balls
{
std::vector<float> Radiuses;
... |
I have been reading a number of posts and I am leaning towards building an SOA.
My main dependencies are:
Need to support multiple clients
Need individual client environments to not effect other client environments
For example, if I want to add a text field to Client A's application, but I don't want Client B to be... |
From what I have read, K&R seems to be a good place to start learning programming in general, and C programming specifically. However, I've just started the first chapter and I have a few questions. They may be extremely simple, and I apologize if that's the case (I am new, after all) -- but your helping me answer them... |
I have created an app that manages a Data cleansing workflow. Each row imported needs to store an arbitrary number of key value pairs in addition to our standard mysql schema. The key values need to be searchable. I am using rails + mysql currently. What are my options? As of now, I am just adding a new fields to the ... |
Traditionally software build numbers fit into the format
Major
Minor
Release
Build
Where a Major version is implemented whenever there are breaking changes, Minor when new mini features are added, Release when something is published and Build each time it's built.
I find the last two digits work really well in a CI e... |
I got two classes.
busiObj(created from ancient flat files)
key(provides means to tell busiObjs apart)
key has a c'tor that takes a busiObj
public key(busiObj foo)
{
bar = foo.someThing;
[...]
}
I want to create the key in the c'tor of the busiObj
public busiObj(...)
{
myKey = new key(this);
[...]
}
... |
I'm working as a developer / architect on a software project. The project manager decided not to follow the Agile principles, but to rather have an Excel sheet with all the feature requests and their estimated (remaining) effort. I'm required to update the estimated remaining time of each feature that I'm implementing ... |
I know output to the console is a costly operation. In the interest of code readability sometimes it is nice to call a function to output text twice, rather than having a long string of text as an argument.
For example how much less efficient is it to have
System.out.println("Good morning.");
System.out.println("Please... |
I have referred What is the difference between And and AndAlso in VB.net? to understand the difference between And and AndAlso.
I am from C# background - and C# has AndAlso only - no And.. And I don't see any practical use/advnatage of And.
Is there any practical use of And in VB.Net?
Reference
Or versus OrElse
What ... |
I'm wondering if anyone knows of a language that supports automatic-evaluation.
(not sure this is the right term. so let me describe what I mean below)
For example, a program asks for an int as its input, one can give it 2 + 2, which evaluates to an int with value 4.
Of course, one can certainly make a program that acc... |
If I am planning a structure for support testing in Linux, a structure that will contain packages, such files as shell and build scripts, app configurations, DBs, sources, tests and jars for to be managed, applications for be managers, users, permissions, etc., what diagram could be used for it? Just now I am using the... |
I've got myself into a bit of a mess. I've got code coming from Main, through myMethod and down to OtherMethod. One of the parameters can be either an int or a string, which affects OtherMethod but none of the intervening methods.
public static void Main()
{
myMethod(number: 10);
myMethod(letters: "ten");
}
pu... |
Licensing question - am I allowed to use a GPL binary executable (.exe) in my copyrighted .bat script? Namely I want to use FART command line tool (find & replace text in files) in an install script for a proprietary product. Is such use actually static or dynamic type of linking?
|
Since trying to use them will cause an error what is the workaround to get the same effect as them?
My Base Class:
public abstract class IPacket
{
public abstract int Identifier { get; set; }
public abstract void Handle();
}
Child Class:
public class DoSomething : IPacket
{
public override int Identifier
... |
I'm learning about code contracts in .NET, and I'm trying to understand the idea of pure constructors. The code contracts documentation states:
All methods that are called within a contract must be pure; that is, they must not update any preexisting state. A pure method is allowed to modify objects that have been crea... |
My database is going to store words, so the Word table is the most important. The Rhyme table lists which words a particular word perfectly rhymes with. It consists of three fields:
RhymeID - primary key.
WordID - foreign key linking to Word table
Rhyme - a non key integer which refers to a different record in the Word... |
I come from a C# background before my existing role. I am developing a VB.NET app. The code I inherited had option strict set to off and all other directives set to 'None'. I have recently switched option strict on and corrected all the errors. It will take me about one day to correct all the warnings. I am trying... |
(This is question involving user experience, but I am primarily interested in the best practice technical solution to this common problem.)
There are several places in my website where users are redirected: login screens, pay walls, etc.
Sometimes these can be stacked. For example, login, then pay, then land on a part... |
I'm implementing a mechanism to notify a group of users about newly inserted blog comments.
The architecture uses the Redis Pub/Sub mechanism.
By definition, the pub/sub mechanism aims to propagate message to the right subscribers, without storing/persisting anything.
Although blog comments are obviously persisted in D... |
A lot of my security experienced friends have told me that I need to code my web applications for working under the Suhosin PHP patch, Suhosin being "an advanced protection system for PHP installations [...] designed to protect servers and users from known and unknown flaws in PHP applications". Sense stating that feat... |
For example, Objective-C, Swift and Ruby (i.e. RubyMotion) integrate with the Cocoa framework.
Is this done via linked libraries? I assume they call functions in existing binaries instead of simply recreating some common interface.
|
I was given a task to prototype a Desktop Application with the ff. requirements:
Must use javascript, nodewebkit, node.js
Must be multi platform specially Windows and OSX
Can take a screenshot of a certain area where a use can point and drag
Must be able to watch multiple directories for changes
Mostly 1,2,4 are poss... |
Moinsen,
I am somehow stucked in a design problem. Language is ANSI-C.
Lets assume we have a tinkerbox of software-modules:
one module for the logic Logic
(at least) one module doing some logging Logger
two modules, both giving a "frame" to let the program run, lets say
one with a GUI
one for commandline
...
Theref... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.