instruction stringlengths 34 19.9k |
|---|
Consider a basic js object:
var obj={x:1,y:'2'};
Is this stored internally as a hashtable or does js use a different mechanism for key value pairs? If they are hash tables does anyone know how they handle collisions?
|
I'm a new app developer and after like 20 downloads of my app (free and ad-free) I already got two feature requests, and I'm not going to implement either.
Should I respond to these feature requests and if so, how? I'd prefer not responding at all because I'd rather spend the time to work on my app, but being a new dev... |
I'm starting to design a web application, and I'm evaluating some decisions regarding the general structure of it. My use case is as follows:
I plan to have multiple customers on a single server. Initially there won't be many customers, probably two to start (but the system should be ready for more, of course). As I'm... |
I am designing a HTTP-based REST API.
Let's say I have an entity called Entity that has a bunch of properties. Some of its properties are files. Let's say Entity has following properties:
name: string
description: string
photos: array of photos
videos: array of videos
API is designed to be used from mobile devices and... |
Running Apache ZooKeeper (this applies to PAXOS style system just as well) with 2 members - which is not recommended - does not make sense, because if either
member1 goes down
member2 goes down
there's a network partition between member1 and member2
, ZooKeeper will declare business hours to be over, as there's no s... |
I've just been learning Unit Testing and I'm trying to understand how I could incorporate it with a project with existing code. Say I wanted to write tests for a specific class in that project, but that certain class requires an instance of another class for the the methods to be run and/or tested. How should I approac... |
I am inheriting a legacy code. The legacy code has lot of web forms and each web form does not have much of functionality other than hosting a user control.
My question is -
Should we create a user control even if that control is not used in any other web form ?
Are there any hard benefits in creating user controls ... |
So I have been googling about this OpenSSL heart-bleed thing and somehow sees that it is caused by the heartbeat extension which requires client to ping the server to show its aliveness and it all comes to this memcpy function in C which is meant to copy from the source array to the destination array with the user spec... |
I have an existing database app written in D7 with apollo databases.
The client has given me a fast desktop with 24gb ram
Can I somehow load the database files into ram to speed up processing?
With millions of records some procedures take 1/2 hour or more, mostly due to disk read/write
|
I want to implement a parallel clustering algorithm "out-of-core" in CUDA. My CPU has 12GB of RAM and GPU has 4GB of it.
What I want is that the entire dataset should be on the disk, and I can pick blocks of data from it, put the blocks on CPU memory, pass them to the GPU, process it there and store the result back on... |
I was looking at the terms of use for CocoonJS and noticed this section
License Grant. By uploading User Content via the Services, you expressly grant, and you represent and warrant that you have a right to grant, and do so grant, to Ludei, a royalty-free, non-exclusive, worldwide license to use, reproduce, modify, pu... |
I am coding a program which has persistent data (the MELT monitor, related to GCC MELT). The data is persistent because it is expected to be read and overwritten by most executions. (That data is in particular made of abstract syntax trees)
Currently, this persistent data is an Sqlite database. Of course, I am backing ... |
Based on the same example for this question.
Within the Pro ASP.Net MVC 4 by Adam Freeman, there is a discussion on aggregates and aggregate roots with a simple auction system. There are members who bid, items that are bidded upon, and bids. The author says that there would be an aggregate of Item and Bid with Item b... |
Quick example:
HM observes CM
SM observes CM
HSM observes HM and SM, but wants to be updated only after both have their new value derived from CM.
More detail:
(this is still a made-up example, but the closest and simplest I can come up with)
class ColorModel:
can store any RGB color.
observable by a ColorObserverIn... |
Suppose I have two or more UserControl implementations with vastly different implementations but near identical code-behind. One strategy to avoid code duplication is as follows:
Change each UserControl to inherit from a new abstract class, AwesomeUserControl
Move all of the codebehind from each UserControl into Awes... |
Basically I am writing a MSMQ based multi-threaded messaging pattern utility library. It's like a set of components all inherited (directly or indirectly) one class that's called my base component class.
Each of these messaging components have the ability to listen to multiple queues via multiple threads and to proces... |
I'm working on an Open Source software project (LGPL) which uses another LGPL-licensed software. To make it easier for users and developers I'm delivering and linking against the compiled thirdparty.
As far as I know I have to include the sources and license-statements of LGPL software if I'm delivering and using it in... |
What is a web Application Programming Interface?
Many common sites provide APIs. Why are they needed, and what function do they provide?
How does one access a web API?
|
I'm trying to convince the designers of a language that multi-line comments with an arbitrary start and end are important, and should be included. Currently there is only a "comment-to-end-of-line" primitive.
Their line of argumentation reminds me of what some say about why you should use spaces instead of tabs. Basi... |
Or rather, practically applying PRIMES in P.
I've heard a lot about "PRIMES in P", or the "AKS algorithm". It is, to oversimplify slightly, a very fast way of finding prime numbers.
However, while I've tried reading the original paper (the revised "V3" seems to have vanished from the internet), it's a bit above my comp... |
I have been using Entity Framework for a few years. I have flip-flopped between calling out to repositories in my business logic or using lazy loading to retrieve data as I work my way through the code.
The problem with the first approach is that a single business object can end up relying on a lot of repositories (in ... |
Just started learning about classes in C++ and I'm have trouble understanding why object orientated programming (OOP) is useful. I understand the syntax, how to use them etc.
But I'm still confused as to why OOP is advantageous. Here are some specifics I'm having trouble with:
Private variables. What is the use? Many ... |
Consider an application that stores a set of records that contain:
Description
Cost
Purchase Date
I'd like to be able to allow users to utilize natural language to search the dataset.
For example, the search expression:
blue from last month less than $20
would translate into (Linq as an example only - correctness o... |
I want to write a program in Java using RS-232. But I am unable to find the java.comm Package for the windows. Which library should I use for this purpose?
http://www.oracle.com/technetwork/java/javasebusiness/downloads/java-archive-downloads-misc-419423.html
The only package avaiable here are not for Windows. Can you ... |
I'm building websites in ASP.NET MVC and I quickly figured out that my models are getting harder to organise as they grow.
What I normally do is create one model to add and edit data. But in my add view I have 2 extra properties. So I'm re-using the same model with 2 extra properties but I don't use these my edit view.... |
I am trying to implement Golomb coding, but I don't understand how it's tuned to obtain optimal code.
It is said that
Golomb coding uses a tunable parameter M to divide an input value into two parts: q, the result of a division by M, and r, the remainder. The quotient is sent in unary coding, followed by the remainde... |
I am about to start a new ASP.NET MVC5 project and I am planning the authentication / authorization requirements at present.
The client wants Windows authentication, to prevent their users having to remember another new password. The site is web facing, so the downside would be an ugly pop up box asking for their crede... |
For a long time I've tried to get my head wrapped around the visitor pattern, and somehow this thing keeps being rather fuzzy to me.
I'm currently under the impression it is only useful to apply operations on objects that implement the Composite pattern. At least as far as PHP is concerned. Is that an accurate observat... |
I use git for my personal projects, so I have never run into any issues with Git, however I had a discussion at work today and its something that I haven't thought about.
In TFS you can store your changeset into a shelveset, this shelveset can be viewed by other developers, say for a peer review.
From what I understand... |
I was looking at Jcrop library code for scaled image size calculation, but I couldn't clearly understand algorithm used in following function:
https://github.com/tapmodo/Jcrop/blob/master/js/jquery.Jcrop.js#L187
function presize($obj, w, h)
{
var nw = $obj.width(),
nh = $obj.height();
if ((nw > w) && w > 0) {... |
I have started building a charting library on top of d3js using javascript's inheritance. My goal is to develop reusable and fully customizable chart components. I read the article: Towards Reusable Charts. Then, I went through the source code of nvd3.
NVD3 uses boiler plate code in each chart like: copying and pastin... |
I am writing a MATLAB application that makes fairly heavy use of the MATLAB File Exchange. Most of the functions I use from here fall under the BSD license.
My application is being deployed for internal use only and is not meant for public consumption. While my particular case uses code that falls under the BSD license... |
I am using PHP and designing some abstract classes.
I can declare properties with constant values within my abstract class and access/overwrite them from any class which extends this without re declaring them within any of the extending classes.
A benefit to this is less repetitive typing but the downside that overtime... |
Is there a good way to run a C# application on clientside in lieu of JavaScript? I have done some front end work with JavaScript and backend C# for web developing at an old job, but I am interested in hosting a website myself soon. I have a C# application I would like to be open source, but before people care to downlo... |
I just came across this article, and in particular, this answer. Essentially they're talking about returning self from instance methods to allow for method chaining. That being said, one of the first thoughts that came to mind was, Why not always take instance methods with void return types and make them return this ... |
I have heard/read mixed things on whether to start with an object model or a data model. And more people say to starting with an object model as it will ease your data modelling.
My question is, Shouldn't an object model always drive the design of data model? Why and When would a data model design be different than an ... |
For a typical if...else wrapped with exception handling, is something like the following example a recommended practice to avoid code duplication?
try
{
if (GetDataFromServer())
{
return ProcessData();
}
else
{
throw new Exception();
}
catch(Exception ex)
{
return null;
}
in... |
Imagine a small local business (in my case a dog daycare) with a few dozen part-time employees . The goal is to automatically create weekly staff schedules. My question is about what algorithmic approaches to explore for this problem.
There are many constraints to keep in mind, chiefly (1) the availability of the staff... |
Recently we fitted a 4-Tier Architecture in our project composed by the following four main layers :
User Interface Layer.
Data Access Layer.
Domain Layer.
Business Layer.
All the layers fulfill their usual roles in 4-Tier Architecture and interact which each one in the usual way. We use SVN to maintain our CVS.
My p... |
I need to implement a Cursor class to perform operations on a Document object, which is implemented internally as a simple list of rows. The Cursor class must have methods such as moving around the Document, add lines, remove lines, insert text in a given position etc.
The problem I have is relative to the details of t... |
In C# generics, we can declare a constraint for a type parameter T to have a default constructor, by saying where T : new(). However, no other kinds of constraints like this are valid - new(string) for example, etc.
From a language design and/or implementation perspective, what is the reason for this?
Is there somethin... |
Sometimes I find myself wanting to run the same code from a few different spots in the same function. Say I have some function func1, and I want to do the same thing from a few different spots in func1. Normally the way to do this would be to write another function, call it "func2", and call func2 from several differen... |
So lets say we are creating a simple "modular system" framework.
The bare bones might be the user management. But we want things like the Page Manager, the Blog, the Image Gallery to all be "optional" components.
So a developer could install the Page Manager to allow their client to add a static home page and about pag... |
I've been working on a game in my spare time. I'm pretty much done defining the primitives and until today everything was pretty well segmented and encapsulated but now it's come time to implement path finding (and other ways for the objects to interact with each other). Here path finding requires at minimum a knowledg... |
I have a Producer/Consumer implementation where the number of consumers is configurable (this is a form of configurable throttling). The producer and consumer are kicked off like this:
var cts = new CancellationTokenSource();
var processCancelToken = cts.Token;
Task.Run(() => Parallel.Invoke(new ParallelOptions() { Ca... |
Is there any specific reason driving Python files to often be so large? Python files may contain several classes within one file, and some files go up over 10k lines in length. This seems to go against the idea of modularity and encapsulation.
Also it doesn't seem "Pythonic" in the first place, considering IMO it can b... |
We have a service to return messages. We want to limit the number returned, either allowing the caller to specify the max number to return, or else to use an internal hard limit. We also have thought it would be nice to include in the response whether more messages are available. The "best" way to go about this is not ... |
If I have a polyline made up of any number of vertexes, what is an efficient algorithm for tracing around the boundary of this polyline?
There are 4 situations to consider:
The polyline does not intersect itself and has no colinear edges.
The polyline does not intersect itself but has an interior or exterior loop.
The... |
I use an MVC web framework to create an application which contains a hierarchy:
Location <1-N> Devices <N-M> Services
I have a number of Locations. Each Locations can have several devices (represented by an 1-N relationship in the database). Each device runs services. The services (like http, ftp, etc) are defines in ... |
Someone told me Session or HttpContext.Current.User will return different value when we are working with ajax postback, in case of when the are so many user are live to site.
For example, suppose there are 1000 people are online in site, and from them 100 call ajax method/ wenmethod and on this we might get different v... |
In most cases, it is possible to create both a native compiler and an interpreter for a programming language. The compiler would simply convert the source code to machine code, and the interpreter would simply execute the source code (or some IL produced by a compiler).
However, I'm not sure about languages with garbag... |
In a non-agile development team a lead developer generally:
Sets the standard (coding and otherwise)
Researches new technologies for the team
Sets the technical direction for the team
Has the final say on matters
Designs the architecture of a system
However an agile team works differently:
An agile team will rely on... |
I have an eCommerce platform that creates a basket as soon as the user lands on the site if they don't already have one (from session or cookies). It then stores the basket information in session and in cookies to remember what the user has added to their basket for a month.
The problem is if they aren't capable of hav... |
For a long time I worked almost exclusively with input/output streams in java. However a few years ago I started exploring async I/O as well (e.g. running on jboss netty).
However when working in the async I/O world, I could not reuse any of my sync utilities. I also had to start on a rather large library of new I/O ut... |
I want to produce maintainable code for configuring one or multiple classes differently depending whether in a production or development environment.
For example, making a Paypal class/object that handles API calls to Paypal, using different settings depending on some sort of global switch set to either Dev or Live. Th... |
Why did Microsoft choose to change the resources management system from .NET's RESX files?
RESX had useful code generation, providing developers auto-completion for resources names and outputting IMHO very readable code.
The new RESW format is as far as I know, the same bare XML files, but without any code generation, ... |
I keep hearing people say Banking systems like ATM use Eventual consistency model for data synchronization, but I am wondering if it is true.
Definitely the amount you withdraw might be delayed showing in your banking statement, but I assume they won't let the amount of your banking account inconsistent at any given t... |
I'm in charge of defining an XML schema for some data; the plan is to have various systems (all under our control) upload XML files that match this schema to a central server for processing. I don't have much knowledge of the design of these other systems, so I'm working collaboratively with those system experts to mak... |
I have designed and implemented, for my final year in college, an autonomous robot with Arduino board microcontroller. The robot wanders around an area, avoids obstacles and tries to detect intruders.
I have to do some testing for this project . Could anyone help me by telling what test procedures I can perform in pro... |
Generally speaking, RESTful API's are very good for representing resources and collections of resources.
http://example.com/resources
http://example.com/resources/item17
And we are good, if we work with resource.
However, what should be done, when you need to expose API which does an action which doesn't create/upda... |
I am writing an application in Java which use MVC pattern design. I have 4 major classes: Main, Controller, Model, View. Main initialize the other three and run launchMenu() in a infinite loop, a method included in Controller. This launchMenu from Controller runs a launchMenu method of another class: MenuHandler, which... |
We want a simple tool to parse PDF forms, retrieving just the associated field names and user values. PDFSharp would be a good option for us, as it is under the MIT license, but it is a few versions of Acrobat behind - so not going to work. The most popular library (from what my searches have revealed) seems to be iT... |
I have a website that allows for users to paste content (like snippets of code, etc) for sharing. Like Pastebin and Github, I also have a "raw" link that will display the raw contents of those posts.
However, some users are posting up code and then using our service as a host for distributing content that violates our... |
I have an app where I need to synchronize some entities (simply download latest versions of entities from server to client). Entity has bunch of text properties and bunch of resource links (referenced by ids, URLs, whatever).
For example let Entity has three properties:
id: integer,
name: string,
photos: array of photo... |
"The Interface-Segregation Principle (ISP) states that no client should be forced to depend on methods it does not use."
The decorator pattern is a design pattern to decorate a method of a class. For this, the decorator implements the same interface as the decorated object, so it can take its place.
But doesn't this me... |
I have a question about Thingiviews license. I have a site that has to do with 3D Printing, it is not done yet but I was wondering if I would be able to use it on my site,
The big reason I am asking is because it will be used to show 3D models that will eventually be made and sold, like shapeways kinda, so I am not se... |
I want a quick way to roll back our production build in the event of any mishaps - a one-click solution, if you will. My gut is telling me that this is important - and I believe that my gut is correct, but I want implementation advice.
My current thought is to start a local repository on our production server, and simp... |
I'm not even sure how to define this difficulty. It reminds me of the test a couple of prospective employees did on me before I got a job. They would pick an object in the room and then I'd be allowed to ask questions to help myself determine what that object is (much like 20 questions). I was ridiculously good at this... |
I see 'the bootstrap process' mentioned in Dayle Rees Laravel tutorial "Code Bright" but no explanation of what it actually means. The Wikipedia definitions on Bootstrapping in computing don't seem to have any particular relevance.
|
I'm just starting on a new little pet project of mine. I started the project using a familiar pattern for using objects as "filters" in SQL Queries. I've never been much happy about its easy of use, but eventually more or less accepted it after having it drilled into my head by colleagues.
The example below hopefully ... |
I'm playing around with different ways of integrating d3 and angular, in the context of learning both of these frameworks, and am hoping for some input:
My client application receives a JSON array of nodes and an array of edges from my server.
The central component of the client is a graph visualization implemented ... |
I'm designing a class that holds several types of data. Some of the properties are optional. For example, let's say I have a class that represents a person, and one of the properties is occupation. I have another property, military rank, but this property is can only be retrieved if the person's occupation is milita... |
I am considering building a DBAL from scratch with PHP to use within my projects and also to learn through the process.
I have noticed on SO and other reputable forums that whenever this is mentioned most users advise to use an established DBAL like Doctrine and to not "reinvent the wheel".
Why is it that with this spe... |
I have some classes so far.
Hand stores information like SB, BB, ante, collection of Players
HandState inherits from class Hand. has members like phase {POSTING BLINDS, PREFLOP, FLOP, TURN, RIVER, SHOWDOWN }, pot. I consider every action in a poker hand as a handState. Players post ante (if any), Small blind and big b... |
I am making HTTP calls on the client side and the server expects me to supply a client nonce. It needs to be 4 bytes long. I am planning to use this combination:
base64(parts of the MAC address + random bits generated by RNG)
Given that the protocol is created by experts (thus its security is not to be questioned), is... |
I need to read some of your opinions. I'm developing a desktop app (.net/winform) to keep data in one place. This is used by several clients and the data is stored in MS SQL Server (client-server arch.)
One of the feature is to be able to send notifications via email when conditions met. I've never did something like t... |
This is a licensing question about the Dalvik and J2SE core libraries. In particular the license governing java.util.concurrent.SynchronousQueue.
The license header of the class in the JDK source states that it is GPLv2 only (see grepcode).
However, the same file in the Dalvik core libraries seems to be governed by the... |
I'm writing a web application in javascript that will be served to the clients' browser. The intent is for the app to appear to the client as a monolithic application, not a series of interlinked refreshing web pages.
My question deals with common architecture. In order to relate the question I'll mention a specific fe... |
New technologies can accomplish existing tasks in more efficient and powerful way. But sometimes old technologies cannot be discarded unfortunately, so more numbers of technologies in one system make maintain difficult. Is it worth to introduce new technologies?
For instance, a legacy system uses SOAP internally and J... |
In my problem I had lots of objects with slightly different behaviour, but identical attributes and methodes with identical interfaces. The objects variants were quite big in number, and I didn't want to create a class for each of them, with lots of repeting code.
I circumvented creating a lot of derived classed by the... |
I am in a meeting with a client later on, regarding an ASP.NET web app we are creating for him. The app includes a lot of 'form' style screens with 20-30 textboxes, and of course a 'Save' button that posts back to the server and saves the data.
The client really does not like this as he is worried users will forget to ... |
I currently have an app which basically runs two halves of an API - a restful API for the web app, and a synchronisation API for the native clients (all over SSL).
The web app is completely javascript based and is quite similar to the native clients anyway - except it currently does not work offline.
What I'm hoping to... |
Is there a performance difference between using ++x over x++ increment operators?
I've see developers use ++x in loops where I would normally write x++ out of habit.
For example;
for(int x=0; x < 10; ++x)
There would be no difference in the results between ++x or x++. So I'm wondering if there is a reason some people... |
Where I work we have a number of teams that are converting over to having a team dev environment. Basically a couple members of the team are putting together an image that is then installed on everyones computer. It includes an OS, an IDE (with source control managed from it), a couple of server systems they need for... |
I've recently joined a project where we are extending the functionality of an external application that our company has bought.
It is an Office Add-In with an admin console that allows you to create Windows Forms style forms with code-behind files, and gives you a single place to store common code. This can be quite ch... |
This morning, as I was writing some html and haml, it occurred to me that the way divs are used is ridiculous.
Why are divs not implied? Imagine if this:
<div class="hero-img">
<img src="http://whatever.com/this.jpg">
</div>
was this:
<hero-img>
<img src="http://whatever.com/this.jpg">
</hero-img>
If the "div ... |
I am creating a scoring system for a competition that is somewhat obscure, but it resembles the Olympics in terms of its high-level structure. Therefore, I will ask my question in terms of an abstracted, fictional version of the Olympics, since everyone can relate to that to some degree.
Assume the following hierarchy ... |
Build systems for web applications are great: they give dependency management, code minification, and the ability to use tech like SASS or CoffeeScript that require pre-processing.
However, I find actually using build systems to be ugly and annoying... you need to make sure developers have the build tools installed, th... |
My company is investigating using a service bus. Currently we have running prototypes of NServiceBus and Microsoft Service Bus (on premise).
I'm quite happy with the pub-sub and topic messaging capabilities the bus provides but I'm getting lost in one of the requirements they are referring to.
For example: They want to... |
I am developing a embedded system (computer + os + programs) to sell it to a company.
I am confused about the licensing and the softwares I wanted to use to develop the system.So I want to know if I can use these programs free of charge and without distributing the source code for commercial use.I wanted to use:
A lin... |
I am currently studding OpengGL with OpenGL Supebible 5th edition. I've found interested for me some C++ code that is distributed with the book (see also on google code). That code is under New BSD License. I am writing my software on C# with SharpGL wrapper and I'd like to know following things:
Can I rewrite that C... |
I'd like to preface this that this question is similar, but my question doesn't involve randomness, just finicky determinism, so the answer of "use a known seed" doesn't really apply. Likewise, this question is similar, but again, I'm not expecting the algorithm to ever fail -- I just don't know which way it will be co... |
I'm trying to program a very basic FLAC player using 100% C# completely from scratch. My understanding of this type of thing is very limited, so I'm using this project as a way to learn about compression and decompression. I'm a computer science and math major currently in university, so I'm not adverse to learning wha... |
I'm developing a system using .NET which will be used by multiple users. Because of that, I need to identify on the database which data belongs to each user. Explaining with an example, imagine I have the entity Product. Then each user has its own products, and so in the database on the table of products we must be abl... |
I have made a simple web app, which runs completely offline - all data is saved in HTML5's localStorage. Now, I want the data to get synced with the server, so that the user is able to use the app on multiple devices at a time.
What I have done so far is:
For each operation the user performs, a log entry is added.
Whe... |
I'm creating a CRUD-based web project, and am thinking about using a server side MVC framework (such as CodeIgniter or Laravel) in tandem with a client side MVC framework (such as AngularJS). Is this a fairly common approach? After all, it's clear that I need something on the server, and that doing MVC on the client as... |
I came across this term when looking into PHP's "traits" (which are apparently bad, since, among things, they're not mockable), but I can't really find a definition for this "mockability". It might be related to polymorphism? There isn't even a Wikipedia entry I could find!
|
I've noticed that Google and large search engines do not display "proper" paging, but display an approximation. For example, I tried to give a specific search on Google to return few results, as per below:
eating +ants in malta near the sea
This returned "About 71 results".
However, it only showed 2 pages in the page... |
I am creating something similar to a Content Management System, that can be downloaded and used by everyone that needs it. I've been working in web-development for a couple of years (mainly as a hobby, i.e. creating personal homepages for acquaintances), but have never had the need of a user to enter his own configurat... |
I'm building a client library that consumes a collection of OpenStack API services. I know that as time goes on more services will be added - so I want to come up with a clean and neat way of structuring my client library to minimize development time (for future new services) and avoid duplication.
So far, I've thought... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.