instruction stringlengths 34 19.9k |
|---|
Suppose I have a web app where sellers add their products and set them as available for sale. Then I show a list of products in my mobile app, where I get products via my REST API.
My problem: suppose two clients view the same product(and there's only 1 item available from the seller) and they make simultaneous order. ... |
I am making an Android application which reads several JSON files and inserts the read information into tables in my database.
For instance, there are three files:
countries.json
{
"countries": [
{
"name": "United States",
"org_ids": [
{
"id": 1... |
I previously asked this question about creating an algorithm for joining records from multiple databases, and since then, I have built a rudimentary version of it (which doesn't allow for inter database table associations to keep it simple for the moment), and now I am trying to test it. So far, I have tested doing joi... |
I have some concurrent key-value store implementations that are implemented with hash tables and search trees that I would like to compare. I would like to benchmark them with a real world application where several threads stresses the key-value stores.
I already have some micro-benchmark that stresses the key-value s... |
One thing I cannot find anywhere is: is this approach limited to non-critical software? Because in critical (or just when customer wants us to follow his rules) we have no freedom in testing and just follow the procedures.
Am I right?
|
I'm interested in what algorithms or rules I can programmatically implement to generate RGB or HSV colors for plotlines to keep them visually distinct from the neighbors.
I know that in professional mapmaking, there are algorithms or rules that make sure that no two adjacent countries on a map are the same color. I can... |
I am trying to improve my knowledge and ability with graphs and graph algorithms and have noticed something curious: as far as I can tell no "mainstream" language contains support for graphs in its standard library. Trees yes, graphs no. The only language that comes even remotely close is C++ with Boost (which isn't te... |
I'm developing a simple web application in node.js. Users can log in from any page in the application, so I handle authentication in the server's code and logic, and the application's server-side code checks to see if a couple session variables are set. If they are, the application continues with user-specific inform... |
I was looking for an answer to the question of what a DAO should return when a search ends up to be for an entity that does not exist.
There are some generic previous questions related to returning null, but I am looking for an answer specifically in the context of the DAO retrieve scenario.
To be clear, when I say N... |
We are building a Game Client and Server, our system is broken into four major projects: (Client and Server, Shared Interfaces, Source Art). In addition, both client and server have a set of libraries where we put shared code for client and server respectively. As you can imagine this leads to a lot of projects, I coun... |
So, we've got a guy who likes to write methods that take Objects as parameters, so they can be 'very flexible.' Then, internally, he either does direct casting, reflection or method overloading to handle the different types.
I feel like this is a bad practice, but I can't explain exactly why, except that it makes it mo... |
I've refactored a program to remove its dependency on an sql database by storing all the state in a memory model. However the manager liked the ability to easily inspect the domain state just by doing an sql join/filter on the database at any time; and he wishes to maintain some similar domain inspection ability. We ... |
I know that an app developed with PhoneGap is slower than a native one because at PhoneGap the whole code must be interpreted at runtime into a native one.
But could someone explain or has a good in-depth website which explains why a native app retrieves data (a picture or text) from a web ressource faster than an app ... |
Our specific situation is that we are creating an agreement between ourselves and another team for shared control or use of a PHP based web application that we have been building. We have a set of standards and conventions documented in our technical specs. However, I have been asked to define them in terms of an i... |
I am trying to design a table to store references to multiple tables as a "target" of the item in each row.
An example should clarify what I am trying to do:
Imagine you have 4 tables (images, videos, comments, likes)
with likes being similar to
CREATE TABLE `likes`
`target` int(11),
`user_id` int(11),
`created_at` tim... |
I'll admit it, I haven't yet mastered the language, but my experience with it tells me that Javascript is a highly flexible language, allowing prototypal inheritance, dynamic typing, functions as first class citizens and so many more cool stuff. I think such features bring some inconsistencies, but that's nothing new, ... |
I have a View Controller or a View that implements delegate and dataSource methods of UITableView.
These methods are not going to be used outside this class.
So is it a good idea to make the declaration of the UITableViewDataSource and UITableViewDelegate inside the .m file with a private category?
For example :
Instea... |
I have this personal rule to start all function/method names with a verb. My verb of choice for functions or methods that get a value based on some data structure or object is get. I'm wondering if that's a good idea.
The good thing about get is that it doesn't really say anything about how that value is being retrieve... |
I am about to begin writing a program in c# that will read Addresses from a source file create a Geocoding request, sent it to Google Maps API, get the response choose the coordinates from the xml and then store them in a database.
My question is what is the proper type of source file considering performance and easy i... |
I will be taking an advanced PHP UNiversal IT Test (UNITT) for a position I am applying for.
However, I am unfamiliar with the term 'unitt test'.
What is a unitt test and how would a company execute one?
If anyone is familiar with this, please let me know the best way to prepare
|
I have been learning UML and have a basic understanding now, but I keep seeing these sort of high level architecture diagrams. Here's one from Microsoft:
Source: A bad picture is worth a thousand long discussions.
Is this a UML diagram? Are there any rules to follow for creating these types of diagrams?
I would like t... |
I am a relatively new to the world of software development and I've used the Ruby on Rails framework to develop relatively simple applications before. I know that frameworks can be extremely useful in terms of getting applications up and running quite quickly.
However I also know about the well documented problems tha... |
I am creating an application that visually displays world regions, e.g. to place markers within an administrative region.
Does a dataset exist with geometrical or geographical (long/lat) descriptions of the world's current country borders (and possibly other administrative divisions)? Ideally the dataset would be in a... |
Why?
Depending on your source the Intel compiler is likely or most definitely the compiler generating the fastest executables for the x86 architecture (5 to 100 % execution time improvement).
Intel offers its compilers for Linux under a non-commercial license for free (I think I read it is free somewhere on their page:... |
Wonder if anyone could shed some light on this messaging construct:
The documentation says that messages appear btwn brackets [] and
that the msg target/object is on the left, whilst the msg itself (and any parameters) is on the right:
[msgTarget msg], e.g., [myArray insertObject:anObject atIndex:0]
OK, simple enough..... |
How do you deploy your website in Azure so that it looks exactly like when you run it in your localhost? This is a very simple website that I created following the ASP.NET MVC4 tutorials. However, I added a new background image and it doesn't show. Is there anything else I need to do to make sure all of my files are b... |
Here are reasons why one would want this:
1) We often don't use all the dlls but we force customers to install the entire .NET framework. It would be great to just deploy the dlls we need.
2) We often want to update our application and the framework but that sometimes requires a machine reboot because other applicatio... |
I've been looking att different web stacks, mainly rails and node.js. One thing that strikes me is that while rails is often used with a relational database Node.js seem to go hand in hand with Mongodb, judging by the blogosphere.
Is there a specific reason for this? I like the modularity of node but I'm also sceptical... |
At our company we have pretty large body of PrototypeJS based JavaScript code, which we are porting to jQuery for several reasons (not really important here). I'm trying to set up coding guidelines to make/keep things tidy during the porting.
One observation from wading through the prototype based implementation is tha... |
Say I have a web service with a method MyWebServiceMethod(string passedValue).
The web service calls a method MyServiceMethod(string passedValue) where the value from the web service is passed along.
The service calls a repository method MyRepositoryMethod(string passedValue) where again, the value from the service is ... |
Suppose I have component A,B,C that all put some data into a database. Each component depends on data in the database inserted by the previous component.
How do I test these modules in isolation? I already have tests at the unit level, but I now want to test with the database. I have seen suggestions to make a dump of ... |
For example, what happens if a coder tries to code in purely functional-style paradigm in OO-paradigm language(Java)? Will it work? Or the OO nature of Java will not let it happen?
Also, is applying wrong paradigm to language unfitting to it a bad practice or not?
Is it like trying to drive a jet on road instead of fly... |
I currently work in a company where the Waterfall model is deeply ingrained. We are pushing Agile principles but it's a long process. Meanwhile, I have to work in a Waterfall world with sequential projects phases.
My question is about the analysis phase. I must provide a list of task and how long they will take. What t... |
I am pretty new to Web Application programming and so to OOP Javascript and the new Client-Server interactions.
I am encountering some trouble wondering about how much AJAX I should use or how much data I have to save "locally" .
Explainig it better: at the moment , to manage the data that I obtain from AJAX request ... |
Quick background: In JavaScript, the constructor function for each object type has a prototype property. The prototype refers to an object that each constructed object uses as the next step up in its prototype chain. When you want one type to inherent from another type, you can set the prototype of the child type to a ... |
I am developing an application, which currently has about 150,000 lines of code. The previous developer didn't really use any discipline when writing code. Application is in production but is continually developed.
I have read Martin Fowler's book (Patterns of Enterprise Application Architecture) and it talks about 'T... |
Many applications do nothing to separate the interface from domain logic. I’ve been programming for a couple decades and have worked at more than a dozen shops and none of them have taken any measure of separating the interface from the domain logic. That is, they're all using the Autonomous View pattern. This runs... |
Why does 0 evaluate to false and any other integer value to true is most programming languages?
String comparison
First of all, it may seem evident to any programmer, but why wouldn't there be a programming language - there may actually be, but not any I used - where 0 evaluates to true and all the other integer values... |
I tried to find if there's a similar question but didn't even know what keywords should I use :)
I got a method in an interface accepting an other interface as a parameter:
bool CanDoIt(AnInterface subject)
One of the implementations needs to fulfill the requirement that the method should return false for all concrete... |
For some time in personal projects I have been using XSL to convert my raw XML data into human-friendly HTML/CSS (in simple projects, I have no JavaScript, so let's leave that out of the equation for simplicity).
Now I'm trying to understand the MVC architectural pattern (not my first experience with it, but it is taki... |
I was creating a language and discovered that my language tokenizer would have to change depending where in the parse it is.
I.e. abc[1] would be parsed as 4 tokens (abc, [, 1, ]), where as { abc[1] } would be parsed as 3 ({, abc[1], }).
Is a grammar that would change its tokenizer mid parse defined somewhere? Does a g... |
Context:
I'm working on a fairly large Access database (which I inherited) that has its interface and tables separated. In order to make this work together, we have a lot of SQL queries (dozens). Some pointing to that database and some pointing to our datamarts. The code at this moment is somewhere around 12k-14k lines... |
I've been trying to think outside of the box as to how desktop GUIs can be designed in code(not a graphical designer!). I've come across basically three ways this is done:
XML
Raw code (create a window, create a text box, add text box to window, etc)
HTML and friends
I'm sure that someone has done something other tha... |
Occassinally I have to write methods like this:
string GetReportOutputDirectoryAndMakeSureExist()
{
string path = Path.Combine ( ... ) //whatever logic
if(!Directory.Exists(path)) Directory.Create(path);
return path;
}
or
string GetAndVerifyExistenceOfReportConfigurationPath()
{
string path = Path.Com... |
Whenever the question comes up on which Agile tool to use use there always some people that answer "don't use an electronic tool because you will lose the big-visible-board advantage which better generate team conversation".
Is this always the case or are there any contexts where an electronic tool is a better choice? ... |
I have a class Base that has several children, say A, B, C. For testing purposes I'd like to mock those derived classes by deriving from them. So MockA derives from A, MockB derives from B and so on.
The problem is, that MockA, MockB, ... all inherit protected members from Base that have to be set in the same way in ea... |
I want to save some user-generated data with some signature of the user that generated it (let's say that the user has to fill some forms with some data and I want him to sign the written data).
The server side is some random server language (that has big enough libraries to cover everything I'll need to do), the clien... |
I've been facing a problem recently, in which I want to optimize two programs.
For that, I wanted to create some kind of "Common Interface" which I could reuse between my two programs.
However, the code of these are approximately 1000 lines, and I don't want to spend a big amount of time checking if this or that functi... |
Google has given a reason that All apps on iOS have to run in the sandbox environment except for special apps by apple that get to tap into some private APIs.
So Chrome on iOS uses whatever the UIWebView provides plus it might be doing its UI stuff and some external caching to add something extra to it.
But Why does G... |
The Apache License states:
"You must give any other recipients of the Work or Derivative Works a copy of this License;"
So if you've copied a bunch of functions from some Apache-licensed code (so it's not just linking, you've borrowed code) into a product that is not itself Apache-licensed, what's a good way to indicat... |
I am currently working on creating a toolkit for work and I've gotten to the point where I'm wondering about error reporting.
Basically all of my tools, which consist of a grouping of classes, will eventually be ran from a main method. Many of these tools will be doing operations on file like reading them in and con... |
I have to create a github-presence for an open-source organization. The aim is to distribute code snippets and reference implementations in different programming languages.
These contributions are going to be (ideally) created by people outside of the organization and should be collected.
I know that good practice is t... |
edit:
so clearly I didn't explain this well, so let me try again with examples. I have a 'pipe' of a given size with signals routed through it at given offsets. The pipe can get fragmented with signals in different offsets making it impossible to fit a new signal. I want an algorithm that will tell me how to arrange... |
I have created a windows form using visual studio design, that is simply drag n drop component into the form from Toolbox.
Is it possible to import it into Blend and change its appearence using Blend?
I opened the project from Blend but ony the code appears not the form itself.
Thanks in advance!
|
So I saw this video on Youtube with all these C++ masters on GoingNative 2012 : Interactive panel where everybody could ask the questions.
This is the video I was talking about: GoingNative 2012 - Day 1 - Interactive Panel: The importance of being native
And at time 0:24:00 someone put a very interesting question:
We'... |
After reading for what seems days on the specifics of GPLv3 and more specifically AGPLv3, I have one question as far as distributing and to whom.
If I create a web app (server and client) for a client. They pay me, I hand over all source and ownership. The web app is currently only accessible to employees and contracto... |
This extends off this other Q&A thread, but is going into details that are out of scope from the original question.
I am generating a parser that is to parse a context-sensitive grammar which can take in the following subset of symbols:
,, [, ], {, }, m/[a-zA-Z_][a-zA-Z_0-9]*/, m/[0-9]+/
The grammar can take in the fol... |
I often find myself returning a boolean from a method, that's used in multiple locations, in order to contain all the logic around that method in a single place. All the (internal) calling method needs to know is whether the operation was successful, or not.
I'm using Python but the question isn't necessarily specific ... |
I've been catching up with the modern client-side JS ecosystem and reading up on CommonJS and AMD (incl. associated tools - browserify, requirejs, onejs, jam, dozens of others). If I'm writing a Javascript library, how do I modularize/package it such that it can be most broadly accessible (ideally by users who swear b... |
We are a small team working on a web application using MVVM design pattern using technologies like .NET, Knockout and HTML. I am trying to come up with a code review checklist for this, so that my team can make use of it while coding as well as while reviewing. I tried to find in google, but no help there.
Can you guys... |
I am in a search of a better performant algorithm to implement a program, to find the count of each word in a sentence i.e.., a String in the programming sense.
I know my algorithm is too basic and Noob. Here's my algorithm.
Read the String.
Tokenize the String with the delimiter, put each token in a list(ArrayList)... |
I need help with coding something. I'm trying to design a system that will allow users to setup rules for the system to process (similar to email processing rules, in a way). When I receive a chunk of data (in this case, it is a object that has properties with values related to the client system's hostname, OS version,... |
I'm building a REST API. I don't want to have real folders in my directory structure, but I'm not quite sure what to use else. My REST API uses paths like this:
api.server.com/<object>/<action>[/]
Here, <object> is the object the action <action> should be performed on. For example, a URL api.server.com/user/create wou... |
The only way I could figure how to do it was create the schema on the localDB with code first and then manually change the database string to Azure and then run the code on Azure.. But that only gives me the schema and not the data..
Is there a better way like ? bacpac? Create a script instead? Or some other concept ... |
I have a database sanitizing function that I use when the user enters some data into my website. I escaping the mysqli characters with mysqli_real_escape_string(), but I wish to also output the content with htmlspecialchars(). The problem is, let's just say the user enters something with a single quote; that will be ... |
Many languages use the concept of an iterator. The c++ STL expands on this with input iterators, output iterators, forward, bidirectional, random access and others. As far as I know, these distinctions don't exist in other languages. In this talk the author of the STL, Alexander Stepanov, talks about iterators (among o... |
I have recently started learning the nuances of scalable and enterprise computer architecture, and one of the central components is a messaging queue. In order to learn the most I can from any programming paradigm, I am trying to implement my own version of a messaging queue service.
So far, my initial design runs on a... |
When doing unit tests the "proper" way, i.e. stubbing every public call and return preset values or mocks, I feel like I'm not actually testing anything. I'm literally looking at my code and creating examples based on the flow of logic through my public methods. And every time the implementation changes, I have to go a... |
I work for a small software development house (10~ developers, a few product managers and a few support staff) that sells various products and services to organisations internationally through resellers. I arrived in the job 7 months ago into a role opened up by a developer who left after 3 years. The company has maybe... |
So you've made some code changes that should hopefully speed up some part of an application. But there is just one problem - you don't know how it will perform in live.
Different networks, different machines, different memory, different configuration, different times of day, different users, different server loads etc ... |
How would you define Continuous Integration and what specific components does a CI server contain?
I want to explain to someone in the marketing department what Continuous Integration is. They understand Source control - i.e. they use Subversion. But I'd like to explain to them properly what CI is. The Wikipedia Articl... |
I was evaluating the various ways in which the big guys implement auto suggest. These are my observations.(Search string used was "ab") Questions towards the end.
Yahoo tries something like this, where the response was a JSONP. Response is readable and serves the purpose.
Yahoo's response
yasearch({"q":"ab ","gprid":"Y... |
I'm planning to build a eCommerce web application(similar to http://zovi.com/) using JSF 1.2 and node.js. All front end components will be jsf components binding to backing bean. I want to achieve real time functionality ( such as displaying Today's hot sellers ,Customers who viewed this item also viewed such patterns)... |
I was applying markdown comments in the xml comments of a config file when the XmlParser reported that two hyphens (--) are not allowed in xml comments.
Checking the XML Specification, it appears that xml comment isn't designed to contain two hyphens for compatibility reasons with SGML parsers.
Why do SGML parsers disa... |
I've seen some projects that - with each new year - start to change all files in their source-tree to update the copyright year.
Isn't this just pushing hot air on a level of magnitude? AFAIK:
Copyright year is based on relevant changes of a work (also) - not only because of a trivial change of the copyright year in a... |
I'm about to start working on a new commercial PHP project with a friend that will be licensed and sold as a script to run on your own shared hosting account or server.
Looking at the statistics (http://w3techs.com/technologies/details/pl-php/5/all) 50.3% of PHP 5 installations are still PHP 5.2 or lower (43.5% being ... |
I'm doing a PHP application with CodeIgniter and most of my controllers accept record ids as parameters for retrieving purposes.
I also pass record ids in my forms action.
Like this: www.sample.com/records/save/sFKu=4
Is this the right way to do this? Note that the record ids are encrypted.
|
We have an existing ERP system written in VB 6 that we are converting to .Net incrementally. Now, every module in the system is being separated into DLLs so that the product becomes customizable and flexible. I'm not sure if this is the way to do this.
I think this will cost a lot of maintenance in the future. What do ... |
Perhaps a bit of an odd question but I can't think of a way to achieve what I want.
I produce a product which ends up installed on-site at clients premises. It is a business critical and high availability application, and has to handle processes very quickly.
While obviously most of the work goes into the actual applic... |
I'm doing a lot of work with XML, our legacy XML generators use the ruby template language ERB to create the XML files. I've been experimenting with Nokogiri and the builder model of creating XML, but I seem to be able to accomplish everything I want using both methods. So, what should I be taking into account when cho... |
Let's assume the modeling of User model in a context of a social network.
User concept is composed of two notions:
Authentication elements like userName/Password/Email etc...
Extra data information sometimes called "User profile" like firstName, birthday, pictures etc..
At first glance, this analysis involves separat... |
Been trying to come up with a flow for a basic tiered web application, and have been reading conflicting information online. What I'm trying to figure out is if there is an advantage to still using DTO objects from your DAO to Service layer through the use of some sort of mapper.
The basic flow I foresee is as follo... |
Ok so I need to create a bunch of utility classes in python. Normally I would just use a simple module for this but I need to be able to inherit in order to share common code between them. The common code needs to reference the state of the module using it so simple imports wouldn't work well. I don't like singletons, ... |
I think it's generally good practice to #include the header for any types used in a CPP file, regardless of what is already included via the HPP file. So I might #include <string> in both my HPP and CPP, for example, even though I could still compile if I skipped it in the CPP. This way I don't have to worry about whet... |
I have the opportunity to rewrite a core piece of a project (C#) that is inheritance-heavy and feels increasingly restrictive in how it is designed. The scenario is pretty simple, imagine an application that is built to handle various small tasks. Every task is unique in it's functionality so it implements an ITask int... |
I have the opportunity to rewrite a core piece of a project that is inheritance-heavy and feels increasingly restrictive in how it is designed. The scenario is pretty simple, imagine an application that is built to handle various small tasks. Every task is unique in it's functionality so it implements an ITask interfac... |
When writing software I'm often forced to at some point to make a decision that involves a design pattern of "by convention" naming and behavioral patterns. This normally makes me feel kind of slimy as a .NET developer because nearly everything is statically typed (arguably even the dynamic type is statically typed, b... |
What is the best way to implement automated updates? I've gotten as far as libcurl, I imagine I need to ping the server every now and again with the current version of the software. But then what should I do? What server tech needs to respond, and how?
|
I notice that when I code I often use a pattern that calls a class method and that method will call a number of private functions in the same class to do the work. The private functions do one thing only. The code looks like this:
public void callThisMethod(MyObject myObject) {
methodA(myObject);
methodB(myObje... |
What's the best practice?
This :
for ($i = 0; $i < count($array); $i++) {
//stuff
}
Or, what I usually do :
$count = count($array);
for($i = 0; $i < $count; $i++) {
//stuff
}
Is it the same with the magic of compiler optimization?
|
Me and a small team of engineers are considering using SVN to store our electrical schematics and parts libraries; currently we just have a network folder where we put all of our files. Our company also has a separate SVN server that we have access to.
I was wondering if there was some way that we could use the SVN rep... |
What is the name of λx.λf.fx in lambda calculus?
Does the corresponding function have a standard name in functional programming languages, like Haskell?
In object oriented programming, is there a usual name for a method foo which takes a function as an argument, such that x.foo(f) returns f(x)?
|
I'm not asking for legal advice; just some rough guidance.
I have a host application in Java that uses the Rhino JS engine to execute JavaScript. That JavaScript can then make calls into other Java libraries, some of which might be licensed under the GPL.
I distribute my hosting app, the JS files as source and the unmo... |
A Transaction contains one or more LineItem. One LineItem has a relation with an Item. Every Item has a number field that represent quantity in stock.
Using this approach, every Transaction creation will need to decrease quantity in Item. If user update a Transaction then quantity in Item will need to be adjusted. ... |
Take the following examples:
public static String returnOnce() {
String resultString = null;
if (someCondition) {
resultString = "condition is true";
} else {
resultString = "condition is false";
}
return resultString;
}
public static String returnMulti() {
if (someCondition) {
... |
When the context class can accept a null strategy, is there another way to do it without check if its null?
Is this considered a good strategy design implementation?
class MainApp{
static void Main(){
Context context = new Context();
while(true){
Strategy strategy = createConcreteStrateg... |
Since I discovered the joys of AJAX, I tend to do all my requests to the server using AJAX. Is this a good idea?
According to you, what should I do in PHP and what should I do in AJAX?
I like to do my requests to the server with AJAX because I can use it as a kind of web service.
|
You can find many frameworks with an example todo list for demonstrating a small but full application in the framework. You don't have to consider large problems like scaling or caching, but you still exercise most of the fundamentals of that framework in a todo list.
Is there an analogous application for systems-leve... |
Say I want to build a website that support multiple language and use MongoDB datastore. I wonder what is a good approach to have multiple versions of the body and title of an article, one for each language.
Should I keep all versions in the same article document? Like a collection of key-value pairs of language code an... |
Basically, I'm trying to understand why layered and tiered are that different, and why they don't translate easily to each other.
I understand that layered could be 3 separate class files for UI, BL and DAL. Whereas tiered can be a Project for the UI, which links to a BL project which links to a DAL like entity frame... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.