instruction stringlengths 34 36.1k |
|---|
I have lots of code like this in my constructors:-
function __construct($params) {
$this->property = isset($params['property']) ? $params['property'] : default_val;
}
Is it better to do this rather than specify the default value in the property definition? i.e. public $property = default_val? Sometimes there is ... |
Possible Duplicate:
Best books on the theory and practice of software architecture?
In life it doesnt matter if you do one thing for 15 years. You will end up waking one day and asking stuff that are equal to "how do i walk?" :)
My specific question is that as a new entrant to C# and OOP i am stepping into many lit... |
I have another one of those "is it done in XML" questions (my last one about xml comments hasn't been answered if anyone has a good explanation)
I was just wondering if anyone, anywhere would:
Use multiple root elements in an XML document
Put text content outside of a root element
W3C discourages these practices, Jav... |
I always wanted to use randomly generated strings for my resources' IDs, so I could have shorter URLs like this: /user/4jz0k1
But I never did, because I was worried about the random string generation creating actual words, eg: /user/f*cker. This brings two problems: it might be confusing or even offensive for users, an... |
I'm starting symfony and interested in learning where symfony is coming from. In terms of it's architectural challenges.
What are the architectural or philosophical differences between symfony 2 and 1?
What changes make it so different from the other point version?
|
Here is my situation: a company has x number of employees and x number of machines.
When someone is sick, the program have to give the best possible solution of people on the machines. But the employees can't work on every machine. I need a code for making little groups of possible solutions.
this is a static example... |
I'm writing a data gathering and reporting application that takes XML files as input, which will then be read, processed, and stored in a strongly-typed database. For example, an XML file for a "Job" might look like this:
<Data type="Job">
<ID>12345</ID>
<JobName>MyJob</JobName>
<StartDate>04/07/2012 10:45:... |
I have services on 10 machines that stores data in database on these machines.
And I have main server that needs to pull that data from these ten machines.
What is better for this. Implement some rpc or use replication?
|
Let me give you an example of how I name my classes alphabetically:
Car
CarHonda (subclass of Car)
CarHondaAccord (subclass of CarHonda)
There are two reasons why I put the type of the class earlier in its name:
When browsing your files alphabetically in a file explorer, related items appear grouped together and par... |
I'm beginning Javascript development and as a beginner in JavaScript I make a lot of mistakes. The way I'm developing is very counter-productive because every mistake I fix I have to shutdown Glassfish, re-build the app and re-deploy it. My app is a Java back-end with REST services and the Html, JavaScript, CSS for the... |
I've never attempted anything like this before but what I want to do is code a browser for Windows.
I know that I can use the web-browser control that Microsoft has released, but I'm interested in seeing how the problem is solved from a lower level. So I want to know what layout engine I should be looking at? Or is a ... |
Most of simple "group chat" systems are based on local file storage logs (e.g. log.txt ).
I'm developing a simple group chat (under 20 users simultaneity ) with jQuery/AJAX.
So basically, client-side code loads log from server every second. It needs to be fast.
In database system (PHP/MySQL) that would mean MySQL query... |
I have a free software web application that using other free software scripts for appearance. I have trouble to decide whether should I copy source code of used scripts to my project main repository or list them as dependencies and ask user (who installs application to his server) to install them himself?
Since some of... |
I am joining a software company very soon as a fresher. But I am afraid that no one knows me and also every one there will be professional.
So I want to know, what precautions should be taken in communication, behavior and other things?
|
I have a shape that will be defined by:
char s_type;
char color;
double height;
double width;
These variables are scanned in from a request string sent to my server and passed into my printing function, which then prints out the shape. Currently they are just local variables sitting in my main(); however, I was wonder... |
I've been reading a bit about OOP in relation to Composition, Components and Composites. I believe I understand the fundamental principle (not sure).
Can someone please provide a code example of a person or car (both have many properties) using Composition, Components and Composites? I think seeing it in code would cl... |
What does 'automating a use case 'means and how does the tools that automate helps with that?
whats makes automation good to do and does it holds any significance for web developement.
|
I keep reading this sentence:
Linux is a Unix-like system, but it is not Unix.
I don't know what's the real difference between the two. I know Linux got a lot of ideas from Unix and the licenses of the two are different. Apart from that, as I am not an expert in either one of them, I want to know whether there are ba... |
Language like Haskell have concept of purity. In pure function, I can't mutate any state globally. Anyway Haskell fully abstracts memory management, so memory allocation is not a problem here.
But if languages can handle memory directly like C++, it's very ambiguous to me. In these languages, memory allocation makes vi... |
I am Localizing my php application. I have a dilemma on choosing best method to accomplish the same.
Method 1: Currently am storing words to be localized in an array in a php file
<?php
$values = array (
'welcome' => 'bienvenida'
);
?>
I am using a function to extract and ret... |
Usually I achieve low coupling by creating classes that exchange lists, sets, and maps between them. Now I am developing a Java batch application and I can't put all the data inside a data structure because there isn't enough memory. I have to read and process one chunk of data and then going to the next one. So havin... |
I would like to ask on method parameters design consideration. I am usually deciding between using individual variables as parameters versus grouping them to a class or dictionary as one parameter.
Is there such a rule when you should use individual parameter against using a class or a dictionary to group the parameter... |
I was thinking about ways to improving my commit practices.
Is there any co-relation between no. of source code lines and no. of commits?
In a recent project that I was involved in, I was going at 30 commits per 1000 lines.
One typical file from the project has these stats
language: JavaScript
total commits that includ... |
I am planning to create a web solution for the desktop, I would be dividing my task into three steps
Design
Coding
Automated use case
I am wondering if in the future I have to port my web solution as mobile phone native application. How would I do that? Will I go back again to the design phase to redesign or will I j... |
I have the need to phase out an obsolete method. I am aware of the [Obsolete] attribute. Does Microsoft have a recommended best practice guide for doing this?
Here's my current plan:
A. I do not want to create a new assembly because developers would have to add a new reference to their projects and I expect to get... |
I understand the idea of a callback, where I pass a function into another function and that function then uses the supplied function at will.
I am struggling to understand deferred callbacks, even after googling it.
Could someone provide a simple explanation please? I program in Ruby, but also know C/C++ a bit, but mos... |
Possible Duplicate:
Extracting user requirements from a person who does not know how to express himself
As a hobby freelancer I'm new to this. I've never had a non-technical client before explain to me what his future website is supposed to do.
A person wants me to make a website for him and he basically explained t... |
I've got an SVN repository of a PHP site and the last programmer didn't use source control properly. As a result, only code since I started working here is in the Repo.
I have a bunch of old copies of the full code base saved in files as "backups" but they're not in source control. I don't know why most of the copies ... |
I am trying to set-up a simple SVN workflow at home. I am new to subversion (and programming) so I have been reading the official PDF documentations but still not sure about how to set-up my repository.
I am working mainly with python, bash and rsl (Renderman Shading Language)
So I already have a /dev structure on my d... |
I've been wanting to find a solid answer to the question of whether or not to have runtime checks to validate input for the purposes of ensuring a client has stuck to their end of the agreement in design by contract. For example, consider a simple class constructor:
class Foo
{
public:
Foo( BarHandle bar )
{
Fo... |
C is a language written between '69 and '73 according to WIkipedia. I imagine it made programming a whole lot easier and opened the gate for other programming languages.
My question, however, is what programming language dominated the market before C appeared? I'm tempted to say fortran and/or BASIC but I wasn't even a... |
I've noticed more and more mentions (both in posts here and in actual job descriptions) of programmers' "portfolios" - typically their public profiles on sites such as this, GitHub, etc.
How important is this, and would companies (startups in particular) reject (or immediately discard without even interviewing) otherwi... |
In my new web app I'm going to allow social login through Twitter (maybe), Facebook and Google and I'm in search of the best way to do it.
Actually I'm using Rails with Devise + Omniauth and this is the problem:
Should I ask the user to choose a password so that he can login without a social network?
Or maybe the user... |
Can my MIT/BSD licensed, open source project, or a closed source project I build and sell, execute a command, where the command is a program released under the GPL?
I would not be distributing any version of the GPL'd program, either source code or binary. I would be telling the customer/end user that they need to have... |
I'm a young upstart programmer and I've never actually seen a database. But computers in large part come in boxes, not in cylinders so I was wondering why they are always represented as a cylinder when people show their architecture drawings.
Is there a reason why or is it just tradition to draw them like that?
|
If this is not the right place to ask this question please inform where it would belong, to change it...
I have a doubt for the correct word or concept in english language [not my native], about the relationship of
language to framework
for example i work with
objective C, with the cocoa touch frame work || python... |
CoffeeScript is a language that transpiles to JavaScript, with a clean syntax, inspired by Ruby. Is there a similar language that transpiles to C, allowing for more readable code without compromising on performance? If nothing like that exists, is there a good reason for not creating it?
|
On HTML5 Boilerplate they use this code for jQuery:
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<script>window.jQuery || document.write('<script src="js/libs/jquery-...
What's more readable:
if (!window.jQuery) document.write(...);
or
window.jQuery || document.write(...);
|
Is catching an error with try ... catch a better practice than catching an error with proper analysis/error check? For instance, removing from an empty list: Does surround with a try catch clause considered as a more efficient way than testing if the list is empty beforehand?Or is it the same? Thanks.
P.S: If a similar... |
I've got a site with ~500 registered members, 300 of which are what you'd call "active". Site data is kept in a MySQL dbase.
I'd like to add a myBB forum to the site, but this question applies to any forum really.
What I very much want to avoid is requiring my users to register both on the site and on the forum because... |
Why do we need private variables in classes?
Every book on programming I've read says this is a private variable, this is how you define it but stops there.
The wording of these explanations always seemed to me like we really have a crisis of trust in our profession. The explanations always sounded like other programm... |
In Document based NoSQL to create tables (AFAIK) I need:
Create such many as many rows in table documents with same ID field (that will be table id) and each time need to set the columns (for each document).
Then you first search documents by id (table) and next search what you need in the selection.
Please correct if ... |
I work for a software development company where the development work has been off shored to us. The on shore team handle the support and talk directly to the clients. We never talk to the clients directly we just talk people from the on shore team, who talk directly to the clients.
When requirements come, the on shore ... |
Private variables are a way to hide complexity and implementation details to the user of a class. This is a rather nice feature. But I do not understand why in c++ we need to put them in the header of a class. I see two annoying downsides to this:
It clutters the header from the user
It force recompilation of all clie... |
I am considering to sponsor a development of some particular features in some Open Source tools. I would like the results of the work to be available publicly, and if possible, to be included in the main product line. The features are usually something which is of general use, but not very critical, and no one has curr... |
I will be adding a feature to the software and have to update or modify some of public API of the present open source software.
What are steps which could be taken to ensure the compatibility of the software.
what are the testing methods which are used in open source world to test the newly added features??
Open Sourc... |
This is really two questions. Im doing a project for the university for storing baseball players statitics, but from baseball data I have to calculate the score by year for the player who is beign displayed. The background is, lets say 10, 000 users hit the player "Alex Rodriguez", the application have to calculate 10,... |
A quick introduction
My college semesters include a 8 week project working for an actual company with a software need in order to get some much needed practical experience. I have just started such a project with 5 other students. We're required to spend roughly 40 hours a week per student on this project. We're workin... |
There are many ways to expose a Java web application to the consumer: application container (JBoss etc), servlet container (Tomcat etc), OSGi (Knopflerfish etc), self-executable WAR (Winstone etc) and so on. Are there any clear considerations where one approach should be favoured over another?
As an example, could a c... |
I have mostly worked on simple java programs and compiled and run them with Eclipse on Windows. So, I have no experience of using command prompt for compiling Java projects and do not have much info about what actually happens beneath the play button in Eclipse.
Now I have to submit a Java application which will have b... |
I have seen many organizations looking for developers who have good command over Facebook, Google and other API's. Now I am a bit confused about it. I have developed Facebook fanpages, embedded facebook buttons to websites and used google maps API too but the thing is that these API's are very large to completely maste... |
The downsides of Mainframes is well trodden ground; expensive, legacy, dwindling community, etc.
I'm not particularly interested in the downsides, but I am curious if there are any benefits to mainframe hardware/software over the current Intel/AMD & Linux/Windows environment.
I've been told that MFs are particularly g... |
Recently I've noticed myself implementing pattern similar to the one described below. Starting with interface:
public interface IUserProvider
{
User GetUser(UserData data);
}
GetUser method's pure job is to somehow return user (that would be an operation speaking in composite terms). There might be many implementa... |
I recently found out about strong typing in VB.Net (naturally it was on here, thanks!) and am deciding I should take another step toward being a better programmer. I went from vba macros -> VB.Net, because I needed a program that I could automate and I never read anything about strong typing, so I kind of fell into the... |
I'm wondering if there is a good extant pattern (language here is Python/Django but also interested on the more abstract level) for creating a business logic layer that can be created without coding.
For example, suppose that a house rental should only be available during a specific time. A coder might create the follo... |
I have been working on a website containing 3d maps, virtual 3d tours, etc. All of the content is large like images and video.
The problem is the site performs well under normal speed connections but it take more time to load if network is busy or the internet connection is slow. How can I describe this to the custome... |
I'm using the following code in my application, and it's working fine. But I'm wondering if it's better to make it with malloc or to leave it as is?
function (int len)
{
char result [len] = some chars;
send result over network
}
|
I am new to JavaEE and am faced with a tight situation here.
I have to develop a Java application for (CRUD) handling records and saving and loading an XML concerning that record. Obviously, I won't be asking you to do this for me. What I would be asking you is to give me some hints/pointer. Initially I thought JAXB wo... |
I find myself constantly running into this expression "don't reinvent the wheel" or "never reinvent the wheel" when I ask some questions on SO. They tell you to use some frameworks or existing packages. I know where this attitude is coming from since it's unwise to waste time on something others have already solved. ... |
I intend to make a web application that displays 3d environments that can be navigated by dragging(with a finger or mouse depending on the platform). The web app will render 3d environments of development sites including contours, water pipeline locations, buildings etc.
I am trying to decide what technology/libraries ... |
Defect containment metrics, such as total defect containment effectiveness (TDCE) and phase containment effectiveness (PCE), can be used to give a good indicator of the quality of the process. TDCE captures the defects that are captured at some point between requirements and the release of a product into the field, ind... |
(Let me know if this is the wrong SE for this)
Why is a Here Document (or Heredoc) called that? Wikipedia didn't have anything to say on that particular subject. I did find unix docs describing a "Here is document", is that the original form?
|
I am developing a system for mailing which has a account id/password to login and I need to store the smtp server account and password for sending mail. Since the mail is auto send I can't request the user input password/id each time when sending.
Therefore, is storing the user account id/password (system b password) i... |
For small size projects, is it worth following the SDLC? is SCRUM/agile development a better approach?
Edit: The project I have in mind is a small change but it will affect multiple layers/parts of the application, so there will be 2 or 3 developers involved each from a different team, then the code will be integrated ... |
We're having a few discussions at work around the naming of our database tables. We're working on a large application with approx 100 database tables (ok, so it isn't that large), most of which can be categorized in to different functional area, and we're trying to work out the best way of naming/organizing these withi... |
Scenario: We have both Winforms and MVC code that is being used to work on a nation wide multi-user platform that does lots of logistics for lots of users. Tax rules change per state and even per city or county. These tax rules make a huge difference for our industry.
The other issue is that rules can change based on ... |
I just finished coding a (basic) ray tracer in C# for fun and for the learning experience. Now I want to further that learning experience. It seems to me that ray tracing is a prime candidate for parallel processing, which is something I have very little experience in. My question is this: how do I know the optimum num... |
Does the saying, "form follows function" hold true in programming or language-design? Why or why not?
|
Scenario:
You push to production
The push broke multiple things
That same build did not break qa or dev
As a developer, you don't have prod access.
There is lots of pressure from above to get things working agian.
Specifics:
PHP/MVC application that is API-driven in Zend.
Deployed to a few servers.
My question:
W... |
I have just started working with a team that has picked up some aspects of Scrum (two week timeboxing) but not others (the team does not currently agree to all estimates or to the number of points in a sprint, but I'll change this soon.) The product owner is also a technical resource (scientist) with some development ... |
I would know if someone can suggest a good approach to convert a word document that contains forms in a web app, specifically in an application built with WaveMaker.(but I'm curious also with a general approach not strictly dependent on the technology that I have mentioned).
For example, if I have a page in a word docu... |
In the .NET Framework, at least in the C# language, we have two "versions" of the string type:
"string"
"String"
It appears that they are interchangeable, but are they really? If they are not interchangeable, is it generally better to use one instead of the other, and under what circumstances?
|
I basically have the gist of TDD. I'm sold that it's useful and I've got a reasonable command of the MSTEST framework. However, to date I have not been able to graduate to using it as a primary development method. Mostly, I use it as a surrogate for writing console apps as test drivers (my traditional approach).
Th... |
Both languages have the same syntax.
Why does C have the weird * character that denotes pointers (which is some kind of memory address of the variable contents?), when PHP doesn't have it and you can do pretty much the same things in PHP that you can do in C, without pointers? I guess the PHP compiler handles this inte... |
I am looking for (or attempting to design) a technique for matching nodes from very similar graphs based on the structure of the graph*. In the examples below, the top graph has 5 nodes, and the bottom graph has 6 nodes. I would like to match the nodes from the top graph to the nodes in the bottom graph, such that th... |
When reading the famous SICP, I found the authors seem rather reluctant to introduce the assignment statement to Scheme in Chapter 3. I read the text and kind of understand why they feel so.
As Scheme is the first functional programming language I ever know something about, I am kind of surprised that there are some fu... |
I am the only person on my team that use TDD. How do I make them to use it?
I am annoyed that when I pull, someone's code will break my tests and I am the one who has to fix them.
Will using github, fork and pull request solve this problem, so that they need to pass the test before the pull is accepted?
I am not the pr... |
Possible Duplicate:
Why are statements in many programming languages terminated by semicolons?
I just found out that R Programming Language, which is somewhat belong to the C family (I'm not sure about this but it uses {} instead of begin end), uses a new line as a delimiter for a new line of code instead of the sem... |
I am developing software that uses many calls to a server. On a client side it's a Silverlight application. Almost every time a user clicks on a button in it, it sends 1-5 WCF calls to a server. There can be up to dozen or so users at a time. The server is a database server that serves data to a client. I am an interme... |
I'm currently learning C#, but wondering whether it is beneficial to learn some C++ before/at the same time as in order to understand the concepts a little better? I've got a C++ book and it does seem rather useful, especially explaining pointers and references.
|
I need to generate debug output in a java appliation that cannot be debugged by placing break points and traces. I've thus far been placing the debug flag as a static variable in one of the classes and then accessing it from all other classes. But this I suspect will eventually cause massive issues later on. What's the... |
The code is a complete mess of a combination of classic ASP/ASP.NET. The scrum consist of us patching up the big mess or making additions to it. We are all too busy doing that to start a rewrite so I am wondering..
Where is the part in Scrum where the developers can have the power to say that enough is enough and deman... |
We (and the JS SO chat room) had a talk with @rlemon some days ago about his Little-XHR library about error handling.
Basically, we wanted to decide which error handling pattern should be used:
xhr.get({
// Some parameters, and then
success: function(data) {},
failure: function(data) {}
})
Or:
xhr.get({
... |
The rule of 3 (the rule of 5 in the new c++ standard) states :
If you need to explicitly declare either the destructor, copy constructor or copy assignment operator yourself, you probably need to explicitly declare all three of them.
But, on the other hand, the Martin's "Clean Code" advises to remove all empty constr... |
I've been working in multiteam groups for as long as I've been a web developer, and in my experience, a team can be a lonely soldier or several people; generally a company will have multiple teams working on different projects and once the project is out in the wild, any team can perform maintenance on it.
This is a si... |
I need to design a database that will contains information about personal disease of users.
What can be the approach in order to implement the columns of the DB's tables: encrypt the information, separate data within two differents DB, one for sensitive data and another for not sensitive data, or both or another approa... |
Let's assume you are convinced that the extra time spent unit testing has merit and improves production. Does that still hold up when everyone working on the same code doesn't use them? This question makes me wonder if fixing tests that everyone doesn't use is a waste of time. If you correct a test so the new code will... |
I am aware of the fact that TFS 2010 ultimate edition can create and validate architecture diagrams. For example, I can create a new modeling project > add Layer Diagram > Add Layer called View > Add BL Layer > Add DL layer.
Then I can validate this architecture as part of the build process when someone tries to check... |
I studied computer science near the end of 1980s, and wasn't taught OOP that formally.
With Pascal or C, when I understand the top-down design of functions, and the idea of black box, then everything just seem to make sense, as if there is a "oh I get it!" -- some kind of totally getting it and enlightenment feeling.
B... |
Our application uses database (mostly Oracle), and database is at the core. Each customer has its own database, with its own copy of application. Now with each new release of our product, we also need to update the database schema. These changes are adding new tables, removing columns, manipulating data etc. How do the... |
Just wondering whether dynamically built HTML layout is fine from SEO perspectives? So let's assume e-commerce engine and its most popular page - products catalog. So 90% of the page is built using AJAX and MVVM library knockoutjs which builds HTML on the fly on the client side. So how search bots would parse such cont... |
I've got a nice MVC set up going but my website requires some views that don't map directly to a model. Specifically I've got some generic Reports users need to run, and now I'm creating a utility for comparing some system configurations.
Right now the logic is crammed into a Reports Controller and I'm starting a Comp... |
It occurs to me that the ModelBinder mechanism in ASP MVC
public interface IModelBinder {
object BindModel(System.Web.Mvc.ControllerContext controllerContext, System.Web.Mvc.ModelBindingContext bindingContext);
}
Is insanely powerful. What are some cool uses of this mechanism that you've done/seen?
I guess since th... |
My team is getting up to speed with Scrum, but most of us are more familiar with non-agile or "pseudo-"agile methodologies. The part that is the biggest hurdle for us is running an efficient Sprint Planning meeting where we break our backlog items into tasks, and estimate hours. (I'm using the terminology from the VS2... |
Background
I was just asked in a tech interview to write an algorithm to traverse an "object" (notice the quotes) where A is equal to B and B is equal to C and A is equal to C.
That's it. That is all the information I was given.
I asked the interviewer what the goal was but apparently there wasn't one, just "traverse"... |
I am currently learning Javascript, and there is one element of the syntax that I can just not seem to nail down. That element is adding semicolons at the end of each line. I have learned Python and Ruby, and written a ton of both, so the lack of semicolons is stuck in my mind! Is there a way to drill that (or even any... |
I have been seeing opportunities go past me for just 1 reason: not having professional industry experience. I say to many employers that I'm capable of doing the job and show them the work I've done during the academics and also several personal projects which I took extra time and effort to teach myself the new indust... |
Any idea on how to build an application that provides unique keys each time it get called by another process.
Calling process isn't my problem here, my problem is how to sync between two(or more) processes and preventing it from providing the same key to both of them.
I'd really appreciate your help in this issue, ple... |
I have written a program that can rapidly (within 5 sec on a 2GB RAM desktop, 2.33 Ghz CPU) differentiate between structured text (e.g English text) and random alphanumeric strings. It can also provide a probability score for the prediction.
Are there any practical applications/uses of such a program? Note that the pro... |
I want to save the configuration of my project which includes
Screen size
Screen position
Folder paths
Users settings and so on.
The standard places where you can save these are configuration values are:
Registry
INI files
Personal files (like *.cfg)
How do you choose between these places? Also, are there any pros ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.