instruction stringlengths 34 19.9k |
|---|
Bugs happen and sometimes data has to be fixed in production. What is the safest way to go about this from a big company standpoint? Are there tools that can help? Here are some considerations driving this requirement...
We need to log who ran the query and what they ran
Ideally we need to give the person access to on... |
I'm new to a small development company (half a dozen programmers and should grow to possibly a dozen eventually). We also have a few external contractors working with us (just to add a bit of complication).
I would like to slowly start adopting Agile, or more importantly short sprints. I was curios to know, from past... |
I first came across that algorithm as the "Random minimum cut" algorithm. And recently a colleague was trying to pack a big quantity of small textures into one image file. Then it clicked - why not use Karger for this packing problem?
I don't know a good way to map this problem to a graph defined in order to minimize t... |
I was creating a new action for a WebApi controller and tried to create a url using the following:
@Url.RouteUrl("DefaultApi", new { httproute = "", controller = "ClientApi"})
and noticed that the default route did not have an action attribute, it looks like this:
config.Routes.MapHttpRoute(
name: "DefaultApi",
... |
I need a bit of help to understand the relationship between a viewmodel and a command, and the responsibility of the viewmodel.
I'll try to give an example (using Caliburn Micro).
I have a viewmodel class, a command class and a view with a Save button.
public class EditViewModel : Screen
{
public bool CanSave
{... |
I'm currently at the beginning of a build. We are requiring a lot of back end functionality around Clients/Users/Groups/Roles.
However, these aren't required for Sprint 1 which is acting as a MVP release. But I want to ensure we are preparing for this enhanced back-end in the future.
This is easiest by defining an inte... |
My question is related with System.in and System.out classes (there might be others like those in the Standard library). Why is that? Isn't that a bad practice in OOP? Shouldn't it be used like: System.getIn() and System.getOut()? I've always had this question and I hope I can find a good answer here.
|
I'm working on an algorithm that works best if the inputs are passed to it in a particular order, so I want to sort them that way. The difference is drastic enough for me to consider re-sorting the array.
Consider an array a with length n. I want to sort it the following way, and return the array of indices of a instea... |
In Java there is a notion of "rich client platform" - it's a framework for building desktop applications, provides common features like help browser, window layout management, etc. Prominent frameworks are Eclipse and Netbeans.
Now I am curious if something like that can be done on top of web browser? I heard about XUL... |
I'm responsible for creating a presentation to management that details how a system should be refactored or rewritten. We have an existing system that has had production failures and the code base is not in a desirable state.
Here are the current possible options:
Rewrite the system using developers that provide the b... |
I have a class that inflates objects from rows found in a database (or another source, e.g. MongoDB, a CSV file, etc.). To set the object's properties, it does something like self.__dict__.update(**properties) or obj.__dict__.update(**properties).
Is this considered Pythonic? Is this a good pattern that I should contin... |
I have been going through interview questions and I saw one which made me stop and think for a while. It starts with a quote and asks about your interpretation and whether you agree or not.
"For infrastructure technology, C will be hard to displace." - Dennis Ritchie
From a bit of background reading you can find that... |
The symbols for access modifiers that I know are relevant for many different languages:
public: +
private: -
protected: #
package: ~ (or none)
However, in VB.NET there are other such access modifiers -- friend, and protected friend (these are called internal and protected internal in c#). What are ... |
I'm trying to log to a file and move it about every 30 seconds. I'm using the os.rename function (which I do from a supervisord process) in python to move the current log to a timestamped log (which will then be processed by another python script) and then I continue to log to the old stream from my uwsgi server.
I'... |
I have some perl code that uses pack and unpack to transform the data in a way that I don't understand.
$unpacked_data = pack('b*', join('', unpack('(b7)*', $packed_data)))
Where $packed_data = a Byte Array of say, 2341 bytes, and with the above perl statement, unpacks to 2048 bytes of data.
Can someone explain this s... |
Binding directly the form to your model helps a lot to get rid of boiler plate code, but that means that your model must have a getter/setter for each property otherwise it wouldn't be possible. Another choice would be to create another layer (DTO) only to carry the data to/from the form and then you can have a rich do... |
So with cqrs, we accept that consistency is eventual.
However, that doesn't mean that the user has to continually poll, or that eventual means an update has to take more then 500ms to sync.
For the sake of UX, we want to at least give the illusion of consistency, or if not possible, be as transparent as possible.
Wit... |
After reading gnat's answer to Why a static main method in Java and C#, rather than a constructor? I take his answer to mean that the purpose of a Java class with a static main method is to define a program entry point and that it is not meant to be the program itself.
There may be a better way to do this, but I usuall... |
Recently, we had a discussion about code using protected inheritance in order to hide the fact (to client code) a class inherits from a specific base class but to exploit this fact in the implementation.
The following code demonstrates this. It compiles with recent versions of GCC and clang++ (it uses C++11 features):
... |
How do you identify users when a programming pair checks in code? I heard a complaint that, often a junior dev will be at the keyboard, using his/her account, but is not going to be the best person to ask questions about the code being checked in (the more senior dev is likely to have the best answer).
Is this really a... |
I've used a software suite that is installed in offices and on remote vessels. The installations communicate back and forth, and they do that by using a simple proprietary file format that looks something like this:
/SHIP:16
MILES=45213
/ORDER:22943
STATUS=OPEN
TOTAL=447.84
URGENCY=HIGH
/ORDERLINES:22943
ITEM=3544
QU... |
I have a hobby project and it looks like there is need to have some API library (which in turn is a wrapper over existing http API) at least for two languages - JavaScript and Python, adding support to Perl would be nice as well.
The question is - what are the best practices for minifying the cost of supporting and dev... |
I have a software that reads from a file. Each object in the software takes 7 inputs viz. string string string float string float int
I have an input file. It contains a number of input values. If input for one object is like:
hss cscf "serving cscf" 32.5 ims 112.134 124
(Note: when an object's variable needs multi wor... |
I am currently refactoring an application that i built in JavaScript.
The application uses a starting hour and a total working hour count in order to construct a timetable for daily, weekly and monthly views. The starting hour and total working hour count are the same for all timetables
I considered using a pattern to ... |
I have been coding for a while, but mostly scripts and simple applications. I've moved into a new role where it is all about developing Web Apps and using a proper MVC architecture, so I am desperately trying to learn about all that very quickly.
I hope this question is not too similar to "Best Practices for MVC Archi... |
My problem is with JavaScript in the browser but I guess it could apply to any event-driven environment.
I have coded up a widget in my app. The widget allows a user to select an item using 3 different sub-widgets (table, map & gallery). The sub-widgets display the same items and a selection can be made from whichever ... |
When downloading various software packages, and executables for Windows, I always see two different types of executables to download. One just says ...32-bit and the other always says ...amd64. I know this has nothing to do with AMD, but it is referring to 64-bit operating systems, so why is this still a norm? Even lar... |
I'm currently in the process of writing a support ticket system... Let's say it's a small forum application, or something like Uservoice.
Now I want my users to be able to edit their tickets, but still be able to see the old versions of them.
Which route should I take in terms of Database-Design?
I've thought of someth... |
I have a simple console application that will be deployed as a scheduled job. Below is its pseudo code
Main(string[] args)
{
//get xml string from database
Reports reports = ReportsDB.GetReport(args[0].ToString());
//Generate xml file using xmwriter
//post the file to sftp site
}
I was wondering how ... |
In MVC the Domain Models(from Model Layer) should instantiate other Domain Models or all the Domain Models should be instantiate in the controllers and passed down using Dependency Injections?
How do you implement this in real applications? If you choose this path isn't the controller getting to fat?
|
I have a class that has 3 dependencies.
WritabbleDBConnection, ReadOnlyDBConnection and a QueryFilter utility object.
I want to do constructor Injection so my class would look something like this.
class PersonDataAccessObject {
public function __construct($dbWrite, $dbRead, $queryFilter) {
// sets to local... |
I watched Stuart Sierra's talk "Thinking In Data" and took one of the ideas from it as a design principle in this game I'm making. The difference is he's working in Clojure and I'm working in JavaScript. I see some major differences between our languages in that:
Clojure is idiomatically functional programming
Most ... |
Say you had a live video stream of a popular boardwalk that had thousands of pedestrians walk down it each day. Could software be written to count the number of people that walk by a camera and collect data on things like how many of them were wearing red clothing or how many were over 6' tall?
I'm thinking the softwa... |
How can I match two strings, but at the same time allow for X number of characters to be incorrect in the match. The number of errors should be a controllable variable.
While X number of characters can not match in the string there should be a limit as to how many run in a sequence. Given two strings I might allow 5 ch... |
[Moved here at the suggestion of SO users (10k SO+)]
I'd like to develop a peer-to-peer application. While I have a lot of experience in LOB apps, I'm new to the P2P arena.
I've got a rough idea of how things should work but need some more details to fill out my understanding.
What I know (believe) I need to do:
A sig... |
As I can see, smart pointers are used extensively in many real-world C++ projects.
Though some kind of smart pointers are obviously beneficial to support RAII and ownership transfers, there is also a trend of using shared pointers by default, as a way of "garbage collection", so that the programmer do not have to think... |
I've recently joined a company where I'm working as the scrum master on an agile development project building a web app.
The team is just about to be the maximum size for an agile team (expecting 9 next week). We have talked about potentially splitting the team into two teams, not so much to shorten standups (which ar... |
I am working on an application which is completely written using server side method in asp.net web forms with c# .
Now my team lead wants to convert whole application to ajax , in that approach we need to do the following tasks one by one .
1- Change all page methods into web methods so all will be static methods
2- ... |
I'm writing a factory class for a Selenium Web Driver and I came across a choice that I couldn't figure out which is cleaner. Having two methods with the same parameter.
GetWebDriver(string browser)
GetRemoteWebDriver(string browser)
or adding a boolean parameter
GetWebDriver(string browser, bool isRemote)
I would th... |
At the moment, like a fair few of you I'd imagine, I spend at least 40 hours working on projects that use a specific set of technologies. Sometimes I'm doing maintenance, and have those technologies enforced, and sometimes I'm doing new builds.. but have the skillset of the team enforced due to maintenance reasons (qui... |
Nearly all open source software licenses require (or at least lawyers generally suggest they require) users to include the full license in the root of the project that they are protecting.
One lawyer I spoke to suggests this is a legacy of the CD age, when it was necessary that a full license be included in a jewel cas... |
I've been hearing a lot about the "new" MV* frameworks. I've tinkered with KnockoutJS (I created an invoicing application), but I much prefer to write clean, modular code in raw JavaScript - leveraging utility APIs and other libraries when necessary.
Given a methodical/structured/SOLID approach to writing a JavaScript ... |
I've got a nice, fairly popular JavaScript library that is following Semantic Versioning.
The current library has a few dependency libraries, which are available either as separate downloads or as part of a single bundled download. I see a need to head down this path further. I want to extract additional, smaller libr... |
I have the following lines of code in my application:
return "Service is alive since: " + TimeUnit.MILLISECONDS.toMinutes(mxBean.getUptime()) + " minutes";
It uses the following package:
import java.util.concurrent.TimeUnit;
My application is a web application. Does it means that I have something wrong logically if I... |
I have a console application that is run by taking the input parameters. It can be configured by passing report name parameter, for e.g. reportgen.exe sales.xml. It hits the database and retrieves the data into xml file and sends to sftp site.
Whole of this process is logged and the xml files are being saved in a dire... |
Is there a "scientific" method to determine how much resources/money should be spent on improving the security of a piece of software?
I work in a team where our work is prioritized by a product owner (ala Scrum). The product owner is kind of sales driven and focuses on new functionality requested by customers and less... |
I have been going through various system design examples to understand how we approach any system design question.
Here is what I have understood till now.
Know the system first and find out how it works.
Think of all use case.
Identify key components and their responsibilities.
Connect all the components so that they... |
Suppose a REST API, in response to a HTTP GET request, returns some additional data in a sub-object owner:
{
id: 'xyz',
... some other data ...
owner: {
name: 'Jo Bloggs',
role: 'Programmer'
}
}
Clearly, we don't want anyone to be able to PUT back
{
id: 'xyz',
... some other data ...
owner: {
... |
Is it better to do this
#define INT_TRUE 1
#define INT_FALSE 0
int someFunctionalityIsEnabled = INT_TRUE;
or this?
int someFunctionalityIsEnabled = 1;
It can be safely assumed that false will always be zero and true will be non-zero.
|
Folks, first time on CodeReview - just looking for some input in creating some automation in CakePHP, wondering if this is best used a component or a behavior. It's model driven but involves logic and processing. Here's the scoop:
The app I'm creating requires the user to be notified when a model meets certain conditi... |
My apologies if a variation of this question has been asked before, but due to its nature it is hard to search for.
I am having a discussion with a colleague about object-oriented design, and it basically comes down to a choice between two different paradigms. What I had been searching Google for was a discussion betw... |
I have a Java application that I need to support. I'd like it to collect user information, such as system information: OS and hardware for easier diagnostics and support.
Are there any security & privacy regulations I need to follow?
Do I specifically need consent from the user to do this?
|
I am an experienced C++ developer, I know the language in great details and have used some of its specific features intensively. Also, I know principles of OOD and design patterns. I am now learning C# but I cannot stop the feeling not being able to get rid of C++ mindset. I tied myself so hard to the strengths of C++ ... |
I was thinking of creating some login code (probably to work with BrowserID so users don't need to store their passwords with my site while also ensuring the supplied email account belongs to them) which required any user accounts to be an email address in the ".name" or possibly ".me" TLD (or in any other TLD that was... |
I have experience developing software and web applications and I have decided to do some freelance work on the side. Well, I met with my first client and they are requesting a relatively simple, custom system that (without being long winded) tracks client’s paperwork as it progresses through the business’s different ma... |
I have a Java web application that supports multi-tenancy to keep customer data
separate.
Connection pools to each customer database are created at runtime. The
details of each customer shard (jdbc url, credentials, etc) are stored in a shard
"control" database. When the application needs to access a customer shard... |
While working on a project I've come up with some design solution. I am having a hard time relating it to any general design pattern or analyzing this situation in details. This is also prohibiting me to find any better design for this.
This is a simple analogy of my solution -
Both Kangaroo and Tiger can walk but only... |
As an example I want to switch from C#/.NET to Scala/Jvm. I'm working as a self-employed and I'm free to choose my favorite language/platform. Having more than 8 years of experience in C#/.NET leads me to have lots of reusable codes, libraries and framework. I can work on my projects and ideas without thinking about la... |
Why do browsers use different rendering engines, this causes the problem I hate the most "make your HTML/CSS compatible with all major web browsers".
Why don't they use one rendering engine as a standard and this will save a lot of time and effort for all developpers. In fact this is what I hate about IT industry "C... |
I am trying to figure out the best way around a small problem i have with a design for a Hypermedia API i am currently building.
I have a notion of a site, very simple doesn't have much going on and it is accesible via:
/sites
/sites/{id}
Sites have a bunch of properties and none is all too sensitive. However, a sit... |
I was reviewing some threads on Stack Overflow and started asking myself how I would design my classes and relationships to create such a system.
My Goal -
I want to build a review system like the Stack Exchange review system.
Let's take a look at how the review system works on Stack Exchange. I will only refer to the... |
In most programming languages documentation where they talk about operators +-*/=<> they also include ()[] as operators.
There are unary operators, multiplicative operators, additive operators, bit shifting operators, etc. etc.
I can find no terminology that separates parentheses operators from the rest of them. Callin... |
I was going through the Introduction to Algorithms by Cormen et al.In the chapter titled Amortized Analysis,the difference between accounting and potential methods is given like this
The accounting method overcharges some operations early in the
sequence, storing the overcharge as “prepaid credit” on specific
obje... |
I'm working on a C# project which provides users an on-demand method of importing data from various formats and then performs mail-merge-like actions to complete a template. The process works for basic data types. However, I need to add the ability to perform calculations on the existing data (which is not present in t... |
I am using several activities based on the ListActivity. All of them display information from different SQLite queries, and all of them use the ViewHolder optimization. The cursor adapter have to be specialized, and the view holder is also special for the purpose. Therefore, they are defined as private classes inside t... |
In a code review that I was doing to a coworker, I said that here:
if (someValue === 'final'){
There is no sense to use strict comparison because the only way to pass it as true is with other string value equals to final.
I think that it is enough:
if (someValue == 'final'){
His argument is that an object could have ... |
I'm a bit stuck with a problem involving the normalisation of location input data from the user (which comes from a third party).
Aim
To logically breakdown and interpret the user location input field and understand if it is listing single or multiple locations, from one or more countries.
The Problem
The type of data... |
I've been studying object oriented analysis and, so to get started with this in practice I've decided to first of all build my own management system to have my customers data and so on. Trying to gather requirements for the first time and write use cases for the first time led me to some doubts. I want to ask here abou... |
I have a script written in Ruby that has maxed out a core in my server's Xeon processor for the last 2 hours. Since it's currently only using 1 of four possible cores, I want to try and rewrite the script to take advantage of all four cores.
I can use the .each_slice(n) method on the array that contains my data, but I... |
Short version
How does the IF() function cause the passed expressions to NOT be evaluated prior to being passed in as parameters?
Detailed version
I am part of a standards committee, and a discussion was initiated which, in general, is trying to ban the use of the IIF() function. The general consensus is that if you wa... |
We're redesigning our application's plugin interface, so we're using the Adapter pattern with our proof-of-concept design to show that the new interface will function without committing to using it in the application itself.
We don't know what to call this new interface. It serves the same purpose as the old one - let'... |
Suppose that we are developing some application that requires us to be able to manage customers and that those customers can be both natural and legal person. There are some different ways on which we can deal with it and I'm not sure which of them is the best regarding extensibility, code reuse and so on.
The first th... |
I'm starting to work with agile iterative approach to software development and this question seems quite natural. After gathering the requirements I should write a few use cases to describe how the user interacts with the system while the requirements are being met. Now, how much time should we spent with this?
Should ... |
When naming a model, should the name be as generic as possible-- even if that won't be the name displayed to users?
For example let's imagine a Django model for liking another user's posts.
Does it make sense to name the model 'Like' even if I plan on displaying it as Kudos, Endorsements, Ups, etc?
Does it make sense ... |
Can anyone explain this piece of code?
CODE1
int &fun()
{
static int x = 10;
int &b =x;
return b;
}
int main()
{
fun() = 3;
cout << fun();
return 0;
}
Output: 3
CODE 2
int &fun()
{
int x = 10;
int &b =x;
return x;
}
int main()
{
fun() = 3;
cout << fun();
return 0;
}
Out... |
In light of recent revelations about widespread government monitoring of data stored by online service providers, zero-knowledge services are all the rage now.
A zero-knowledge service is one where all data is stored encrypted with a key that is not stored on the server. Encryption and decryption happens entirely on th... |
We are looking at an app that needs an upgrade. Currently it runs on iOS4, 5 & 6. The upgrade will move to iOS5, 6 & 7. It will also involve some UI changes and new features. I've been reading stuff on iOS7 and looking at things like auto-layout.
What we are trying to figure out is the best way to handle the differenc... |
My development team presently uses the following software in our workflow:
JIRA
Bamboo (Atlassian continuous integration)
Greenhopper (Atlassian agile project management)
Confluence
Git, hosted on BitBucket
Visual Studio 2012
As you can see we are quite heavily invested in the Atlassian ecosystem. We are considering ... |
I've noticed that Facebook SOMETIMES uses a hash in the url. For example, when I'm on my home page, and then I click my profile page, the URL quickly changes to:
facebook.com/#_________
followed by some other stuff.
before quickly loading to:
facebook.com/profileName
It doesn't always do this. What's going on here?... |
For our iOS app, a lot of complicated UI logic depends on the interface orientation of the ViewController. This conditional logic is present in a lot of places.
Can it be segregated into different states in form of objects?
|
I develop an open source Android application, which is licensed under GPL and freely available on Github.
It is currently under heavy development, therefore it isn't published in the Play Store yet.
What can I do, if someone decides to publish it in the Play Store,
without modifying the code (just build it from m... |
I inherited the project from a very experienced Java developer. The project is Android app and the guy who coded is is very experienced in coding regular Java apps. He introduced some file structures that I haven't come across before (I haven't coded Java apps outside Android area). I can follow the code with no proble... |
According to rules of TDD unit tests are written before production code, but what about Integration tests that exercises interaction between concrete (non mocks) wired objects?
Should they be written before unit tests or after production code just to test the "wiring" ?
Note that I'm not talking about Acceptance or fun... |
I have this script I'm working on.
What it should do is generate a new div every time I press a button and I've already done that, but those are not draggable. I think that happens because of the onLoad function but alternative do I have?
The second problem is that when I click one of the blue boxes, all of them must ... |
I'm developing my own scripting language to solve some unique challenges for a project.
The language takes source code and converts the contents into tokens, and then a command factory is used to convert those tokens into something that can be executed.
An example of a script might look like this.
accept: always;
rejec... |
Asynchronous programming seems to be getting quite popular these days. One of the most quoted advantages is performance gain from removing operations that block threads. But I also saw people saying that the advantage is not that great. And that properly configured thread pool can have same effect as fully asynchronous... |
I am trying to setup a small data-logging application under linux. The data arrives via serial port, and from there it should be pumped to logging and to graphical display.
The logging functionality is there for initialization purposes of the graphing functionality, after a reboot.
The data arrives every second and is... |
I have started to learn Javascript. From book http://eloquentjavascript.net:
There is one more arithmetic operator which is probably less familiar to you. The % symbol is used to represent the remainder operation. X % Y is the remainder of dividing X by Y. For example 314 % 100 is 14, 10 % 3 is 1, and 144 % 12 is 0. R... |
On our team, we use Git as our source control. We have several areas of code that are almost independent but have some overlap. Lately we have been discussing workflows and approaches to using source control. One complaint that comes up when I promote using a feature branch workflow is that people often run into compli... |
The company I work for is in the process of completely overhauling our current intranet site by moving it onto a Drupal framework. One area I am questioning is the number of include files we have. As it exists right now, every single .php page has a corresponding .inc page. There are .inc pages that provide certain fun... |
I'm designing the database schema for a new product feature. In my current design I have some related optional data. Rather than have nullable fields I have a separate table with a 0..1:1 relationship to the main table. I chose this design because the queries are simpler* if null data doesn't have to be taken into cons... |
One of our web applications is a page that takes in a serial number and various information is returned and displayed to the user. The serial is passed via AJAX, and based on the response, one of the following can happen -
An error message is shown
A new form replaces the previous form
Now, the way I am handling th... |
The question will sound weird as I'm not very experienced in C, C++ and ASM.
Let's say I have a hard time finding a C# managed, safe-code-only solution to solve a problem. Then I find that in 1998, some codes for (e.g.) a codec have been written in C for PPC, x86, arm, etc. This code can have 20000+ lines, and I need t... |
Currently programming a new software, I'm searching for information about protecting my concept and my source-code. I precise I'm quite new in licensing.
As I'm feeling very concerned by Open-source and sharing with the community, I'm puzzled on the other hand because I want to make some profit of my work (around 1 yea... |
Assuming a platform with no kernel mode, such as Atmel AVR, is there any difference between a device driver and a library, given that everything is user mode anyway?
I ask because I'm thinking about how I want to layer my code. It's like this:
+----------------+
| Business logic |
+----------------+
| CAN library |
... |
Is there any software which can be used to write functional and non-functional requirements?
When writing those, it is essential to:
Store the document in text format to be able to make diffs and minimize the impact on the version control,
Apply extensive formatting when creating diagrams would be an overkill,
Use dia... |
Sometimes when I start working on a project, I just can't think of a good name, or think of a good name that isn't already taken. As a result, I'll end up picking some sort of code name for the project.
My question is, how do you handle name changes in your source code once you find a real name for your project? Should... |
I am looking for an efficient way of evaluating an array of strings against a series of rules and then adding them to another array.
For example I have an array of strings:
something
a
1234
#gohere
I want to iterate through all the items in the array and evaluate them based on a series of rules. For example:
Strings... |
In most programming languages, variables do not have identifying characters like they do in PHP. In PHP you must prefix a variable with the $ character.
Example;
var $foo = "something";
echo $foo;
I'm developing a new scripting language for a business application, and my target users do not have a programming backgr... |
Here's the gist of the problem: There are multiple service providers who each have their own schedules of availability. There are multiple customers who seek their services. Customers need to be able to book a reservation time for the service but they should only be able to book times in which some service provider is ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.