instruction stringlengths 34 19.9k |
|---|
We make iOS apps where we often get data in a list from an API, then we select the data and go to the next ViewController.
Often it happens that the server is down or some API is not ready.
What is a good development practice where we can continue our regular work flow without depending on the webservice and then when ... |
It is popular to write documentation in the same file as the code and extract that using software to generate documents. In order to not affect performance, the documentation is written within commented lines, in a DSL designed just for the purpose of that. And that often results in cumbersome source file.
Nowadays, te... |
For the last 3 sprints or so, I've observed our Product Owner suddenly shoving new stories -- stories not previously in the Product Backlog -- at the top of the Product Backlog.
Because of this, the existing items in the backlog never get worked on. New stories continuously take over the helm and make into our Sprint ... |
I am not sure if this is the place to ask the following conceptual question (Stackoverflow is definitely not).
I saw this question in a multiple choice exam (single answer), similar to the ISTQB exams:
Why it is not recommended to report several defects in the same issue
/ ticket ?
a. In order to keep the report con... |
I was trying to find the sum of divisors of numbers upto 106. The test cases are like of the order of 105. I have done some pre processing like
int divisors(int num)
{
int sum=0;
for(int i=1; i*i<=num; i++)
sum += (num%i)? 0 : ((i*i==num)? i : i+num/i);
return sum;
}
Is there any better method to ... |
I am developing an application which must run on up to thousands of client systems that I control (Linux) which are connected behind common NAT devices to public Internet. Each of these client devices must receive infrequent messages from a cloud service (1 or 2 per day) and on average, must receive these messages in ... |
It is easy to find questions asking if one should start with python 2 or python 3, and it is a consensus that python 2 is the way to go as it is has more libraries and thus better supported.
Python 3 was launched back on 2008 and this question already addressed a migration. As it was too soon, the solution was to wait.... |
For example I've got following code:
auto z = [](int x) -> int {
if (x > 0) {
switch (x) {
case 2: return 5;
case 3: return 6;
default: return 1;
}
}
return 0;
};
And later I call this several times. In asm code I see external calls with lambd... |
While examining alternatives to Exim/Dovecot for a dedicated mail server, I came across the lamson project, a python-based MTA. I also found the following fork of the project:
https://github.com/moggers87/salmon
Quoting from the docs at the fork:
Salmon is a fork of Lamson. In the summer of 2012 (2012-07-13 to be
e... |
Let's say I have a company that ranks the cutest cats on the internet.
I offer a resource at /cats/ which provides users with the latest, cutest adorable cats.
Users can either get just the top 3 cats if they haven't paid at all or registered. The top 10 cats if they paid 337 dollars and are logged in, and the top 100 ... |
Most modern languages make a heavy use of pointers / references: a typical OOP language uses VMT lookups, a typical functional language builds key data structures out of pointers, etc. Even typical C code often sports things like foo->bar->baz.
It is well-known that dereferencing a pointer is cache-unfriendly, unless t... |
I have been trying to get some architecture documentation passed at work. I've spoken to my CIO and he has said to me that if I prove to him that if we stay within MOF then we can implement it. I am not an architect, I am a software developer trying to become an architect.
I downloaded the MOF documentation and did so... |
If a compiler's work is essentially translating source code into machine level code, can there be any glitch in a compiler, i.e. a faulty "translation?"
The same goes for an interpreter: can it fail to output the required content sometimes?
I have not heard of any bugs in compilers/interpreters, but do they exist?
|
I currently have a number of classes (~20) that all do the same thing (abstractly), namely, generate an instance of a particular class from an xml file.
The way that they use the content of the xml file varies quite a bit, and the data gets stored into different substructures (fields, groups, etc) that are shared acros... |
Say your users can create their own web-based forms (textboxes, selects, etc) and publish them on the web for their users to fill out.
Does anyone have a resource or any advice on how to architect the database to tie into the dynamic forms?
For example, would you create a child table for each form, or different ver... |
I am under the impression that an encrypted string cannot be decrypted so the original value is lost forever.
However, if the following string always equals "dominic" (my name), then can't there be some logical way to reverse it; being as it's not random nor is it based on the date/time, but there is a logical method... |
Suppose you have a NodeJS application.
A release could consists of multiple steps:
Automated and/or manual tests
Deployment
(if something goes wrong) Rollback to the last stable version
There are some desirable requirements regarding the application's dependencies:
When you have done your testing, you want to deplo... |
I am a Product Manager, under me I have about 10 developers, UX designers and marketers. Marketers research about the demands of features, UX designers providing UI mockups, and develkopers write code.
Now, we want to do our feature development monthly meeting (sprint) in a more structured manner ( previously, feature ... |
What should we do if a item in scrum takes longer then expected? i am asking this because i have been noticing items that developers is struggling to complete as it is much tougher then initially thought.
In such situation should we
remove the item from sprint back to product catalog so that we can
meet the sprint ti... |
Should I add an external id for every table?
For example if I have these tables :
Customer
=======================================
Id Name Gender
---------------------------------------
1 John M
2 Doe M
---------------------------------------
CustomerPurchase
======================... |
I am building an MVC application in PHP, using Zend Framework.
My model includes Domain Model and Mapper layers. I am trying to keep the domain model in pristine condition and have managed to keep it free from persistence-related code. Now I am trying to find a solution for ACL.
I have 'general' ACL rules that can be... |
When creating a new file format for an application, you can write the code or the documentation first.
When writing the documentation first, you have a better idea of what you should implement.
However, you might need to change a lot of the documentation you have written afterwards when writing the code, because you ma... |
I have a unique problem which I'm hoping someone can assist with.
I have One big text file, our Production file. The data in the file is delimited in the following format
Reference|Cost Centre|Analytics Base Value|....
UMBY_2288|023437|2883484|...
NOT_REAL|1343534|283434|...
The average size of this file is about 30... |
I'm wondering what you call an applications that are not hard coded around any database structure?
Let me give a small example:
I have one application where the views, the controllers and the model are tailored to the information and fields in the model, and thus the database.
I have a second (theoretical) applicatio... |
Bit of a rant, but bear with me.
People call me purist. I do not code in any way other than TDD. When I try to push TDD as a company policy, the following conversation:
company owner: "we'll do TDD when the project warrants it"
me: "if you can't do TDD on even small/simple projects, you won't suddenly know how to do it... |
I have seen on a number of resumes the term "virtualization." While every resume is unique, what does the broader term or skill of "virtualization" mean or imply?
I feel that the ability to install virtual machines is not the only thing that this means. I have installed VMs and in my experience it was mostly followi... |
Question: Is there value in denoting a key as "Primary"?
This question is not about the definition of a primary key. It is not about the fact primary's aren't nullable. It is not about implementations such as MySQL which automatically perform clustered index voodoo behind the scenes on primary keys.
NOTE: The question ... |
To test a method that returns a clone of the object it is called on, i need to re-run the test suite on the newly created object if i am to ensure that full functionality is retained, i found my instinct was to clone the object then call all other test methods in sequence i order to reduce code duplication. However tha... |
I ask this question out of curiosity.
Lets say the class Foo is a singleton and I want to call Foo instead of Foo.Instance to access the static object.
Would it be possible to encapsulate the object itself within a dynamic property?
Would C# allow me to create a dynamic property that refers to anything but a property... |
For this case let's assume something like... "removedNonPriceChangingConfermations" that is in no way relating to things that happened in the past tense, nor does it return a list of removed items (which you would never need in this context).
If you can't spot the other thing wrong with it, I challenge you to a high-st... |
I know the concept of register variable and it's use cases but there are few questions in my mind based on what I have tried.
I cannot access the address of a register variable in C though I can do it C++! Why? Is there any issue in accessing the addressing of a register variable?
Suppose if I declare a string variab... |
I have an embedded Linux C application that runs with a simple CLI. I am now tasked with creating a GUI that accomplishes the same functionality as the command line program. I am not an accomplished GUI designer and the majority if my experience is in deeply embedded C coding.
My initial thought is to use qtcreator to... |
I have method like this:
methodA(someParams)
{
do some initializations,etc;
call methodB(someParams);
}
methodB(someParams)
{
do work;
if blah then raise exception::FileNotFound
if blahblah then raise exception::ResourceNotFound
}
When I am adding documentation for methodB, I am also documenting the excepti... |
Assume that we are developing a web application, and Hudson does typical jobs such as compile, unit test and static code analysis.
But the tricky part is: Hudson deploys and starts up application server to do integration tests, once the previous jobs done.
That means some difficult things, such as database connection,... |
As a C++ developer from the 90s during the great OOP wars, I put high value to OOP as a basis for hiring new C# developers into the company.
However, there are plenty of frameworks today like ASP.NET MVC that handles most of the OOP heavy lifting. Programmers without deep knowledge of OOP can just as easily follow the ... |
Say I got a minimal use case such as "view home page" or "view banner ad". Should it be included or exluded in the use case actually following the link? What I mean is that whether it belongs to the use case "view page 1" if a report is that "The link from page 1 to page 2 is not working" in the common case of a "link ... |
I have made a program in Javascript and HTML5 canvas and I am wondering what happens when you draw a shape on a certain location of canvas then draw another shape on top of that same object. Does it consume more memory because I am drawing new object on top of each others? (Currently, rendering process of my program is... |
I have always heard that linear search is a naive approach and binary search is better than it in performance due to better asymptotic complexity. But I never understood why is it better than linear search when sorting is required before binary search?
Linear search is O(n) and binary search is O(log n). That seems to ... |
class myClass
{
int age;
public int Age
{
get{return age;}
set{age = value;}
}
Versus
class myClass
{
public int Age{get; set;}
}
What's the difference between these two? Are they both the same?
|
I'm used to delimit statements by a semicolon from Java, so naturally I do it in Scala code too. I also feel that the code is easier to read, because it's evident where one statement ends and another begins. But many times when I post a piece of Scala code on SO, the code gets edited just to get semicolons removed.
Sh... |
I suspect I've made a schoolboy error here, and am looking for clarification. A lot of the classes in my solution (C#) - dare I say the majority - I've ended up writing a corresponding interface for. E.g. an "ICalculator" interface and a "Calculator" class that implements it, even though I'm never likely to replace tha... |
I have my first programming job interview today (in a few hours!) and would like some advice.
The job title is Trainee Programmer and it is for a secure printing company.
I have found a lot on the internet about programming interviews, but since this is a Trainee role I have no idea what to expect.
I know that the com... |
If I have a variable containing a List it could contain objects of a lot of different types e.g. ArrayList or LinkedList. The difference between a LinkedList and an ArrayList is pretty big. The big O behavior of the methods differs greatly. For example sorting the List and then using it to do binary searches is perfect... |
It's known 2-way Merge sort takes N*logN time.
I wonder, what would be the running time if we split an array of the size N into N subarrays and then do the same thing as we would do for 2-way Merge?
|
I have a web-application with an async HTTP backend, which gets called by the client by AJAX requests. The client has to start a job and then polls for the result.
I started with a simple 150ms polling interval, which was fine for small jobs, but big jobs, which could take several minutes, threw many failed requests to... |
I want to build a website that will contain a lot of images. I don't want users who visit the website to be able to save the images.
I have blocked the right click option, but is there any other way to keep users from saving the images?
|
Here's the scenario...
I have a web site that has a generic handler written in asp.net (.ashx file) that accepts http requests, gets relevant data, converts the result into xml and then passes that back via the response.
This will eventually be used so that a windows application can make data requests to this web site.... |
My web application will use AJAX calls often and so I have set up some JavaScript to handle "messages" or "responses". These responses are returned (from my ASP.NET application) as JSON objects that act as feedback once a function is complete.
Suppose my responses have three basic elements.
Type (error, warning, info,... |
I've met the criterion of good system desing as its stability relative to requirements change.
Small req. changes should raise small changes in design.
Yet I have gut feeling that almost for any somewhat complex software system it's possible to state the set of small changes in requirements which causes unacceptable am... |
Background
I have this tables
+-------------------------+ +------------------------+
|Airport | |Country |
|-------------------------| |------------------------|
|airport_code string (PK) | |country_code string (PK)|
|address string | |name string |
|name str... |
When a program doesn't compile, error messages are sometimes esoteric. Often a simple Google search leading to a site like stack exchange solves the problem. Now why can't we automate this?
How about a Siri for coding? By Siri, I mean an intelligent personal assistant. Not talking about speech recognition here.
I wond... |
I'm facing a choice of whether to start building Haskell components for a certain production app that is all done in Ruby.
I'm leaning toward Haskell for several reasons, primarily speed (compiled Haskell is like 4-8x faster), greater transparency (via Haskell type system), and safer refactorability (type system). I'v... |
I'm programming a windows phone 7 app which needs authentication for news-like read access.
I use Application.UnhandledException to handle (my) AuthFailedException, which can be thrown from any page, and navigate to a login page.
To mimic a modal dialog, I do the following:
I attach a BackKeyPress event handler to cl... |
I have a (browser based) web application. On each page, I want to have a little label and link in a corner that displays the user's username and other account information along with a logout button. The information that will be displayed is immutable.
Should I store that account information in session attributes when a... |
If you have to pay the price of performance to make code more readable would you prefer that or you would always prefer performance over it?
|
We are about 40 developers working on the same code base and we use Git for version control.
My question is: can there be problems if, for example, some developers have a much older version of Git installed on their system ? Or should we try to enforce some rule that says something like "you should upgrade Git on your ... |
Hypothetical scenario: codebase is exercised by unit tests run by a TeamCity build-bot, that also uses the built-in dotCover tool to provide coverage metrics. The build will fail if less than X% of the code is covered.
Unscrupulous developer running NCrunch (or a pre-tested commit in TC) sees that his next checkin will... |
I was asked about how to run a suite of 65.000.000.000 tests and I wonder if it is normal to have a project with such a huge amount of tests.
Have you worked in projects with this characteristic?
|
Mention the pros and cons of UIBinder in GWT.
I want to develop a big project. Is it flexible to use UIBinder for my project?
|
I am designing an application that interacts with a RESTful API.
When returning error messages like Unable to sign up user
Should the error message be generated by the app? or by the API? I am looking for best practices.
|
I have multiple functions and a lot of code inside $(document).ready(function()). I am using jasmine to test the functions inside the ready function as well as the code inside ready() but when the test cases inside describe are executed it is not able to access the code inside the ready function.
$(document).ready(func... |
Often in a table that has no natural key, it is still useful for users to be able to have a uniquely generated identifier. If the table has a surrogate primary key (and in such a case you would certainly expect it to) should that key be exposed to the user or should another field be used for that purpose?
One reason n... |
Here's a *hypothetical* issue.
There is a performance issue in the current release. Its difficult to find the cause of this issue because the performance tests haven't been run in roughly 10+ releases (with anywhere from 10 - 100 changes per release). My idea is to automate the process of running the performance te... |
I was asked this question in an interview. For eg: UITableviewDelegate protocol has CellForRowAtIndexpath. Why make it a delegate method in a protocol not a method in the UITableView class and call it directly?
|
I'm currently examining the possibilities and implications of linking against a GPL library for an application in a commercial context.
From what I've understood of the GPL, as long as the application is used internally there is no obligation to release its code (even if a copy is moved to a controlled subsidiary).
Wha... |
Someone asked me this. The answer he gave was HTML5 in UIWebView can cache the app data so it can run offline. I thought the same thing can be achieved using safari add to home screen, no?
|
Given a file > 5Gb, simply with lines like Apache's access.log.
I need to get number of lines.
Any constructions like
file(filename).read().counter('\n')
would read all of the file and it would take a very long time.
On the other hand, e.g.
os.stat(filename).st_size
works very fast.
It is possible to get at least an ... |
I am working on creating a new data processing system, where there are multiple steps each fulfilled by different services. For example, there is a scheduling service that kicks of something, an analysis service that does the processing, and a notification service that summarizes and emails out results. Data flows thro... |
Consider the following scenario:
I am writing a Dispatcher Servlet that delegates processing to various handlers depending on the request URL; the handler objects having previously registered themselves for URL patterns, pretty much as Servlets register themselves in web.xml.
When a Handler registers or unregisters its... |
Applications and operating systems have a ton of windows and controls, sub windows and sub controls. I've noticed its common to have sub controls have their coordinate systems reset to start at 0 making drawing much easier. However I'm not sure how that is done and how I'd be able to do that.
I'm going to be creating a... |
About a year or so ago, I forked a project licensed under Apache 2.0 and made extensive changes and additions to the code, a good portion of which I contributed back freely to the community.
Recently, the code moderator changed the licensing to LGPLv3, and I wanted to find out if I was correct in my belief that this l... |
I am working on a C# console application that loads the data from a third party and bulk inserts into tables. Basically the code consists of a static method with logging statements. In these scenarios, how does one write the unit test cases?
Example code
void Main(string[] args)
{
// for loop here to read config fr... |
Mushroom cultivation requires fairly precise chemical composition of substrate (a.k.a. growing medium). Let's pretend we're growing shitakes and that this is the required composition of their substrate:
Nitrogen | Benzene | Toluene | Dioxygen Diflouride
5% | 5% | 10% | 80%
We want to create an appropria... |
There seems to be divided opinion on this subject, and I wanted to get people's insights on whether they've found using underscore prefixes and suffixes to be helpful with coding or not.
You know, code like this:
class MyClass
{
private int _someInteger; // some advocate local vars prefixed with underscore
privat... |
I have a class that will end up having more than ~30 methods. They all make sense to be part of the same class because they require access to the same data.
However, does it make any sense to split up a large class into several smaller abstract classes (by functionality, type, use, etc.) and have the main class extend ... |
As far as I know, Apache Solr Lucene project is a web-app which is used for rich text searching.
I just wanted to know:
Why can't I use MySQL for that and just for rich text searching, why we use Solr?
When all the other things can be performed using any DB ?
|
I am an objective-c/iOS apps developer and I was wondering if I perform Unit Tests on my code, how should I go about it?
What is unit test anyway? Ain't I testing a specific part of code while running the whole app itself?
What is its use?
I have read few articles, wikipedia etc. but I am not sure whether unit testing ... |
I have three questions about REST API design that I'm hoping someone can shed some light on. I've searched relentlessly for many hours but haven't found answers to my questions anywhere (maybe I just don't know what to search for?).
Question 1
My first question has to do with actions/RPC. I've been developing a REST AP... |
Where I work we recently switched the Agile development using Scrum. We went through the typical growing pains but have reached an approach that seems to work for now (whether it'll work in the long term is for another question!).
Obviously, the department management is happy the transition to Scrum is working. But t... |
I was going through the analysis of quicksort in Sedgewick's Algorithms book. He creates the following recurrence relation for number of compares in quicksort while sorting an array of N distinct items.
I am having a tough time understanding this... I know it takes 1/N probability for any element to become the pivot ... |
The concept
I'm programming an interface over pygame as a personal project, to make the creation of games easier for me.
So far I managed to design an architecture that behaves like this :
Objects are displayable components that can appear and move on the screen
Objects can have children objects
When an object display... |
Are there some best practices on the repository front, or some common newcomer-traps that I should avoid?
I have recently been reading about the benefits of repositories even for single-developer projects and, in addition, I am likely to start working with multiple other engineers in a short while but, how do I go from... |
From Real World OCaml (beta):
OCaml distinguishes between non-recursive definitions (using let) and
recursive definitions (using let rec) largely for technical reasons:
the type-inference algorithm needs to know when a set of function
definitions are mutually recursive, and for reasons that don't apply
to a pu... |
Would something like This program uses code written by Nathan2055 satisfy the requirements for the BSD license, or do I need to copy out the whole notice? I know it asks that the notice is kept intact, but if I'm only using one file of code it's a waste to have to copy the entire license into the main copyright file.
|
While getting my code reviewed here the issue of using the const keyword came up. I understand that it is used for implementing read-only behaviour on variables.
I am confused about what are the various situations when it can be useful.
Should it be used for the sake of clarity in function prototypes?
Should it be use... |
I have been working for a long time with PHP, and tried to be as good as possible on it (good coding practices, knowing how every request is handled from the start to the end, etc.), but now, for job reasons I have to start learning ASP.NET and C#.
I've read and tried to understand it's foundations, as ASP.NET is alway... |
Background
The "all-PK-must-be-surrogates" approach is not present in Codd's Relational Model or any SQL Standard (ANSI, ISO or other).
Canonical books seems to elude this restrictions too.
Oracle's own data dictionary scheme uses natural keys in some tables and surrogate keys in other tables. I mention this because th... |
We currently have 5 scrum teams that work off their own product backlog for the past year.
Each team works on their own dedicated system but underlying technology is the same .Net.
There has been a lot of discussion on moving to feature based teams working off a single backlog. The reason is one of our main systems ha... |
A basic calculator can perform a wide variety of operations. How does the claculator 'get' the concept of adding two numbers in the same way a human does? I dont think people that make claculators store every possible result of every possible addition on the chip before shipping it. Soemhow the chip needs to 'learn' ho... |
I need to write a server application that fetches mails from different mail servers/mailboxes and then needs to process/analyze these mails.
Traditionally, I would do this multi-threaded, launching a thread for fetching mails (or maybe one per mailbox) and then process the mails.
We are moving more and more to servers... |
I'm in the middle of a redesign on the part of my current project that deals with user permissions and authorization. I have an interface named IUserPermissions that encapsulates this information.
One part of a user's permissions are the Roles which they are a member of. I'm trying not to violate the Open/Closed Princi... |
Preface: My question does not exclusively pertain to Google and it doesn't exclusively pertain to iOS. I'm only using Google and iOS as examples because they are familiar to many. I could have just as easily used 'Company X', apps 'A', 'B', 'C', 'D', and 'E', and 'Android', but I wanted to keep my question rooted in th... |
A common operation in JavaScript is to replace an object method with a new one while still calling the original method. This is often done like this:
var originalMethod = obj.method;
obj.method = function(arg) {
// call original method
originalMethod.call(this, arg);
// do my stuff new stuff
}
I'd like to ... |
I was working with a query I wrote today had to change the code from the WHERE clause to use a IN(list of stuff) filter instead of using something like
item_desc = 'item 1'
OR item_desc = 'item 2'
OR item_desc = 'item 3'
OR item_desc = 'item 4'
The above ran for 15 minutes and returned nothing, yet the following gave ... |
This construction is considered wrong
unless
#..
else
#..
end
This is for the general reason of double-negative confusions. It translates to:
if not
#..
if not not
#..
end
We all agree this is confusing.
Is there any situation (include semantic) that the unless..else construction would be more appropriate?... |
This one's all over our codebase but I'm not sure I've ever heard a name put to it.
We have C# and Java (and Rails but we don't have to touch it very often) so I'll speak more generally. It's like the data concerns never get fully established until you're literally right in a view controller preparing to drop it on the... |
I need to do some text processing tasks with short XML fragments.
The section "details" shows an example... My solution is to use a tokenizer based on regular expresions, but it is not elegant and not uses any build-in function. The candidate build-in functions (that others indicates to me) are strtok and SimpleXML.
S... |
I have commit access on an open source project named Foo hosted on GitHub (there are many other committers if that is relevant). I would like to make a change via pull request so that someone else reviews it before it gets committed to the master branch of the Foo codebase.
To make this pull request, I can either make... |
I am working on a tool (Python, may or may not be important) that will allow a user to maintain a configuration file containing arbitrary shell and/or language code to be executed on particular events and intervals. The code will potentially involve multiple statements.
I understand there are potential behavioral and s... |
I am developing a project in C# and due to a design decision it is not possible to have a static class inherit another static class. But I have, in my opinion, a case where this would make sense.
I have a music player which is able to play music from many different music sources: local files, YouTube, SoundCloud, Jamen... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.