instruction stringlengths 34 19.9k |
|---|
Could someone explain the rationale, why in a bunch of most popular languages (see note below) comparison operators (==, !=, <, >, <=, >=) have higher priority than bitwise operators (&, |, ^, ~)?
I don't think I've ever encountered a use where this precedence would be natural. It's always stuff like:
if( (x & MASK) ... |
Question
What are the possible ways to solve a stack overflow caused by an recursive algorithm?
Example
I'm trying to solve Project Euler problem 14 and decided to try it with a recursive algorithm. However, the program stops with a java.lang.StackOverflowError. Understandably. The algorithm indeed overflowed the stack... |
I am confused when I read this (regarding singleton design pattern):
How do we ensure that a class has only one instance and that the instance is easily
accessible? A global variable makes an object accessible, but it doesn't keep you from
instantiating multiple objects.
So what is the use of singleton pattern ... |
We have several years of customer data that has been collected over time. I'd guess that 95% of the data (Names, Business Names & Addresses) is in all UPPERCASE format.
The data entry tool used within our organization offers an "Export as Proper Case" function. We do not have the ability to modify this data import fun... |
The Situation
I'm currently working in project that develops several RESTful services that partly interact with each other. As an example:
Service A uses Service B
Service C uses nothing
Service D uses Service C
most of the Services use a common Utillities project.
There is NO actual code sharing between the service... |
I haven't come across this issue before and can't find it in my Schaum's Outline UML book and was wondering if someone here could help.
I'm making a use case diagram for e-commerce, and in it I want to describe that in order to add a book to your shopping basket, you have to either search products (using the websites s... |
In my opinion, one of the greatest things about Scala is its interoperability with Java and its similar syntax. One thing that I found strange is the use of the _ operator for package wilcard imports instead of the * operator that is used in Java.
Is there a technical reason for using _ instead of *? If not, then why w... |
When I remote connect to my work PC, in IE10, the juniper remote client service which is basically a plugin executed in the browser does not run. I need to turn on compatibility view to see it. My question is what exactly is happening behind the scenes in compatibility view such that such a large number of compatibilit... |
I have a company intranet that utilizes a similar set of data across many different pages and many different methods.
Speaking in generalities, is it closer to "best practice" to retrieve a large dataset and filter it for each specific page or method or retrieve many smaller specific sets of data to use? I cannot real... |
I am reading Cristopher Alexander's "Notes on the Synthesis of Form", and he is describing a solution to a problem as having good fit, when there is an absence of bad fit; we can't describe all of the qualities of good fit because it's too complex, but we can identify the bad qualities that stick out.
The complexity of... |
I am designing a flexible and extensible way to store configuration settings for users.
Database Table Design:
╔═════════════════════════════╗
║ ConfigurationItemDefinition ║
╠═════════════════════════════╣
║ ID ║
║ Name ║
║ Type ║
║ Default... |
I'm currently beta-testing an iPhone app. Right now I have sent out the first beta-test for my users and I have labeled that release as 1.0 for my testers.
Now since the testers have tested the app we have discovered some bugs that I have fixed and I'm ready to send out a new beta-test for my users. Should I label the ... |
At our company we have started outsourcing some of our development.
This has worked somewhat well. However, we are having a hard time getting them to properly use version control. They are familiar with SVN and know how to use it. However, for some reason they don't commit regularly, instead they work with 16 things s... |
Why do some object oriented languages let the programmer use primitive data types?
Aren't classes like Integer, Boolean, etc. enough?
|
I recently started using the Object aid UML generator plugin for Eclipse and noticed that by default adding of dependency relationships is switched off.
This made me wonder if in most cases they should not be shown or rather that most people don't want to show them, seeming as this is the default setting.
How do I deci... |
I read some stuff like cm bell labs but i couldn't get it all. How does it work really? What is the logic in that?
|
A little background on where this question is coming from. In my current .NET application I'm working on some features related to archiving a certain type of business entity called a "Project". Depending on the situation what has to be archived, and the exact actions involved in archiving can vary wildly. My basic idea... |
I've been using Reactive Cocoa (by GitHub), a Functional Reactive Programming API for use with the Cocoa libraries for a while now, but have just read "Out of the Tar Pit", the paper that supposedly presents the concepts behind it, and I am a little confused.
The paper presents (as I understand it) Functional Relationa... |
what is LPCTSTR and LPCTSTR-like (for instance HDC) and what it does stand for?
|
I've been working in the same software development department for a few years now. In that time, the average stay of a developer has been 6-9 months. A handful have been around for over 2 years, but the majority of our 20 or-so developers come and go at a relatively high rate.
As a result, the majority of our project... |
I have worked for various organizations many of whom call their environment that comes after the test/developer environment and before the staging and/or production environment either model or QA.
They all seem to use this term interchangeably, however, is there any technical difference or should there be a difference ... |
What is the best and most efficient way to set up two versions of the same website?
I want one version that is online and open for everyone to use but I also want a developer version where I can develop and test new things instead of doing that against the ftp.
Currently I have MAMP setup on my developing machine and I... |
I had learned that following piece of code is bad because it is obstrusive javascript and mixes presentation with logic:
<a href="" onclick="archive()">archive</a>
The best practice was to add some sort of identifier to the link element and then bound an event to it on a separate file. Something among those lines
$("#... |
I recently learned that when merging two branches in git, if there are changes on two adjacent lines git declares this a conflict. For example, if file test.txt has this content:
Line 1: A
Line 2: B
Line 3: C
Line 4: D
and in branch master we change this to
Line 1: A
Line 2: B1
Line 3: C
Line 4: D
while in branch te... |
Question:
Can a mere entry level programmer become a mid or senior level programmer working in a company as the only programmer without a mentor?
Background:
I was hired as an entry level programmer for a mid size company that does not do programming except for internally. I am regarded as a genius inside the company ... |
So I have a quick question about the linear probing method of collision resolution in hash tables. So by definition a linear probing method would look like:
while (hashTable[hash] != null)
hash = (hash(key) + step) % tableSize;
But in my case I know exactly what the table size will be, I know all the keys, so I'm ... |
I am hoping this is the correct stack exchange to be asking this, here goes.
I am building a new website whereby it implements its own custom login system. You simply register your username, email password etc. Then you're free to log in with the option of clicking "remember me" to save the hassle of logging in every t... |
I need to develop an algorithm for finding all the local maxima in a two-dimensional array: how to search for local maxima in the the most efficient way? Are there algorithms about it?
Moreover, the algorithm should be able to handle even the "flat" peaks, that is it should find the central coordinates of each peak. He... |
I am looking for an explanation on just why XML needs to be validated. I have been testing DTD's and Schema's for the past month and recently tried to find out why I am doing this. I know it makes the XML better and more Semantic but what are the overall benefits of validating XML?
|
I know there are similar questions to this one, and I've read most of them. Most of the answers to these questions are talking about "cost-effectiveness" and "time-saving" aspects of the frameworks, which are huge reasons in favor of using frameworks.
I'm a pretty new .NET developer and I'm trying to learn stuff like W... |
I'd like to know if it makes sense to divide the project I'm working on in two repositories instead of one.
From what I can say:
Frontend will be written in html+js
Backend in .net
The backend doesn't depend on frontend and the frontend doesn't depend on the backend
The frontend will use a restful api implemented in ... |
I have a Person class with a one to many relationship to Employment. A Person in the CRM can have multiple Employments (historic data).
My current REST URI for this class looks like this:
http://domain/persons GET [collection]
http://domain/persons/{id} GET [resource]
http://domain/persons/{id}/employments GET [collect... |
I' creating a client server application in which I need to update a particular database. I'm using python with MySQL. There are two options:
I use a client.py and server.py, the client.py can send data packed into JSON to the server, the server.py will handle the database and send query data back in the form of JSON.
T... |
I'm working in a small team with up to 5 (web)developers. Because our team is growing frequently and we ran into problems with multiple people working on the same code we decided to set up a VCS.
Current Situation
Currently we are working with a central development server (LAMP). So every developer works on the same co... |
I am a mathematics student and am just starting to learn about programming. I am stuck on a particular program I am trying to write for fun. I want to find an algorithm to create all possible column vectors of size N containing only ones and zeroes and combine them in one large matrix by putting all the columns after e... |
I am wondering if it is reasonable to write closed source, paid web apps in Javascript (JS MVC Frameworks like AngularJS, Backbone, Knockout, ...)? I'm concerned because in this type of frameworks you use typically a REST backend for CRUD operations and the majority of business and application logic happens in Javascri... |
I'm reading 97 Things Every Programmer Should Know, now I'm positioned in "Apply Functional Programming Principles", and there is a paragraph that says:
...A leading cause of defects in imperative code is attributable to
mutable variables. Everyone reading this will have investigated why
some value is not as expec... |
I'm maintaining an open source framework (in Python on *nix platforms if that matters) for the first time in my life. It is pretty much pre-alpha, not much more then a scientific proof of concept, yet. But it is also already used in production by another department because it is the only framework globally that approac... |
What's the most secure method of performing authentication in a single paged apps? I'm not talking about any specific client-side or server-side frameworks, but just general guidelines or best practices. All the communications are transfered primarily through sockJS.
Also, OAuth is out of the question.
|
I am stuck on the following problem. I want to find an algorithm that finds all possible permutations of a certain numbers of distinct digits and then put them in a large matrix for instance. For instance for the digits 0, 1 and 2 I want to get the matrix:
2 1 2 0 1 0
1 2 0 2 0 1
0 0 1 1 2 2
Here they are in order but ... |
Pretty straightforward, was wondering what the inspiration or precedent for the CSS 'float' concept. I'm not familiar with any other graphic APIs or other layout DSLs that use this concept, but it's such a huge part of HTML layouts. I'm curious if a previous language had a similar concept, or if 'floats' originated fro... |
I plan to get a PhD in CS, concentrating in some subfield of artificial intelligence, not sure which one at the moment. I'm looking into R&D departments in industry, but there don't seem to be too many.
For example, I have literally found hundreds of labs for the basic sciences and other engineering fields, but for CS... |
Our test automation team writes tons of automation tests for our WEB application, but it seems to me that their code is becoming way too complex and warrants that someone will test it as well.
Is there a best practice for writing these automation tests?
I'll appreciate any answer with concrete inputs from someone who... |
I know the definition of an testing oracle but to me, it seems to be overrated. I have a specification, why should I bother with thinking about oracles? I just compare what the spec wants and what the program does. Or I have the use cases, whatever. When I read about oracles in books, it looks as if it a science on its... |
Let me start with a disclaimer: I'm not the best programmer out there. I do however study I.T. and learnt a bit of Java and C.
I'm getting stuck into Python and Django + Mongoengine, I'm not going to explain it into detail as it will deviate from the original question.
While trying to understand what is happening at th... |
In projects with many use cases, it's valid to create different use case diagrams, one for each screen? Or I shouldn't guide myself on the GUI of the software to make this, why?
As a clarification, the software does already exist, and I'm just documenting it for my undergraduation final project.
|
There seems to be two major ways to set up a web server backend. You can use a LAMP stack, with the server-side code in something like PHP or Python (or Ruby or JavaScript, which don't start with a P.) These scripting languages tend to be dynamically typed, with all of the disadvantages in performance, correctness an... |
I'm designing a financial system that should grant access to data based on roles and privileges. For example, a manager can see the financial transaction of users under his domain but not information regarding other transaction. Although it's possible to implement ad-hoc I was wondering if there are patterns or guideli... |
...or, in other words: When sending a mail programmatically, do I really need to go through the hassle of setting the correct MIME type or can I just use application/octet-stream?
The mail clients I tested all do "the right thing" based on the file extension, even if the MIME type is just the generic application/octet-... |
Someone has asked me this question and I couldn't answer as I am not on the web part of development so I'm asking here.
If one has just finished college and is trying to break through into web development/web-design a portfolio of already developed projects/sites seems to be essential to me for going to interviews.
Wha... |
I have an ASP.NET MVC4 application. Suppose that I wanted to execute some code (such as emailing a user) 2 days after a user has signed up.
One way is to have code executed on every request which scans the database for users and their sign-up time and execute code based on that. This seems messy and it depends on peopl... |
When using a non-MVC service-oriented/Interactor pattern approach to decoupled system architecture, how is session state implemented?
I've been thinking of building the frontend of an application using MVC (PHP/Ruby etc.), and send messages to a command-line backend which is the actual application. Since I want the off... |
We have a large team of developers and testers. The ratio is one tester for every one developer.
We have full bug tracking and reporting systems in place.
We have test plans in place.
Every change to the product, the testing team is involved in the design of the feature and are included in the development process as mu... |
I'm looking at using Go (aka golang) for a project (a SQL database, but that mostly doesn't matter here) where performance is critical, but under low load the primary bottleneck will be I/O to disk. In this case, I think Go would be great!
Under high load or while hitting cache a lot, CPU and memory utilization will in... |
Many programmers know the joy of whipping up a quick regular expression, these days often with help of some web service, or more traditionally at interactive prompt, or perhaps writing a small script which has the regular expression under development, and a collection of test cases. In either case the process is iterat... |
Which reasoning would you follow to choose one license over another? Which literature would you expect someone to read, if he wants to make a meaningful decision about licensing?
I specifically don't go too much into detail about my current project, because I am looking to learn how to make this decision correctly with... |
Is it possible to host a long-running worker inside ASP.NET application? The worker (for it's a windows service) is reading from a queue sending messages to a WCF service.
Would it be possible to run this "light long-running worker" inside an ASP.NET application? I read about setting pool start mode to "always running"... |
I'm working on an ambitious, commercially-driven open source project* (it probably falls under Wikipedia's definition of Open Core). I'm an engineer on the project, so I don't have too much sway over all of our policies.
The majority of the code is in public projects on GitHub, and we have public mailing lists, but th... |
As an educational exercise, I am looking to implement a constraint solver from scratch. However, since the field is entirely new to me, I am at a loss of where to begin with background research.
The problems I aim to address are mostly sets of inequalities, such as a < b && b < c, where a, b, c are integers. (While it ... |
I was recently asked as an exercise to design a scalable graph.
My first intuition was how to seperate the graph and distribute it (sharding,consistent hashing..etc)
Turns out my thinking was on the wrong line, I know what scalability is, but it seems it is a bit hard to think about it pragmatically.
What is the prag... |
While solving any problem, we write algorithms. Some efficient, some not, some work, some fail. But sometimes we end up writing something which is mostly a success when we do a dry test run, perhaps, the way we frame the test data is prejudiced, but the algorithm fails in some other cases.
For some algorithms , the nat... |
I like to think I write good maintainable Java code, using best practices, design patterns and try and get good test coverage with unit tests.
Recently whilst looking for a job, I came across a couple of job adverts that have references to "scalable" code.
So, my question is, what is considered to be "scalable" code?... |
I'm using Ninject, but this is not a Ninject-specific question. I'm wondering if the advanced and flexible capabilities of the IoC container are giving me enough rope to hang myself with a bad application design.
I've got a service interface:
public interface IBuilderService {
IBuilder Create(string category, strin... |
I'm creating a website that is going to aggregate women shoes from across the web into one website. Kinda like polyvore.com does with all their products but mine is only going to be shoes. Which makes my job a lot easier but I'm still lost as to how I go about getting all the data.
I have access to 3 APIs so far. Whi... |
I was writing this code:
private static Expression<Func<Binding, bool>> ToExpression(BindingCriterion criterion)
{
switch (criterion.ChangeAction)
{
case BindingType.Inherited:
var action = (byte)ChangeAction.Inherit;
return (x => x.Action == action);
case BindingType.Exp... |
To explain what I mean, let me start with an example.
Consider a deque that supports O(logn) concatenation with another deque and O(n) addition of n elements at one end. This dequeimplements a general seq interface (or type-class, or what have you) that allows iterating over a collection.
An explicit optimization appr... |
Is there a technical name for a software project where the current and prior stable releases are both maintained?
|
I saw a video about random numbers and how the programmer in that video was talking about computers generating pseudo random numbers and that they are not really random. I knew about this.
Then he showed the decay of a radioactive material to generate random numbers where he claimed to be truly random. Is there really ... |
I'm looking for a reference to clean coding styles that I can pass to a team member.
In particular, the rule that a method should not change its return type based on an input parameter. If you need different output, use a different method.
Example:
$invoice_items = getInvoiceItems();
$total = getInvoiceItems( T... |
I'd like to create something similar to what you see here...
http://www.houzz.com/ideabooks/9424693/list/8-Beautiful-Ways-to-Work-Glass-Into-Your-Kitchen-Cabinets
If you click on the second photo down, youll notice it has a bunch of tags, linking to actual products, or just descriptions of products.
Is this done using ... |
We're thinking of using some open-source MIT-licensed software in one of our web projects (a jQuery datetime plugin).
The first line of the MIT licence is:
Copyright (c) [year] [copyright holders]
If we include the plugin as-is (without making any changes), I understand we need to include the licence with only the o... |
Are there any best approaches for refactoring a programming project that has previously been written with the static reference anti-pattern (the majority of classes refer at some point to a static bean, where all of it's variables are public.
Half-way through a class, for instance you'll see something like:
EvilClas... |
There is a new hype with the long awaited lambda expressions in Java 8; every 3 day another article appears with them about how cool they are.
As far as I have understood a lambda expression is nothing more than an anonymous inner class with a single method (at least at the byte-code level). Besides this it comes with... |
We are building an accounting web application. In our database, we store basic data about our customers, like phone number, their login informations, because these things are tied into our web application. Now we need a CRM system to do things like sending marketing mails to users who signed up, but never used the serv... |
Sometimes, I notice typos in articles (blog posts) or books in source code that appears in the body of the article. It may be an indication that the code has been manually copied and pasted (e.g. missing braces ), or that something nasty happened to the text.
How may I write an article inside the source code of a proj... |
I am trying to learn Lisp and looking at all the Lisps out there and their differences.
I see that in some implementations of Scheme, you can use square brackets interchangeably with round brackets for readability, so because they are treated the same, I assume they are still just S-expressions like everything else.
Ho... |
I couldn't understand the reason of it. I always use String class like other developers, but when I modify the value of it, new instance of String created.
What might be the reason of immutability for String class in Java?
I know there are some alternatives like StringBuffer or StringBuilder. It's just curiosity.
|
How can I say in english, that programming language can be compiled to other programming languages?
The example can be Haxe. On the website the language is decribed as "Multiplatform":
Multiplatform:
Haxe can be compiled to all popular programming platforms with its
fast compiler – JavaScript, Flash, NekoVM, PHP, ... |
One of our team member duplicates code. Code duplication causes confusion among my team members reading his code, it causes bugs down the line when the duplicated segment is fixed in one location and not the others and it bloats the size of his code-base.
I have discussed with him not to duplicate code. But he show exc... |
I've been told in previous questions that functional programming languages are unsuited for dynamic systems such as a physics engine, mainly because it's costly to mutate objects. How realistic is this statement, and why?
|
What is it called when you aren't using an MVC framework and each URL has it's own file associated with it. I want to say it's model 0 or class 0 but I haven't been able to find anything useful via Google. :-)
|
As a DBA, most SQL is submitted to my team for review. We do not have a SQL developer, so the code is frequently very, very inefficient.
Our current process is:
SQL is submitted for review right before it goes to beta
Issues are pointed out but frequently not resolved because the application has already been written ... |
I know there are some products for reverse debugging.
I am wondering that does reverse debugging mean going to one step back or starting over again up to one step back?
I've found an explanation here.
|
I've been talking to a colleague that comes from AS3 to the HTML world. He has created a small website (there are apparently no dynamic contents) following the no-flash rules for his very first time, and as if you own a hammer you tend to hammer everything, he decided to create a framework in JavaScript, so he could do... |
Because we need to keep response times low, we get tons of requests, and we need to basically process ALMOST the same data (which I'll refer to as X) each request (the inputs are different though, so we can't cache responses), we are using a technique where we grab a new copy of X every 90 seconds from the database and... |
I have been in the process of generating documentation for an upcoming project. One of the features of the data available in this project is that it will be revisioned (or at least large parts of it will be).
I came across the (as I understand it, very new) "Accept-Datetime" HTTP header. This looks absolutely perfect f... |
I mostly work in Python and Ruby, but I recently decided to learn some C so I have a better feel for how a computer actually works.
I've been wondering whether it is possible to take this even a step further. Does anyone learn machine code (whatever C is compiled into) anymore? Would I benefit from taking some time to ... |
I am creating a stored procedure that is logging some data. The data ultimately needs to end up in 2 tables. The incoming data is coming from a JSON string containing 15 parameters, and the data is then logged to the database using the stored procedure I'm writing. I would like to send the data into 1 stored procedure ... |
I currently have a database that uses Class table inheritance model. Three different tables inherit from this table. The child tables have all a FK to the parent table and the fields are properly indexed.
We hare currently having some issues at the application level because it is difficult to figure out what child tab... |
In C#/Java, the dependency inversion principle is often demonstrated by high-level classes that depends on an interface/abstraction (that it owns). Low-level classes will implement the interface, thus inverting the dependency.
I wonder, how is it applied in object-oriented languages with no interface? For example, I'm ... |
I am a beginning programmer who has written a spider application in PHP. Currently there are three parts:
1) The Spider (spider.php)
2) The Harvester (harvest.php)
3) The Configuration file (for example, craigslist_config.php)
I use the spider to search the web for items I want to buy. An item can be found on any webs... |
Programming question:
Reverse words in a string (words are separated by one or more spaces).
Now do it in-place.
What does "in-place" mean in the above context for an interpreted language like PHP or JavaScript?
|
I've seen many lists on the internet that includes many 'ities' (maintainability, scalability, portability, etc), but I'm not sure if animations, screen transitions, and similar features are functional or non functional requirements.
|
Suppose I'm building a JSON API and would like to include an endpoint that returns a list of recently created posts. Somewhere in my system is an existing Post model with the following test:
create a few posts in the db (some new, some old)
posts = Post.recent
assert that posts only contains new posts
Now I want to ... |
I am creating a web application in java where I need to mock the following flow.
When user trigger a certain process (add product to cart), I need to pass through following steps
Need to see in HTTP Session if user is logged in.
Check HTTP Session if shopping cart is there
If user exist in HTTP Session and his/her car... |
We are having a debate and I am struggling to decide which side to come down on. Basically we have an event type lets say like like this (simplified example).
public class Event
{
public virtual int EventId { get; set; }
public virtual DateTime DateTimeOccurred { get; set; }
}
Many different events in our sys... |
I was doing edit reviews on Stack Overflow and found out that people keeps correcting the word "boolean", replacing it with "Boolean" when it appears in text (but not in source code, of course). And then I found out that the spelling checker in my browser agrees with them.
Is there any rationale behind this? It seems g... |
I was having a discussion with a colleague and he bought up the topic of MVC and the use of ViewModels in ASP.NET MVC.
The discussion was that, in an n-layer architecture, the UI, Business Layer and Data Access Layer are individual assemblies/projects and ViewModels are the UI's representation of a database/business ob... |
Please tell me if:
Node.js will make our site faster!
Node.js will consume fewer server resources, we can save money!
Node.js will make us more productive!
Node.js means we can share client and server side JavaScript code.
To clarify, we're rewriting a frontend server, which will talk to our existing Ruby on Rails ap... |
I am conducting academic research on the topic of Extreme Programming and whether its practices lead to creating space for more errors and bugs in applications.
From the experiences I gathered from many, I have comments that fall on both sides. Many support it and consider it a daily necessity, with dynamics that can ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.