instruction
stringlengths
34
19.9k
Perl has this really cool documentation method that makes documenting really easy. It's called POD (Plain Old Documentation). Here is an example: =head1 NAME Example::Module - an example =head1 SYNOPSIS use Example::Module; my $object = Example::Module->new(); print $object->as_string; =head1 DESCRIPTIO...
When learning about polymorphism you commonly see something like this class Base { int prv_member; virtual void fn(){} } class Derived : Base { int more_data; virtual void fn(){} } What is upcasting or downcasting? Is (Derived*)base_ptr; an upcast or downcast? I call it upcast because you are going away from the base...
I've some application on the Google Play, free to download, but I have some people reporting things like: "There has been problem installing on my htc x." How do I help these people? I could reply and ask things like their android version and what not, but this won't really help me debug it, since the error occurs o...
A good example of what I'm trying to ask about would be Facebook's new Timeline feature. In the beginning, only a select few were allowed access to timeline. As the feature became more solidified in how it was working and bugs were fixed in it, additional users were allowed access to the feature. At a later date, a lar...
I am storing database passwords in app.config as plain text. I am also publishing the application. How safe is that password stored in app.config? Can I use a disassembler and find it?
I have been learning C for a while but still get confused about designing large programs within C (a large application such as the Linux kernel). Moving from Java where you have classes it's difficult to understand how to design a large application in C. What advice/links can people advise from moving from a high level...
Suppose I want to implement MVC in JavaScript. I am not asking about MVC frameworks. I am asking how to build it in principle. Let's consider a search page of an e-commerce site, which works s follows: User chooses a product and its attributes and press a "search" button. Application sends the search request to the se...
I have a .c file that basically manages its own little database of people. There are add, remove, edit and search functions among some others. It has a static array which it uses to store the data. What is a good way to go about unit testing a file like this? Because the array is static I can't put in my own data. Shou...
Generally I am asking if this is a norm. The application architecture includes spring and the zk framework. I personally can't help but think this introduces a number of problems. I mean...this is a lot of non synchronized functionality. On top of that we are using an Apache project that, through my browsing of source,...
I have created a Monopoly game with a 2D Graphics in Java for my final exam at college. I feel that the game doesn't look very good and I want to add a 3D Graphics. My problem is that I have never done 3D programming and I don't know how to create 3D objects. Can someone tell me where can I create 3D objects and what l...
This is a problem that I think many people will find very common and some guidance from the expert users around here will be appreciated. Background Basically I'm a junior web developer in a team of 6 (all juniors too). 6 months ago our team leader and project manager left the company. Currently we are being managed by...
How would you recommend creating "anchors" in code comments, so that during maintenance, developers can easily cross-reference other code comments. I realise that software should be intelligently structured and this should mitigate this requirement to some degree, but I have often found myself writing a comment where I...
Why is 80 characters the "standard" limit for code width? Why 80 and not 79, 81 or 100? What is the origin of this particular value?
I've got three nib files in my project, each of which is driven by its own class (.h and .m files). Each nib has a stylized design with a full screen background image and a few overlay images acting as buttons. Each button has its own button-click sound, and most of the buttons on each nib file will play a different...
At our company we are not using a source control so we do backup manually. My habit is like this: I backup only scripts where I removed code snippets, and those scripts where I only added code snippets I don't backup. Is it reasonable to backup each time when you change something, or there are some conditions for file ...
Is there a (quantitative) tool to measure performance of functions based on its input? So far, the tools I used to measure performance of my code, tells me how much time I spent in functions (like Jetbrain Dottrace for .Net), but I'd like to have more information about the parameters passed to the function in order to ...
In reading another programmers code, he uses a format I have never seen. E.G. namespace MyNs.HereWeAre {//tab here for some reason public class SomeClass {//here's another tab public string Method() {//yet another tab string _v...
As I understand these form the basis for targeting a wide array of devices based on the browser size, given it would be a time consuming to generate different layouts targeting different/specific devices and their resolutions. Questions: Firstly right to the jargon, is there any actual difference between the two or...
To note, I'm not interested in simply 'hiding' content for mobile devices, I want to filter out that content completely. I'm also not trying to address the issue by building a mobile specific interface (mob.example.com). There was another question regarding something similar: How do I prevent useless content load on t...
2 teams (A and B) in different geo locations are developing Project P. Both of the teams are also developing few other smaller projects: A has projects PA1 and PA2. B has PB1 and PB2. P is the only one common to the 2 teams. The Scrum design today: Each team has a PO, and they decide on the priorities together. One ...
I have several websites that I help manage. When running on my local machine (under iis7), the websites run on under a folder on my machine d:\WebRoot\TheWebsiteName and run as htt://localhost/TheWebsiteName, but when they are deployed they run as http://www.TheWebsiteName.com (also running under iis7) Currently I am h...
It's quite difficult for me to understand these terms. I searched on google and read a little on Wikipedia but I'm still not sure. I've determined so far that: Abstract Data Type is a definition of new type, describes its properties and operations. Data Structure is an implementation of ADT. Many ADT can be implemented...
Last week I started making daily backups of my relatively small (~300mb) site. The backups are zipped, so it's less space, but it will quickly add up, especially as my site gets bigger. I was thinking of unzipping the latest backup, and from now on just using mercurial to add/update files from newer backups. Are ther...
80x24 characters seems to be a very common default for terminal windows. This answer provides a very good historical reason as to why the width is 80 characters. But why is the height commonly 24 (or 25) lines?
I'm working on becoming a self-taught programmer. I've read a little bit through a lot of languages and I decided to start with Java and have been using it for several months now. I didn't have much of a problem since most my programs are relatively simple, or games that don't take much planing. That is until my last ...
I'm looking for a way to load data into properties/variables etc and have this information accessible to all the pages of my app. I want the information to be loaded via a background thread to keep UI thread free. Some of the pages will have various properties of their controls binding to these global properties. Here ...
Say you need to implement a few closely related functions that provide a piece of functionality, but there is no need to track any state between those functions, they just sometimes pass some parameters between themselves. What would be the best decision from the design standpoint? Make it a class, or just a separate s...
This has never come up, so I've never thought how a data or programming model should work that simulates (a) bird's eye view of cars moving and some rudimentary physics, (b) how the cars would follow a road layout and (c) how an efficient data structure for roads would look like. Obviously, this question also means to...
By searching for the different software development methods I found that there are two AM: Agile Modeling Agile Manifesto The problem is that I can't get the difference between them. If one is a part of another? or an update to the other?
I would like to know if it is possible to use DBUS on Android using Java. From what I have been searching till now it appears like there isn't any DBUS programming support on Android. However, Bluetooth on Android uses DBUS. I would like to confirm if it is actually the case. If so, is there a possibility that DBUS wou...
If I have a loop within another loop, yet I know the inner loop will only run once, will this algorithm still be O(n^2)? For i = 1 to n do For j = 1 to i do If (i==j) do For k = 1 to n {Do stuff} The very inner loop will run at most 1 time, since i will only equal j o...
Python's Zen states on line 14 that: Although that way may not be obvious at first unless you're Dutch. Is this a reference to the famous Dutch computer scientist Edsger W. Dijkstra?
I'm reading Coders at Work and Brendan Eich cites a paper by Norvig, from when he was at Harlequin, "about how design patterns are really just flaws in your programming language." Can anyone provide the link to this paper?
When we say 'documentation' for a software product, what does that include and what shouldn't that include? For example, a recent question asked if comments are considered documentation? But there are many other areas that this is a valid question for as well, some more obvious than others: Manuals (obviously) Release...
We have a repository of tables. Around 200 tables, each table can be thousands of rows, all tables are originally in Excel sheets. Each table has a different scheme. All data is text or numbers. We would like to create an application that allows free text search on all tables (we define which columns will be searched i...
I understand that in asymmetric crypto systems: The public key is generally used to encrypt data and only the private key can be used to decrypt that data. It's trivial to derive a public key from the private key (see this SO question). Firstly, is this correct? My goal is to supply data with my application that is d...
I am developing an application in which I have a Class containing various methods. The problem is that i need to call most of the methods on form submission. For that reason, I have to create a new file on each form submission. On every file, I have to create an instance of the same class and then call the appropriate ...
Is there a tool available for checking if various combinations of open source licenses are compatible with each other? I'm planning on building various tools that use an Apache license for distribution because Apache's licence seems to strike a good balance between being permissive and being enforceable in law. Howe...
Was hoping someone could provide some patterns/techniques/ideas to increase performance for the following scenario. Am integrating with an external ordering system via SOAP. The external system can be slow and unfortunately nothing can be changed at that end. All products are retrieved from this external source and an ...
Is it considered bad practice (and how bad) to run different JavaScript for IE? Currently im writing some JavaScript and the simplist way to work arround IE quirks seems to be to check for browser version and run different code var browserName = navigator.appName; if (browserName == "Microsoft Internet Explorer") { ...
I am preparing for a test and I can't find a clear answer on the question: What would be the impact of proving that PTIME=NPTIME. I checked wikipedia and it just mentioned that it would have "profound impact on maths,AI,algorithms.." etc. Anyone can give me an answer?
I've been trying now for a long time to wrap my head around OOP. I see its advantages. I've read many, many tutorials and watched an equal amount of videos on the subject. I get the animal/cat/dog examples, I get the car/drive examples. What I'm struggling with is how to apply these concepts in a real-world application...
I am currently doing my first real project with TDD. I have written tests, and implemented most of the logic for the application. However, there are properties I know I need to have on the UI, however, there is really no way to write a useful test which will cause their creation. For example, a description field. It's...
I find myself writing a lot of code like this: int myFunction(Person* person) { int personIsValid = !(person==NULL); if (personIsValid) { // do some stuff; might be lengthy int myresult = whatever; return myResult; } else { return -1; } } It can get pretty messy, especially if multiple che...
Say there is a team of ten agile developers. Every day they each pick a task from the board, commits several changes against it, until (by the end of the day) they have completed the task. All developers check in directly against trunk (Google-style, every commit is a release candidate, using feature toggles etc). If t...
I used Dragon Naturally Speaking very briefly a few years ago and was thinking if it would be a viable solution for programming? I was thinking more so if you break your arm or something that would be a major hinderance to programming. This same question on SO but was never answered.
During all my professional lifetime that I have been programming in Windows enviroments, I advised my friends and coworkers to not use a DSN database connection in their applications, based on my own personal conclusions, but I really haven't seen any evidence of them. I know that using a DSN connection via ODBC data s...
I have some .NET projects that are starting to get large enough to merit looking into Dependency Management solutions, so we don't have to copy binaries from one project to another. Here's what I've found so far: NPanday is based on a port of Maven. I can't tell how recently it was worked on, but the last release was ...
I often want to have the same unit test applied to data multiple items that are roughly equivalent (two non-empty strings). Currently I implement these in multiple unit test methods, with names like MethodNonEmptyValidString1 and MethodNonEmptyValidString2. This has a bit of a code smell to me. Is it better to have...
On nodejs with node-mysql, should I create one connection for the service like this: var client = mysql.createClient({ user: 'user', password: 'pass' }); // Create a new mysql Client io.sockets.on("connection", function (user)) // when a user enters { result = client.query('check user'); //check for user on...
I am working with a client right now that wants me to sign a contact with a warranty for a year for no additional charge. As well as any reasonable changes he wants during the contract that are outside of the guidelines for no additional charge while not affecting deadlines. And lastly documentation and training for al...
Let's say I have the following lines: Lorem ipsum dolor sit amet, (tag) consectetur adipiscing elit. Phasellus congue nisi vel lorem dignissim tristique. (tag) Etiam vulputate lacus nec velit lobortis ut adipiscing mauris condimentum. (tag ) Vestibulum quis nulla id nisi ultricies placerat. (teg) In tempus vulputate an...
At our company, we have a custom software application using our own framework. The framework was built in approximately 2002 or 2003, long before I showed up at the company. Majority of the functions in the framework are solid so we still use them as we've never had any issues with them, I'm talking about the database ...
I have an entity (model) called Notification, shown to Users of the system. So far, Notifications were created and showed instantly to users when they were enabled, and hidden when disabled or deleted. Also, Users can close/cancel the Notification so they don't see it anymore and that action is persisted in a collectio...
A colleague of mine was once at a seminar about agile development, where he heard it is possible to use unit tests as technical documentation. Something like using unit tests as an example of how to use the class. A quick Google search provided TDD and Documentation, which proves it should be possible. But looking at o...
I've considered making modules and the like for various languages and other open source things. Where documentation is not specified but rather is communal de facto standard or entirely ad hoc; should I try to improve from that standard in my code if it is not in-line with what I've learned to be good documentation fro...
My company is a small twenty-man engineering firm. All the application programming here is done in VB6 by two people, who have taught themselves VB6 from an assembly background while working here for the past 25+ years, and myself. As a result, the VB6 code is riddled with horrendous code smells, like tons of stringly ...
I just finished a redesign for a website that is currently using Google Analytics. I want to continue to use Google Analytics, but I'm not sure if I should create a new profile for the new site or simply use the old UA number. The new website has a completely different URL structure and much of the content has been upd...
Why do trees grow downward in computer science? I have a feeling it goes back to a printer, and that a program traversing a tree first prints the root, and uses the notion of a bottomless stack of paper to express the indefinite levels of recursion that might be encountered. References: Trees grow downward, having the...
I'm trying to develop a model to work on an assignment problem in the firegifhter area. Given n firefighters, m trucks and z ongoing fires, each with a danger level, try and allocate the resources in the best way. Is there some work on this i can read to try and understand how should i formulate my problem (costs, and ...
I'm an iOS developer (freelancer) and i want to know how much cost to build an app? and how should i do to estimate the price? like this app http://www.finalcad.fr/en/index.html
In Java, there are multiple languages that compile to Java bytecode and can run on the JVM -- Clojure, Groovy, and Scala being the main ones I can remember off the top of my head. However, Python also turns into bytecode (.pyc files) before being run by the Python interpreter. I might just be ignorant, but why aren't ...
I am reading the paper "Efficient Reconciliation and Flow Control for Anti-Entropy Protocols"! , I couldn't clearly understand Section 3.2 "Scuttlebutt Reconciliation". Here I extract out some sentences from the paper, which especially confuse me. If gossip messages were unlimited in size, then the sets contains the e...
I feel like I have a reusable "something" here and I'm not sure whether to think of it as a pattern or an algorithm (or neither). It's characterized by having an unknown amount of work to accomplish a task because the subtasks can encounter various conditions which cause them to add "Issues" to a global queue. Then, th...
I was (casually) researching semantic / ontology based approaches to technical documentation, when I stumbled upon this gem: Literate Programming and the Semantic Web are ideas from different times, which do have a connection. The linked paper, Literate Programming in XML by Norman Walsh, discusses XML technologies t...
Looking for the recent and powerful upcoming programming languages over net, I came across Ceylon. I dropped in at ceylon-lang.org and it says: Ceylon is deeply influenced by Java. You see, we're fans of Java, but we know its limitations inside out. Ceylon keeps the best bits of Java but improves things that in our e...
I've been doing some reading about DNSSec and am interested in the algorithm that they chose to use when splitting the trusted key up between the 7 Trusted Community Representatives (TCR). I unfortunately can't find any information about the algorithm itself anywhere. Is it just an implementation of the Shamir Secret S...
Are there any situations where having a "data model" in which all of the entities are instances of a Map<String, Object> would make any sense? How do you explain to someone why having such a "data model" is not such a good idea? It seems like it's an absurd approach to me, could I be missing something?
I'm trying to understand the basic concepts of algorithms through the classes offered at Coursera (in bits and pieces), I came across the deterministic linear time selection algorithm that works as follows: Select(A,n,i) If n = 1 return A[1]. p = ChoosePivot(A, n) B = Partition(A, n, p) Suppose p is the jth element ...
Following on from this question - how do you explain to someone that this is just crazy!: boolean someMethod(Map<String, Object> context) { Object object = context.get("someProperty") Object another = context.get("anotherProperty") return object.toString().equals(another.toString()); } Apparently the re...
I'm wondering if someone has done some experiments correlating code metrics (SLOC, Cyclomatic Complexity, etc) with bug density in Object Oriented applications. I'm not looking for experiments that only prove or disprove a correlation, but on both. I'm not trying to find a silver bullet as I believe that the bug densi...
When I was reading the summary of previous work in Dogsa T, Batic D. The effectiveness of test-driven development: an industrial case study. Software Quality Journal. 2011;19(4):643-661. it struck me that the measurements used in a lot of studies around TDD are based on things like lines of code, defects and time spent...
I'm studying an approach to understand better how the continuous integration workflow fits better in a software development company with the scrum method. I'm thinking something like this: Would that be a nice workflow?
Apparently less than 1% had javascript off in 2010: http://developer.yahoo.com/blogs/ydn/posts/2010/10/how-many-users-have-javascript-disabled/ So is it worth it to still support browsing without javascript? For example: Form submissions. Normally I would set up click or change events on form elements and just update t...
I have been learning Java. And still after a prolonged time I don't know why the name of the folder is "bin" where one find all the tools for java? Is there is any logical reason behind that? I have also noticed the same in .Net framework also.
I am learning OOP. I have studied much about encapsulation but the more I read the more I became confused. I understand we hide (by making private) data and expose it to user of class (other developers) as properties or methods. I also understand by encapsulation we hide details. In an article (http://www.csharp-statio...
I'm using the WTFPL in my personal projects that I have published on GitHub. Currently I'm using the license verbatim, but I have a suspicion that I shouldn't be leaving the third line: Copyright (C) 2004 Sam Hocevar <sam@hocevar.net> in there, and instead should use my name instead of Sam's. But the license is very ...
C# WinForms: A Combobox with some items in in. A spread sheet with some items in it. Each row also has a check-box so users can select them. User picks an items in the combobox and clicks a Save button. It means associate that Combobox item to those selected items in the spreadsheet. Q1: What's a good structure I can u...
In implementations of the Scheme programming language (R6RS standard) I can import a module as follows: (import (abc def xyz)) The system will try to look for a file $DIR/abc/def/xyz.sls where $DIR is some directory where you keep your Scheme modules. xyz.sls is the source code for the module and it is compiled on the...
I know there have been a number of discussions of whether break and continue should be considered harmful generally (with the bottom line being - more or less - that it depends; in some cases they enhance clarity and readability, but in other cases they do not). Suppose a new project is starting development, with plans...
To give some context, I've been a Ruby & Rails developer for the past few years, and just recently started doing quite a lot of JavaScript to add more responsiveness to the apps. When programming backend, it is quite easy (at least for me), to do most of the stuff test driven and just keep hammering out a bunch of code...
Right now I'm struggling with this concept of DRY (Don't Repeat Yourself) in my coding. I'm creating this function in which I'm fearing it's becoming too complex but I'm trying to follow the DRY principle. createTrajectoryFromPoint(A a,B b,C c,boolean doesSomething,boolean doesSomething2) This function I have say tak...
I've been trying to implement a text classification system. It needs to read a text file, and extract the words and the word frequency. So far, I've been planning to parse the words, put them in a dictionary and save it to an XML file. I am using C++/CLI. Is this a good implementation or is there a simpler or better im...
I recently started using <vector.h> library and I was wondering, since all the operations are already implemented, IF the method of the sorting algorithm is the most efficient one. Everything runs perfect, there is no doubt, but should I worry about its performance? If I want to sort up to 6-7 million numbers, should I...
I'm new to Programmers and I am looking to increase my knowledge of programming. Recently, a user on Stack Overflow told me using singletons is a bad idea, that they encourage tight coupling and that they make testing harder. What prompted this discussion was that every class I've ever written accessed any kind of data...
I have raised a question on dba.stackexchange.com but as the heart of my question is in fact to do with logic I have raised a more general representation of my issue here. I think it is the right place, apologies if not. I have a number of objects that are read and written to in a set sequence. I also have four locatio...
I have a site that has been built from scratch by a few different programmers over time. The first programmer, who built the initial system and database, was not very tech savvy. Other programmers who worked later also did things their own way, taking shortcuts, patching things instead of dealing with root cause issue...
I'm part of a two-person team that is building a web-based virtual tour application with specific extra functionality that doesn't exist in current applications. This is a summer school project. The team lead wants this application to be as platform and dependency-agnostic as possible. To do this, we're using Google'...
I don't understand the benefit to HATEOAS for APIs intended for use by programs (as opposed to humans directly browsing your API). Sure, the customer isn't bound to a URL schema but they are bound to a data schema which is the same thing in my mind. For example, assume I want to view an item on an order, let's assume ...
I have this requirement: The application must allow the Administrator to edit, create and delete Users. Now, I have heard that each action must go in a functional requirement, and my question is: What of the following statements would be the more appropriate(if any): 1: The application must allow the Administrator to ...
We develop a windows application in .NET 4 with a database of MySQL. When we are about to deploy that application, we install the .NET 4 framework in our client, then when installing the .NET Connector for MySQL, it requires a .NET framework 3.5. But the .NET 4 is already installed. Wasn't .NET framework backward compa...
I am only developer working on a project. The functionality that I have coded works to expectations(desired result) but since I am the only one I don't know if I can do anything better to it. How do I determine if my code is optimized (I want to increase the performance of some features)? One thing that comes into mi...
TL;DR : Do functional languages handle recursion better than non-functional ones? I am currently reading Code Complete 2. At some point in the book, the author warns us about recursion. He says it should be avoided when possible and that functions using recursion are generally less effective than a solution using loops...
In DDD examples it seems the common method for developing the domain model is to sit with domain experts and iterate over versions of the model, say on a whiteboard, continually modifying it and changing it until presumably an agreement is made on how the model looks. On my project I've spent a couple of days with a do...
From the essay Programming Languages Explained by Paul Graham, published in Hackers & Painters: The high-level language that you feed the compiler is also known as source code, and the machine language translation it generates is called object code. From the Wikipedia article on object code: Object code, or someti...
So I have a function that takes two dates. The SQL query gets all the results between the two dates. I currently have my function setup as such: function myFunc(start, end) Where start is the most recent date and end is the oldest date. Is this intuitive/correct or is there another naming/ordering convention I sho...
What design and implementation issues did programmers have to solve when they decided first to use structures and classes? When did this happened and who were the pioneers behind these ideas? Note, this is double question, because structures and classes are related. I realize that structures are quite older than classe...
Part of our ERP system is a sub-system for running background jobs. We track a variety of meta-data about our jobs in a table including timestamps for submitted, started, and end times. I'm creating a report showing the performance of our job system, detailed by day. One KPI is maximum # of jobs running at once. The ...
Why do some open source projects not accept pull requests, but require contributors to email patch files only? e.g. Git Although they publish code in github or other distributed scm hosting. It is not interactive nor convenient to send patch files. Patch file is an old-fashioned way. Pull requests are interactive. Othe...
With todays browser extensions/tools is it not easily possible for a user to edit the html/css settings of a website and so enable some disabled buttons etc... to gain access to not permitted areas?