instruction
stringlengths
34
19.9k
I have a script, and now it's the perfect time to have an option to change theme templates. I was looking forward to store these files in php files, or html files. with CSS file. I looked over some codes and I found that they use brackets to refer to the variable. Here's an example of a template block: <div class='bl...
Can software with AGPLv3 license be used with GPLv3 project? Can the resulting project be GPLv3, or must it have the special requirements of AGPLv3? I am not very smart from clause 13 of GLPv3 that mentions AGPLv3. Notwithstanding any other provision of this License, you have permission to link or combine any covere...
Problem Statement - Given a NxM grid of 1s & 0s (1s mark walls, while 0s indicate empty chambers), the task is to identify the number of chambers & the size of the largest. And just to whet my curiosity, to find in which chamber, a cell belongs. It seems like an ad hoc problem, since the regular algorithms just don't...
I've come to notice that a lot of software that companies use for managing things like time, expenses, setting up phone systems, etc is very non-intuitive from a user experience point of view. I know personally I waste a lot of time just trying to figure out how to navigate these systems, especially if I don't have a ...
What's the basis behind SHA-1 or SHA-2 or other Checksum algorithms? I read about it here http://en.wikipedia.org/wiki/SHA-1#Data_Integrity But I am still wondering about an answer in a layman's language. Can I understand it as a very, very compressed code that can be translated back into original data? Let's say, I ...
In this post, Martin (the language's head honcho) writes: [XML literals] Seemed a great idea at the time, now it sticks out like a sore thumb. I believe with the new string interpolation scheme we will be able to put all of XML processing in the libraries, which should be a big win. Being interested in language...
I am fighting about a web application script optimization. I have an ASP.NET web app that reference jQuery in the master page, and in every child page can reference other library or JavaScript extension. I would like to optimize the application with YUI for .NET. The question is, I should put all the libraries referen...
I was wondering if there's some software to manage a XP project. I'm starting a school project and I want to follow this methodology, but, we don't have a place to work. Each one works at home (in pairs), therefore I can't follow XP ambient patterns. So, anyone knows of any software to manage this?
I have been reading up on arithmetic coding and, while I understand how it works, all the guides and instructions I've read start with something like: Set up your intervals based upon the frequency of symbols in your data; i.e., more likely symbols get proportionally larger intervals. My main query is, once I have en...
We want to allow the same core service to be either fully implemented or, as other option, to be a proxy toward a client legacy system (via a WSDL for example). In that way, we have both implementation (proxy & full) and we switch which one to use in the configuration of the app. So in a nutshell, Some desired features...
I am somewhat familiar with the concepts and benefits of Scrum. With that in mind, I am trying to improve the failing Scrum product management structure of a company I'm now working for that has three separate B2C products, catering to the same demographic and accessible on the same website. Each product has a product ...
I am currently working on a rather large project, and I have used JUnit and EasyMock to fairly extensively unit test functionality. I am now interested in what other types of testing I should worry about. As a developer is it my responsibility to worry about things like functional, or regression testing? Is there a goo...
I would like to implement some kind of manager class in my application. It will be in charge of loading textures, processing them, distributing them etc... At first, I wanted to make a global variable that simply contains an instance of my manager class. I found this question: https://stackoverflow.com/questions/464657...
I have a need to produce a simple dependency tree diagram. The input data would be in the following simple format: ITEM_NAME DEPENDENCY ---------------------------- ITEM_101 ITEM_75 ITEM_102 ITEM_77 ITEM_102 ITEM_61 ITEM_102 ITEM_11 This means that ITEM_101 depends on ITEM_75 and ITEM_102 depends on item...
So yeah, I'm creating a programming language. And the language allows multiple threads. But, all threads are synchronized with a global interpreter lock, which means only one thread is allowed to execute at a time. The only way to get the threads to switch off is to explicitly tell the current thread to wait, which all...
What is the "stack" exactly? I've read articles, tried comprehending it through my understanding, experience, and educated guessing of programming and computers, but I'm a bit perplexed here. The "stack" is a region in RAM? Or is it some other space I'm uncertain of here? The processor pushes bits through registers o...
I'm looking for some input and theory on how to approach a lexical topic. Let's say I have a collection of strings, which may just be one sentence or potentially multiple sentences. I'd like to parse these strings to and rip out the most important words, perhaps with a score that denotes how likely the word is to be i...
I need an algorithm to place horizontal text labels for multiple series of points on the screen (basically I need to show timestamps and other information for a history of moving objects on a map; in general there are multiple data points per object). The text labels should appear close to their points--above, below, o...
How could a random generator be implemented? I'm not speaking about the invocation of a language mathRandom() method, but the implementation of the routines that lead to generate numbers totally random.
In http://www.json.org Douglas Crockford shows the specs of the JSON format in two interesting ways: In the right side column he lists a text spec that looks like a YACC or LEX listing. In the main body of the homepage, he put several images that gives us a simple way to visually understand the valid sequences that com...
A class that performs both computations and data logging* seems to have at least two responsibilities. Given a system for which the specifications require heavy data logging, what kind of design patterns or architectural patterns can be used to avoid bloating all the classes with logging calls every time they compute s...
In a C++ program that doesn't contain legacy C code, is there a guideline regarding the maximum number of levels of indirection that should be used in the source code? I know that in C (as opposed to C++), some programmers have used pointers to pointers for a multiple dimension array, but for the case of arrays, there...
I appreciate you can't start an open source project with just an idea but would just a design be enough? Has anyone ever seen that done where a designer posts a design and developers join to start the coding?
I am designing a logic analyzer and I would like to implement some Matrix Algorithm. I have several channels each one represented by a row in the matrix and every element in the column would be the state, for example: Channel 1 1 0 0 1 0 1 1 0 1 Channel 2 1 1 0 1 1 0 0 1 1 Channel 3 0 1 0 1 1 0 1 0 0 I would lik...
I have to read lines from a text file in sequential order. The file is a custom text format that contains sections. If some sections are out of order, I would like to look for the starting of the next valid section and continue processing. Currently, I have some code that looks like this: for (int currentLineIndex=0; c...
I worked in academia a few years, but more on the D-side of R&D. The race for papers never appealed to me and I'm a practical not theoretical type, but I do like reading papers on certain topics (e.g. Google Papers, NLP, FB papers, ...) a lot. How common is it that normally working developers submit papers to conferen...
Is support for non-english characters common in programming languages? I mean, technically, I would think it is feasable, but I don't have any experience in anything other than english, so I don't know how common it is. I know that there are non-english based programming languages, but can something like C#, C++, C, Ja...
We are using TFS and SQL Server 2005 (looking to upgrade to SQL Server 2012 if that makes a difference). We store our database schema in a Visual Studio Database project (VS 2010). When code is released to live we currently use the Visual Studio Database Project to build a script for all our schema changes. The problem...
Can any one please explain this piece of code I found in the linux kernel source. I see a lots of code like this in linux and minix kernel but dont seem to find what it does (even if C compilers support that kind of function definition) /* IRQs are disabled and uidhash_lock is held upon function entry. * IRQ state (as...
One of the problems web apps have against native apps, especially on the mobile front, is the constant need to re-download each web page on request. Ultimately, this leads to slower performance. Why if web apps only download new pages if they're actually needed, not because they're simply requested. For example: perhap...
I would like to publish part or full source code of one or more plugins (licensed under GPL, GPLv2, MIT or no license) in my website/blog. Website I am talking about is for everyone, free to use and free to copy code. Plus, is it okay if I do not provide any link to the source code/plugin? I will definitely give full c...
The 'continue' keyword in Java (and probably in many other programming languages) is used to skip further execution of the current iteration. Why was the name 'continue' chosen? Why not something more straightforward like 'skip' ?
I have read recently some articles (e.g. http://dailyjs.com/2012/09/14/functional-programming/) about the functional aspects of Javascript and the relationship between Scheme and Javascript (the latter was influenced by the first, which is a functional language, while the O-O aspects are inherited from Self which is a ...
I always get confused about how to use the verb "to map" in the context of associating objects with each other, particularly if the mapping is directional. Is there a distinction between mapping users to IDs and mapping IDs to users In the given example, which would be the better way to put it?
I've built a few API's using the complete rails stack. In each project there have been multiple uses for rails core features. Each of the API has had management screens for monitoring usage, managing authentication keys, etc. Is there such thing as an API without a management front end?
I need a very simple pseudo random generator (no any specific quality requirements) and I found Microsoft's variant of LCG algorithm used for rand() C runtime library function fit my needs (gcc's one seems too complex). I found the algorithm here: http://rosettacode.org/wiki/Linear_congruential_generator#C However, I w...
I'm in a new position where I need to process a flat files on a regular basis. The last time I did this was 5 or 6 years ago but as part of the file layout I received control totals. It gave me simplistic information on the file like the total number of records as well as sums of the important fields. This helped me...
Zend's Coding Standard Naming Convention says Functions in the global scope (a.k.a "floating functions") are permitted but discouraged in most cases. Consider wrapping these functions in a static class. The common wisdom in Python says practically the opposite: Finally, use staticmethod sparingly! There are very few...
I'm building a blogging site for learning, with a PHP/MySQl back-end. All of the user input is handled with forms sent in POST requests. Will using JSON somehow make it cleaner, or easier to maintain or add features? Or am I just adding an interchange format for no reason? So essentially, what functionality would be be...
(This is mainly aimed at those who have specific knowledge of low latency systems, to avoid people just answering with unsubstantiated opinions). Do you feel there is a trade-off between writing "nice" object orientated code and writing very fast low latency code? For instance, avoiding virtual functions in C++/the ove...
What is a better approach when it comes to performance and optimal resource utilization: accessing a database multiple times through AJAX to only get the exact information needed when it is needed, or performing one access to retrieve an object that holds all information that might be needed, with a high probability th...
Edit: my language allows for multiple inheritance, unlike Java. I've started designing and developing my own programming language for educational, recreational, and potentially useful purposes. At first, I've decided to base it off Java. This implied that all the code would be written in form of classes, and that code ...
Is there a difference between public class A extends AbstractB implements C {...} versus... public class A extends AbstractB {...} abstract class AbstractB implements C {...} I understand that in both cases, class A will end up conforming to the interface. In the second case, AbstractB can provide implementation for ...
I'm developing a Javascript library, and I'm thinking about releasing it under an open source license (e.g. GPL, BSD, MIT) — but that requires that websites that use the software link back to my website. Do you know about any such licenses? And how have they formulated the attribution part of the license text? Do you t...
I grasp that it can fetch internet resources, but I'm not really fully appreciating what that means. I was doing the challenges at pythonchallenge.com, and I got past the one that requires urllib to fetch the page and read the source, but I don't see how this is useful quite yet. And examples are kind of lacking in div...
I have been interested in some of the concepts of functional programming lately. I have used OOP for some time now. I can see how I would build a fairly complex app in OOP. Each object would know how to do things that object does. Or anything it's parents class does as well. So I can simply tell Person().speak() to mak...
Recently I have been assigned to work on a major requirement that falls between a change request and an improvement. The previous implementation was done (badly) by a senior developer that left the company and did so without leaving a trace of documentation. Here were my initial steps to approach this problem: Cons...
Why it is less common to use wiki/markup in enterprise as documentation? They use Word document instead. Wiki/markup are in text format, which is version control friendly.
I am new to DDD, having worked only in Transaction-Script apps with an anemic model, or just Big Balls of Mud, so please forgive any terminology I abuse. I am trying to understand the proper separation between the domain model and the repository. What is the proper way to construct a domain object that is coming from a...
I need to develop an app for booking appointments. This is going to be hosted in a shared server. So performance is the most important thing. I have used symfony2. I quite liked the framework. But seems to be heavy. Which framework would suit me considering my requirements? I have shortlisted three frameworks yii, symf...
I often encounter the following statements / arguments: Pure functional programming languages do not allow side effects (and are therefore of little use in practice because any useful program does have side effects, e.g. when it interacts with the external world). Pure functional programming languages do not allow to ...
Today, I got into an argument about the term "procedural generation". My point was that its different from "classic" random generation in that procedural generation is based on a more mathematical, fractal-based, algorithm leading to a more "realistic" distribution and the usual randomness of most languages are based o...
I've writing a date-time library, and need to implement the addition of a duration to a date-time. If I add a 1 month duration: P1M to the 31st March 2012: 2012-03-31, does the standard define what the result is? Because the resulting date (31st April) does not exist, there are at least two options: Fall back to the l...
Edit: Comments suggested, that DSM just faded out by being not used recently. What were the reasons for this, what are DSMs drawbacks? Literature lists many positive aspects like easy to port programms to, no marshalling and therefore faster and so on but also negative aspects like only usable in homogenous environment...
Possible Duplicate: Writing Web “server less” applications So, let's say I'm going to build a Stack Exchange clone and I decide to use something like CouchDB as my backend store. If I use their built-in authentication and database-level authorization, is there any reason not to allow the client-side Javascript to wr...
I'm modeling a chemical system, and I'm having problems with naming my elements / items within an enum. I'm not sure if I should use: the atomic formula the chemical name an abbreviated chemical name. For example, sulfuric acid is H2SO4 and hydrochloric acid is HCl. With those two, I would probably just use the atomi...
For PHP, best practices, I have read somewhere that if you assign your data to a variable it takes almost no memory or resource. So let's say I have this function that return a count. public function returnCount($array){ return count($array); } or if this is better? public function returnCount($array){ $count ...
A project I am working on has a bunch of legacy tests that were not properly mocked out. Because of this the only dependency it has is EasyMock, which doesn't support statics, constructors with arguments, etc. The tests instead rely on database connections and such to "run" the tests. Adding powermock to handle these c...
I am an experienced Java programmer, and I want to create a complex web application requiring dynamic pages, drawings, etc (take SO as an example). Do I have to learn javascript/html in order to create such an application? It is not that I don't want to learn another language (I've done this before), but technology on ...
Problem statement: Given: TFS as Source Control Heavy desktop client application with tons of legacy code with bad or almost absent architecture design. Clients constantly requiring new features with sound quality, fast delivery and constantly complaining on user unfriendly UI. Problem: Application undoubtedly requi...
I discovered some time ago that the GOTO control keyword was introduced in PHP 5.3.0. http://php.net/manual/en/control-structures.goto.php Why did it happen? What are the language design goals behind this? Did the PHP developers community asked for it?
I am developing a rather eye-candy application which is to be released on Mac App Store. Due to its graphics intensive use, it would save a great deal of time on UI end if the app could be released with a fixed size main frame-dialog. I did try doing a search regarding App Store policies on the matter but could not fin...
Let's say I have ThingImpl and IThing. The former is an implementation of the latter, which is an interface. IThing has 1 method: do(arg1) Is it considered a hack/bad practice to add a method in addition to do()? Example: do(arg1, arg2)
I would like to know, is it considered a common practice to use constructions like |=, &&, ||, != altogether in the single line of code? E.g. hasErrors |= vi2!=null && vi2.hasErrors() || vi.hasErrors(); What can be done to make the code more readable? The programming language is Java, if it matters.
I do not fully understand what am I asking (lol!), well, in the sense of if it is even possible, that is. If it isn't, sorry. Suppose I have a Java program. It has a Main and a JavaCalculator class. JavaCalculator has some basic functions like public int sum(int a,int b) { return a + b } Now suppose I have a ruby f...
I am new to web crawling and I am testing my crawlers. I have been doings tests on various sites for testing. I forgot about robots.txt file during my tests. I just want to know what will happen if I don't follow the robots.txt file and what is the safe way of doing the crawling?
Both Android and iOS seem to support their application having a binary delta update. But how does it work? I build a binary program, neither of the distribution sites have the source code - how does the update process know what is changed?
TL/DR: Any way to work out if known numbers between a known start and ending figure should be positive or negative numbers? I am developing an application in PHP which can import and read PDFs. The PDFs are financial ones such as bank statements with records of transactions in and out of a bank account. I only have PDF...
Is else while without intervening braces considered "safe" maintenance wise? Writing if-else code without braces like below... if (blah) foo(); else bar(); ...carries a risk because the lack of braces make it very easy to change the meaning of the code inadvertently. However, is below also risky? if (blah) { ...
I've been looking into the details behind these two different categories: Web runtime environments Web application programming languages I believe I have the correct information and have phrased it correctly but I am unsure. I have been searching for a while but only find snippets of information or what I can see as ...
In this SO Question there is a comment by starblue that A computer without loops is a calculator Is this true? Is that the only difference? Is there a set of criteria to differentiate or has the line become very blurred?
I am not sure weather it is a proper question to ask out here but it is really bothering for a while. As the official website writes: The Rails Rumble is a distributed programming competition where teams of one to four people, from all over the world, have 48 hours to build an innovative web application, with Ruby...
I am developing an app in ddd maner. So I have a complex domain model. Suppose I have a Fare object and Airline. Each Airline should contain several or much more Fares. My UI should represent Model (only small part of complex model) as a list of Airline, when the user select the Airline, I must show the list of Fares....
Assume I have a public source code repository. Am I violating copyright laws if there's any old commit where I have not yet added all copyright info for other people's open source code? Details: Consider this theoretical scenario: I copy-paste someone else's open source code files into a repository. I commit. I prefix...
How do people define the minimum hardware requirements for software? For example: how can a software development company tell the customer that they will need 8 GB of RAM to run the program properly?
Background: There are around 60 students at the boarding school I work for. The counselor asked my colleague and me to come up with a better way to come up with seating arrangements for dinner than by hand. He would like assignments for the rest of the school year. He also asked us to try to solve some of the issues he...
I've recently started with a new firm and I'm trying to understand the mechanics behind something, so I'll anonymize the code and present but a sample: [Test(Description = "Retreives the New view for XXXX.")] public void New() { "~/XXXX/New".ShouldMapTo<XXXXController>(x => x.New()); "~/XXXX/New".WithMethod(HttpVer...
Possible Duplicate: I’ve inherited 200K lines of spaghetti code — what now? I'm dealing with legacy code. It contains some BIG classes (line count 8000+) and some BIG methods (line count 3000+). For one of these methods I wrote a unit test that covers at least some code. This function has no specific structure, it i...
I have to extend/fix a large online form written by other developer. There is a lot of code, mixing PHP and JS. It's kind of write-only style of coding and I want to redo it completely, but currently I can't. It works like this: It is a wizard-style form with 12 steps - let's call them phases to not confuse with steps...
I have a class that I'm testing. The class has a function: apply(List<IRule> rules, List<ITarget> targets); In one test I want to ensure that each target has been passed to one rule, a la: rule1.AssertWasCalled(fnord => fnord.Test(target1)); rule1.AssertWasCalled(fnord => fnord.Test(target2)); rule1.AssertWasCalled(fno...
I'm working on re-factoring certain aspects of an existing web service. The way the service APIs are implemented is by having a kind of "processing pipeline", where there are tasks that are performed in sequence. Unsurprisingly, later tasks may need information computed by earlier tasks, and currently the way this is d...
I saw a conference by Herb Sutter where he encourages every C++ programmer to use auto. I had to read C# code some time ago where var was extensively used and the code was very hard to understand—every time var was used I had to check the return type of the right side. Sometimes more than once, because I forgot the ty...
I've recently read the article The Problem with logging and was wondering about my current logging strategy. Usualy I use Log4J in my projects and just have to decide which line/attributes I would like to log. This strategy worked well for me in the past for all my projects without user-interaction. Now I want to set u...
Can I license a program under Apache License 2.0, if it is using/including EclipseLink? (EclipseLink under Eclipse Public License or Eclipse Distribution License) I did not change anything in EclipseLink. I would realy like to distribute a Version that includes the needed EclipseLink jars, so that it is working "out of...
How would you implement / design a class which has to represent a bitmap? I'm stuck at handling the different possible color modes and I keep thinking that this should be somehow implementable using templates / design patterns in an elegant AND efficient way: Suppose you have a file.bmp. You then want to open that file...
I came across this article proposing a style of coding in c++ that looks a bit weird at first. But after reading it over and pondering for a bit I'm really considering giving it a try. The most appealing benefit is the ease of refactoring methods. I find myself constantly changing method names, parameters and so on whi...
Quercus is an implementation of PHP written in Java, and released under the GPL. If I use it, does my PHP code fall under the GPL? What about my Java code? Assuming I write new Java code, and new PHP code, and use Quercus to run my PHP code on the JVM and call into my Java code, which pieces fall under the GPL? Also, a...
Assume you are using APIs from a vendor, how to make sure their API is working as expected? My main concern is sometimes the vendor pushed the changes to their code and break the API, we want to have some sort of automatic software to test them continually. How to deal with this?
Most security threats that I've heard of have arisen due to a bug in the software (e.g. all input is not properly sanity checked, stack overflows, etc.). So if we exclude all social hacking, are all security threats due to bugs? In other words, if there were no bugs, would there be no security threats (again, excluding...
When subdividing intervals for arithmetic coding, the worst case scenario is that the final interval will have size 2^(1-n), where n is the number of unique symbols you are encoding. This will reach the limits of machine precision, when using regular datatypes, really quickly: For instance, I've made a JavaScript imple...
Background I have a requirement where I need to remove a few nodes in a network based upon a command given by the user. To keep the nodes from transmitting or receiving data I thought of changing its IP address to some other address. Before I change the address I want to save the node's IP so that I can re-assign the...
Our Architecture team is proposing a framework that would see our SQL queries moved from coded strings within our applications, into a file based system where we would invoke them with function calls. Our application makes heavy use of SQL queries ranging from the mundane, to very complex. This is a .NET solution. The ...
I am taking a C++ class in my school. Since I've programmed in Ruby I know some OOP stuff. But in C++ there are member functions, member variables, and static functions. In Ruby we have instance methods, instance variables, and class variables. And there are more... Any reason they're different? Are they quite differen...
If we have double numbers, let's say I want to see if some double parameter is equal to zero that is passed as double: public bool AlmostEqual(double x, double y) { double epsilon = Math.Max(Math.Abs(x), Math.Abs(y)) * 1E-15; return Math.Abs(x - y) <= epsilon; } considering double shows 15 accurate digits. So ...
We use Drupal 7 as our base CMS tool. For one specific product, something like an ERP, we've created sort of a non-drupal layer, to keep our specific business code in. It would be something like this: ------------- | Business | -> This would be our business specific code layer ------------- | Glue | -> This is wh...
I had originally posed this on StackOverflow. The question was closed and I was asked to post this here instead. Here is the original question I had posted there: I have been programming using procedural method for a while now. I have done some good amount of reading pertaining to OOP and I know how to use it. It's ju...
I asked this question over at stackoverflow and it was suggested a tighter form be posted here. Many early career numerical researchers face the prospect of having to create performance critical software from the ground up. Most are ill equipped to do so, and my lab is no different. I currently work extending a sophist...
This is related to my recent question regarding naming awkward domain objects. A number of answers indicated I was using the wrong representation for the domain objects. To summarize, I chose to use an enum to represent some domain objects used as keys in lookups. For this question, I want to review my decision to ...
I'm helping to reogranize several redmine projects; although I have a lot of experience with issue tracking systems, I've never worked with redmine before. What is the best way to organize Issues in Redmine so that they can be easily grouped by: feature (e.g. "Upload a file", "Login to site", "Send message") system co...
My aim is to, via pattern analysis and statistics, (as well as piece mobility and position) build a chess position evaluation analyzer (rather than simply going brute force ply-searching). Id like to hear some thoughts a language that will be interesting/fun/challenging to learn and reason with. Ideally the language w...