instruction stringlengths 34 19.9k |
|---|
Background
One of the advantages of decoupled components in systems is that you can extend the system without having to touch the existing code.
Sometimes you don't even have to recompile the old code because you can dynamically load classes from disk like this:
clazz = Demo.class.getClassLoader().loadClass("full.packa... |
I was curious, why do we prefer byte[] array to transfer data over the network and not anything else?
Or if I am missing anything, what are the other ways to transfer the data over a network.
|
Why Redis for queuing?
I'm under the impression that Redis can make a good candidate for implementing a queueing system. Up until this point we've been using our MySQL database with polling, or RabbitMQ. With RabbitMQ we've had many problems - the client libraries are very poor and buggy and we'd like not to invest too... |
We have a generic parameter table whose important attributes are :
id number auto increment not null
domain varchar (200) not null
classification varchar (200) not null
param_name varchar (200) not null
value CLOB/text
created_by, created_date, updated etc
Here the id is unique for the table plus at the functional lev... |
I am very new to continuous integration, but I decided to give it a shot. Unfortunately I found there to be huge quantities of different tools, and each one is sizable and seems to be difficult (I am new so of course it intimidates me).
What I am looking for however is a tool that can
run my junit tests
execute my bui... |
I've been tasked to correct some issues on the backend of a large website project that has been outsourced for some time. The original developers and us are not on good terms so it's not feasible to get them involved.
The technology stack is as follows:
MySQL 5.x
PHP 5.3 (and a variety of supporting libraries)
Apache... |
I'm trying to provide a by-reference getter to a list of objects in a class. My setup looks something roughly like this:
class c_Container
{
public:
c_Item* Get(int uid);
private:
c_Item itemList[10];
}
class c_Item
{
public:
int uid;
}
c_Item* c_Container::Get(int uid)
{
for (int i = 0; i < 10; i++)
... |
Suppose I have a function that I need to call a lot, maybe a few thousand times on every mouse down or mouse move. It uses an instance of a function (class), called Transform:
function func1(a, b, c) {
var t = new Transform();
t.rotate(a);
t.scale(b, c);
return t.m[0];
}
So I'm creating thousands of new transf... |
It was suggested on my Stack Overflow question that this might be better suited to this site, so I'm cross-posting it.
I'm working on my first ground-up build of an MVC site. I have a collection of views, a collection of models, and I've tested most of my views and fixed the obvious bugs.
The last step I need to do is ... |
Let's suppose I have a code file that reads (I'll use Java-ish syntax) and it is being interpreted. Kind of like a ruby script.
class A{
int fieldName = 4;
A(){...}
void doSomething(){...}
}
A instanceOfA = new A();
A.fieldName = 7;
This is what I understand to happen when this file is interpreted.
Fil... |
I have a problem I am developing a solution for and currently I solve it with a brute force solution that checks all possibilities. It works for small numbers of bins but I'd like to work with a reasonable speed for increasing numbers, however the algorithm I use (brute force) increases in computing time in a factorial... |
I picked up some Project Euler questions today and decided to find more effective ways to Answer the questions l had already answered.
So on the question about finding the sum of the even Fibonacci terms up to 4 million; I noticed that if we had a separate sequence for the even Fibonacci terms (starting with 0 & 2 as ... |
I am working on a set implementation in JavaScript currently. This should kind of simulate generics as known from Java or C#. I need a mutable version of that (allows for adding/removing set values) and an immutable one.
My constructor signature looks like this:
new GenericSet( 'number', [ 10, 20, 30 ] );
,
// mutabl... |
In my team, we are about to start the reimplement of a service. One of the important steps to do to accomplish this is how do we ensure that we are doing it in the right way and we are not introducing new bugs.
So, what we have in mind is create a bunch of test to verify the following:
The behavior. Both services sho... |
I'm starting to introduce myself in CQRS concepts, but I get stucked with the following situation:
Supouse you have an entity that must have an unique name. In order to verify that, prior to create the entity you must make a query, thus you are verifing against the query subsystem.
But what happens if the syncronizati... |
Problem
I was just trying to debug a set of file-manipulation routines I wrote for a program I am working on. One of them kept returning an INVALID_HANDLE error.
Explanation
I figured out what the problem was. It turns out that because I provided several overloads so that I could call the function with either a file ha... |
There is something not clear for me and this is how to prevent other people read my code. The thing is that I want people create their own branches but not to view the other's branches. If someone is responsible for networking, I don't want this guy to view graphics codes. S/He must be forced to work on his branch only... |
This is not strictly related to C++ but its type system serves to illustrate the problem well.
Assume:
We have a generic template Container<T> (such as a std::vector<T>) which stores an unspecified number of elements of the same type T on the heap. Each element is allocated and deallocated via the constructor and des... |
On wikipedia it says that GDI is an API and core operating system component responsible for representing graphical objects and transmitting them to output devices.
I'm not finding much on what GDI+ actually does so I'm wondering, is GDI+ replaceable with gui frameworks like wxWidgets and GTK+ or are those frameworks ra... |
As a software engineer, we are always eager to get effective tools to boost our productivity.
And in our daily work, we are often unsatisfactory with the existing tools and would like to have better ways such as better GDB script config, Vim script and some Python script to make boring things automatic.
However, it is ... |
I have two tree data-structures that I made in C++ , and they give a response for range queries/point queries in that program. I am using Ubuntu. I need help in understanding the way to compare the performance of these two data structures (for answering the query in that program) in external memory. How can I do this?
... |
I'm writing a small C++ class, Block, to transform serialized data into a memory structure, and supply the structured data to callers through several accessor methods. I've tried to keep its scope specific and limited. The users of the class are very low-level - they, too, are very narrow in their focus and have as f... |
After learning the basics of computing simple die throwing games and calendar applications, I want to explore simple graphics - drawing and moving around geometric objects is ok to start with, eventually adding pixel graphic of course.
I've taken an introductory Java course but would rather do it in C++, Python or a co... |
Much has been said lately of continuous delivery. It does sound appealing, but runs against the grain of convention wisdom in big corporations.
Jez Humble - Continuous Delivery
Thoughtworks Presentation - Continuous Delivery - Part 1
Thoughtworks Presentation - Continuous Delivery - Part 2
Assuming the following:
Y... |
We were migrating from Java 6 to Java 7. The project is behind schedule and risks being dropped, in which case it will continue to use Java 6.
What are the specific improvements in Java 7 that we could go back to our manager with and convince him it is important to use JDK 7? Looking for bug fixes that I could highli... |
My team has about 18 members and the code is generally good, using TDD and good specifications makes for working code. But I think they abuse comments in favor of writing cleaner, more readable code.
I would like to introduce them to the concept and I'm wondering how can I do that on a larger scale without sitting with... |
When it is necessary to integrate with a web application, and an API is unavailable, is it a viable solution to simulate a web browser interacting with the web application as a real user would interact with it?
UPDATE
Some context.
Web App belongs to a vendor/partner. Their timeline for building a proper API will not m... |
I have just completed my Bachelors degree in IT field. I have deep interest in coding and really want to be a professional in it. Now, apart from college courses, I have been learning programming(C#) on my own (college level programming is too basic). Now I feel I need a little more time to be close to professional pro... |
I'm trying to come up with a sane architecture to delay a task for 24 hours. So far I've thought of:
unix cron job, but this will not be able to take the load we give it, since we will have many thousands of delayed tasks per day
Use RabbitMQ with dead letter exchange, however, this is a hack and being a hack is ridd... |
I jumped in to a project and I see that the other developers are adding a lot of logic in the setters of synthesized properties.
I understand how this works, but I think that it makes it hard to understand the flow of the program; while reading the code, whenever I see self.something = whatever, I always check if somet... |
I'm creating a simple game development framework with Ruby.
There is a node system. A node is a game entity, and it has position. It can have children nodes (and one parent node). Children are always drawn relatively to their parent.
Nodes have a @position field. Anyone can modify it. When such position is modified, th... |
It is usual for me, when doing web development, to copy attributes from my model classes to the other class that will be sent to the client. Usually, with a class that accepts a model and extracts the necessary information this is sufficient (something like a adapter I suppose), but sometimes it is not that easy.
In so... |
At the end of the answer to "Can I do ++x and x++ in Python?" on this page: http://norvig.com/python-iaq.html, you can read:
[...] I'm with my fellow Dane, Bjarne Stroustrup, on this one. He said in The Design and Evolution of C++ ``If I were to design a language from scratch, I would follow the Algol68 path and make ... |
Background
To start off, at work I work with a legacy system that, in its day, was quite spectacular, but now is ...interesting... to work with. It uses IBM (now Rocket) UniVerse as its backing database. One particular part of it that has caused some issues is its lack of data-integrity checks. By data integrity, I don... |
JVM supports so many languages other than Java like Groovy,Clojure,Scala etc which are functional languages unlike Java(I am referring to Java before Version 8 where Lambda's are not supported) that doesn't support functional capabilities.On a high level what makes the JVM so versatile that it can support both Object O... |
If I already have integration test for my program, and they all passed, then I have a good feel that it will work. Then what are the reasons to write/add unit tests? Since I already have to write integration tests anyway, I will like to only write unit test for parts that not covered by integration tests.
What I know t... |
I developed an intranet (local network) ASP.NET web project for my co-workers.
In the development process I used Chrome and Firefox and didn't test much with Internet Explorer.
The website works well with Firefox and Chrome and with IE it had major bugs.
Is it legitimate to ask the users to use Chrome or Firefox?
They ... |
I've attempted test first in Ruby on Rails using Test Unit and RSpec.
I'm wondering how to do test first in situations that are more closely tied to the OS/filesystem.
Problem: Building a USB stick of MP4 files.
Inputs:
List of mp4 file name, destination directory pairs.
List of source directories
List of destination ... |
Code Reuse as a Problem
I was thinking about this question on software delivery, and I kept coming back to the issue of repeatability and / or reproducibility. They matter, because if you don’t repeat a project then it becomes more difficult to improve the process you used to build the project. Engineering involves c... |
One year ago, I discovered the WPF technology and I developed a little application, as first experiment, to compare the content of two different directories. The content of each directory is shown in a different DataGrid.
At that time, I didn't develop the application using MVVM pattern, because it was only an experim... |
We need to define our requirements for a REST API. What are tools which aid in creating a document which will fully describe the webservice so it can be created by another entity?
|
I currently have a set of components named DataValues, ValueParsers, ValueFormatters and ValueValidators. The first one defines an abstract base class DataValue and contains a whole load of implementations. The 3 other components each define in interface similar to their name (minus the "s"), and also contain a bunch o... |
I heard the terms "application-level testing" and "system-level testing". I think I know the difference, but I am not sure. I tried to do some research on the internet, but the closest explanation of the difference that I can find is this http://en.wikipedia.org/wiki/Software_testing#Unit_testing (unit testing and syst... |
We currently have a complex VC++ software application, which uses a library like ObjectARX to build the dll. I feel there are many features in C# like Collections, Generics, and other libraries which can be used to build the current application in a better and efficient way.
I have been thinking about it, but I am not ... |
In JavaScript, every number you will ever use will always be represented with what C programmer would call a double. The official type is I believe number. If I recall correctly, that fact was mentioned by Google as a "fundamental" problem with JavaScript and one of the reason why they wanted to have clean break with D... |
The title sums it up. I'm interested to know if there exists an algorithm capable of producing variable output given identical input without relying on other sources for randomness such as DateTime.Now or a number generated from a light sensor etc. In addition, the algorithm can not be run in sequence, just two distinc... |
I have a code where I have to read some Binary files in database. I wrote a For loop that iterate over my file path array, then it call a READ function that read that file into database.
I run this code with traditional for loop everything goes smooth, but then I change the for to Parallel.For and it doesn't go smooth... |
I'm making a drawing program as my first open-source program merely to get a taste of the open-source community. To make said program, I am using Python 2.7. I'm using the following modules:
EasyGUI 0.96 - Under the 3-clause BSD license
Pygame 1.9.1 - Under the LGPL 2.1 license
All I intend to do is create a program ... |
I just joined a group of five developers (non-professionals) working on a medium sized Python framework (> 50 modules, > 10.000 lines of code). The project has no documentation whatsoever and there are no coding conventions of any kind. My job is to
get an overview of what the framework does (theoretical physics calcu... |
Let's say, I want to model an application which allows users to model class diagrams. The high level use case can be modelled as UC1:Model Class Diagram, which refines itself into UC11: Model Class, UC12: Model Connection, UC13: Model Composition, etc.
Since UC11, 12, 13 are part of UC 1, I used the include-Association... |
I am working on a new function for a ASP.NET MVC website. The execution time is quite long at present so I am considering options.
The function takes an excel spreadsheet, uploads it to the web server. It then needs to select all of the rows and using Entity Framework insert the rows in to a database. Each row matches ... |
I am using eclipse for android programming, and every here and there i see the statement, "TODO Auto-generated method stub."
I understand that these methods were generated automatically by eclipse upon creation of classes and other trigger activities but I do not understand the need to have it mentioned everywhere.
Wha... |
I was just learning about sqlite in android programming from the New Boston Travis videos and I have come across something strange:
It is said that if the database does not already exists, onCreate() method is called to create it. so far, so good.
But, if the database already exists, then onUpgrade() method is called w... |
I have a Qt application, which sends and receives messages. Messages are stored in a local MongoDB.
The application has a message list window, which shows sent, received and all messages (depending on the view). For performance reasons the application has a QList, which holds QPairs of Mongo ID and the message itself, ... |
Not only are our sprint planning meetings not fun, they're downright dreadful.
The meetings are tedious, and boring, and take forever (a day, but it feels like a lot longer).
The developers complain about it, and dread upcoming plannings.
Our routine is pretty standard (user story inserted into sprint backlog by priori... |
In order to submit a desktop application for the Windows 8 app store, you need to digitally sign any driver or .exe associated with the application. However, the application I was trying to submit contains several files that are redistributions of other companies' software, and some of these are not signed. My applicat... |
Hi I have fairly complex program that is doing computations in a quite large loop. I want to log some basic statistic about the run to be able to analyze its performance over time and vs loop number. For now I am outputting a set of numbers, about 5 or 6, each loop.
The problem is the number of loops is quite large so ... |
I was told to create two lists concerning most frequently used words from a plain text (10 Mb arbitrary texts) as monograms (for single worded expressions such as human, water, is) and bigrams (for two-worded expressions such as basketball team, united states and etc)
I am stuck here and don't know how I can go about... |
I want to built an app that it will support In-App Purchases.
In short, user will download the app (with some basic features), and he will have the ability to download extra layers (delivery content) with additional info (e.g. a recipe).
I want the content of this layer (the recipe) to be dynamic, and be downloadable... |
I am working on a set of REST APIs that needs to be secured so that only authenticated calls will be performed. There will be multiple web apps to service these APIs. Is there a best-practice approach as to where the authentication should occur?
I have thought of two possible places.
Have each web app perform the auth... |
I've run into this challenge a couple of times and I'm hoping someone can provide some references, training or advice on how to explain the difference between a Product Backlog Item and a Task in TFS.
I understand and have explained that a Product Backlog Item is the "What" and the Task is the "How". I have also expla... |
When is it okay to open-source something? If I have a big project I like to publish it, but is it looked-down-upon to publish, say, a small function?
|
I work for an organization with one developer (me) and one DBA. When I started, the previous developer had developed applications that had bad architectural practices and it was getting and more time consuming after a couple of years to add features, fix bugs as the story usually goes.
I came in and started re-writing... |
I am currently working on a collection implementation in JavaScript. I need a mutable and an immutable version of that. So what I thought of first was something like:
Collection
MutableCollection extends Collection
ImmutableCollection extends Collection.
My main issue with this is that if I want to implement more spe... |
Elgg is designing a permissions API loosely around the Activity Streams model. The user API could look (roughly) like:
function elgg_can($capability, $subject = null, $object = null, $target = null) { ... }
$capability is a string
$subject is a user object
$object is the object acted upon
$target is the context in wh... |
(On Windows 7 64 bit)...
I am looking for a program, something similar to the default Windows Terminal, what I need it to do is:
Load text from a given URL, split the code in two variables and then trigger a simple Windows command based on these two variables.
Currently I am doing this with PHP ...
<?php
$my_vars = fi... |
I'm creating a web application which on the client side consists of a Single Page Application (with Durandal) and on the server side an ASP.NET MVC site with a Domain Driven Design. The two are connected with a REST Api (Web API).
I have a relation between two entities, which on the database level is many-to-many. (Hot... |
I'm currently working on a Computer Science degree, and I want to build my own Web Server library. The problem? Every search I've done on interacting with web sites points to "Use this library that was built by someone else" - instead of explaining the basics of sending and receiving information.
I'm not asking for a l... |
Short version:
In a tree (non-binary) with many levels of children, where each node can have multiple leaves, what is the best way to tally leaves that meet a certain condition given a node?
Long, convoluted version:
Say you have Folders, which can contain more Folders. In production, my system has about 15 layers of... |
This might sound like another of those questions with "best way" or "best practice" but I couldn't find anything related that could give me some light.
The scenario... I have some ajax calls. Everything works alright. I make the calls, get the results back, change fields, values, colours. Nothing interesting here.
But ... |
In our current setup, most of our database calls are updates where we increment a key by 1.
If all one is doing is incrementing certain keys on a document (a lot) in mongodb, and there are several application servers doing so at once, does it ever make sense to somehow aggregate these increments at the application laye... |
I have a behaviour that I'd like to use in different classes. Those classes are unrelated to each other (no inheritance). I'm using AS3, where multiple inheritance is not possible.
I could use an interface but then I'd have to rewrite the same implementation every time, which is basically what I'm doing now (but withou... |
I was reading an article/interview (Language War: PHP vs. Ruby (by Jeffrey Way; Mar 2011)) by a developer for Envato using Ruby. He says, "PHP is a web framework disguised as a language."
He didn't expound on that statement, so it got me wondering if that is true, and if so how. I did a bit of research but couldn't tur... |
I'm currently doing my OCPJEA assignment.
I have to draw several sequence diagrams for the use cases presented in the documentation. One of the use cases (A) state that after some interaction, the system executes another use case (B).
I've already drawn the diagram for B, is there any way in UML2 to show inclusion, or ... |
I want to implement an in-memory datastore for a web service in Haskell. I want to run transactions in the STM monad.
When I google hash table steam Haskell I only get this: Data. BTree. HashTable. STM. The module name and complexities suggest that this is implemented as a tree. I would think that an array should be mo... |
I'm writing a library which links with modified LGPL library,so two questions:
Do I have to make my code LGPL in case of static linking with LGPL library?
in case of dynamic linking?
|
I deploy an interactive software using Java Web Start. This is a quiet useful deployment technology and I don't want to change. Besides I am about to publish my software under a GNU GPL license.
Usually, when a user installs a new software he is asked to read the license terms and accept it. Is there any equivalent pr... |
I want to make a simple game similar to the choose-your-own-adventure books. The player is presented with a narrative text and gets to choose his action from a list of possibilities. This, in turn, leads to a new narrative text, ad infinitum. The only catch is that depending on some previous decisions, the list of poss... |
I have some experience in building PHP based websites with MySQL access, storing encrypted user details, but all other fields being plain text. My most recent project will require sensitive data to be stored in the database. All of which I'm hosting myself.
I want to set up a system where a user can access his own entr... |
I'm using a BSD-2 Licence code in my project and with author permission, I modify the code. Now, I am using this code in my project. I know, I should mention Author's name and copyright information. Should, I mention What I modify in this code??
|
My software composed of an EXE and dependent class library dlls, built on Windows using visual studio C# Compiler.
I've been able to run it directly on Mac OS X using mono myApp.exe without rebuilding.
Now, for the deployment, I've successfully made mono bundle using mkbundle with --deps option for all dependent class ... |
We "use" JIRA as our ticketing system, but "use" is a real stretch. We have no standards, no templates, no "best practices" documentation for writing a proper JIRA ticket. So I'm spearheading the movement to create such a doc.
It's bad. Real bad. Sometimes, the reporter just copies-n-pastes a stacktrace and submits the... |
This is how I roll with git:
I clone/fork something locally
I create a new branch devel. This is supposed to be a quickfix branch. It is also supposed to be parent to all branches.
I create a topic branch (say make a new theme lex)
I actually create a few more child-topic-branches (say lex.th2) to test/see different ... |
I am writing a RESTful service in Java, of course it's typical HTTP based interface.
I am wondering should the service provide Java interface which has same semantic to the RESTful interface? I think Java interface will ease other Java code to call the service. (Client Java code doesn't need to use HTTP client to trigg... |
I'm trying to document a piece of software I wrote in detail. An SAS is too high level and doesn't cover the API. I found several examples of an SDS online, but I don't see a trend in their format.
I'm wondering if there are some general guidelines to writing a Software Design Specification or what the best approach is... |
From what I've seen of Prolog, it seems as if it would be ideal for crafting a rule engine for an app. Yet, I don't believe I've ever seen a rule engine written in Prolog. Is there some inherent limitation in Prolog (e. g. poor garbage collection algorithm) that would prevent it from being used to build a rule engine... |
Is there any advantage / is it a bad practice in Java to do the below
x = x = 5
I saw it in one of my peers code and I was surprised why he would do double assignment?
Is this something that is same as x = 5 or if x = x= 5 makes a difference?
|
Sample situation: A team of Java developers starts an iOS project. Only one developer has Objective-C/iOS knowledge, and in the beginning he will work on this project alone.
How we can perform code reviews in this situation? What are processes, approaches, tools that this developer will use?
|
I have been programming for a while, and the edge that I am missing over other programming is algorithms. I know what is linked-list and binary tree, but I dont know many more of them.
I failed on 2 interviews, because of exercises that demanded me to know some data structures algorithms. I am also starting to build a ... |
I want to draw a UML diagram of my program. Class Barney has a method Yabadaba(Doo d) which takes a parameter of type Doo.
How do I represent that class Doo is used in class Barney in my UML diagram?
|
The third party login is excellent function that has come in recent years that relieves the load on a programmers mind so that I have to remember less useless passwords.
I don't use the same password for many sites, I use an algorithm: for instance if I make a password for StackOverflow its name starts with S so I'll ... |
Given a project architecture as follows, where each box represents an assembly (all are class libraries), and each arrow stands for a dependency:
Might be worth nothing that this project is massive (well, it will become!), the complexity incurred by such decoupling is absolutely warranted.
Business Logic Layer
The BLL... |
One of the fundamental ways of handling user login authentication & session management is by storing variables in Session space plus setting some data in cookies on client computer while sometimes in database as well.
I have been using this simpler technique in many of my academic as well as a few online projects. But ... |
I am trying to develop a selenium application (using c# win forms). So, while the application starts, the users will enter an app name in the text box. I have many fields such as cost, validity etc corresponding to each app.
Example webpage:
description appname cost validity xyzattribute
---------------------------... |
We have some problems figuring out how to mock complex data and operations on it.
First the problems with generating complex data:
In one of our components we have really complex data structures where the logic of our classes is executed. Unfortunate there are some bugs, where it is necessary to use a big data model to... |
I checked all the relevant question's of my query and their answer's but my questions aren't exactly listed anywhere.
Basically i have just one year of web development experience using joomla , HTML , PHP etc.I have had .NET Training during my academics and now i have a requirement for a professional type .NET web appl... |
Compared to other serialization languages, one of the main criticisms directed at XML is its verbosity; JSON's more terse and readable for most cases, but not all.
But it seems to me that we could cut a lot of the excess from XML simply by stripping away the names from the closing tags. With proper indentation readabil... |
We maintain an API that as part of its purpose makes a call to an external API. This external API takes a few seconds to fulfil the request we make to it. With our current architecture the request is made synchronously, meaning that the http response we return to the user request is blocked until our service get the re... |
I've got a little problem in choosing the best design.
I have some (5 at the moment) image processing operations in my coe (Java). Every processing step independent from the other ones and consoists of a small amount of code, 5-15 lines in general. These are mostly wrappers to JAI, AWT and so on.
My current design is a... |
I have an android app idea, I want to make the app along with a few batch-mates in my collage.
(1) How do I make sure that these guys will not compromise the intellectual properties involved? In the sense that they will not leak out confidential information, new theories, new ideas, new features descriptions either fr... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.