instruction stringlengths 34 19.9k |
|---|
I am currently building a Web application using a LAMP stack that relies on Javascript on the front end. As the app grows and expands, I naturally plan to expand and change the javascript files. I'm concerned that many of our users' computers will cache the files (which I usually want) but I want to be proactive to mak... |
I'm in the process of developing a scalable proxy (Linux/C/C++, Nginx modules or custom HTTP server) handling incoming HTTP requests, and re-routing them to others locations based on parameters included in the incoming request itself (IP, time for example) or external factors (hence the use of an Nginx module able to r... |
I have three classes that work together to do one function (from the perspective of the rest of my program). There is a little bit of set up between them, so, to make it easier for the rest of my program, I grouped them into:
ListManager: object, which initializes them to the right values when it is constructed. The t... |
I get how multiple processes can run on a single core by interleaving the processing. What I don't understand is how the operating system ensures that the program releases the processor after a certain amount of time. If only one program can run at a time, and the os allows a process to run, what's to prevent that proc... |
According to the ECMAScript spec the integer part of a decimal number should be either zero or start with a non-zero digit. A hexadecimal value should start with 0x.
Javascript, in the major browsers, extends EMCAScript to include octal numbers. These are determined by having a sequence of digits (from 0 to 7 inclusive... |
I am creating a new project from scratch and have decided to use a 3-layer model.
I am using:
the 1st layer for business entities,
the 2nd layer for business logic,
and the 3rd layer for data logic layer.
Do I need to create different projects for these different layers or do I need to create different folders in one... |
Is that correct that a mutex object in Linux cannot be used for cross process synchronization as opposed to its Windows counterpart?
If that is true - what was the idea to limit mutex synchronisation functionality on Linux?
|
I have a book which mentions:
"There are many types of testing, including unit testing, integration testing, functional testing, system testing, performance testing, and acceptance testing".
It is often noted that many developers carry out unit-testing only, or no testing at all. From the types of testing above, whic... |
Is it looked down upon or bad to write multiple variable declarations on the same line? As in:
boolean playMoreGames = true; int length;
boolean win; int bodyparts;
boolean contains; char blank = '-';
String word; Scan... |
According to this answer every object in Java is of the same size? Is the answer talking about the object itself or the reference to the object?
Here's the statement:
every object size is rounded to 16 bytes in Hotspot, so an object with
a single byte field will take up precisely the same space as a single
object ... |
In the interest of keeping my Controller's skinny, I put a headline method in a Model.
# My Model
class Property
def headline
"#{name} | #{address}"
end
end
(Then, Property Controller for context...)
# My Controller
class PropertyController
def show
@property = Property.find(params[:id])
end
end
... |
I have a super class: TriggerManager with a subclass TimedTriggerManager. NOTE: I'm working in java
TimedTriggerManager only deals with TimedTrigger s, a subclass of Trigger. TriggerManager references all Trigger objects. To modify the subclass (TimedTriggerManager) to only accept TimedTriggers into its accessors and m... |
I grew up programming C++ and Java where everything was safe and beautiful. Compilers made sure to keep me in check if I ever strayed. Of course, everyone did a little Perl in college, but I didn't inhale. Kids these days are all about PHP on the backend and Javascript on the front. In trying to be hip, I do the same (... |
Is it possible for a freelance programmer to use Open Source products under GNU Public License and make money given that he cannot stop his customers from freely distributing his products?
|
Whenever I am programming in an object-oriented language, I am always faced with what order and how to group the methods for an object. Are there any standards for this, or any suggestions?
|
I've been pondering for a while why Java and C# (and I'm sure other languages) default to reference equality for ==.
In the programming I do (which certainly is only a small subset of programming problems), I almost always want logical equality when comparing objects instead of reference equality. I was trying to think... |
This is a purely design question.
I want to port a nice educational "game" Bug Brain to Java. In this game you design neural networks which consist of three elements: neurons, nodes and synapses.
Neuron is used to perform some kind of processing on its input signals to produce the desired output; it can be connected wi... |
I have been reading various Web application optimizing articles and many of them suggest to remove unused CSS rules. Currently, I have a page which has jQueryUI css, Bootstrap CSS, Datatables CSS and couple of more. All together they translate to about couple of thousands of rules ( my estimate ) and am quite sure I am... |
The question motivations was depicted in the section below.
There are many ways to make text italic,
so, perhaps, there are more than one good
"swap italics algorithm".
The problem reveals some aditional
dificulties in a XHTML code, and using the <i> tag, that must to be balanced.
Example:
<!-- original text: -->
<... |
I come from an object oriented background where I've learned that classes are or at least can be used to make a layer of abstraction that allows for easy recycling of code which can then either be used to make objects or be used in inheritance.
Like for example I can have an animal class and then from that inherit cats... |
The Spring framework supports the use of scripting languages (specifically JRuby, Groovy and BeanShell) whereby a script in any of these can call Java code and vice versa.
I have read that a possible use of this feature is when some modules require frequent changes and it would allow to modify your application without ... |
I got a bunch of questions to answer to prepare for an exam and this one I'm actually not sure what's the clear difference :
"Explain the difference between designing software and designing physical products"
I have an opinion on this, but the more I think about it the more it feels like there's no real difference exce... |
I'm making a app which is based heavily on another application that serves a similar purpose. I'm not actually planning on selling it, but I'm wondering whether it would even be legal for me to sell it.
I don't borrow graphics from the other application, but I have a very similar color scheme, virtually the same featur... |
This probably been asked for but I can't google "How to make a compiler in C++" because I will just get "How to compile C++" as the results. Anyway, for my question, I'd like to make a simple programming language in C++. Now I understand basic file IO stuff but what I don't get is how to build a EXE. The problem here ... |
Sometimes I run into a situation where I need to equate two new variables with an old one. Which of the following (if any) is a good practice (w.r.t. code readability or any other factor), under what conditions?
a=b;
c=b;
or
a=b;
c=a;
Note, a,b and c are just the names chosen in this example.
|
I have a single server with several clients. I want to push messages to a particular client at a given time. Clients should not polling to the server. what are good patterns and practices to solve this problem?
|
I'm developing a program using a library made by another programmer (he works in the same company). Recently I discovered a leak in the library, which happens under certain network conditions after a few hours of running. I filed a bug with description of conditions to make this leak happen. That developer answered th... |
I'm reading Pro PHP and jQuery and want to rebuild the example. The author is creating a database connection class:
class DB_Connect {
protected $db;
protected function __construct($dbo = NULL){
if (is_object($db)) {
$this->db = $db;
}
else {
// Constants are defined in /sys/config/... |
Say I have created a web service based on RESTful APIs. Does it make sense to also provide users with a client library for the API in some select languages which are likely to be the most used ones? By client library, I mean a thin wrapper around all the API calls, so that the users can call methods in their language a... |
My requirements are:
To build an ASP.NET MVC web application to use Windows-based authentication, since all the users which will be accessing the application are our internal employees, and they have username and password on our company's Active Directory.
So, as I understand, the Windows authentication inside ASP.NE... |
I stumbled accross the SOLID principles. There is one burning question. Should I always use protocols? I never saw someone using them in the way that a Java developer would use them.
I tried it in a demo project and ended up with a .h file for the protocol, another .h for the header. A .m file for the implementation a... |
I am working on a personal project that works with databases, and in this project I have a set of classes that are similar, so they inherit from a common base class. The problem I am faced with is that I have this nagging feeling that the names of the classes that derive from the base class do not really reflect what t... |
I have some legal questions regarding OpenJDKs source header:
/*
* Copyright (c) 1997, 2008, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU Gener... |
I seem to see this often enough in my code and others. There's nothing about it that seems horribly wrong, but it annoys me as it looks like it can be done better. I suppose a case statement, might make a little more sense, but often variable is a type that does not work well or at all with case statements (depending o... |
I use 3 standard Spring MVC war, which share a common core (Services, DAO, and Models).
The main problem is when I plan to deploy all the 3 wars on a same server. I have the Core Application Context instantiated 3 times.
I know it's possible to share a common context using an EAR, but for scalability purposes I have to... |
Background/Scenario
I started writing a CLI application purely in C (my first proper C or C++ program that wasn't "Hello World" or a variation thereof). Around midway through I was working with "strings" of user input (char arrays) and I discovered the C++ string streamer object. I saw that I could save code using thes... |
We are getting ready to port part of our app over to node.js, and are looking for a way to support s3 uploads and testing in our development environment. Right now we are thinking about setting up test buckets (ie 'myProductionBucket-test'), setting this in our dev environment configuration, and then creating a lifecy... |
I'm trying to create a process for better understand what's happening in my code. I want to create metrics to automatically give my answers about simple or complex questions like:
How many times a url was clicked? (how many requests arrived to a certain servlet method)
How many times a certain user requested the same ... |
I'm new to object-oriented programming, to java, and to programming in general, and as my first real project I'm trying to program the board game Monopoly.
What I've got so far is an array that can store objects of the class Square (which has various subclasses, like properties, the railroads, chance cards etc.). Playe... |
I've been learning both Common Lisp and Racket, and one thing that I consistently hear is that Racket is a much "smaller" language than Common Lisp. I was wondering what this really meant. As far as I can tell, the syntax for Common Lisp isn't that much bigger than for Racket.
Basically, I'm wondering what exactly abou... |
We currently have a monolithic Rails application that is really three separate applications that make use of the same data. In trying to figure out how to properly compartmentalize and break the mono-app into smaller pieces, it seems apparent that we need to have a central data service that the various pieces can commu... |
I'm a php developer working on a startup, and my friend,
my partner(a developer also), who is building the startup with me,
is an asp.net/C# developer.
How do we work together collaboratively, as we program in two distinct languages? I know you can use Mono http://mono-project.com to design android applications, (which... |
I am trying to write a simple program that should allow a user to save and display sets of heterogeneous, but somehow related data. For clarity sake, I will use a representative example of vehicles. The program flow is like this:
The program creates a Garage object, which is basically a class that can contain a list o... |
I'm new to object-oriented programming, and I keep running into this issue. (I'm programming in Java) I've been a bit reluctant to ask about this, since it seems like such a basic issue, but I can't find any information on it, or questions about it here, and none of the textbooks I have read (on a quite basic level of ... |
Recently had a doubt about how and where to test repository methods.
Let the following situation: I have an interface IRepository like this:
public interface IRepository<T>
where T: class, IEntity
{
IQueryable<T> Query(Expression<Func<T, bool>> expression);
// ... Omitted
}
And a generic implementation of ... |
I've seen two styles of using sizeof for memory-related operations (such as in memset or malloc):
sizeof(type), and
sizeof variable or sizeof(variable)
Which one would you prefer, or would you use a mix of the two styles, and when would you use each style? What are the pros and cons of each style and when you use the... |
I understand PKI reasonably well from a conceptual point of view - i.e. private keys/public keys - the math behind them, use of hash & encryption to sign a certificate, Digital Signing of Transactions or Documents etc. I have also worked on projects where openssl C libraries were used with certs for securing communicat... |
For example, let's say I want to build a game, and I have a limited knowledge of programming(some but definitely not enough). Should my first move be to design the game and then learn how to implement each separate part? Or should you learn a language really well before you design a game?
|
I have a bit of a challenge and I am not sure how to approach this.
We have a very very large project (that is about 5 years old).
The code base is HUGE so a full refactor is out of the question.
What we will be doing is refactoring bits of code as we use those parts (this is backend code, which we will be using on a f... |
I understand PKI reasonably well from a conceptual point of view - i.e. private keys/public keys - the math behind them, use of hash & encryption to sign a certificate, Digital Signing of Transactions or Documents etc. I have also worked on projects where openssl C libraries were used with certs for securing communicat... |
We are in a process of redesigning our product code in such a way so as to support multitenancy.
Currently the implementation is such that one product deployment caters to only one customer.
Thus the application data corresponds to only one customer. This data (which is global wrt the application) is in the form of ... |
I currently have a SQLite DB on my server that is needed by an android app I am currently developing. I download the DB to the android device using HTTP each time the contents are changed.
Does anyone have any suggestions as to how to do this more efficient. ie. when the database gets large I don't want the android us... |
The golden rule of code structuring is always said as splitting into many sub functions is a good thing. Though I noticed it becomes a problem in complex applications when a class of e.g. 10 bigger functions is split into a class with 50 functions. When development went so far, it becomes quite hard to understand the c... |
I'm not so familiar with C++. Can someone please inform me what this lines does (in detail):
auto add_element = [&rows,&cols,&values](size_t row, size_t col, double value)
{
rows.push_back(int(row));
cols.push_back(int(col));
values.push_back(value);
};
Rows, cols, values are obvious vectors.
Is this the s... |
As a side project I wrote a simple macro in SAS to add syntatic sugar to SAS code. I hate how verbose SAS is sometimes!
So my macro looks like this
%macro md(code);
/* expects a superquoted string */
* append a b;
%if %lowcase(%scan(&code.,1)) = append %then %do;
proc append base = %scan(&code.,2) dat... |
I have just been reading through some of the white papers & examples from Microsoft "Roslyn" and the concept seems very interesting. From what I can tell, it opens up the black box that is the compiler and provides an interface that we can use to get information and metrics about code written in Visual Studio.
Roslyn ... |
A customer of my employer has recently requested new features for some legacy code, and since the authors of the program are no longer here, I've been assigned to implement the new features.
I've been provided with some high-level documents that are mostly from early stages of the project: the project definition, black... |
This last semester i've had lectures about OOP design, i understood most of what i was supposed to
but there is something that i can't get right.
I'm pretty sure that the models i create are wrong because they cannot be implemented.
I wrote quite a lot because i can't tell where the problem is.
This isn't homework , it... |
Is it ethical to make a copy of my work's source code, for the sole purpose of my own reference? By reference, I mean as reference where I can refer to it about how I (and my teammates) implemented various design patterns, architecture, etc. It does not contain any trade secret, product, secret algorithm or anything li... |
For advocacy purposes, I'm looking for a good example of some popular/widely-known closed-source and generally paid-for software application/package which uses dynamically linked LGPL-licensed libraries, and isn't shy of saying so in its installer dialogs or preferably in its "About" info and/or online documentation on... |
I just ran into an odd scenario. I’m sure that I must have run into the same situation in the past and yet somehow not noticed it until now.
I am writing a program that requires at least two command-line arguments. Dealing with this is simple enough, just check that there are sufficient arguments. For example:
A: if (... |
Let's say I have a boolean condition a AND b OR c AND d and I'm using a language where AND has a higher order of operation precedence than OR. I could write this line of code:
If (a AND b) OR (c AND d) Then ...
But really, that's equivalent to:
If a AND b OR c AND d Then ...
Are there compelling arguments in favor or... |
I am making a voxel game like Minecraft. I am able to load chunks using multithreading with the code...
for (int x = 0; x < WorldSettings.WORLD_WIDTH_IN_CHUNKS; x++)
{
for (int y = 0; y < WorldSettings.WORLD_LENGTH_IN_CHUNKS; y++)
{
chunks[x, y].BulidVertexData();
Thread.Sleep(50);
}
}
this... |
We are starting a total new Branch at our firm. I am usually developing database interfaces or internal server/client applications/tools for our company, but I never had to do something with hardware.
Szenario
My Boss want to sell a device, which has a touch-screen to set up the many, many features. However, the config... |
I have been given the task of redeveloping an "in house" solution to make it expandable and easier to maintain and administer.
The original solution had been hashed together over time using PHP as more requirements were added, and the need to expand is expected into the foreseeable future.
The solution, gathers many di... |
I've noticed an increase in mobile applications being released that offer high value features, but without any corresponding web based version.
Was just reading about a new medical app for iPhone that allows doctors to share medical images, and had this idea been done 5 years ago it surely would have been a web applica... |
I was thinking about this earlier today and figured I would get some input on the matter. When I develop applications I would usually have the Data Access Layer on another project, incase it could be re-used elsewhere in a similar manner in the future but also to allow updating the DAL without updating the UI layer.
Wh... |
I want to know how to manage a big project with many components with version control management system.
In my current project there are 4 major parts.
Web
Server
Admin console
Platform.
The web and server part uses 2 libraries that I wrote. In total there are 5 git repositories and 1 mercurial repository. The pro... |
I'm currently designing an automated testing framework for doing embedded systems testing on an embedded Linux system. There exists an old system, but it is particularly hard to use, mainly because it wasn't designed as a framework and was originally designed to test one product only. What this means is that the framew... |
I program in C and I believe I know the language well. I understand all the concepts and my problems never come from misuse of the language.
I have problems because I always forget or oversee things. Setting a variable to zero, or generating a particular test case. I keep finding bugs in my code due to conditions I cou... |
I've been reading articles such as this one that indicates web development has evolved to use JS frameworks. Where I work, we have a massive website with many existing web applications that are already established and are server side heavy.
One article I read said that the DOM manipulation/jQuery method leads to unmai... |
I am making a multiplayer game. Now I am trying to choose the technology to connect the android devices to the server. The clients run on Android, and the game is MMORPG. I would like to write the server in java. Right now I have only 3 ideas for it:
1) creating multithreading environment with plain java and sockets. I... |
I'm new to git (and github). I work in Java and Python. Right now, I manage my projects in only one directory - let's call it Code and the folder is on my Desktop.
I want to group my projects by the language I code in. So, I want:
/Code/
++ /Java/
++ /Python/
I do not know if Git would be happy with this or not. If it... |
About this function: org.apache.commons.lang3.BooleanUtils.isFalse(Boolean bool) and the similar isTrue, my co-work (less experienced) use it for every boolean in the code. I am trying to convince him that it is not a good practice because make the code confusing. In my POV, it should be used ONLY if the boolean to be ... |
So, I've been developing some analytic software at my work and also have started to take more notice to analytics in general. For instance, I recently installed Google Analytics on my blog(which is custom and open source).
I mostly make open source software outside of work, so I think it might be cool to be capable of... |
Is there a language with something like the following construct?
var_type(TYPE_1, TYPE_2,..., TYPE_N) obj;
and now its possible to:
TYPE_17 staticTypeVariable17;
obj = staticTypeVariable17;
TYPE_3 staticTypeVariable3;
obj = staticTypeVariable3;
without obj being a pointer of some base class and with no need for cast... |
I'd just like to hear about any experience creating a (simple) site for redirecting requests.
Basically we have multiple domains, but as we add more domains and change URLs, there is a huge problem of maintaining old links.
When discussing this we are considering using one constant site to determine where the present ... |
Reading this SO question it seems that throwing exceptions for validating user input is frowned upon.
But who should validate this data? In my applications, all validations are done in the business layer, because only the class itself really knows which values are valid for each one of its properties. If I were to copy... |
I am fairly new to Java and my experience is limited to Web Based Applications running on a Web Container (Jboss in my case).
Am I correct in saying that for Web Applications the web container takes care of multi-threading? If so, can I introduce new treads in a Web Based applications? Is there any advantage in doing ... |
When checking for parameter consistency a the top of a function body, what is the best strategy?
This one:
protected void function(Object parameter)
if (parameter == null)
return;
//... do things
}
...or this one:
protected void function(Object parameter)
if (parameter != null) {
//.... |
I'm reading through a PDF on C++ programming from this page on Stanford's site. It says that when you're creating a C++ header file for a library interface, use a #ifndef preprocessor command to make sure you don't compile the same interface twice.
So, your header would look something like this:
/**
MyFile.h
*/
#if... |
In computing what is meant by binary compatibility?
I read about it in context of serialization/deserialization that this process of serialize/deserialize should be binary compatible. What does it mean in this context? In particular I am interested in understanding the role of binary compatibility in a language like J... |
I got involved into a project where we are taking over a bunch of legacy code. Code is basically shell scripts and PL/SQL packages/procedures/functions. There is no documentation how the code works and there is also no comments on the shell scripts. I was thinking that first thing to do is to get an understanding of th... |
What should a programming language have so that it can be said to promote good reusability? Only generics and functions come to my mind when I hear the word reusability. What else make a programming language good for writing easily reusable code?
|
Is it completely unheard of to have a .c file dedicated to just data? In my case, I'd be using it for global variables that are shared across two other .c files. Here's specifically how I'm using it.
// serverth.h
struct serverth_parameters {
struct { // right now, this is the only struct needed
char * roo... |
re-edited by author: no this is not 2 questions. This is one question about code review questions containing two separate points. Please do not edit my question.
For naming variables, the two sides are regarding using articles (a, an, the) in the variable name (e.g. theBook vs. book -or- parseTheString vs. parseString... |
This has happend to me more than once, thought someone can give some insight.
I have worked on multiple projects where my project depends on external service. When I have to run the application locally, i would need that service to be up. But sometimes I would be coding to the next version of their service which may no... |
So there is a website that I want to build. It will be a review aggregator and probably a bit more. I want to build this website for three reasons:
I really think this website will be used by a reasonable amount of people
I want to practice my programming skills since currently at my job I am doing mostly scripting ... |
May be this is a stupid question, but I'm kind of intrigued.
Being JavaScript a prototype based language, with its pseudo-class function constructors sort of half baked (remember JavaScript: The Good Parts ...) I wonder how is it possible that it didn't have, right from the start, some easy way to access the prototype ... |
People often give me the "divide and conquer" tip, but I think for some problems it's not nearly enough. The problem with such a complex problem as the Hanoi Tower problem is that you can't even simulate or abstract parts of the problems even if you divide it into parts if you know what I mean. So, can anyone give me a... |
Throughout my life I've accumulated a fair share of scripts that have proven to be useful to me in many cases and might be useful to many others. I look at things like todo.txt (which probably started off as just someone's personal text file manager) and even simpler ones online and sometimes I feel like I want to put... |
It appears in not just one language that comments can't be nested. Do you have a good solution for this problem? One workaround in C/C++ and Java is to only use the single-line comment but it becomes impossible then to comment out a larger block. I'm facing something like this:
</li><!--
<li><!-- Save -... |
When creating websites, is it better to have a lot of images in one folder, or have them separated?
It's something that has always been in my mind but I never researched enough about it, and googling didn't give me many answers.
So I have been building mostly sites for real estate agencies since I started, and I always... |
How do I convince project managers, product owners, business analysts, clients and various other stakeholders that refactoring is a worthwhile and productive part of the development process?
As developers we all know that requirements change or are never fully explained from the start, and therefore how we wrote a piec... |
As far as I understand, the adapter pattern is creating a wrapper object for our real object of interest, simply one more level of indirection, which provides flexibility. The flexibility is in that if the real object's interface is changed, then we change the wrapper interface pointing at the real object, leaving the ... |
In a method, i have calls of single method of another object that returns field value, like foo.value(), which is defined like Field value() {return this.value;} Is it better to make a local variable, like Field value = foo.value() and use it. Or use many method calls of a single method? Why? How does it correlate with... |
I am constructing a ray tracing algorithm , i know that the first step is to develop camera and view plane specifications.
Now is the next step performing rasterization algorithm on image before a BVH tree is constructed so that intersection tests can be performed?
Kindly Guide
|
I had a discussion with my colleague about the following problem.
We have an application where we need filtering functionality. On any main screen within the upper navigation bar, there is a button in the upper right corner. Once you touch that button, an custom written Alert View like view will pop up modally, behind ... |
We java developers always know that you should always override equals() when you override hashCode(), but I consistently have trouble remembering this rule.
What is a clever mnemonic to help Java developers remember this?
|
Background
I have read people rebutting the fact that a certain software is free as in free speech, even when it is licensed under GPL.
Some say Java isn't free because to obtain a professional certification you must get it from Oracle.
Some say Java JDK is not free to re-distribute.
Some people even say the openJDK is... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.