instruction
stringlengths
34
19.9k
Pretty straightforward, was wondering what the inspiration or precedent for the CSS 'float' concept. I'm not familiar with any other graphic APIs or other layout DSLs that use this concept, but it's such a huge part of HTML layouts. I'm curious if a previous language had a similar concept, or if 'floats' originated fro...
I plan to get a PhD in CS, concentrating in some subfield of artificial intelligence, not sure which one at the moment. I'm looking into R&D departments in industry, but there don't seem to be too many. For example, I have literally found hundreds of labs for the basic sciences and other engineering fields, but for CS...
Our test automation team writes tons of automation tests for our WEB application, but it seems to me that their code is becoming way too complex and warrants that someone will test it as well. Is there a best practice for writing these automation tests? I'll appreciate any answer with concrete inputs from someone who...
I know the definition of an testing oracle but to me, it seems to be overrated. I have a specification, why should I bother with thinking about oracles? I just compare what the spec wants and what the program does. Or I have the use cases, whatever. When I read about oracles in books, it looks as if it a science on its...
Let me start with a disclaimer: I'm not the best programmer out there. I do however study I.T. and learnt a bit of Java and C. I'm getting stuck into Python and Django + Mongoengine, I'm not going to explain it into detail as it will deviate from the original question. While trying to understand what is happening at th...
In projects with many use cases, it's valid to create different use case diagrams, one for each screen? Or I shouldn't guide myself on the GUI of the software to make this, why? As a clarification, the software does already exist, and I'm just documenting it for my undergraduation final project.
There seems to be two major ways to set up a web server backend. You can use a LAMP stack, with the server-side code in something like PHP or Python (or Ruby or JavaScript, which don't start with a P.) These scripting languages tend to be dynamically typed, with all of the disadvantages in performance, correctness an...
I'm designing a financial system that should grant access to data based on roles and privileges. For example, a manager can see the financial transaction of users under his domain but not information regarding other transaction. Although it's possible to implement ad-hoc I was wondering if there are patterns or guideli...
...or, in other words: When sending a mail programmatically, do I really need to go through the hassle of setting the correct MIME type or can I just use application/octet-stream? The mail clients I tested all do "the right thing" based on the file extension, even if the MIME type is just the generic application/octet-...
Someone has asked me this question and I couldn't answer as I am not on the web part of development so I'm asking here. If one has just finished college and is trying to break through into web development/web-design a portfolio of already developed projects/sites seems to be essential to me for going to interviews. Wha...
I have an ASP.NET MVC4 application. Suppose that I wanted to execute some code (such as emailing a user) 2 days after a user has signed up. One way is to have code executed on every request which scans the database for users and their sign-up time and execute code based on that. This seems messy and it depends on peopl...
When using a non-MVC service-oriented/Interactor pattern approach to decoupled system architecture, how is session state implemented? I've been thinking of building the frontend of an application using MVC (PHP/Ruby etc.), and send messages to a command-line backend which is the actual application. Since I want the off...
We have a large team of developers and testers. The ratio is one tester for every one developer. We have full bug tracking and reporting systems in place. We have test plans in place. Every change to the product, the testing team is involved in the design of the feature and are included in the development process as mu...
I'm looking at using Go (aka golang) for a project (a SQL database, but that mostly doesn't matter here) where performance is critical, but under low load the primary bottleneck will be I/O to disk. In this case, I think Go would be great! Under high load or while hitting cache a lot, CPU and memory utilization will in...
Many programmers know the joy of whipping up a quick regular expression, these days often with help of some web service, or more traditionally at interactive prompt, or perhaps writing a small script which has the regular expression under development, and a collection of test cases. In either case the process is iterat...
Which reasoning would you follow to choose one license over another? Which literature would you expect someone to read, if he wants to make a meaningful decision about licensing? I specifically don't go too much into detail about my current project, because I am looking to learn how to make this decision correctly with...
Is it possible to host a long-running worker inside ASP.NET application? The worker (for it's a windows service) is reading from a queue sending messages to a WCF service. Would it be possible to run this "light long-running worker" inside an ASP.NET application? I read about setting pool start mode to "always running"...
I'm working on an ambitious, commercially-driven open source project* (it probably falls under Wikipedia's definition of Open Core). I'm an engineer on the project, so I don't have too much sway over all of our policies. The majority of the code is in public projects on GitHub, and we have public mailing lists, but th...
As an educational exercise, I am looking to implement a constraint solver from scratch. However, since the field is entirely new to me, I am at a loss of where to begin with background research. The problems I aim to address are mostly sets of inequalities, such as a < b && b < c, where a, b, c are integers. (While it ...
I was recently asked as an exercise to design a scalable graph. My first intuition was how to seperate the graph and distribute it (sharding,consistent hashing..etc) Turns out my thinking was on the wrong line, I know what scalability is, but it seems it is a bit hard to think about it pragmatically. What is the prag...
While solving any problem, we write algorithms. Some efficient, some not, some work, some fail. But sometimes we end up writing something which is mostly a success when we do a dry test run, perhaps, the way we frame the test data is prejudiced, but the algorithm fails in some other cases. For some algorithms , the nat...
I like to think I write good maintainable Java code, using best practices, design patterns and try and get good test coverage with unit tests. Recently whilst looking for a job, I came across a couple of job adverts that have references to "scalable" code. So, my question is, what is considered to be "scalable" code?...
I'm using Ninject, but this is not a Ninject-specific question. I'm wondering if the advanced and flexible capabilities of the IoC container are giving me enough rope to hang myself with a bad application design. I've got a service interface: public interface IBuilderService { IBuilder Create(string category, strin...
I'm creating a website that is going to aggregate women shoes from across the web into one website. Kinda like polyvore.com does with all their products but mine is only going to be shoes. Which makes my job a lot easier but I'm still lost as to how I go about getting all the data. I have access to 3 APIs so far. Whi...
I was writing this code: private static Expression<Func<Binding, bool>> ToExpression(BindingCriterion criterion) { switch (criterion.ChangeAction) { case BindingType.Inherited: var action = (byte)ChangeAction.Inherit; return (x => x.Action == action); case BindingType.Exp...
To explain what I mean, let me start with an example. Consider a deque that supports O(logn) concatenation with another deque and O(n) addition of n elements at one end. This dequeimplements a general seq interface (or type-class, or what have you) that allows iterating over a collection. An explicit optimization appr...
Is there a technical name for a software project where the current and prior stable releases are both maintained?
I saw a video about random numbers and how the programmer in that video was talking about computers generating pseudo random numbers and that they are not really random. I knew about this. Then he showed the decay of a radioactive material to generate random numbers where he claimed to be truly random. Is there really ...
I'm looking for a reference to clean coding styles that I can pass to a team member. In particular, the rule that a method should not change its return type based on an input parameter. If you need different output, use a different method. Example: $invoice_items = getInvoiceItems(); $total = getInvoiceItems( T...
I'd like to create something similar to what you see here... http://www.houzz.com/ideabooks/9424693/list/8-Beautiful-Ways-to-Work-Glass-Into-Your-Kitchen-Cabinets If you click on the second photo down, youll notice it has a bunch of tags, linking to actual products, or just descriptions of products. Is this done using ...
We're thinking of using some open-source MIT-licensed software in one of our web projects (a jQuery datetime plugin). The first line of the MIT licence is: Copyright (c) [year] [copyright holders] If we include the plugin as-is (without making any changes), I understand we need to include the licence with only the o...
Are there any best approaches for refactoring a programming project that has previously been written with the static reference anti-pattern (the majority of classes refer at some point to a static bean, where all of it's variables are public. Half-way through a class, for instance you'll see something like: EvilClas...
There is a new hype with the long awaited lambda expressions in Java 8; every 3 day another article appears with them about how cool they are. As far as I have understood a lambda expression is nothing more than an anonymous inner class with a single method (at least at the byte-code level). Besides this it comes with...
We are building an accounting web application. In our database, we store basic data about our customers, like phone number, their login informations, because these things are tied into our web application. Now we need a CRM system to do things like sending marketing mails to users who signed up, but never used the serv...
Sometimes, I notice typos in articles (blog posts) or books in source code that appears in the body of the article. It may be an indication that the code has been manually copied and pasted (e.g. missing braces ), or that something nasty happened to the text. How may I write an article inside the source code of a proj...
I am trying to learn Lisp and looking at all the Lisps out there and their differences. I see that in some implementations of Scheme, you can use square brackets interchangeably with round brackets for readability, so because they are treated the same, I assume they are still just S-expressions like everything else. Ho...
I couldn't understand the reason of it. I always use String class like other developers, but when I modify the value of it, new instance of String created. What might be the reason of immutability for String class in Java? I know there are some alternatives like StringBuffer or StringBuilder. It's just curiosity.
How can I say in english, that programming language can be compiled to other programming languages? The example can be Haxe. On the website the language is decribed as "Multiplatform": Multiplatform: Haxe can be compiled to all popular programming platforms with its fast compiler – JavaScript, Flash, NekoVM, PHP, ...
One of our team member duplicates code. Code duplication causes confusion among my team members reading his code, it causes bugs down the line when the duplicated segment is fixed in one location and not the others and it bloats the size of his code-base. I have discussed with him not to duplicate code. But he show exc...
I've been told in previous questions that functional programming languages are unsuited for dynamic systems such as a physics engine, mainly because it's costly to mutate objects. How realistic is this statement, and why?
What is it called when you aren't using an MVC framework and each URL has it's own file associated with it. I want to say it's model 0 or class 0 but I haven't been able to find anything useful via Google. :-)
As a DBA, most SQL is submitted to my team for review. We do not have a SQL developer, so the code is frequently very, very inefficient. Our current process is: SQL is submitted for review right before it goes to beta Issues are pointed out but frequently not resolved because the application has already been written ...
I know there are some products for reverse debugging. I am wondering that does reverse debugging mean going to one step back or starting over again up to one step back? I've found an explanation here.
I've been talking to a colleague that comes from AS3 to the HTML world. He has created a small website (there are apparently no dynamic contents) following the no-flash rules for his very first time, and as if you own a hammer you tend to hammer everything, he decided to create a framework in JavaScript, so he could do...
Because we need to keep response times low, we get tons of requests, and we need to basically process ALMOST the same data (which I'll refer to as X) each request (the inputs are different though, so we can't cache responses), we are using a technique where we grab a new copy of X every 90 seconds from the database and...
I have been in the process of generating documentation for an upcoming project. One of the features of the data available in this project is that it will be revisioned (or at least large parts of it will be). I came across the (as I understand it, very new) "Accept-Datetime" HTTP header. This looks absolutely perfect f...
I mostly work in Python and Ruby, but I recently decided to learn some C so I have a better feel for how a computer actually works. I've been wondering whether it is possible to take this even a step further. Does anyone learn machine code (whatever C is compiled into) anymore? Would I benefit from taking some time to ...
I am creating a stored procedure that is logging some data. The data ultimately needs to end up in 2 tables. The incoming data is coming from a JSON string containing 15 parameters, and the data is then logged to the database using the stored procedure I'm writing. I would like to send the data into 1 stored procedure ...
I currently have a database that uses Class table inheritance model. Three different tables inherit from this table. The child tables have all a FK to the parent table and the fields are properly indexed. We hare currently having some issues at the application level because it is difficult to figure out what child tab...
In C#/Java, the dependency inversion principle is often demonstrated by high-level classes that depends on an interface/abstraction (that it owns). Low-level classes will implement the interface, thus inverting the dependency. I wonder, how is it applied in object-oriented languages with no interface? For example, I'm ...
I am a beginning programmer who has written a spider application in PHP. Currently there are three parts: 1) The Spider (spider.php) 2) The Harvester (harvest.php) 3) The Configuration file (for example, craigslist_config.php) I use the spider to search the web for items I want to buy. An item can be found on any webs...
Programming question: Reverse words in a string (words are separated by one or more spaces). Now do it in-place. What does "in-place" mean in the above context for an interpreted language like PHP or JavaScript?
I've seen many lists on the internet that includes many 'ities' (maintainability, scalability, portability, etc), but I'm not sure if animations, screen transitions, and similar features are functional or non functional requirements.
Suppose I'm building a JSON API and would like to include an endpoint that returns a list of recently created posts. Somewhere in my system is an existing Post model with the following test: create a few posts in the db (some new, some old) posts = Post.recent assert that posts only contains new posts Now I want to ...
I am creating a web application in java where I need to mock the following flow. When user trigger a certain process (add product to cart), I need to pass through following steps Need to see in HTTP Session if user is logged in. Check HTTP Session if shopping cart is there If user exist in HTTP Session and his/her car...
We are having a debate and I am struggling to decide which side to come down on. Basically we have an event type lets say like like this (simplified example). public class Event { public virtual int EventId { get; set; } public virtual DateTime DateTimeOccurred { get; set; } } Many different events in our sys...
I was doing edit reviews on Stack Overflow and found out that people keeps correcting the word "boolean", replacing it with "Boolean" when it appears in text (but not in source code, of course). And then I found out that the spelling checker in my browser agrees with them. Is there any rationale behind this? It seems g...
I was having a discussion with a colleague and he bought up the topic of MVC and the use of ViewModels in ASP.NET MVC. The discussion was that, in an n-layer architecture, the UI, Business Layer and Data Access Layer are individual assemblies/projects and ViewModels are the UI's representation of a database/business ob...
Please tell me if: Node.js will make our site faster! Node.js will consume fewer server resources, we can save money! Node.js will make us more productive! Node.js means we can share client and server side JavaScript code. To clarify, we're rewriting a frontend server, which will talk to our existing Ruby on Rails ap...
I am conducting academic research on the topic of Extreme Programming and whether its practices lead to creating space for more errors and bugs in applications. From the experiences I gathered from many, I have comments that fall on both sides. Many support it and consider it a daily necessity, with dynamics that can ...
I am working in a windows service (using VB.Net) for internal use of my department. When ever a certain type of exception (FooException for now on) is captured, I follow the same logic: Log the exception Send an email to someone. In order to reuse code and not to copy-paste the same lines in every catch FooException ...
I have a large XML file (about 75,000 lines) where I have to build a catalogue (houses) from. Building the lists works fine, but now I have a problem. The catalogue should have a detailed presentation page of one house. One house (<item id="123">) has about 800-1200 lines of data, based on the house type. Which is the ...
I am trying to explain the dependency inversion principle to my (mostly junior) colleagues. How can we define which one is the "high-level policy" and which one is the "low-level detail" in a software? For example, if our software automates workflow of several business applications, why do we say that the workflow auto...
Hello fellow programmers! I have a 2D graph which is best described as a Cartesian grid with traversible and non-traversible cells. I'd like to be able to detect subsets of this graph where the diffusion behaves anisotropically, i.e.: it is constrained by corridor-like passages. I initially turned to diffusion tensor ...
Leave a open database connection throughout the execution of the aplication, or for each time a operation will be executed a new connection will be created? Open throughout the execution: Open aplication -> Open connection; Operations -> use the opened connection -> commit; Close aplication -> close connection; For ea...
I'm pretty sure this is a question purely about aesthetics but I wanted to get all your opinions on it before I start proliferating this type of code in my codebase. Consider the following code: //Foo.h class Bar; class Foo { public: Bar& GetBar(){return *bar.get();} private: std::unique_ptr<Bar> ...
I’ve had this gut feeling about Windows Workflow (WW) for a while now. And, until now, I couldn’t think of the right words to say in order to explain it. Since I think I have a good way to verbalize it now, I thought I’d share. I believe there is a problem in our industry where a great percentage of developers take a l...
Not being a Java practitioner, I recently came to learn about the JAX-RS specification and Apache CXF framework. While still wrapping my head around all these things, I also read the this question on SO. Since MVC is a design pattern while JAX-RS is a specification, I was confused about the comparison. Granted my nasce...
I work in a small web development company (3 programmers) for a while. During the last year the company had hard times (less projects) and a few co-workers were fired, including our Production Manager. Having this person out of our team mean to us that we have to deal more and more with the company bosses (owners). It'...
I have been trying to wrap my head around MVC pattern for about 6 months.I've read tons of articles, Q&A, and blog posts about MVC and HMVC patterns, but I just simply don't get it 100%. I tried learning MVC by exercising one of widely used PHP MVC framework, CodeIgniter. I've implemented few internal websites for my c...
So there are 3 computers that I use to work on this project with, my home PC, work PC, and work Mac (for building to devices). The project has an SVN repository that two other programmers use so I can't commit broken code to it. The lead doesn't know how to use version control so the trunk contains art assets and every...
I am dissatisfied with the file comparison tools I have worked with so far. While no tool would be able to always predict the line matchings that make best sense, at least current tools should be able to do a better job when changes mostly consist of added and removed indentation. But the tools have I used end up match...
I'm working on a wishlist system, where users can add items to their various wishlists, and I plan to allow users to re-order the items later on. I am not really sure about the best way to go about storing this in a database while remaining fast and not turning in to a mess (this app will be used by a fairly large user...
I am trying to understand this: I wrote a code for points on a circle of radius 1. Note that the first and last point intentionally coincide. do i=1,imax X(i,1) = COS(-2*4.0*ATAN(1.0)*(i-1)/(imax-1)) Y(i,1) = SIN(-2*4.0*ATAN(1.0)*(i-1)/(imax-1)) print *, X(i,1)**2 + Y(i,1)**2 end do The code is supposed to be a circ...
I have successfully connected my microcontroller to my TV via through VGA adapter i made that convert digital to analog signals with the help of resistors. Currently i am utilizing 8 pins that I am using as 2 Red 2 Green 2 Blue 1 Hsyn and 1 Vsyn. I was thinking if there is a way to add 'A' Alpha in it, it's used for t...
I would like to convert this Java applet into an equivalent web app. This is my first time creating a web app, but I have some programming experience and time, and am willing to teach myself all of the necessary tools. By "web app", I mean an application which would work in browsers without requiring Java or Flash, for...
References and pointers do the same thing as I know. Is there any difference between them? If there is no difference, why we call them reference not pointer?
In an MVP application, what should be the most appropriate way to implement restriction to some UI actions based on the current user's privileges? For example, in a role-based security, different roles will have different access to some UI interactions on the same view. If, for instance, we have an online store, on the...
The general recommendation to record original scanned images used to be "use TIFF". But programmers need evolution of format for "evolution of software", and I need to evolve my system to change from TIFF to JP2. I have a big image storage (terabytes) for legal and scientific scanned materials, they need original reco...
I have a long time running project. Its been running for about 6 months. The project is very big. The lead developer/team leader designed the project and the whole project is in his brain. He knows all ins and outs. I also know almost everything. But I am not confident like him. Problem is recently he is charging qui...
I've been writing most of my javascript applications in an OO style close to what I would use for most other languages. However, this means that most callbacks need to have a reference to an object, and I generally handle that by using $.proxy (or dojo.hitch, or whatever the framework's tool for this is) to be sure tha...
My cousin (Age 10) who studies in Standard 5. He wants to learn programming and programming logic. Which book or resources should I refer? Is there any Good Data Structure book to improve programming logic specially for children?
I've been working on improving an existing library to be more maintainable after trying to implement a feature I wanted and found the code to be hard to alter. The library is a node.js grunt plugin called grunt-contrib-jshint and my implementation is in a repo called grunt-jshint-bfs. I've run a code analysis tool call...
I am trying to understand how stack frames are built and which variables (params) are pushed to stack in what order? Some search results showed that the C/C++ compiler decides based on operations performed within a function. For example, if the function was supposed to just increment a passed-in int value by 1 (simila...
Originally, this is a part of another question. Why is sizeof called a compile-time operator? Isn't it actually a run-time operator? And if it is indeed a compile-time operator, how does it help in producing portable code which runs the same in different computers ? Please explain in detail.
We have lots of user-generated images on our site. When users upload their images, we only store the original. However, depending on the page, we show different sizes of those images (small, medium, large, original). Is it necessary to store all sizes of these images or is there a better way? Currently, we are resi...
For performance issue I want the logging send to a new thread. While the main program can work, the new thread can write the error or other messages to a file without effect to the main program. How could I send all stdout to the new thread? Work to be done: create a new thread, ok open a file, ok create a pipe inside...
What is a XML schema in plain simple terms? What will be the problem if an XML doesn't have a schema defined? An example can be very helpful.
Can we create a program that print out its source code what if we (or the program itself) compile than the new program would have the same exact functionality what the original program has? So somehow it would reproduce himself in perfect clones that can reproduce too. The program shouldn't use any external files other...
I'm a member of a small new team and with one of our latest builds I noted that, VS2010 code files don't contain language formatting. So for example when I write down a Euro symbol in my code or use a "." or "," in numbers or use Pounds, Euro or Dollar symbols, those look ok in my code, but for a coder in Russia th...
In C# what is the best practice for encapsulating variables I need to use in multiple methods? Is it OK to simply declare them at the top of my class above the two methods? Also if I am using app settings from my config file should I use a getter? like this... private string mySetting{ get { return WebConfigurationMan...
In database managements systems lecture, my professor said that we can use Oracle etc. ui designing tools instead of using Visual C# or etc. He added that SQL is as strong as a programming language. So I wonder why do we still use these programming languages for desktop applications which mostly adds/deletes/updates re...
For example to read data from a website we do: HttpResponse httpResponse = httpClient.execute(httpPost); HttpEntity httpEntity = httpResponse.getEntity(); is = httpEntity.getContent(); The method that executes the HTTP request, returns a response, then we turn the response into an entity, then we turn ...
I notice that a property of codebases that I like hacking on is that it's quick to find the relevant code for some feature, without knowing much about the code base at all. For example, searching for a label in the GUI, and immediately hitting the code that implements that feature. This seems to be in direct tension wi...
here's the link of the app: https://play.google.com/store/apps/details?id=com.iatll.airlock I had studied AI in the final year of b.tech cs programme, and i do remember some algorithm of generating and solving the 8 puzzle game; we had to implement it in Prolog (tough times) But I'm not sure if the above mentioned a...
I have predicate, that enumerates through backtracking list of values. I want to find highest value from this list. For example: ranked_move(X,Y,R) :- between(0,10,Y), between(0,10,X), rank_move(X,Y,R). top_move(X,Y) :- % X, Y for highest R Right now, I have it solved by using findall and custom predicate that goes th...
I have been thinking about it and wanted some feedback, recently I thought about doing it like this: function foo(){ if ( !foo.prototype.statics ){ foo.prototype.statics = { // declare static functions/vars here } } if ( !(this instanceof foo) ){ return foo.prototype.statics; ...
I have written a rather small App with only one activity. From my understanding an activity has to be seen as kind of a view and controller in one class. But even for a little app, with 3 dialogs (made with AlertDialogBuilder and all those anonymous inner classes that come with it) my activity has 500+ LOC and became v...
I am thinking about starting a small project and I want to make its versioning with git. Bitbucket seems a good option for me with their free plan. I want to use it as the main tool for working with git since they have nice tools like a web-interface, Mac OS client, and so on. But, in order to have higher protection f...
Let's say I have BaseA and BaseB classes. BaseB can have to several references of BaseA instances. Now, we have two other classes, DerivedA and DerivedB that respectively inherit from BaseA and BaseB. How can I show in such a diagram that DerivedB should only store instances of DerivedA and not instances of BaseA? It ...