instruction
stringlengths
34
19.9k
I found it's really hard to divide the task of developing a website to a team of people. The problem is a website should have consistent looking and be integrated in users' view. The style and page template need to be shared by all parts. Most of the website is access restricted, the access control system is dependent ...
Does it make sense to write default constructor when it has no arguments, empty body and no other constructors exist? The only benefit I can think of is reducing the risk of forgetting to add the default constructor when another one is created. But this error would show up anyway if the default constructor is actually ...
I came across Instagram's API client written in Python. In their class InstagramAPI, they bind the methods to a function in bind.py. When called, the function returns an instance of the class InstagramAPIMethod and execute the request call. What are the advantages of doing it this way? (over directly creating instan...
To improve some lookups, I am considering the use of Bloom Filters. But in my use-case, the most probable outcome is that the element do exists in the target set. Bloom filters can have false positive, but no false negatives. That would make me check the real (big and slow) storage most of the time because of the uncer...
I have an automated invoicing web app and I'm trying to build in some failsafes and a structure that will, under no circumstance, allow an invoice to be double charged. All things working perfectly, the scheduled task runs and everything charges as it's supposed to. But there are a few scenarios we know of that can cau...
I am working on a new project which will query data from a 3rd party REST API. This is for a real time sports data feed, so the feed only works when a game is actually taking place. Although the 3rd party provides good documentation (XSD, etc), they have no way to simulate a game happening, and so to test code I have w...
Consider the following hierarchy in C++ notation: class A { public: virtual void doStuff()=0; virtual void doOtherStuff()=0; }; class B:public A { public: void doStuff(); void doOtherStuff(); }; class C:public A { public: void doStuff(); ...
I have to write a decent size database, 1GB more or less. I have only taken an introductory semester regarding SQL databases. During the course we learned that the relational model under SQL has no implied order and that therefore when querying we should always have a variable that sets the correspondant order in the ...
I am beginner in algorithms. Last year I participated in Google Code Jam. One of the major issues I faced during the competition was my code was working fine on my test cases, but when I submitted on a large number of test cases, I failed to pass them causing some logical error. So, my question is basically how can I t...
I've been trying to find information online about where WWF 4.5 fits with in an architecture based around an enterprise message queue using central broker(s) (RabbitMQ in particular). It seems like responsibilities overlap a bit since WWF offers the ability to pause-and-resume (persist/restore) workflow instances. I'm...
In Don Norman's seminal work "The Design of Everyday Things", the author coined the phrases and explains the difference between "Knowledge in the World" and "Knowledge In Your Head"; an example of this is a multi-switch light panel that can either incorporate "Knowledge in the World" by being a model/map of the room, ...
I have a part of CQRS pattern implemented using S#arp Architecture like this: public class MyCommand { public CustomerId { get; set; } // some other fields } public class MyCommandHandler<MyCommand> : ICommandHandler<MyCommand, CommandResult> { Handle(MyCommand command) { // some code for ...
I am developing and maintaining a web-based application that's used internally at my job. I am the only developer and so I'm not really using branches; everything happens on the trunk. I do tag releases in Git with the date and time, and I'm starting to transition to using a build number instead of date/time. In the p...
I would like to know what should be the best way to keep data on a server related to the following points: Chat logs Heavy text content User references like amounts of ids (1,4,14,524,23220,...) I'm using PHP and a mysql database but as obvious I know the topics above don't go well into mysql at large scale and maneu...
I have an automated invoicing web app and I'm trying to build in some failsafes and a structure that will, under no circumstance, allow an invoice to be double charged. All things working perfectly, the scheduled task runs and everything charges as it's supposed to. But there are a few scenarios we know of that can cau...
I still don't understand the difference between a native app and web or hybrid apps from the interface point of view. Now, apps such as Twitter, Facebook, etc. Are they native? or web? or hybrid apps? In those apps what is the most code was used? is it HTML and JS? or is it a language such as Objective C or Java? I'm ...
I'm doing it in C++, I can't post the entire thing, because it's gigantic, I'll just sum it up with a simple example.I have: class B; class A { //Members and methods... void DoSomething(B* owningSystem); }; class B { //Members and methods A memberA; } So the problem is, A needs to know about B to use its DoSomet...
for (i = 0; i < 3; i++) { for (j = 0; j < 4; j++) { cout << arr2d[i][j] << "\t"; } cout << endl; ..... Like that for example. Do you read the for loop inward-out (starting from for (j = 0; j < 4; j++)) or outward-in (starting from for (i = 0; i < 3; i++)) Just wondering. :D
I am trying to better understand what would be required for a compiler to be able to make intelligent choices regarding concurrency on behalf of the programmer. I realize that there are many difficult aspects of this problem for instance: Ensuring that there are no race conditions Ensuring that the code to be run conc...
I have a couple of questions about UML. Firstly, how would you show "Use Case Ends" on a sequence diagram. Secondly, if you have an alt in a sequence diagram for "Variable == false", would you need to show what would happen if the variable is true, even if nothing would happen other than moving onto the next method ca...
While studying IOS, i generally come across viewcontroller. That gives me, confusion, if this "ViewController" has to do something with controller ( in MVC ) ? But how come both "view" and "controller" are combined in this terminology. What does it actually mean ?
So, I've inherited one of those "Engineer's Special" spreadsheets -- the kind developed by Mort the Engineer, with lots of hairy VBA and WTF, complicated calculations, and no documentation. Fortunately, most of the primary inputs and outputs are on a single page. Maybe not enough for full test coverage, but a start. I'...
Recently I wrote some (I hope) useful application. I would like to share it with every person on the world, making it open source. I would like to publish the source code as well as binary files (both for Windows and Linux). I used only free tools to write my application: Code::Blocks, MinGW, gcc/g++, Linux Ubuntu/Linu...
I have a File database table with the following columns: Id (PK), Filename And a Document database table with the following columns: Id (PK), Name, Description, FileId (FK) When a user wants to "save" a Document, my client-side JavaScript does it in two quick AJAX calls (in an attempt to be RESTful and save each resour...
How important is it to initialize variables? Does proper initializing avoid memory leaks or have performance advantages?
I have a scenario where I will implement Command pattern like described in this article. Actually from an Asp.Net MVC view, some user will invoke different commands/actions like Start Live Video, Start Live Image, Start Recording etc. A Web Socket Server will then receive these commands and dispatch them to a Receiver ...
I am trying to develop a simple system for sharing data across several websites. Most of them are developed in PHP while some are developed in Wordpress/Drupal. Redundant information is spread across several websites and this has caused a problem where we have to update the information across several websites separatel...
I made a search on google to find out who are the people in Oracle responsible for updating the Java API in other words who are those responsible for adding new classes and methods to the API and updating the Java Documentation. I could not find an answer to this question which leads me to the next question, what if I...
I'm quite a CSS beginner. I've read some introductory books but now I came across a sort of question that isn't answered in any of them: Let's say I have a basic HTML-based website with a standalone CSS file. Now I'm creating a new CSS class or ID and I want it to have a meaningful name of course because I'll probably ...
I am working on a networking site where I need to reload the notification div every second. I wanted to know is it good or bad to load it every second as there are some other divs also loading after every 3-4 seconds. Will it cause any problem like hanging, slowing down, etc? Reloading is done by ajax: var auto_refres...
I have a Rails server that connects to a json API on another server to get data to build the pages dynamically. These pages, however, don't change very much and not very often. I was thinking I could cut down the page load time, also, cut down the calls to the JSON API significantly if I just periodically called the JS...
As far as I know, it generally refers to late or dynamic bindng. So why a word like late or dynamic wasn't used?
If I'm designing a one page website, is it better to create external file for my JS code, or just put it in the html code? Is putting it on the page faster to load? Can I change the permissions to deny the users requests for the code, but the html page can still call the code?
I need a very simple explanation because I'm not a professional programmer. I found the terminology "abstraction layer" reading the documentation of mysqli extension where is described the difference among mysql, mysqli and PDO extensions in PHP. The article is this, that's where I met "abstraction layer" for the first...
I'm trying to refactor some code, and one of the major changes is to remove the (ab)use of static classes to give global state. I've tried to split up some of the 'global state' functionality with POJOs that can be passed around. But the further down the rabbit hole I go the more and more I feel like this is an Anti-Pa...
Just to make sure if I understand this correctly. Is this right that little endian processors read the memory addresses from highest to the lowest address and where as a big endian processors suppose to read them from lowest to the highest address? The confusion came when I thought that is it true that little endian pr...
Question What is a good way to go about visualizing a complex software application? Are recommended software applications that can be used for this purpose? Background About 3 years ago, I started building a web data mining application. Started out as just me, but has since grown into a project with 5 developers. I us...
I have loops like this: for(int i = 0; i < n; i++) { for(int j = 0; j < i; j++) { sum += 1; } } It's O(n * ), but I'm not sure what the j < i loop is. I have some tests that I ran, n = 10, runs = 45 n = 20, runs = 190 n = 40, runs = 780 n = 80, runs = 3160 n = 10, runs = 12720 It seems to be conv...
Are the IETF BCP 47 language tags defined as enums anywhere in JDK? For Locale.forLanguageTag() we pass values like fr-FR, jp-JP etc. Are there any enums already provided by JDK for it? Or should the developer be writing a custom enum for that? How to handle it in i18n application?
I am currently learning Scala and I find a mental blog of how to proceed to a degree where I can use Scala daily beyond the normal examples. I just do not have a particular project in mind of what I can do. This is not really Scala specific in mind, just generally how do you get yourself proficient in a language via se...
I'm drawing a communication diagram for an application where you can buy books. I'm using domain-driven design and have a 'shop' object, a 'cart' object, and a 'book' object. My first communication diagram, for when the user first comes to the site, is straightforward. I generate all HTML (to show all books and an empt...
I am working on an integration project, where my “app/web service” will sit in the middle serving documents. Basically, a request is sent with the document id as part of the query string, I check if it exists and if it does, write the document (pdf) back to the response. Now, this is very simple to do and we have done...
I have a question regarding dynamic initialization. Example code void main() { int a = 100; //Statement1 //Statement2 ... float b = 6.32987; //StatementA ... return; } The StatementA allocates memory at the middle execution of program. How does process takes place and where does space gets allocated for variable b (s...
Short introduction to this question. I have used now TDD and lately BDD for over one year now. I use techniques like mocking to make writing my tests more efficiently. Lately I have started a personal project to write a little money management program for myself. Since I had no legacy code it was the perfect project t...
What is the preferred way to document the contents of and logic behind dynamically generated data structures in Python? E.g. a dict which contains the mapping of a string to a list of lists of strings? I find it hard to transport the meaning and algorithmic workings of the data elements through Python code alone. It ...
I am looking for description (name of algorithm, code, pseudocode, etc.) that can help me frame this problem and find the appropriate recursion and the most efficient solution. Problem: Given a graph with weighted nodes and a starting node, I want to generate a weight-ordered list of nodes that are lying on a path tha...
Recently I made a program. I forget to delete 2 line of codes. That mistake cost me $800 per day every day. I was programming with PHP. If a visitor uses proxy it redirect somewhere else. Using debugger was impossible because some code contains ioncube. Because the program simply redirect somewhere else no matter what,...
I am creating Rubik's cube solver. It will be good if solver could solve cubes of any size and if it could generate short solutions. I have found many various information about God's algorithm, which as I understand is able to solve various puzzles, not only Rubic's cube. So I want to implement God's algorithm, but I c...
During my short experience with DDD I often find myself in the situation where I wished for some type of lazy loading mechanism to solve some dangerous cases where large nested data sets might be loaded. However after a while I realized that each time, that was the symptom of a poorly designed aggregate root that was ...
Let's say in some reason all objects are created this way $obj = CLASS::getInstance(). Then we inject dependencies using setters and perform starting initialization using $obj->initInstance(); Are there any real troubles or situations, which can't be solved, if we won't use constructors at all? P.s. the reason to creat...
I am trying to come up with a way to wrap a very large web service that changes very frequently. There are 400+ types and each type has 20 to 300 attributes. The service is a SalesForce.com Enterprise API. Typically in this scenario I would create a corresponding domain model and interfaces and use AutoMapper or simila...
I am working (alone) on an application that is a music portal where you can search for artists, songs etc ... The C# solution consists of: a class library that contains all the stuff to access the web service the application itself I've recently started using Git and figured out the benefits it does provide to a proj...
I'm trying to understand the theory behind a lexer with the purpose of building one (just for my own fun and experience and to compensate for not taking proper CS courses :)). What I have yet to understand is if lexer theory is the same no matter what language you are analyzing? Is it just about splitting white space ...
I was wondering if there was an SDLC (software development lifecycle) or methodology (Kanban, SCRUM, waterfall, otherwise, etc.) that was particularly well-suited for continuous delivery systems, and why? I'm sure each methodology has pros/cons that make it suited for certain components of CD, but there must be one tha...
I am having a discussion with my co-worker on how much work a constructor can do. I have a class, B that internally requires another object A. Object A is one of a few members that class B needs to do its job. All of its public methods depends on the internal object A. Information about object A is stored in the DB so ...
I have some code, which I want to present in UML, but I've stuck at one point. Let me tell you something about code's functionality. I have a workspace in which I can place some Components, select them, delete, add new, move etc. I can also connect them according to some rules (there are different types of Components ...
Sellers on large sites like Amazon and Newegg need to provide names, descriptions, and images for their products to be displayed on the e-commerce sites. These sellers could have 10000+ products to sell, each with their own unique name/descriptions/images. I can't imagine that e-commerce sites would have their sellers ...
I have a user interface with numerous controls and data inputs on it. Buttons, text fields, and checkboxes, etc. Imagine the following "rules" exist for a sample UI with 2 of those controls: B2 cannot be used until TF1 and TF2 both have values TF2 cannot be entered until TF1 has a value CB2 cannot be checked unless TF...
I was recently considering that sometimes several objects depend on each other (e.g. if they contain cyclic references) and therefore it would be useful to create them as part of one atomic operation that makes sure that, after construction, the new objects fulfil some collective constraint. In order to do this one cou...
There appears to be widespread agreement in the OOP community that the class constructor should not leave an object partly or even fully uninitialized. What do I mean by "initialization"? Roughly speaking, the atomic process that brings a newly created object into a state where all of its class invariants hold. It sh...
I'm trying to build a Firefox add-on which lets you create executable files which can be associated with a default program or added to the "Open With" list and possess its own icon. I was hoping to avoid having the add-on compile files into exes, but... It does not seem batch files can have their own icons. Although o...
Here is the typical sequence of events when someone navigates to a page in my application: The user navigates to my application, including URL parameters and query strings. The server receives the request and generates the HTML On the client, AngularJS grabs any parameters and makes an AJAX call The resulting data is ...
I want to have the home page (root of the website), check if a cookie exists for a user being logged in, and then based off of that determining whether or not to load the sign up page (landing page) or the feed of the user logged in. Where would I have this check occur? I've kept it in the controller for now, but based...
Application server - JBoss AS 7.1.1 JDK6 J2EE 1.3 My web application is more than 10 years old and facing this session swap problem in my portal. Noticed that swap happens mostly when many concurrent users accessing the portal and underlying windows server is busy (more than 90% CPU usage) To analyse this issue, I lo...
I have started to see variable initialisations like that in Java libraries: Class clazz = new Class(); or Class klass = new Class(); Is there a particular reason for people to misspell the word "class" when declaring these variables, and to use a "kool boyz" sort of writing style? Also what is wrong with using someth...
I've got two functions at the moment: suspendGroupsAndUsers($groupId){} enableGroupsAndUsers($groupId) {} But the difference between the two is one variable/string. Should I just have: setStatusGroupsAndUsers($status,$groupID) {} This feels more DRY... Or have the above two functions actually call the setStatus fun...
Say you want to render a table with five columns, but you want the order of the columns to be different depending on some specific parameter. This would be very easy to accomplish if the model sets the order. The view can then simply use a loop and create the table accordingly. However, unless I have misunderstood thi...
I've read Where are octals useful? and it seems like octals are something that were once upon a time useful. Many languages treat numbers preceding with a 0 as octal, so the literal 010 is actually 8. A few among these is JavaScript, Python (2.7), and Ruby. But I don't really see why these languages need octal, especia...
Actually, I already have at least 3 different solutions for the problem, I just don't like any of them for various reasons. In ASP.NET MVC/Razor, there are no controls anymore, in the sense as they were in ASP.NET. An ASCX control used to be view+controller intertwined, so I get it. Instead we have html helpers that em...
I have a problem about the calculation of shortest paths on an unweighted and undirected graph. Which algorithm I use to calculate the shortest path between a node A and node B that passing through a node C on an undirected and unweighted graph?
As a "new" programmer (I first wrote a line of code in 2009), I've noticed it's relatively easy to create a program that exhibits quite complex elements today with things like .NET framework for example. Creating a visual interface, or sorting a list can be done with very few commands now. When I was learning to progra...
The problem I've written a application for Android licensed under GPLv3 which needs to use Google Play Services, a proprietary library, as a plugin to the app. Now I'd also like to add libspotify as a plugin. For all of the proprietary libraries used I'm providing alternative open source plugins but they are not as goo...
I'm looking to see if there is a design pattern that can solve the following problem. The example is fairly specific but the goal is a public + internal API. I need specific information for my underlying library but I want to present the API generically. If my question is vague or terrible I'll try and spruce it up ...
I'm working on a project in which we are trying to apply both domain-driven design and REST to a service-oriented architecture. We aren't worrying about 100% REST compliance; it would probably be better to say we are trying to build resource-oriented HTTP APIs (~Level 2 of Richardson's REST maturity model). Nevertheles...
I have searched around and I can't find any particular answer that addresses what I am asking but no doubt it will have been mentioned already somewhere. I know that when you inherit from an abstract System.Web.Security.RoleProvider you override this method public abstract string[] GetRolesForUser(string username); and...
A little background: I am working at a large company, using Windows XP and coding Winforms in VB6/VB.Net and some WebForms in VB.Net (95% maintenance code). I have one 4:3 19" screen. A more modern version of Windows isn't happening soon, neither is any greenfield work by the sounds of it! I wasn't told about any of th...
Have very recently started a new position. One of my key challenges is a C# WinForms application (let's call it AppX) that causes a lot of non-planned work. The main reason for this is that it needs to be deployed to several hundred branch offices. Currently, this is done via GP update or bespoke application. Both of ...
I have an api only application (rails-api) and I'm looking to authorize a user on both email/password or 3rd party services like facebook or twitter etc, so I know I will have to use Oauth at some point. My question is, can I solely use Oauth, or do I have to implement my own authentication (or something like Devise) t...
When using mindmaps, you order them based on how you think it fits best. So for instance (tab means subtree) requirements dinner food forks spoons breakfast food forks this could be written using food at dinner breakfast forks at dinner breakfast spoons at dinner What...
I understand that a software engineers job is to work with all aspects of developing and supporting a software system. How does a project manager fit/work with a software engineer in a small team (5 or less) environment?
Is it ok to just use git only locally? I don't want to have to pay for a service that provides private repositories (such as Github) but I think git is a great way to organize my closed-source project.
I am a lecturer for a post-graduate module where I expect my students to write Python code that replicates examples from the textbook. The project has been running for a couple of years and this year I want to introduce more automated testing. The problem is writing tests for the functions which primarily produce a mat...
My question might sound stupid and not suitable for this site, but i dont have any better place to ask then here, so please bear with me. Im a college student that love playing with android. Around last year, i changed my main OS to Ubuntu, and i found its amazing. So, i decided that i want to help developing open-sour...
For prevent email conflicts for authentication system we can surely choose email and password combination as unique identifier. What can prevent me to built authentication system by treating unique identifier as combination of email and password ? What is wrong with this design ?
I am currently planning my first eCommerce application (mySQL & Laravel Framework). I have various products, which all have different attributes. Describing products very simply, Some will have a manufacturer, some will not, some will have a diameter, others will have a width, height, depth and others will have a volum...
The Microsoft Reciprocal License (here taken from the WIX toolset I use) has the following sentence: For any file you distribute that contains code from the software (in source code or binary format), you must provide recipients the source code to that file along with a copy of this license Does that mean I have to p...
Is there a common and accepted term for the manual tests done by programmers or users on software in lieu of or in addition to automated testing? For example, in a progression as follows: "Desk Test" for the non-automated testing a programmer does while writing code. "Unit Test" for an automated test for a particular...
We've started working on a mobile app using Xamarin. There's a core library that is to be shared among Android and iOS apps. In the core library there will be several functions for communicating with a web service. I've had a discussion with my brother on what the best approach would be, we both have a different opinio...
In the Permissive Field of View algorithm, a destination square is visible from a source square if any unobstructed line can be drawn from the source square to the destination square. The algorithm works by defining a series of view fields (essentially, triangles) and checking if the destination square exists inside of...
I have a good grasp on how the C compiler was bootstrapped from itself and how that must have been very efficient, since the first pre-bootstrapping version was written in assembler, which is as low level as you can get. BUT today we have a very different situation, with languages first written on other relatively high...
If I have an array that has more info than I need and I want to pull out a subset of its name value pairs I have come up with 2 methods. Both rely on this: $detailkeys=array(title,summary,subtitle,url,imgsrc,description); The method I came up with on my own: foreach ($detailkeys as $keyname) { $details[$keynam...
My team uses Mercurial for version control. Our development / version control routine is: all been committing to the same branch pulling for changes and rebasing our commits locally before pushing back to the hosted repository This keeps everyone in sync. And the latest code (even unfinished code) is than grabbed fr...
Our team of 12 is currently considering implementing a style guide. The question came up if long term productivity benefits outweigh the short term productivity loss as everyone adapts. What has been your experience with style guides? I should also note our code base is rather large and we'll probably have to run our c...
For one of my project ideas, I want to create a dice rolling app. It would allow people to setup somewhat complex combinations of dice roll cascades in a visual way. I have a pretty good idea on how I would program the logic for the dice, namely as if you're creating a math formula; Class: Formula Properties: Left f...
I have a business requirement for a javascript "write once run everywhere" App. I did research and discovered that there are a few options between: FireFox OS, ChromeOS, NodeOS, Tizen, and Dart. What I do not know - is if 1) this software is truly capable of allowing a single website to be written once and exported to ...
I've built an MVC web application and I need to run several tasks at different time intervals. So I've also made a console application to schedule these tasks through task manager in windows. For example, the application needs to send out an email every week summarizing the program's data. I've chosen to use the Nuget ...
I am building an app using MVC 4/Razor and EF 4/ .NET 4 in which it is possible to search items by zip code and thus retrieving items only a certain distance from your current zip code. I have a class that calculates distance using census gazetteer files (zip, lat, and lon) and the Haversine formula. My specific proble...
Say you're running a website which generates a large number of tasks that should be run at particular times (e.g. reminder emails). You could run a cron which SELECTs a database table for unprocessed events before the current time (or even a long running process that polls the table), but this seems messy. On the other...
I have been asked to write an application (visual application) that can be run both online and locally. This application contains a lot of external data (video, images and audio) files so the main issue I have is deploying this over the web. I want to architect this so that I only have to write 1 system and not a separ...
I am talking based on experience with Java and C#. I do not know if other language have different exception handling implementation. In order to achieve loose coupling, we need our code being programmed to use abstraction rather than implementation. However the exception handling case is the opposite. The best practice...