instruction
stringlengths
34
19.9k
I am currently nearing the end of my first year of my CS degree and have been disappointed with the lack of coding I have been asked to do (one unit). I am basically looking for an effective way to gain practical knowledge but am unsure where to look for experience from a near beginner's perspective.
I feel that I am good at writing code in bits and pieces, but my designs really suck. The question is, how do I improve my designs - and in turn become a better designer? I think schools and colleges do a good job of teaching people how to become good at mathematical problem solving, but let's admit the fact that most ...
So I've been asking the wrong questions for the last three days and after searching a lot I think I have an idea of what I need, my question is how to use timers with two threads writing and reading on one queue. In other words, I have one queue(or any other data structure) and two threads, producer and consumer, so ...
I am quite new to programming and I am now creating my own program as part of my Master Thesis. My program is done in Java and uses several third-party libraries. These libraries come with different licenses, mainly: LGPL 2.1 GPL 2 + GPL Linking exception Apache version 2 BSD I have actually not touched the source co...
Hi I am currently developing a web application in Spring and Hibernate where i have several different tables. The Delivery table for example is mapped many-to-one with the Customer table and the Product table. I am wondering what the best practice is for creating a view function where I display all the columns related...
What was the first program that was created as a dedicated IDE? That is, purpose built for coding, rather than simply allowing integration as part of its expansion options. This is opposed to a text editor that has generic plugin/add-in/shell features that are were not dedicated to development work. The features I am t...
I was wondering how people deal with working in a project with badly written and formatted code, I'm talking mixed tabs and spaces, unnecessary parentheses and newlines and a whole bunch of warnings appearing on the code from the IDE. For context I have this problem on java projects, where no formatting was agreed upon...
I'm working on an open source project that has full time professional developers from several universities, plus a couple of other organisations. The product has something like a dozen deployments, various variations, plugins, related components etc. Generally development so far has been driven by institutions "scratch...
I know how to do simple loops but I don't know what's going on when many loops are working together. For example: for (var i=0; i <= 9; i++){ document.write(i); for (var m=0; m <= 9; m++){ document.write(i); } } Is there a way I can learn loops inside out?
I am designing a WinForms application in C# and wanted to get a design check by you guys. I am fairly new to programming and have been reading some material, so please excuse my mis-usage of words or 'computer science' terminology if need be. The Design I have a MDI application with MAIN as my parent form and various o...
At the company I work at, every service class has a corresponding interface. Is this necessary? Notes: Most of these interfaces are only used by a single class We are not creating any sort of public API With modern mocking libraries able to mock concrete classes and IDEs able to extract an interface from a class ...
I have an online document which essentially gets stored to the database as XML string. I'm thinking about a way to implement versioning of the document for the user. So that user can go back to previous versions of the document. update In my case it's a web application with hundreds of thousands of users. A user c...
I have a collection of normal functions and self-calling functions within a javascript file. In my comments i want to say something along the lines of "This script can contain both self-calling and XXX functions", where XXX is the non-self-calling functions. "Static" springs to my mind, but feel that would be incorrec...
Let's say I have a list of precipitation values by hour, each showing how much rain happened in the prior 24 hours, ordered by date. For example: { '2012-05-24 12:00': 0.5, // .5" of rain from 5/23 12:00 - 5/24 11:59 '2012-05-24 11:00': 0.6, // .6" of rain from 5/23 11:00 - 5/24 10:59 '2012-05-24 10:00': 0...
This question relates to a question I asked earlier, which can be used for reference here: Is this the best way to approach this design? Is this an example of MVC? While coding, I came across a realization that I am not creating 'loose coupling'. The way I am trying to solve the problem right now is creating an instan...
In principle, a single Django application can be reused in two or more projects, providing functionality relevent to both. That implies that the same database structure (tables and relations) will be re-created identically in different databases, and most times this is not a problem (assuming the projects/databases are...
The purpose of this assignment was the find the smallest and largest of the integer(User inputs 5 entries) I am a beginner Java programmer with no prior experience. Is there an easier way to do this without a ton of if/else statements? Forgive for the dirty code. //Scanner Object Scanner input = new Scanner(Sy...
I have been given a file with several records. I have also been given business rules that determine how to process those records and produce an output file. The business rules are relatively simple: If record is of type A, use methodology A. If record is of type B, use methodology B. However my client emailed me with...
You try a new tool and it does not work. You google the problem and if you are lucky a random answer says you need to edit some weird configuration file and place it in a specific directory you don't know. You try but during the process things go wrong. Either because you don't understand the steps listed in the answer...
I am building an app using Code Igniter, it is being based on CI-Bonfire. I am pulling in the dev branch of CI-Bonfire using git, I want the entire project to be git controlled as well, but I want to be able to just pull the latest changes from the dev branch of CI-Bonfire, but push my entire app to a different reposit...
I stumbled upon this question and a couple of other along the same lines. While we know creation of enum is thread safe and enums are by birth singletons . It kind of confuses me that why would any one want to have a synchronized method with in an enum. Yes I am fully aware that methods in an enum are not thread safe...
What is a good way to define "state", as in state variable or state machine, to a new (previously non) programmer? What are some good ways to explain why this concept is useful for writing software? Is the concept of state explicitly taught in beginning programming courses or books commonly?
I think one of the best ways to learn and become a better programmer is to share knowledge gained from working on personal or work projects with others. One way to do this at the workplace is to set aside an hour or so a week and let one or several team members present their progress on the part of the code base they h...
OK, I am creating a game using JavaScript and HTML5. The variables such as map, x, y, level, exp, etc are stored in JavaScript to keep track. On my client page, the JavaScript variables are stored to play along with the game. Every 5 seconds, the client page sends a POST AJAX call to the MySQL database and it successfu...
I've been thinking about the subject and I've always wondered, from where do they obtain the data that is analized in applications, I've looked at Nasdaq's website and they do not seem to have any sort of APIs, do the firms parse yahoo's finance section, or are there special contracts, agreements in places with the dif...
On my machine while developing I'm using icons from other application (in particular MS Paint and Paint.NET) as sign for the user that if he chooses to open that file (with our own internal command) it would open in those applications. Is it legal to extract the icons from those applications and use them? Commit them t...
We have an intranet site which was done in .net with plenty of functionality but management wants it to look more visually attractive and get the graphic designer involved. The graphic designer is NOT a programmer nor has any desire to learn how to code. She would be updating the main page only. I was trying to figur...
I have 2 apps. They both have accounts, and each account has users. These apps are going to share the same users and accounts and they will always be in sync. I want to be able to login automatically from one app to the other. So my solution is to generate a login_key, for example: 2sa7439e-a570-ac21-a2ao-z1qia9ca6g2...
In a project where I'm working on the data access layer I'm trying to make a decision how to send data and objects to the next layer (and programmer). Is it better to tell him to reference my dll, OR should I build a generic handler and let him take the objects from there (i.e. json format) If I understand correctly...
On EF4 actions on entities are actually done via the Business Element layer (BE). Why do I need the Data Access (DAL) on another layer?
On my new team that I manage, the majority of our code is platform, TCP socket, and http networking code. All C++. Most of it originated from other developers that have left the team. The current developers on the team are very smart, but mostly junior in terms of experience. Our biggest problem: multi-threaded concur...
I don't know if this question is strictly related to software development, but still I'll give it a try: Like a lot of programmers, I love to work on hobby projects. Sometimes, seemingly good ideas turn out to be not so good, so I drop the project. But sometimes, something useful comes out of the project. So, I could r...
When using method chaining like: var car = new Car().OfBrand(Brand.Ford).OfModel(12345).PaintedIn(Color.Silver).Create(); there may be two approaches: Reuse the same object, like this: public Car PaintedIn(Color color) { this.Color = color; return this; } Create a new object of type Car at every step, like t...
I have recently finished an undergraduate course in computer science and I am looking for a job. During the search I encountered several interesting (and tough) problems that needed clever algorithms to solve. I also use google code jam as a practice set. I cannot understand how those solutions translate in solving rea...
For a long time now I've been in the habit of checking whether a collection (array, dictionary, whatever) is non-empty with a nonequality. Like this: if ( MyArray.Length < 1 ) { // Do something if the array is empty } Sometimes I do this for strings too, and other kinds of collections. In practice, this should be ...
I would like to know the idea behind the working of 'docking' in applications. I have worked with applications where components from individual forms are docked on a single main form to provide the necessary GUI. But I don't have any idea whats happening in the background. According to Wikipedia A dock is a graphical u...
I am a noob to sentiment analysis and found a good resource for Bayesian Opinion Mining and a way to make it self improving. I was wondering though, if the optimum analysis is dependent upon the supplied data set and since self improvement would mean adding known patterns to the data set (my understanding), wouldn't th...
I am designing the a web application using Domain-Driven Design. I have following scenario: Each Application Group can have one Application and each Application can have multiple Configurations. I am trying figuring out which one will be aggregate object... Which one will be aggregate roots and why?
I am learning objective-C after having good knowledge of C/C++. I have 2 questions: Are Obj-C message passing and C++ vtable, two different ways of implementing polymorphism or Are they two very different concepts which I have misinterpreted into different implementations of same concept? I read following line from th...
I am working on a personal side project that will utilize a complex and large relational database. During the design of the database I had some co-workers give advice to how I should approach my application; they advised to use the entity framework. From what I've read and what I am watching it sounds like the entity f...
Im currently evaluating a front-end architecture for a big app that will be developed by a team of about 6 developers + 1 web designer so that said, having a robust SVN friendly architecture is a must. So far I'm evaluating this two options: A mixture of JQuery/UI/Mobile + Backbone/Underscore + Require JS + Twitter-Bo...
I'm very curious about this: Lets say that you have to use the GPL in your library because some dependency uses it or (if your library is fork) the upstream library uses GPL. Now GPL doesn't play well with a couple of important open source licenses which means that some users simply can't use your librar because of lic...
This post is a follow up to this question: PHP Atomic Memcache on StackOverflow. Considering I am using Memcache (no d at the end) on PHP 5.3.10, I implemented a custom locking system where a client will wait until a lock key is destroyed before it begins to modify a key on memcache. So: Client 1 connects, checks for ...
I'm about to undertake a project. This requires me to write code, and tons of it. The client's requirement is to hand in all source code at the end of the project. My question is: How do I quantify the price for source code and the software product? Is there any metric that one follows to determine pricing? How would ...
I study in software engineering and this year a new association at my university is opening a robotic submarine club. It's a new club and they needed software guys for micro-controllers manipulation, gui output and other software oriented requirements. I've been accepted to the club and there is nothing established rig...
I need a proper explaination of Jamie Zawinski's Law of Software Envelopment: Every program attempts to expand until it can read mail. Those programs which cannot so expand are replaced by ones which can.
I've been looking around for an algorithm that would optimize the distance between 2 list of coordinates and choose which coordinate should go together. Say I have List 1: 205|200 220|210 200|220 200|180 List 2: 210|200 207|190 230|200 234|190 Calculated Distance between Coords: 205|200 to 210|200 == 5.00 205|200 to ...
Say I've got a third-party service called Cool.io that provides a RESTful API but often goes down. My applications consume that API, but when Cool.io goes down, my app really can't do much... but it should! Say I create a proxy to the Cool.io and this proxy stores a copy of Cool.io's data and provides RESTful endpoints...
I am creating a website, where users can upload their own videos. So far I am just building the main structure with HTML and CSS. Is it a better practice to write server-side code before the site layout is finished? Does it not make a difference?
During an interview I was asked to implement a random generator in java without using any existing random number libraries that takes as an argument int n, and returns a random number between 0 and n. This was the implementation I provided: public static int random(int n) { int r = 0; for (int i =0; i <n;i++) {...
Edit: Given the recent downvoting (+8/-6 at this point) it was made clear to me that Gartner's lifecycle is a biased metric from a programmer's perspective. This is something that is part of a paper I'm going to present to management, and management types are part of Gartner's audience. Giving DVCS exposure & enthusia...
I was wondering why C++ is a good choice to write a compiler. Of course C is good for this purpose too, because many compilers are written either in C or C++ but I am more interested in C++ this time. Any good reasons ? I was looking for that in the Internet, but I cannot find any good reasons.
I did a lot of self-study coding, got some experience with Parallel Programming Models: Actors, Software Transactional Memory, Data Flow. When I am trying to apply these architectures to real life - into high load web application - any model doesn't support durability and persistence for data. Real life tasks requires ...
When I read the book Effective Java chapter 4, I met some sentences but I can't think them out : What is the implementation when designing a class , why subclass will rely on the implementation detail of superclass? Why will inheritance break encapsulation?
As far as I know, a Turing Machine is the widely used model in computational theory to know whether something could be computed and if computed can they can be computed in finite time (P, NP, NPSpace). But I have the following doubts: Is a Turing Machine essentially a black-box model where a set of inputs give a set o...
Here's what I'm doing: I am reading a file in BLL, which is sitting in the UI layer. Currently the application is using HttpContext.Current.Request.PhysicalApplicationPath to find the absolute path written in BLL. I feel this is not a good design and I am thinking that I should pass this information in some kind of str...
Let's assume, for a second, that you're "the boss", or architect, or whatever position would permit you the authority to decide on the following question: You work on a product that's existed for a number of years and it's developed entirely in an imperative style/language. Let's also say that there is a feature or sub...
I have a logic intensive algorithm that I need to code in two languages (actually I finished it in one language satisfactorily and am about to start coding in the other language). By logic intensive I mean the algorithm is non trivial, needs careful understanding and, importantly, could be having bugs (due to complexi...
I've been checking out Berkeley DB and was impressed to find that it supported a SQL interface that is "nearly identical" to SQLite. http://docs.oracle.com/cd/E17076_02/html/bdb-sql/dbsqlbasics.html#identicalusage I'm very curious, at a high-level, how this kind of interface might have been architected. For instance: ...
I'd like to reach out to the community on this one. As a software developer, I'm not an expert salesperson or marketing guru - I think in code and not much else. Most developers I come across are like this and also tend to be serious penny-pinchers. Let's say, as a developer, I recently released a new software produc...
I want to create my own Dropbox clone (for learning purposes - only the Windows app) and am looking for some tips. Currently, I use the FileSystemWatcher to check if there's a change, then use rsync to sync all the data. Now, how does this work with multiple computers? If computer A changes a file, it should be pushed ...
Just came across this post on reddit, where someone was charged $1,223 for a "FREE STEAK SALAD". I was trying to figure out 'Why 1223?' thinking that this might be a programming error somewhere. But 1223 seems to be pretty much an ordinary number (= 100110001112). Any ideas?
I'm just learning about use-case analysis and use-case diagrams and am a little confused whether or not the MySQL database of a web app should be considered an actor. Is the databased considered outside of "the system" or my application, because it is its own server, most probably on another physical machine? On the o...
In an ideal world: In an excellent article Don't Call Yourself A Programmer, And Other Career Advice, Patrick McKenzie explains, among other things, that language doesn't matter: A developer is a person who solves problems, in general. A developer is not a person who writes code in a specific language. Businesses don'...
I am just beginning to learn Functional programming (FP). I come from a OOP world, where everything are objects, and most of them are mutable. I have a hard time wrapping around the concept that functions don't have side effects. If something is not mutable, how are common things objects like Employee or Person repres...
I'm part of a small team of four, and I'm the unofficial team lead (I'm lead in all but title, basically). We've largely been a "cowboy" environment, with no architecture or structure and everyone doing their own thing. Previously, our production deployments would be every few months without being on a set schedule, ...
I need to find a way or an algorithm that groups members of a given data set (of positive integers) so that the difference between group means is minimized (not maximized, as usual). There are two constraints: The number of groups should not exceed log(N) base 2. N is the input array size. Let us assume that N = 16, ...
I am relatively new to Visual Studio Development and I was wondering - it seems that everytime I make changes to my JS or CSS in my project - I have to "build" the project again. Is there any way to simply refresh the browser as opposed to building everytime ? My understanding is that all the files are copied to some t...
Microsoft released Silverlight 5 but there has been no news of any future versions (except service releases) being released. Combined with the increasing visibility of HTML5 and modern JavaScript libraries it now makes a lot of sense to start adopting the new and emerging technology instead of relying on Silverlight wh...
I ask because I've seen a couple of OO PHP tutorials which do not adhere to this, but to me it just makes sense. It makes it easy to instantly see if a file is a class or not, if non-class files all use lowercase names.
Say I have a function that creates a list of objects. If I want to return an iterator, I'll have to return iter(a_list). Should I do this, or just return the list as it is? My motivation for returning an iterator is that this would keep the interface smaller -- what kind of container I create to collect the objects is ...
When starting a new software project that will be used on several platforms, how do you determine the best way to start development? Do you develop for one platform and then port to the next? Do you try to develop all platforms simultaneously? For example, I'm going to start developing a Windows Phone app in C#. Much o...
Possible Duplicate: How much documentation is enough? Do you know how the big IT company like IBM, Microsoft, or google make sure their application source code has proper documentation for future new programmers? What are their methods or tecniques? Do they tell the programmers to write documentation or hire a speci...
I am working on a project in which we have to implement and unit test some new module. I had a quite clear architecture in mind so I quickly wrote down the main classes and methods and then we started writing unit tests. While writing the tests we had to make quite a few modifications to the original code, such as Mak...
Abstract (tl;dr) Please read the full question, this is awfully simplified: How can unix file permission style restrictions be applied to inter-type data/control flows, allowing fine-grained access to some class-members for some groups of classes? Background information If you think about unix file systems and permissi...
Is there a way I can make the license I use for an open-source software package be valid for all contents of the package without having to write it into every single file? I often saw a LICENSE file, but does this file (with the license in it) makes all contents of the package (i.e. the current directory and all sub-di...
I'm going to work on some project that would do a user-action recognition based on what he/she does in the system. As far as I understand there are two main parts here: Intercept the user actions (say http traffic in web/ui interaction in thick-client) analysis of user intentions. While the first part is rather technic...
I've heard a few times that every extra [number1] milliseconds it takes to process a web request and return a response will lose you [number2] percent of users. Is this just "conventional wisdom," or have there been actual studies on the subject? And has there been found to be a lower bound to this phenomenon, like "...
For about 10 years I've worked on various in-house desktop client applications with SQL Server data stores. Rarely did I start these projects - most are takeover work. One thing that seemed constant everywhere was that there was a single global SQL Server user account that this application used that granted it permiss...
I don't understand what is passed to the function f() when I call it like this. main() { void f(int,int); int i=10; f(i,i++); } void f(int i,int j) { printf("%d %d",i,j); } gives me 11 10 .Can somebody explain why its 11?
Im working on a Java Software and there is a need to use some extern libraries. I found two relevant libs. The one is on an AGPL and the other on the MIT License. Now Im asking my self, can I use these libs if: I would make a non-opensource-nonfree-software or I would make a non-opensource-free-software I dont real...
I have two different tables in two separate databases with around 1.5 million records each. (BTW: im working on oracle databases) The objective is to check if every record present in table A is also present in table B. Since the tables exist in different databases, I think I cannot calculate the "difference" between ...
I'm writing a web app and am wondering about future upgrades and how upgrading the webapp will affect the user experience. In particular, I was wondering how a company like Google approaches this problem. For example, I have seen several examples where a particular google app will ask the user if they want to upgrade t...
A Client has a huge Windows Application running on a Database. This client wants you to develop an "Express" version of this application, including only, let's say, 20% of its features. This Express version must be a Web Application, opened on the WWW. You have 2 choices: Use the same Database to develop the web appli...
Note more discussion at http://news.ycombinator.com/item?id=4037794 I have a relatively simple development task, but every time I try to attack it, I end up spiraling in deep thoughts - how could it extending the future, what are the 2nd generation clients going to need, how does it affect "non functional" aspects (e....
Can we use the word "object" for data / functions in e.g. C (or Pascal) which doesn't really have objects? In C, what is an object? A data structure? A named memory area? I spoke to my collegue about "objects" in C and he said that there weren't any but in the text I study about C the word object is used as a generaliz...
WinRT: is it really about calling WIN32 (wrapped in COM (exposed as .NET)) via a proprietary extension of C++? That looks like a lot of wrappers and layers between the developer and the actual functionality. Does anyone trying to go with it stand a chance at profoundly understanding the ecosystem (if his last name is...
I find that some software developers are very adept at this, and often times are praised for their ability to deliver a working concept with abstract requirements. Frankly, this drives me crazy, and I don't like "making it up" as I go. I used to think this was problematic, but I've started to sense a shift, and I'm won...
I just graduated from university with a degree in Computer Science/Engineering and was fortunate enough to land a job working in the pharmaceutical industry as a developer. My title is System Developer I, which will require the following skills: 0-3 years development experience with C# .NET and SQL Server Experience wr...
I am looking for coding guidelines developers should follow while writing C#/ASPX/SQL code, so that merging into other branches is smooth if not seamless.
I have been asked to quality review two code bases. I've never done anything like that, and need advice on how to perform it and report it. Background There are two providers of code, one in VB and one in C (ISO 9899:1999 (C99)). These two programs do not work so well together, and of course, the two suppliers blames ...
This is a repost of a question on cs.SE by Janoma. Full credits and spoils to him or cs.SE. In a standard algorithms course we are taught that quicksort is O(n log n) on average and O(n²) in the worst case. At the same time, other sorting algorithms are studied which are O(n log n) in the worst case (like mergesort and...
I have, for example, this table +-----------------+ | fruit | weight | +-----------------+ | apple | 4 | | orange | 2 | | lemon | 1 | +-----------------+ I need to return a random fruit. But apple should be picked 4 times as frequent as Lemon and 2 times as frequent as orange. In more general case i...
I have been working on a database project, and I recently received a bug report for the remote execution of some queries. Usually, you try to find out the actual cause for the bug to occur and then fix it. But sometimes what I do when I'm fed up of doing some research (and can't find suitable information on the interne...
In my company we are building a webapp containing serveral central services that we design ourselves and then specify as interfaces. I.e. the interfaces are application specific and they are then implemented with third party libraries which we may change over time. When it comes to exceptions, I have realized that the ...
Another team in my company start to document their stand-up meetings, but I believe it is a waste of time. As far as I know, stand-up meetings are for communication not for status reporting (please, correct me if I am wrong) So, Should we document stand-up meetings?
If we have more than one service that uses same database - is it ok to move out user authentication on separate server and use RPC calls, instead of traditional database lookup?
Me and a friend are looking to team up for some freelance web designing. We both are very strong PHP coders and website designers, but I am better at design and he is better at PHP. So, I'll be controlling the stuff the user sees, he'll be controlling the stuff the user does. In order to speed up development, I'm wonde...
I am currently creating a web application that allows users to store and share files, 1 MB - 10 MB in size. It seems to me that storing the files in a database will significantly slow down database access. Is this a valid concern? Is it better to store the files in the file system and save the file name and path in the...
I'm designing a pretty standard Spring MVC application, and I'm trying to figure out where the responsibility for transaction management should lie. I've been reading Java Transaction Design Strategies, and the one that I think best suits is the Server Delegate one, where the controller is what manages the transactions...