instruction stringlengths 34 19.9k |
|---|
When validating a JavaScript form, would it be better to process each input field individually, or, where possible check collectively?
e.g.
validate()
{
noblanks()
fieldOne()
fieldTwo()
}
or
validate()
{
fieldOne()
fieldTwo()
|
I've been experimenting with random cache expiry times to avoid situations where an individual request forces multiple things to update at once. For example, a web page might include five different components. If each is set to time out in 30 minutes, the user will have a long wait time every 30 minutes. So instead, yo... |
I've been developing the client-side for my web-app in JavaScript.
The JavaScript can communicate with my server over REST (HTTP)[JSON, XML, CSV] or RPC (XML, JSON).
I'm writing writing this decoupled client in order to use the same code for both my main website and my PhoneGap mobile apps.
However recently I've been w... |
With Oracle vs Google trial, it seems that Java is not entirely Open and free (as free software) as I expected. Although there exists completely free/open JVM, it's hard to know what is a copyright infringement with Java, and what is not.
So I'd like to know if there is a completely Open and free language with open an... |
With the huge explosion of mobile devices and addition of HTML5/CSS3, there seems to be a shift towards "responsive" designs (i.e., adapting to smaller screen sizes) which seems to be achieved using CSS3's Media Queries.
My question is, given the current need of adapting to both desktop and mobile, is it common practic... |
We've been churning out wordpress sites for a while, and we'd like to keep a base repository that can be used when starting a new project, as well as updating existing sites with changes to the wordpress base.
Am I wrong in assuming this would be a good thing? We take care of updating the sites, so having a common base... |
Related: “sending 'const NSString *' to parameter of type 'NSString *' discards qualifiers” warning
Sometimes, I think it's useful though. I may need to pass an a table and want to make sure that the content of the table does not change.
However, in most Objective-C program samples, I never see const. My question is wh... |
For example, stackexchange.com, without asking the site owner or Google their information about developing the website, is this possible to know what language is used in the back end?
Seems, the website don't have .extension bar, for example .php that can indicated which is developed in PHP, but without the extension, ... |
As C# has progressed, many language features have been added. It has come to the point where it's becoming unreadable for me.
As an example, consider the following code snip from Caliburn.Micro code here:
container = CompositionHost.Initialize(
new AggregateCatalog(
... |
Sometime ago I read about SQL language drawbacks
(the basic language specification, not vendor specific),
and one of the drawbacks was that the language does not allow to create a set of tuples that don't come from a table.
For instance,
SELECT firstName, lastName from people;
this creates a set of tuples coming fro... |
GNU recommends making an AUTHORS file to list the authors and contributors of a program. But how many "levels" of authors and contributors should the file contain? E.g. if I write a program foo that actively use some library, should I include the authors of that library in the AUTHORS file? It seems that the answer is ... |
I rewrote some parts of Mercurial (which is licensed under GNU GPL v2) in C#. Naturally, I looked a lot into original Python code and some parts are direct translations from Python to C#.
Is is possible have "my code" licensed under different terms or to even make a part of a closed-source commercial application? If no... |
I've moved all our company Git repositories to GitHub and now I want to add employees to the projects. Since most employees already have personal GitHub accounts, I'm wondering whether I should ask them to create a work GitHub account. The reason that I'm thinking of doing this is to decrease the chances of unauthorize... |
I'm creating a parameter table in our database. This table will have 1 row with values that are environment specific (production, development, etc).
Is there any reason why I should define an index on this table?
Update
This table is a parameter table which will be used to drive our job queue system. The table will b... |
I'm developing a Java 6 EE application and I'm testing my jsp code with another one with a testing version of the function calls and code used in the original one but it seems loose and impractical. Is there a good way to accomplish this kind of testing?
|
While working for an employer if one modifies, rewrites, contributes or alters open source software in what cases can it ever be considered a trade secret?
A trade secret, FWIW, is defined by wikipedia as:
A trade secret is a formula, practice, process, design, instrument,
pattern, or compilation of information whi... |
I've always agreed with Mercurial's mantra 1, however, now that Mercurial comes bundled with the rebase extension and it is a popular practice in git, I'm wondering if it could really be regarded as a "bad practice", or at least bad enough to avoid using. In any case, I'm aware of rebasing being dangerous after pushing... |
I Recently had a discussion with a colleague of mine about the pros / cons of WCF. He mentioned about how much code is generated to support WCF, and also the overhead required. It was mentioned that a simple jQuery /Ajax post to a .aspx page (or a handler for that matter) that returns JSON would work more efficiently a... |
I have started to write card game applications.
Some model classes:
CardSuit, CardValue, Card
Deck, IDeckCreator, RegularDeckCreator, DoubleDeckCreator
Board
Hand
and some game classes:
Turn, TurnHandler
IPlayer, ComputerPlayer, HumanPlayer
IAttackStrategy, SimpleAttachStrategy, IDefenceStrategy, SimpleDefenceStrate... |
I am working on a website for which I hope to have an application for as well. Because of this, I am creating PHP API's which will go into my Database and serve specific data based on the method/function called.
I want to protect these API's from misuse however, and I plan on implementing Authentication Digest to do so... |
I have a computer that is recording 100 different data points into an OPC server.
I've written a simple OPC client that can read all of this data.
I have a front-end website on a different network that I would like to consume this data. I could easily set the OPC client to send the data to a SQL server and the website... |
This question is more a design oriented question than a code specific question. I am new to PHP and I am planning to use PDO as a data access layer. Say for instance I have a class called CITY. Now if I need to create an instance of this class, what is the best technique.
Should have a singleton DB access class which... |
Summary: Are there some well-established best-practice patterns that I can follow to keep my code readable in spite of using asynchronous code and callbacks?
I'm using a JavaScript library that does a lot of stuff asynchronously and heavily relies on callbacks. It seems that writing a simple "load A, load B, ..." met... |
I'm working on an Android Game based on Contract Bridge, as a part of my college Summer Internship project. The game will be multi-player such that 4 Android devices can play it, so there's no BOT or CPU player to be developed. At the time of getting project, I realized that most of the students had already worked on t... |
We're a group of 4 developers on a ajax/mysql/php web application. 2 of us end up focusing most of our efforts on testing the application, as it is time-consuming, instead of actually coding. When I say testing, I mean opening screens and testing links, making sure nothing is broken and the data is correct.
I understan... |
The official Java tutorial on generics explains type erasure and why it was added to the compiler:
When a generic type is instantiated, the compiler translates those types by a technique called type erasure — a process where the compiler removes all information related to type parameters and type arguments within a cl... |
I am tasked with setting up conditional profiling - a method of tagging chunks of XML with an attribute, which will then be used as a conditional value to extract subset of that XML.
Have a look at another definition/example: DITA profiling
The XML is documents that are equivalent to printed books - i.e. documents that... |
Behavior-Driven Development with its emblematic “Given-When-Then” scenarios syntax has lately been quite hyped for its possible uses as a boundary object for software functionality assessment.
I definitely agree that Gherkin, or whichever feature definition script you prefer, is a business-readable DSL, and already pro... |
I have never understood what system programming meant. The usual definition given is "...doing something close to the Os or extending Os features...".
Does using Windows API directly rather than some libraries to say do file i/o make it system programming? Was writing Android OS system programming? If I write somethin... |
In IP agreement IP is define as below
Intellectual Property (whether or not patentable and whether or not made during working
hours) is defined as but not limited to: all product specifications, developments, inventions, works of authorship, derivative works, technologies, programs, systems, software, mobile applica... |
It seems to me that many bigger C++ libraries end up creating their own string type. In the client code you either have to use the one from the library (QString, CString, fbstring etc., I'm sure anyone can name a few) or keep converting between the standard type and the one the library uses (which most of the time invo... |
If a project has no a license or has unknown authors, is it public domain?
|
I had a discussion with a testing manager about the role of unit and integration testing. She requested that developers report what they have unit and integration tested and how. My perspective is that unit and integration testing are part of the development process, not the testing process. Beyond semantics what I mea... |
I've come across this PHP tag <?= ?> recently and I am reluctant to use it, but it itches so hard that I wanted to have your take on it. I know it is bad practice to use short tags <? ?> and that we should use full tags <?php ?> instead, but what about this one : <?= ?>?
It would save some typing and it would be be... |
We are planning to add a "SMS verification account" option for our customers. (So we will only send SMS. We do not need a short code.)
We have found several companies who offer SMS gateways through REST APIs (we use PHP).
As we are totally new to the SMS world, we are wondering:
What are the key points to pay attention... |
I have been working on this project for more than a year now, and we are close to release, the project manager wants the product to be perfect and working in every single aspect.
I like that and I love working under the perfection idea, but it seems he is delaying the launch too much because of compatibility issues, he... |
I find it really hard to find resources about computer security. I asked questions on message boards about key loggers and viruses and I got negative assumption from people assuming the the worse. Also, I don't think that I can trust random message boards.
I know that it is a broad topic, but are there any good website... |
I don't fully understand reactive extensions, but my inital reading caused me think about the ETL code I have.
Right now its basically a workflow to to perform various operations in a certain sequence based on conditions it find as it progresses.
I can also imagine an event driven way such that only a small amount of i... |
We have a program written in C++ that is mostly procedural, but we do use some C++ containers from the standard library (vector, map, list, etc). We are constantly making changes to this code, so I wouldn't call it a stagnant piece of legacy code that we can just wrap up.
There are a lot of issues with this code maki... |
We performed a code review recently of mobile application Java code that was developed by an outside contractor and noticed that all of the domain objects / data transfer objects are written in this style:
public class Category {
public String name;
public int id;
public String description;
public int p... |
During an interview I was asked given the following: A real estate application that lists all houses that are currently on the market (i.e., for sale) within a given distance (say for example the user wants to find all houses within 20 miles), how would you design your application (both data structure and alogirithm) t... |
If immutable objects¹ are good, simple and offer benefits in concurrent programming why do programmers keep creating mutable objects²?
I have four years of experience in Java programming and as I see it, the first thing people do after creating a class is generate getters and setters in the IDE (thus making it mutable)... |
Recently I've learned that using a regex to parse the HTML of a website to get the data you need isn't the best course of action.
So my question is simple: What then, is the best / most efficient and a generally stable way to get this data?
I should note that:
There are no API's
There is no other source where I can ge... |
Could anyone give an overview of how list structures which are composed of a
head and a tail which references the rest of the list i.e linked list are represented in memory of the computer? Does the computer make use of cpu registers to hold the pointers the head and rest of the list?
|
I have this problem I think you may help me with.
P.S. I'm not sure how to call this, so if anyone finds a more appropriate title, please do edit.
Background
I'm making this application for searching bus transit lines.
Bus lines are a 3 digit number, and is unique and will never change.
The requirement is to be able t... |
Context
I've been using with a hierarchy of objects (an expression tree) a "pseudo" visitor pattern (pseudo, as in it does not use double dispatch) :
public interface MyInterface
{
void Accept(SomeClass operationClass);
}
public class MyImpl : MyInterface
{
public void Accept(SomeClass operationClass... |
What are "custom software companies"?
By "custom software companies" I mean companies that make their money primarily from building custom, one off, bits of software. Example are agencies or middle-ware companies, or contractors/consultants like Redify.
What's the opposite of "custom software companies"?
The opposite o... |
I work in a PHP development shop and several new developers have joined the team. One of the new members insists on declaring class properties at the bottom of the class declaration rather than the at the top, as one would normally expect.
In all my 5 years of working in web development, I have never seen this done. I... |
I'm evaluating some Agile-style methodologies for possible introduction to my team. With Scrum, is it allowable to have the same person perform multiple roles? We have a small team of four developers and a web designer; we don't really have a lead (I fulfill this role), QA testers or business analysts, and all of our... |
I've getting some information about this, but I still can find a proper answer, I was asked recently in my company for this : "run a fxcop analysis on that code and tell me the results".
Ok, I have VS2010 Ultimate which has code analysis, but before making any comment, I browse it on the internet cause I want to implem... |
Model-driven development seems to have a lot of buzz in certain software engineering circles, but I've never encountered an open source MDD projects "in the wild".
Are any open source projects using model-driven development? (I don't just mean that there's some UML documentation, but that the primary artifacts that th... |
I noticed that in the Vim automatically indents labels in a rather unintuitive way (IMHO).
int main(void) {
goto end;
end:
return 0
}
Are there any style guidelines for labels?
For the faint-hearted, the goto's I am using are for error handling in a controlled and structured manner.
|
I joined a dev team of six two month ago. People are nice, all is good. But more and more I observe an ad-hoc mindset. Stuff gets quick fixed, at the cost of future usability, there is little testing and two people happily admitted, that they like to carry the knowledge around in their head, rather than to write it dow... |
I was reading this question and thought that good points were made, but most of the solutions involved renaming one of the methods. I am refactoring some poorly written code and I've run into this situation:
public class Entity {
public Entity(String uniqueIdentifier, boolean isSerialNumber) {
if (isSerialNumber... |
Value types are types which do not have an identity. When one variable is modified, other instances are not.
Using Javascript syntax as an example, here is how a value type works.
var foo = { a: 42 };
var bar = foo;
bar.a = 0;
// foo.a is still 42
Reference types are types which do have an identity. When one variable ... |
Disclaimer: I didn't know exactly where to put this question. If you feel that this question is not suitable for Programmers @ StackExchange, feel free to migrate it.
Background: Broadening my last question, there is a request for tender for a software system that's open and I have decided to take it on. I am a softwar... |
I have a singleton that anchors together some different data structures. Part of what I expose through that singleton are some lists and other objects, which represent the necessary keys or columns in order to connect the linked data structures. I doubt that anyone would try to change these objects through a differen... |
I am re-factoring some code and an having an issue with retrieving data from two parallel processes.
I have an application that sends packets back and forth via different mediums (ex: RS232, TCP/IP, etc). The jist if of this question is that there are two parallel processes going on.
I hope the picture below displays w... |
Most academic researchers I know target just *nix, and rely on Cygwin to make their applications available on Windows. I have tried many of these projects and always found them too unstable for serious use when running on Cygwin.
Uwin looks like a promising alternative to Cygwin. I haven't tried it yet, but I found sev... |
How do you keep released binaries under version control?
This allows to track which stuffs are changed between each release.
I mean to separate the released binaries from source repository.
The released binaries are either built from Continuous Integration software or manually compiled.
|
Event Sourcing was popularized by LMAX as a means to provide speed, performance scalability, transparent persistence and transparent live mirroring. Before being rebranded as Event Sourcing, this type of architectural pattern was known as System Prevalence but yet I was never familiar with this pattern before the LMAX ... |
I have been learning C++ and I am having a hard time understanding null. In particular, the tutorials I have read mention doing a "null check", but I am not sure what that means or why it's necessary.
What exactly is null?
What does it mean to "check for null"?
Do I always need to check for null?
Any code examples wo... |
Most mobile platforms (such as Android, iOS, Windows phone 7 and I believe the new WinRT) can kill inactive application processes under memory pressure. To prevent this from affecting the user experience applications are expected to save and restore their state as their process is killed and restarted.
Having applicati... |
I read an article that says Scala handles concurrency better than Java.
http://www.theserverside.com/feature/Solving-the-Scalability-Paradox-with-Scala-Clojure-and-Groovy
...the scalability limitation is confined specifically to the Java programming language itself, but it is not a limitation of the Java platform as a... |
Upon searching for a fast primr algorithm, I stumbled upon this:
public static boolean isP(long n) {
if (n==2 || n==3) return true;
if ((n&0x1)==0 || n%3==0 || n<2) return false;
long root=(long)Math.sqrt(n)+1L;
// we check just numbers of the form 6*k+1 and 6*k-1
for (long k=6;k<=root;k+=6) { ... |
Recently I have become interested in learning Javascript for web development. I currently know HTML, CSS, and beginner/intermediate C++. I understand polymorphism, inheritance, and all of that fun stuff. Would any of these skills carry over to Javascript? In what key ways does Javascript differ from C++?
|
Having to work with large files now, I would like to know when the java libraries will start switching to long for indexing in their methods.
From Inputstreams read(byte[] b, int off, int len) - funnily there is long skip(long) also - to MappedByteBuffer to the basic indexing of arrays and lists, everything is adressed... |
(I will show examples using php and phpunit but this may be applied to any programming language)
The case: let's say we have a method A::foo that delegates some work to class M and returns the value as-is.
Which of these solutions would you choose:
$mock = $this->getMock('M');
$mock->expects($this->once())
->metho... |
I am programming in Objective C, iOS. I create a Class A which is a parent class, and Class B inherits to Class A.
Now I have Class B variables which I also need to use in Class A. And also one another Class C, Class A add in Class C (not inherits), and I want to use Class B variables in Class C.
How can I access? I ha... |
I'd like to write down the design of my program to understand the dependencies and calls better. I know there are class diagrams which show inheritance and attribute variables.
However I'd also like to document the input parameters to method functions and in particular which calls the methods function executes inside ... |
Since Java 1.6 the JVM can run a myriad of programming languages on top of instead of just Java. I conceptually understand how Java is run on the Java VM, but not how other languages can run on it as well. To me, it all looks like black magic. Do you have any articles to point me to so I can better understand how this ... |
I need to package an internal project as a debian package. That project will never ever be downloaded by anyone outside of our company, but the debian packaging system insists on there being a copyright file.
What should I choose for this file? There's a remote possibility that a sysadmin could stumble upon that packag... |
I was hired by a marketing company a year ago initially for link building / SEO stuff, but I'm actually a Web developer and took the job just in desperation to have one (I'm still quite young and just finished 2nd year of University). From the 3rd day my boss realised that I'm not into that stuff at all and since he ha... |
I've been following the successful Git branching model guide for most of my development. I still wonder if the way I handle bug tickets is correct.
My current workflow: Once I accept a bug ticket I will do a git checkout -b bug/{ticket_number}, create a single commit as a fix and then checkout develop and do a git merg... |
I need to write several passages of text in an offer to the client about the security layer in ASP.NET MVC web solution.
I am aware of security that comes along with MVC 3 and an improvements in MVC 4. But all of them are non conceptual, except for AntiForgeryToken (AntiXSS) and built-in SQL Injection immunity (with a ... |
As a learning experience, and as project, I am attempting to write a CMS module for ZF2. One of the functionality I would like to have is the possibility of adding dynamic contents in the pages by calling PHP functions in the view scripts.
However, I do not want to give the users freedom in writing PHP code directly in... |
I was recently discussing dvcs with a coworker, because our office is beginning to consider switching from TFS (we're a MS shop). In the process, I got very confused because he said that although he uses Mercurial, he hadn't heard of a "branch" or "checkout" command, and these terms were unfamiliar to him. After wonder... |
I've been doing a lot of reading these last two days on Microsoft Prism, but the thing I'm still not very sure of is what does the future look like for it? I know that version 4.1 was just released a few months ago, but besides Microsoft's own documentation, I haven't found many blog posts written in the last year on t... |
I work at a research organization and we publish a lot of large-ish documents, usually organized in sections. What I want to know is how best to present these multi-section documents on our website.
Presently, what I do is load the entire document as a single page, with each section as its own div. Then I show and hide... |
Is there one?
All the definitions I can find describe the size, complexity / variety or velocity of the data.
Wikipedia's definition is the only one I've found with an actual number
Big data sizes are a constantly moving target, as of 2012 ranging from a few dozen terabytes to many petabytes of data in a single data... |
We're considering converting our WinForms application to a WPF application. Part of the reason is that WPF/XAML seem to be the future. We are also using third party controls that we would like to be able to phase out. Making this conversion seems like a pretty big and time consuming undertaking, though. Would it make s... |
SO I'm building an application for uploading files. We're paying scientists to contribute information on pests, diseases and bugs (for Plants). We need the ability to drag and drop a file to upload it.
The question becomes since the users will be authicentated and setup by us, will it be necessarcy to include a virus ... |
What are best-practices for logging deep within an application's source? Is it bad practice to have multiple event log entries for a single error?
For example, let's say that I have an ETL system whose transform step involves: a transformer, pipeline, processing algorithm, and processing engine.
In brief, the transform... |
I saw this: Learning to program on punchcards
and I've seen this: http://en.wikipedia.org/wiki/Computer_programming_in_the_punched_card_era
but they leave much to be desired.
Can anyone explain to me how programmers programmed when they used punchcards? Specifically, the system of input computers used to derive instruc... |
According to the Wikipedia article on open-source, the philosophy of sharing code has been used in projects since the early computer days (mostly through Universities sharing code). However, I'm interested to know what (and when) was the first commercial open-source software (successfull or not)?
If there's any confusi... |
Is there a virtual memory management process that would allow a program to use the standard container structures and classes, but retain these structures and their data when the program is not running (or being used), for use by the program at a later time?
This should be possible, but can it be done without changing t... |
Sometimes I find myself writing comments on class methods like this:
class A : public Base
{
public:
/**
* Sets variable;
* should be called before ImplementsInterfaceMtehod(),
* else has no effect.
*/
void SetSomeVariable( var_type value );
virtual void ImplementsInterfaceMethod();
}
... |
Is a readonly field in VB.NET thread safe? For example, see the code below:
Class Customer
ReadOnly Name As String
ReadOnly ZIP As Integer = 98112
Sub New(ByVal Name As String)
Me.Name = Name
End Sub
End Class
|
I have the requirement to implement some kind of dual inspection or four-eyes principle as a feature of my software, meaning that every change of an object done by user A has to be checked by user B.
A trivial example would be a publishing system where an author writes an article and another has to proofread it before ... |
I am a CS student with several years of experience in C and C++, and for the last few years I've been constantly working with Java/Objective C doing app development and now I have switched to web development and am mainly focused on ruby on rails and I came to the realization that (as with app development , really) I r... |
I started to use psycopg2 to connect my little python script to a PostgreSQL database few days ago. After some research I found that a lot of database connector, like psycopg, work using cursors.
I know what is a cursor and how to use it. But I still wonder if it's safe to use the same cursor all along the script life... |
What is the best way to get this attributes, thinking in performance and code quality?
Using chained calls:
name = this.product.getStock().getItems().get(index).getName();
id = this.product.getStock().getItems().get(index).getId();
Creating new variable:
final item = this.product.getStock().getItems().get(... |
i would like to begin tinkering with Node.js but i am unsure of some "Real-World" situations where node.js would be considered the proper thing to be used. The last thing a developer wants is to learn a new technology and use it in-properly..
Can you provide real-world examples of where node.js would be used properly
|
I need help with a abstract factory pattern design. This question is a continuation of: Design help with parallel process
I am really confused where I should be initializing all of the settings for each type of medium (ex: RS232, TCP/IP, etc).
Attached is the drawing on how I am setting up the pattern:
As shown, when... |
Attribution: This grew out of a related P.SE question
My background is in C / C++, but I have worked a fair amount in Java and am currently coding C#. Because of my C background, checking passed and returned pointers is second-hand, but I acknowledge it biases my point of view.
I recently saw mention of the Null Obj... |
Tried to ask this on SO but was referred here...
Am I correct in saying that using a GPL'ed web application framework such as Composite C1 would NOT obligate a company to share the source code we write against said framework?
That is the purpose of the AGPL, am I correct?
Does this also apply to Javascript frameworks l... |
I see that there's a lot of questions related to OO Programming here. I'm actually trying to find a specific resource related to embedded OO approaches for an 8 bit MCU.
Several years back (maybe 6) I was looking for material related to Object Oriented programming for resource constrained 8051 microprocessors. I found ... |
This seems to be the common pattern that's emerging in some of the tests I've worked on lately. We have a class, and quite often this is legacy code whose design can't be easily altered, which has a bunch of member variables.
There's some kind of "Initialize" or "Load" function which would put an object into a valid s... |
I started studying Object Oriented Design and Modelling using the this book by James Rumbaugh. It uses a tool called Object Modeling Technique (OMT). I have certain newbie questions. I searched the net, but couldn't get answers
The book is pretty old. Don't know why the school told me to learn this. I know OMT is a pr... |
Can you program Android Apps in a functional language?
I meant is it possible to program for Android in a language that was designed from the ground up to be functional? I'm aware that you can use the functional components of an OO or a procedural language to program in a functional style, I was asking whether it woul... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.