instruction
stringlengths
34
19.9k
Is there a functional language which allows to use stack semantics - automatic deterministic destruction at the end of the scope?
I'm excited about the possibilities for duplex communication with WebSockets between a web browser and web server. I see that WCF for .NET 4.5 supports a WebSockets binding now, and I know there's a JavaScript API for using WebSockets. However, what I don't understand is how these are supposed to interoperate. Yes, ...
If I want to host a website from my home, I buy a domain name. Then, I get a static IP from my ISP. Next, I point it to the IP address of my home system. I can even use the SQL server installed in my system and not worry about the size. I am not talking about piles of servers here. Just one server. I was wondering if i...
I wish to know if there's some way to know which is the elemnet of a logic operation is false? Example. if( String.IsNullOrEmpty(obj1) || (String.IsNullOrEmpty(obj2) ) throw("..............."); How can I kown which one of those is the empty one?
I worked as a lone developer for a long time. During this time, I developed a way of formulating and ordering commit messages: Refactor first, describe exactly the reason for the commit in the message, link to the issue tracker, ... There is even a script to create several sorts of change log (public, company-internal,...
I was wondering if there are any computers that operate exclusively on boolean operations. For example, no add, sub, mult, or div in the instruction set (although these could be emulated with the appropriate boolean code). Rather, the cpu would work by comparing 2 bits at a time, with instructions like and, or, xor. I ...
I'm working through the book "Head First Python" (it's my language to learn this year) and I got to a section where they argue about two code techniques: Checking First vs Exception handling. Here is a sample of the Python code: # Checking First for eachLine in open("../../data/sketch.txt"): if eachLine.find(":") !...
I figured this was more of an architectural question, so I chose to post it here rather than Stack Overflow. So I'm building an MVC web application and have just finished writing the code that wraps my calls into the DB (DAL) and gives me access via an interface to Create, Update, and Delete my Business Objects. Quick ...
So, I'm in a big geographically-distributed company, we use perforce and I'm starting to make the case for a DVCS with a whitepaper I was requested to write. I was thinking that one of the arguments I could use is the bandwidth saved using a DVCS, and technically if there were binaries to download (there are, but they'...
I'm considering the reengineering of my web development ecosystem. We use Git very successfully to deploy new changes to our Production, Staging, and Development servers. Traditionally, I've always had a copy of Apache on my local machine - in the interest of keeping my local machine as lean as possible, I'm considerin...
Here's a service abstraction that I am working on : public abstract class Service { public ILogger Logger{get;set;} public IQueryManager QueryManager{get;set;} public ICommandManager CommandManager{get;set;} } Then I have to call them in my class as usual : Logger.Log("Something"); QueryManager.Query(new QueryObje...
How does Photoshop or other image editing software change an images contrast? What does contrast mean when we process an image pixel by pixel? Or what does image contrast mean at all? Here I created a very basic image to understand image contrast. This is a 10×10 pixels image that gets a 100% non-legacy contrast adjust...
I have read in a recent code review that both ternary operator (condition ? foo : bar) and the XOR operator ^ are rarely used in Java. Is it true? If yes, is this because they are less readable? or some other reason.
I am developing an open source program which for my school project. I have done some research on it, but there are still few questions. It is a school project, it is not any advance application and I am willing to share my work. Is that mean if I release my program with license, people will afraid to change my code b...
We're deciding on how to store translations of some descriptions of database items. We could go the traditional way and keep a translations table (and a language table and an object_translation linking table) OR we thought it might be better to just have a Description column that contains JSON like the following: { ...
Firefox/Chromium have well implemented(?) parsers. Then why are parsers like lxml and other such parsers being developed with so much effort put into it? Aren't they re-inventing the wheel? Or are they solving a different problem? Can't parsers in browsers be made into standalone libraries?
Several people have forked my github repo but they have not fetched-merged from upstream. So my original repo has evolved significantly since the fork took place, and meanwhile these people are showing an old outdated version of my work, which kind of makes me look bad (e.g. what they're displaying is incomplete, conta...
I was looking at Code Complete on the shelf, thinking, "Outside of the Mythical Man Month, this may be one of the few mass market Software Engineering books to stand the test of time." For this reason, I'm thinking of jumping in to reread it. I'm curious - has anyone else given it a second look recently? I so, did yo...
I work for a product development organization that is in online advertising. The assignments I receive are almost always on platforms or tools that I have never worked on before. At first it was android. Then node.js, then windows phone, then debian packaging, then python, hadoop, ganglia, reverse engineering, geo Post...
Often times it's a good idea to have an abstract base class to isolate the interface of the object. The problem is that copy construction, IMHO, is pretty much broken by default in C++, with copy constructors being generated by default. So, what are the gotchas when you have an abstract base class and raw pointers in d...
Earlier, I asked a question about how to measure the quality of a project. The outcome of that question was that the quality of the project can be divided into two parts: Internal quality (code quality, measurable by code quality metrics) External quality (Acceptance test, how well the software meets the requirement...
So, I'm preparing to consider the outcome of training a lot of people (>25) to use Mercurial coming from a centralized mindset. I've done it with individuals and had success with it, although the time invested in each one has been different and most of them have been both proactive and open to trying something new. I w...
Can anybody explain the difference about soak and stress testing? I googled about them and found that both are about to test the software beyond its limits. Is it right for both testing strategies?
Are there any open-source tools to measure the standard of a web application project? I want to verify my project for: Possible security leaks (SQL Injection etc.) Performance Stability (in high concurrent environment) and other quality metrics.
Given that changes to the API/public method signature should be minimal to prevent breaking those client codes that use these methods, I was wondering if the Law of Demeter is less applicable to these. A simple example: class Account() { double balance; public void debit(Transaction t) { balance -= t.getAm...
I'm currently working on an indie project, so I don't exactly have the luxury of throughout human testing or external code review — however, I don't see any difficult bugs in my current code (I fix them as I see them, and most of the time they're just wrong field names and such, things that you fix in a minute or two),...
I am using PetaPoco micro-ORM. It is indeed very easy and secure to work with databases using ORM tools, but the only thing I hate is extra code. I used to put most of the code in the database itself and use all the RDBMS features like Stored Procedures, Triggers etc., which it is built to handle better. I want to kno...
I'm working on a project solo and have to maintain my own code. Usually code review is done not by the code author, so the reviewer can look at the code with the fresh eyes — however, I don't have such luxury. What practices can I employ to more effectively review my own code?
I've been hiring several developers from different places around the world. It all goes well, but I see that some of them are abusing my polite overlooking too much lately. They are all hired for a full-day. However, I see that after 5 hours in a day, not much has been done. I am considering to develop a software that ...
I have read many websites talking about how to avoid and how to design etc. I completely understand those strategies. My question is based on the following preconditions: You have a company with 1000's of developers. There are different teams working on the same product but as modules. New developers writing new code ...
As per rule number 4 of Object Calisthenics by Jeff Bay (RTF) in The ThoughtWorks Anthology, it is recommended that one should "Use first-class collections". Rule 4: First class collections Application of this rule is simple: any class that contains a collection should contain no other member variables. Each collect...
Say I have a web app that uses jQuery. Is it better practice to host the necessary javascript files on my own servers along with my website files, or to reference them on jQuery's CDN (example: http://code.jquery.com/jquery-1.7.1.min.js)? I can see pros for both sides: If it's on my servers, that's one less external ...
The answer to this SO question has become stale: iOS version/device statistics - where can I find? because time currency wasn't part of that question, and iOS version updates have been release since this question was asked. Is there a web site or other publicly available source which keeps a current or frequently updat...
XAML is essentially a subset of XML. One of the main benefits of basing XAML on XML is said to be that it can be parsed with existing tools. And it can, to a large degree, although the (syntactically non-trivial) attribute values will stay in text form and require further parsing. There are two major alternatives to de...
I have signed a Non-competitive agreement but I would like to be able to reuse some code across all projects that I work on for this company. So, which license can be used for my library code that would basically say the following: I (the author) can use my library code in any client project. You cannot use my code in...
I'm working in a small startup as the sole developer in my spare time. We might need some more development help and are looking at an Indian company which comes recommended by someone we know (although they are not very technical). I'll be having an informal chat with them, and thought I'd see if people here had some w...
First off, please note that this question is not about WPF vs. WinForms. What are the highest-ranking benefits that led Microsoft to invent XAML in favour of the “old” approach of generating compilable C# code? My impression is that other developers seem to find a lot of downsides to it, but Microsoft went with it rega...
Our team is working on a market place web application where the application will collect payments from individual users then deduct a small percentage fee before paying the balance to the users chosen service vendor. We've encountered problems finding a service provider that will allow outgoing ACH. We've asked both se...
Possible Duplicate: Private variable vs property? I have a public property with a get and set accessor. Associated with this property is a private field. Is it best practice when referencing these values in other parts of a classes code to use the private field or the public exposed property. Although I release I ...
I am working on co-op at a company as a test engineering specialist. This is not technically a software job, however at the end of the day, I spend most of my time programming. I am not a programming wiz by any means, but I am very comfortable using VB.NET since that is what projects started at my company previous to ...
I am using codeigniter, and have found myself in a similar situation where I have repeated Model methods. I am creating a Model per Controller. But I would creating a Model per database table be considered good practice? That way methods aren't written twice. Instead of Model per Controller or Several small Models that...
I've heard people lecture here and there on the internet that it's best practice to obscure public facing database ids in web applications. I suppose they mainly mean in forms and in urls, but I've never read anything more than a mouthful on the subject. EDIT: Of course, now that I ask this, I find some resources on th...
This is more of a usability issue I'd say, looking of suggestions on it. I have a system that depends on the data entered by the users to be correct, as in the address exists, the name is correct, etc. This is all for places. Now the way I figured I could do this is that I have every entry peer reviewed, as in, have 5 ...
Suppose you have this code in a class: private DataContext _context; public Customer[] GetCustomers() { GetContext(); return _context.Customers.ToArray(); } public Order[] GetOrders() { GetContext(); return _context.Customers.ToArray(); } // For the sake of this example, a new DataContext is *req...
Is there a reason that a semi-colon was chosen as a line terminator instead of a different symbol? I want to know the history behind this decision, and hope the answers will lead to insights that may influence future decisions.
I currently have a web application and I would like to add a messaging feature to it. In order to do that, I use JMS(actually OpenMQ, the implementation provided with Glassfish 3). The problem is that I do not know how to get the message notification from the background(from the listener) to the foreground. I am using ...
I am a Software Engineer professional. I have studied calculus as a core course in my graduation studies. I want to ask question, that what/where is the implementation of calculus in computer science?
The project I am putted in is running awful. :-) Main Problem is a missing architecture and a missing guidline how to organize projects. In this case I have done a sample project architecture with UML class and component diagrams and layer diagrams. The main problem is, that I have to present this architecture to the m...
At work, we're deploying a software bundle of a Java application (written by us) which has lots of external dependencies, most of them being LGPL and BSD-licensed third-party-libraries distributes as JAR archives. Currently, we're deploying a test-client of the software which is distributed as a single java fat jar arc...
I am developing an application using WebSocket to exchange messages; it is based on JSF 2.0.0, but the idea is similar and HTML5 have WebSocket support. Is the only difference between those language the used tag and the syntax? Is the logic behind it the same? I wonder if there any converter for this.
How do most companies define and manage message format specifications? Is it common for companies to create custom tools for creating and working with these documents? At work we have a lot of systems that communicate via UDP messages. Each system has its own Interface Control Document (in Word or in HTML) which descri...
I am from Java background and am new to JavaScript. I have noticed many JavaScript methods using single character parameter names, such as in the following example. doSomething(a,b,c) I don't like it, but a fellow JavaScript developer convinced me that this is done to reduce the file size, noting that JavaScript files...
I make a lot of typing mistakes when I program. I have a good keyboard writing speed but I try to write faster and in the process end up making typos. I want to type faster, but make less errors. Can I do something to improve the situation?
When building an application from scratch, should I start with the object-oriented (OO) model or the entity-relationship (ER) model?
I love being a programmer. There, I said it. However, with that said, I've realized lately that I really can't stand bug-fixing. At all. In fact, while I'm developing something, my productivity is extremely high. Even when writing unit-tests and doing self testing of my development, I'm generally really productive. I ...
Is there any recommended/generally accepted coding style for handling situations where a function returns a tuple of values but only one of those values is used afterwards (note that this is mostly meant for library functions I can't change -- writing a wrapper around the call is probably a bit of overkill…)? Instead o...
The requirements are to take an existing list of identical tables (AAA0001 - AAA9999) which generally don't meed our current requirements and need to be swapped out with three tables (XXX0001-XXX999, YYY0001-YYY999 and ZZZ0001-ZZZ999). Currently, the guy who is programming this update which is supposed to take place on...
So I was speaking to one of the folks I work with here a few days ago, and they were complaining that their company no longer allows workers to work remotely at all any more due to the decrease in productivity. As someone that has heard this excuse used for justifying onsite only staffing in my search for remote opport...
Having messed around with several scripting languages and being a bit of a linguist, there seems to be a way to divide dynamically typed languages into two groups: languages that give variables a default value, and languages that treat accessing an up-to-now unused variable an error. For instance, consider this code: p...
We are planning to use Google Analytics in our organization and I am in charge for setting it up. I was wondering how to deal with multiple environments. We sure do not want to collect data during development and QA (or maybe collect data to a different analytics account), but we want to when the site goes to productio...
Most programming languages have some design decisions that influence their usage and applicability. For example: Python focused on maintainability/readability of code and had indentation be a part of the language itself. Java's intention was to be cross platform OOP 'easier' and 'friendlier' than C++ Objective-C was...
After doing a rough sketch of a high level object model, I am doing iterative TDD, and letting the other objects emerge as a refactoring of the code (as it increases in complexity). (That whole approach may be a discussion/argument for another day.) In any case, I am at the point where I am looking to refactor code blo...
I'm dealing with pretty stressful (in my opinion) situation in my current work place. We've started developing new project, get some requirements, implemented it and then show to someone you can call a 'business advisor' (person who knows business requirements but will not use the program). That person is supposed to ...
I was reading up on design patterns, to better my understandings of ones I know and reveal ones I didn't. One of the last ones I looks at was the Flyweight Pattern. It preaches about shared common function, and I understand this. Keeping with the game example (in the link), sharing functions for units in an RTS I'm sur...
We're using agile methods in my current project at the moment, and we have heaps of stories like these: As an assistant, I want to pay a customer a refund so that they can get some money when they request it As a customer, I want to pay for a purchase so that I can receive my item. How we've done it so far is to pick...
I've been using CoffeeScript for a while now. On Wikipedia, it is said that CoffeeScript is influenced by Haskell. But after I check out the syntax of Haskell, I have found little resemblance from CoffeeScript. Which aspect of CoffeeScript is influenced by Haskell?
I'm working through designing a RESTful API. We know we want to return JSON and XML for any given resource. I had been thinking we would do something like this: GET /api/something?param1=value1 Accept: application/xml (or application/json) However, someone tossed out using extensions for this, like so: GET /api/som...
I've read all of the posts I can find on this and I'm still not sure of the answer. I'd like to use a jQuery plugin on my website that is dual licensed under MIT and GPL. Does the dual license mean that as long as one or the other is satisfied I'm fine, or does it have to be both? I've read that a GPL javascript being...
I very often find myself in situations where I should have opened a parentheses, but forgot and end up furiously tapping the left arrow key to get to the spot I should have put it, and doing the same to get back to where I was - that, or removing one hand from the keyboard to do it with the mouse. Either way, it's a st...
Recently I have project in which a directory listing is enabled, due to which some scripts can be seen by outside world. I asked website administrator and he said it's not his responsibility, its the programmer's job. I also asked programmer about this and he said that the script is actually a cron job, and according t...
I love Rich Hickey, Clojure and Haskell and I get it when he talks about functions and the unreliability of side-effecting code. However I work in an environment where nearly all the functions I write have to read from the database, write to the database, make HTTP requests, decrement a user's balance, modify a fronte...
Possible Duplicate: Techniques to re-factor garbage and maintain sanity? Code maintenance: keeping a bad pattern when extending new code for being consistent, or not? I was hired about 6months by a company that uses Agile, but after learning the code I've realized that it's bad code - methods with over 100 lines of c...
I'm slowly trying to migrate our web application to use CQRS principals. In particular, I have separated "write" and "read" interfaces into commands and queries. I have implemented a "reader" class that can read some data from the DB. I have also implemented a decorator for this reader that caches the data to avoid...
There are several approaches on how to model a business process in software applications (BPM software). For instance, a processes can be described in BPMN, EPC, IDEF0, SOMF, etc. Additionally, different process execution languages such as BPEL, RPC, Wf-XML are available. If I were to develop software for the BPM-mark...
I would like to investigate whether ClojureScript, with the associated Google Closure library is a reasonable tool to build modern, in-browser, Javascript applications. My current Javascript stack consists of jQuery, Backbone and RequireJS with the possible additions of some widgets libraries like jQueryUI or KendoUI. ...
I am basically asking this question to see if I am being unreasonable. My current employer has locked down the machines of all developers so that we do not have access to the root or c: drive. For example, I cannot write a directory under C:. I also cannot install any software which touches the registry. Is this an...
Performance testing is something that I, as a developer do when optimizing. However, if the change is purely optimization, should the QA or business user perform their own performance testing? I would reckon they should, aside from testing that the functionality remains the same. If that's the case, is it acceptable fo...
While searching for jobs online I noticed that most PHP web developer jobs ask you to know about algorithms and data structures.While I don't know PHP yet I have started to learn it in order to obtain a job in that field. While I have seen some similar questions on the forum I don't feel like the answers satisfied my n...
After reading another question about JQuery and CDN's, is it feasible for tools like JQuery to "come with" the browser, thus reducing/eliminating the need for the first download from a CDN, or from your own host server. JQuery files specifically are pretty small, so you could easily have a number (all?) of the differen...
My understanding of a primitive datatype is that It is a datatype provided by a language implicitly (Others are user defined classes) So different languages have different sets of datatypes which are considered primitive for that particular language. Is that right? And what is the difference between a "basic datat...
I have a database design question. Basically I want to be able to create a schema for a User model, then use this User model in other models that extend User but I want to design it in such a way that it's generic enough to be used in every application. For example a Profile or Account model might extend User, and in b...
As I understand it, writing your objects in an immutable style can help the performance of your program for compiled languages, as the compiler tends to rewrite your code in single static assignment form under the hood anyway. Is there a performance benefit to using immutable objects in an interpreted language like Pyt...
Short version: I want "Login on program startup" checkbox like in Skype, for example, but don't know how to protect saved credentials securely. I'm writing client application which, before doing actual requests to server, should be authorized by server. Authorization goes as follows: user fills in standard login dialog...
These days I've been learning a lot about how different scientific fields are trying to move their data over to the Semantic Web in order to "free up data from being stored in isolated silos". I read a lot about how these fields are saying how their efforts are implementing the "visions" of the Semantic Web. As a learn...
Our current user's guide is built using asciidoc. The documentation is managed by a non-technical person, but we keep the source text files as well as generated HTML in source control. Issues arise when they are making doc updates for version x.z in the x.y branch. Typically, one of the developers will update their env...
I started with PHP a little while ago. I've been doing a lot of tutorials, practice sites, etc. and it's going great. One thing I like about PHP is how easy it is to get started (downloading WAMP and voila). However, up until I learned about PEAR and MVC frameworks, I haven't put much thought in using a command line I...
I was wondering what advantages the ontology languages of RDFS/OWL has over using a tagging/markup system (such as http://www.schema.org/) for managing and creating metadata?
Many books about algorithms and data structures are coded by imperative languages. Is there any book that can show functional programming languages can do the same thing or do them better? In particular I am interested in sorting, searching, data structures and graph.
About 3 months ago, our engineering group rolled out Review Board to be used for all peer code reviews. Today, I had a discussion with one of the people involved in that process and found out that we are already looking for a replacement (possibly something commercial) because of several missing features. One of the f...
I have multiple entities like Hotels, Destination Cities etc which can contain images. The way I have my system setup right now is, I think of all the images belonging to this universal set (a table in the DB contains filePaths to all the images). When I have to add an image to an entity, I see if the entity exists in ...
When programming in C, I often get the advice to turn on many or all warnings and not ignore warnings. Does the same hold in PHP, should I enable all warnings in the PHP log?
I was browsing a github project and found this module which has more than 10 thousand lines. Is it a common practice to have that much code in a single module? It seems to me that this should be split over multiple modules. Maybe one for each db engine. What benefit does the developer get from making one huge module li...
This is basically a logging/counting application that is counting the number of packets and counting the type of packet, etc. on a p2p chat network. This equates to about 4-6 million packets in a 5 minute period. And because I only take a "snapshot" of this information, I am only removing packets older than 5 minutes e...
I am learning "Programming languages principles" and there is a lot of information about stuff which make up a programming language . Unfortunately every material I came across until now has a lot of technical jargon involved and is very difficult to understand (Atleast for a beginner sincerely trying to understand the...
What's the role of a Project Manager in Scrum? I have heard that it is not advisable for the PM to be a SCRUM Master which I can see as making sense as the PM oversees the project whereas the SCRUM Master is more concerned with managing the work packages. To my mind it would seem that having a PM as SCRUM Master goes a...
I'm in a code shop of two. And while I understand that a bug tracker is useful where the number of programmers is greater or equal to one, I'm not so convinced that logging bugs, changes, and fixes is worth the time when they're trivial. When I find a simple bug, I understand it, fix it, and run it through some testing...
I am a contract data analyst, so I bounce between jobs every 3-6 months, which I find to be a good fit for me, but it leads to some problems when it comes to coding. I mostly do statistics (I've asked a similar question on cross validated, but the answers there are not relevant here), but I have also found out that the...
Here's a problem I frequently run into: Let there be a web shop project that has a Product class. I want to add a feature which allows users to post reviews to a product. So I have a Review class which references a product. Now I need a method that lists all reviews to a product. There's two possibilities: (A) public c...
I have a library that makes architecture to load data from server and display all controls in table layout. It works great but it have a lot of TODOs there. Also, this library in 99% created by me. I starts developing it in when I working in one company, continue developing in in other company - I just move code protot...
It's a bit subjective, but I'm hoping to get a clearer understanding of what factors make an operator clear to use vs obtuse and difficult. I've been considering language designs recently, and one issue that I always circle back around on is when to make some key operation in the language an operator, and when to use ...