instruction stringlengths 34 36.1k |
|---|
I recently came across the following code (from liferay.js) when I was working with Liferay:
....
if (!Liferay._ajaxOld) {
Liferay._ajaxOld = jQuery.ajax;
}
if (Liferay._ajaxOld) {
jQuery.ajax = function(options) {
if (Liferay.Util) {
options.url = Liferay.Util.getURLWithSessionId(options.u... |
I'm not new to programming and I've even worked with some low level C and ASM on AVR, but I really can't get my head around a larger-scale embedded C project.
Being degenerated by the Ruby's philosophy of TDD/BDD, I'm unable to understand how people write and test code like this. I'm not saying it's a bad code, I just ... |
I am taking the Stanford Online Machine Learning class which is outstanding. http://ml-class.org
Is anyone taking the Stanford Online Database class: http://www.db-class.org? Does it seem useful if you have a few years of fairly simple database experience, but no formal education in the area? Or is it mostly academic a... |
Is it fine to code PHP on Windows and host it later on a server running Linux? Can there be any problems in the migration of such a project?
I would think that there really can't be any problems, especially since I am a beginner in PHP and I won't use any of the advanced functions that may be OS-specific. However, I wo... |
Recently I started releasing an open source project, while I was the only user of the library I did not care about the names, but know I want to assign clever names to each methods to make it easier to learn, but I also need to use concise names so they are easy to write as well.
I was thinking about some guidelines ab... |
I'm interested in whether ActiveRecord pattern, made famous from Ruby on Rails, encourages or discourages the use of SOLID design principles.
For example, it seems to me that ActiveRecord objects both contain domain logic, and persistence logic, which is a violation of Single Responsibility.
|
As I was reading Martin Fowler's famous blog post Is Design Dead?, one of the striking impressions I got is that given the fact that in Agile Methodology and Extreme Programming, the design as well as programming is evolutionary, there are always points where things need to get refactored.
It may be possible that when... |
I asked a question here on programmers yesterday about learning HTML & CSS and the community was pretty generous to provide great answers. One of the answers was given by Emmad Kareem and that was : "if you can't do HTML, don't give up. Consider using Silverlight".
This answer made me visit Silverlight.net and I came ... |
I'm working on a small side project using CGI and Python (scalability is not an issue and it needs to be a VERY simple system.)
I was thinking of implementing authentication using cookies, and was wondering if there were any established best practices.
When the user successfully authenticates, I want to use cookies to ... |
I want to know if the service test classes should use real DAO objects and connect to the database or it should use mock objects to test only the business logic it do?
|
The definition for directed acyclic graph is this: "there is no way to start at some vertex v and follow a sequence of edges that eventually loops back to v again."
So far so good, but I am trying to find some premises that will be simpler to test and that will also guarantee the graph is acyclic. I came up with those ... |
I find it hard to describe this problem in words, which is why I made a video (45 seconds) to illustrate it. Here's a preview of the questions, please have a look at it on Vimeo: http://vimeo.com/epologee/perfect-crossfade
The issue of creating a flawless crossfade or dissolve of two images or shapes has been recurrin... |
I'm currently starting a new sub project where I will:
Retrieve the order information from our mainframe
Save the order information to our web-apps' database
Send the order as EDI (either D01b or D93a)
Receive the order response, despatch advice and invoice messages
Do all kinds of fun things with the resulting datase... |
I've been thinking about interview questions lately and I've been reflecting on bad interview experiences I've had in the past. One of particular note is where I had asked the interviewer why the team chose to use EJB 3 over Spring in their product. The interviewer pretty much tore my face off, yelling "Because Spring ... |
I've developed a website using PHP but I implemented it on Windows OS and hosted it on Windows server.
I just searched the PHP job market to know the on-going technology requirement and to keep my knowledge up-to-date accordingly with the job market.
I see more are asking for LAMP stack. I understand the sort of s... |
OK - I am studying Prism a little because of a "free weekend" offer on Pluralsight. As this is proving too complex for me, I went to the Prism book and looked at the forward, and this is what it said:
What comes after “Hello, World?”
WPF and Silverlight developers are
blessed with an abundance of excellent books.... |
I just finished reading this recent article. It's a very interesting read, and it makes some great points. The point that specifically jumped out at me was this:
The difference was in how they spent this [equal] time. The elite players
were spending almost three times more hours than the average players
on deliber... |
Assume the following situation similar to that of Stack Overflow: I have a system with a front-end that can perform various manipulations on the data (by sending messages to REST back-end):
Posting
Editing and deleting
Adding labels and tags
Now in the first version we created it well modularized but the need as of n... |
I'm currently doing R&D for a web application which we plan to host ourselves initially and then allow customers to self host.
My task has been evaluating web frameworks to see which would give us the biggest productivity initially and ease of maintence while also allowing us to easily support deployment to customer co... |
Oracle seems to license all their Java-related open source code under the GPL with a classpath exception. From what I understand, this seems to allow to combine these libraries with your own code into products that do not have to be covered by the GPL.
How does this work?
What are examples of how I can and cannot use ... |
Other than programming, I'm addicted to sports. I'd like to integrate the two together. What are different programming languages that companies like ESPN use to work with stats? What techniques are used to do this, and how can I get going with it myself?
|
We have a small dev team (only 3 developers) and we recently got
a new team member. While he is a smart coder, his coding style is
completely different from ours. Our existing code base contains
mostly readable, clean and maintainable code, but the new team
member is quickly changing many files, introducing ugly hacks ... |
As the number of "visual" OS's such as Android, iOS and the promised Windows 8 are becoming more popular, it does not seem to me that we programmers have new ways to code using these new technologies, due to a possible lack in new visual programming languages paradigms.
I've seen several discussions about incompatibil... |
Possible Duplicate:
When to favor webforms over MVC
ASP.Net MVC has been around for some time now. The latest one, i.e MVC3 comes with Razor View Engine.
My question: How long is traditional ASP.Net here to stay. Does Microsoft have any plans to eliminate it in aid of ASP.Net MVC in the future and will the next rel... |
A lot of students when they graduate and get their first job, feel like they don't really know how to program even though they may have been good programmers in college.
What are some of the differences between programming in an academic setting and programming in the 'real world'?
|
In various open source CMS, I have noticed that there is a separate table for mapping two relational tables. Like for categories and products, there is a separate product_category_mapping table. This table just has a primary key and two foreign keys from the categories and product tables.
My question is what are the b... |
I am working on a project in Asp.net MVC and need to work with images. There is an SQL database with a Product table. Every product in the table will have it's own image. I have two ways to do this :
1) Save the image in a web directory and store the URL on database.
2) Store the image in SQL itself in binary format an... |
I've come across a situation at work where I have to justify why I need one (or more) mobile developers per platform.
Although I'm quite aware of the why (each platform is substantially different, has its own philosophy, etc.) I can't seem to come up with more than that.
Are there any articles I can read or even books ... |
I'm working at a site similar to Foursquare and Yelp, with approximately 100000 unique requests each week that generates content, growing steadily. We are currently using:
Seam as Java web framework.
MySQL as DB
Hibernate as ORM
Hibernate Search as Index
EhCache for Caching.
Since our site is slowly growing out of th... |
I know some projects and web pages for practicing algorithms like TopCoder and Project Euler.
However, they just dictate the solution of a particular problem. I wonder if there is a resource, website or any material, that doesn't only give away the code, but also explains the solution thoroughly ?
|
So traditional scrum board looks something like this
Backlog | Story notStarted inprogress Done
story 1 Story1 tasks
Story 2 Story2 tasks
Story ..
Story n
Epic x
Epic x+1
However in general a story has many scenarios and when working with BDD you want to wri... |
I personally find reading code full of Unicode identifiers confusing. In my opinion, it also prevents the code from being easily maintained. Not to mention all the effort required for authors of various translators to implement such support. I also constantly notice the lack (or the presence) of Unicode identifiers sup... |
A C or C++ compiler looks for header files using a strict set of rules: relative to the directory of the including file (if "" was used), then along the specified and default include paths, fail if still not found.
An ancillary tool such as a code analyzer (which I'm currently working on) has different requirements: it... |
In short, for simple games:
Is Flash still a good option for browser-based PC clients? It still has 90%+ penetration.
What is a good alternative for mobile devices? Is HTML5 + JavaScript the choice for mobile? Or does one have to learn a new native language for each target platform? (Android, Apple, Windows Phone)...
... |
What if I want to also decouple my application, from classes like Product or User? (which usually have more than one instance)
Take a look at this example:
class Controller {
public function someAction() {
$product_1 = new Product();
$product_2 = new Product();
// do something with the produ... |
I've been working by myself on a fairly large open source project for quite a while and it's nearing the point where I'd like to release it. However, I'm self-taught and I don't really know anyone who could adequately review my project.
A few years ago, I had released a small bit of code which pretty much got ripped ap... |
I want to write my first Java program, for example Phonebook, and I wonder what to do first. My question is should I write GUI classes first or util classes first?
I am database developer and want to know best practice in building program.
|
I have started learning about C# and I come to what is called 'Automatic memory management' or 'Garbage collectors' and I'm wondering if Java contains something like this as well? and if it does, does it do that as effective as C# when it comes to windows desktop application and web applications?
|
Why can't we put them in the same page, like each action paired up with its view? Not using code island, but controller code at top then view code at bottom? What are the problems with this approach?
By MVC, I am referring to frameworks such as ASP.NET MVC and Ruby on Rails, and I am under the impression that the V and... |
I have the following example for a user story with acceptance criteria.
I would like to know if I am allowed to describe how the GUI must be changed to support the new feature. How much detail can acceptance criteria have?
This is my example:
User Story:
As forum administrator I will connect persons in groups, so that... |
Is there a definitive guide to writing code comments, aimed at budding developers?
Ideally, it would cover when comments should (and should not) be used, and what comments should contain.
This answer:
Do not comment WHAT you are doing, but WHY you are doing it.
The WHAT is taken care of by clean, readable and simple c... |
I am currently tasked to write a software to help engineers design standard compliant designs. If there is a bad design, software will report an error or warning.
Maybe it's just me, but anyone who has done this should be familiar with the massive amounts of ANSI standards tables like this one: http://en.wikipedia.org/... |
I have been told that when there are multiple buttons on the page for same purpose but targeting different item e.g. delete item on a grid of items, they say it is recommended to just register for click handler only on the top most element like 'body' and check what was clicked instead of hooking up click with every de... |
My question is about the architecture of my application. I have a Rails application where companies can administrate all things related to their clients. Companies would buy a subscription and their users can access the application online. Hopefully I will get multiple companies subscribing to my application/service. W... |
When QA or UAT comes, should the developer still be involved in setting up data or finding test data for the QA tester or business user? Or will this introduce bias to the developer who coded the system changes that are being tested in the said environments?
|
I've got a question concerning node.js performance.
There is quite lot of "benchmarks" and a lot of fuss about great performance of node.js. But how does it stand in real world? Not just process empty request at high speed.
If someone could try to compare this scenario:
Java (or equivalent) server running an applicatio... |
I work in the field of accelerator physics and synchrotron radiation. High energy electrons circulating in large rings of magnets produce x-rays that are used for a variety of different kinds of science.
Running and improving these facilities requires controlling and modelling the electron beam as it circulates in the ... |
I am just finishing the second semester of my CS degree. So far I learned C, all the fundamental algorithms and data structures (e.g., searching, sorting, linked lists, heaps, hash tables, trees, graphs, etc).
Next year we'll start with OOP, using either Java or C++.
Recently I got some ideas for some iPhone apps and g... |
In the past, the Numerical Recipes book was considered the gold standard reference for numerical algorithms. The earliest Fortran Edition was followed by editions in C and C++ and others, bringing it then more up-to-date. Through these, it provided reference code for the state-of-the-art algorithms of the day.
Older ... |
Preliminary notes
I'll not go into the distinction of the different kinds of test there are, there are already a few questions on these sites regarding that.
I'll take what's there and that says: unit testing in the sense of "testing the smallest isolatable unit of an application" from which this question actually deri... |
If throwing System.Exception is considered so bad, why wasn't Exception made abstract in the first place?
That way, it would not be possible to call:
throw new Exception("Error occurred.");
This would enforce using derived exceptions to provide more details about the error that occurred.
For example, when I want to pr... |
I'm creating a web application on GWT. I'm using MVP pattern with activities and places. I have a xml config file containing some parameters to be used by the application. Content of this xml file is sent to the client using HttpRequest; I'm using a singleton class to hold the information from the xml file.
Right now,... |
I will briefly explain my situation.
I have a website in PHP, this website is powered by a custom framework + some "plug-in" made ad hoc for it.
I am the only developer of this. Until now I just test locally any changes than I upload the php files via FTP.
I don't feel confortable anymore with this. The code base has g... |
We're looking at exposing some of our internal application data externally via a website. The actual details of the website aren't that interesting, it'll be built using ASP.NET/IIS etc, that might be relevant. With this, I'm essentially I'm looking for a mechanism to authenticate users viewing my website.
This sounds ... |
My boss uses the term "portal" for the project I work on all the time.
To me, the word makes me think of Yahoo in the late 90s. Does the word "portal" have old-school connotations, or is it just me? Do you think it's ok to use it or will it drag our client's perception of the product down into the middle-ages?
|
When should I used interpolation search instead of binary search?
For example, I have a sorted dataset, in what situations would I use binary search to find an item in this dataset or in which situation should I used interpolation search?
What properties of the dataset would be the determining factor?
|
I currently am a programmer, I'm almost 16 years of age and have pretty much narrowed my careers down to something involving a Computer Science degree or Electrical Engineering degree (I know they are quite different but this question is about my friend) but my friend isn't so sure.
He is very interested in maths and i... |
For reasons "above my pay grade", we're developing an issue/project tracking system where I work (similar to Trac, FogBugz, etc). The managers want a useful tool to be able to track the overall health of the project (e.g. How much time left, how are we performing vs estimates) and one of the features that has been requ... |
I have a processing problem that I am thinking is a classic producer-consumer problem with the two added wrinkles that there may be a variable number of producers and there is the restriction that no more than one item per producer may be consumed at any one time. I will generally have 50-100 producers and as many con... |
Firstly, I would like to state that I already understand the 'vx' applications for Metamorphic code. I am not here to ask a question related to any of those topics as that would be inappropriate in this context.
I would like to know if anyone has ever used 'Metamorphic' code in practice, for purposes other than those p... |
I still looking best practice for domain model validation. Is that good to put the validation in constructor of domain model ? my domain model validation example as follows:
public class Order
{
private readonly List<OrderLine> _lineItems;
public virtual Customer Customer { get; private set; }
public vi... |
I'm really interested in playing around with the electronic paper technology, but I don't really want to program any commercial device (kindle or whatever).
I have some ideas and I want to start. How do I get a screen of electronic paper, a chip and how to start programming for it (language, interface)
|
I find git hard to understand as I could not find the meaning of the words used for the actions. I have checked the dictionary for the meaning of 'stage' and none of the meanings were related to source control concepts.
What does 'stage' mean in the context of git?
|
Sometimes I hear people saying something like "All committed code must be working". In some articles people even write descriptions how to create svn or git hooks that compile and test code before commit.
In my company we usually create one branch for a feature, and one programmer usually works in this branch. I often ... |
We are trying to have our own startup, with a middleware application to glue small applications with enterprise legacy systems.
for such middle-ware to function properly, we will need some sort of messaging system to make different components talk to each other in a reliable way.
the alternatives are:
use an existing... |
I have a situation where I think I might need dynamic class inheritance in PHP 5.3, but the idea doesn't sit well and I'm looking for a different design pattern to solve my problem if it's possible.
Use Case
I have a set of DB abstraction layer classes that dynamically compiles SQL queries, with one DAL class for each... |
I want to create a financial planning application (for personal use), for which the overall functionality will be this:
User (me..) can create different 'scenarios'.
Each scenario is configured with different incomings/outgoings.
Scenarios can be 'explored' in a calendar format with projections taking into account tax... |
At work, we've just started on a heavily Javascript based application (actually using Coffeescript, but still), of which I've been implementing an automated test system using JsTestDriver and fabric.
We've never written something with this much Javascript, so up until now we've never done any Javascript testing. I'm un... |
Lots of specialized mobile devices use Windows CE or Windows Mobile.
I'm not talking about smart phones here -- I know that Windows Phone 7 is Microsoft's current technology of choice here. I'm talking about barcode readers, embedded devices, industry PDAs with specialized hardware, etc... the kind of devices (Example ... |
I got this question in an interview and I was not able to solve it.
You have a circular road, with N number of gas stations.
You know the amount of gas that each station has.
You know the amount of gas you need to GO from one station to the next one.
Your car starts with 0.
You can only drive clockwise.
The question ... |
I know that the mobile bookmark bubble might sort of work for iOS, but it isn't going in the same section. And for Android, bookmarking is really not going to cut it for a mobile HTML5 application install since users just don't think to go to their bookmarks and that bookmark process takes two or three steps.
To me th... |
A well-known shortcoming of traditional class hierarchies is that they are bad when it comes to modeling the real world. As an example, trying to represent animals' species with classes. There are actually several problems when doing that, but one that I never saw a solution to is when a sub-class "loses" a behavior or... |
We use pthread for thread management in C based systems. pthread is in general compilable by C++ compiler (like g++). However, what are the better ways of abstractions for threads in C++?
Also, for making any system to be working in a multi-threaded system, it is also important to make thread safe. What are the stand... |
Has anyone used Sproutcore for a web application? If so, can you give me a description of your experience? I am currently considering it, but I have a few concerns. First, the documentation is bad/incomplete, and I'm afraid that I'll spend lots of time figuring things out or digging through source code. Also, I'm a bit... |
I'm doing research into software evolution and C#/.NET, specifically on identifying refactorings from changesets, so I'm looking for a suitable (XP-like) project that may serve as a test subject for extracting refactorings from version control history.
Which open source C# projects have undergone large (number of) refa... |
For string constants its usual to use a class with final String values. But whats the best practice for storing string array. I want to store different categories in a constant array and everytime a category has been selected, I want to know which category it belongs to and process based on that.
Addition : To make it ... |
I always see sites that only keeps fresh content on the home or subsections, and the rest of the content is kept in a separate section called 'archive'.
Recently I have also heard that NoSQL DB's like MongoDB are good for archiving (which makes me think this is related to performance)
So why do sites archive their cont... |
Let's assume we have an XmlDoc class that contains basic functionality for dealing with an XML data structure and saving/loading data to/from a file. Now we have several subclasses, A, B and C. They all inherit from XmlDoc and add component-specific methods for setting and getting lots of data. They are like "interface... |
I have a class that defines a private (well, __container to be exact since it is python) container. I am using the information within said container as part of the logic of what the class does and have the ability to add/delete the elements of said container.
For unit tests, I need to populate this container with some... |
I've seen BDD in action (in this case using SpecFlow and Selenium in a .NET environment) for a small test project. I was very impressed - mainly due to the fact that the language used to specify the acceptance tests meant they engaged with the product owner much more easily.
I'm now keen to bring this into my current o... |
Doing a google search for "pythonic" reveals a wide range of interpretations. The wikipedia page says:
A common neologism in the Python community is pythonic, which can have a wide range of meanings related to program style. To say that code is pythonic is to say that it uses Python idioms well, that it is natural or... |
I am trying to make an app that will capture the video from the mobile's camera and detect in real time all the text that will be captured. I would like to make it in C# (for e.g. Windows Mobile) but I can also try to do it in Java (for e.g. Android).
Can anyone help me how can I start with it?
|
Let's suppose you've got a class defined (in pseudocode):
class Puppy {
// ...
string sound = "Rawr!";
void bark() {
print(sound);
}
}
And say, given a Puppy instance, you call it's bark() method:
int main() {
Puppy p;
p.bark();
}
Notice how bark() uses the member variable sound. In m... |
Maybe the question sounds a bit strange, so I'll explain a the background a little bit.
Currently I'm working on a project at y university, which will be a complete on-board software for an satellite. The system is programmed in C++ on top of a real-time operating system. However, some subsystems like the attitude cont... |
Over my programming career I formed a habit to introduce a flag variable that indicates that the first comparison has occured, just like Msft does in its linq Max() extension method implementation
public static int Max(this IEnumerable<int> source)
{
if (source == null)
{
throw Error.ArgumentNull("sour... |
Possible Duplicate:
Make a big deal out of == true?
I've been looking at a lot of code samples recently, and I keep noticing the use of...
if( expression == true )
// do something...
and...
x = ( expression == true ) ? x : y;
I've tended to always use...
x = ( expression ) ? x : y;
and...
if( expression )
... |
I am interested in making a vehicular network simulator (vehicular network as in vehicles can be equipped with radios and when they come in range they can talk with each other). I want to be able to scale to 1000s of nodes if not more. I am quite frankly torn on how to do, or even which language to use or whether I sho... |
So lets say we have a set of gps data points and your current location. If asked to give the closest point to your current location we can utilize a heap with the distance being the key. Now if we update the current location, I suspect that only a few of the keys will change enough to violate the heap property. Would i... |
I'm trying to understand the difference between procedural languages like C and object-oriented languages like C++. I've never used C++, but I've been discussing with my friends on how to differentiate the two.
I've been told C++ has object-oriented concepts as well as public and private modes for definition of variabl... |
I would like to learn PHP for web development but have been drawn back because of comments like the following*:
PHP is good but generates spaghetti code
PHP is nice but Python is marriage material
PHP lacks stuff that you get in other languages like C# or Java
But for PHP5 I have seen some promising comments. So, my ... |
Currently I'm developing the back-end of a PHP application using Recess Framework. I'm almost done and I now need to do the front-end. I have many alternatives and I prefer a CMS. The alternatives in my knowledge are Drupal or Wordpress. The problem is that I've never used Drupal and Wordpress(or any better). Thus I do... |
I apologise in advance for the length of this post, but I want to paint an accurate picture of the problems my app is facing and then pose some questions below;
I am trying to address some self inflicted design pain that is now leading to my application crashing due to out of memory errors.
An abridged description of ... |
I was wondering if anyone can give me some direction related to "Block level design" in context of mobile application? Recently I saw a video in my university and a professional mentioned about building block level design of applications, since then it has stuck in my brain!
It would be really helpful if someone can sh... |
I am taking a module called "Requirements Analysis & Design" in a local university. Common module, I'd say (on software development life cycle (SDLC) and UML). But there is a lot of things I wonder if they are actually (strictly) practiced in the industry.
For example, will a domain class diagram, an not anything extr... |
My company is building a corporate Java web-app and we are leaning towards using GWT-RPC as the client-server protocol for performance reasons. However, in the future, we will need to provide an API for other enterprise systems to access our data as well. For this, we were thinking of a SOAP based web service. In my... |
We are working in a Java/.NET company and my team and I are planning a project for a client.
One of the requirements is that the project has to be done in .NET
I've asked about this requirement, and the client said that it doesn't matter, and that if I have a good reason we can use other technology. But, I have to jus... |
I have recently been refactoring large chunks of code and replacing them with Linq queries.
Removing the language bias - Linq is essentially a set of Map / Filter and Reduce operations that operate on a sequence of data.
This got me thinking, how far would I theoretically be able to take this. Would I be able to rewrit... |
Call it democratic software development, or open source on steroids if you will.
I'm not just talking about the possibility of providing a patch which can be approved by the library owner. Think more along the lines of how Stack Exchange works. Anyone can post code, and through community moderation it is cleaned up and... |
Example #1: I have a view displayed in my MVVM application (let's use Silverlight for the purposes of the discussion) and I click on a button that should take me to a new page.
Example #2: That same view has another button that, when clicked, should open up a details view in a child window (dialog).
We know that there ... |
Possible Duplicate:
What are the pros and cons for the employer of code questions during an interview?
I am curious to know why do companies hand you a blank paper and ask you to write code? This confuses me, because these days intellisense, google, stackoverflow etc are common sources to look up syntax and / or IDE... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.