instruction stringlengths 34 36.1k |
|---|
I have been using Python for a fairly long time and now I want to modify a Python library to fit my needs.
There are two ways to do this as far as I know. One is to modify the source code itself. Other is to write a wrapper around the original library.
But I don't understand which is better, doing what is a good pract... |
I'm into creating a php based web chatting system.
About 1000 concurrent users across the world will be using it, so what would be the best tech to deploy?
As I did some research online, mainly I found systems using ajax and jquery for chatting while there're some using web sockets. I'm not sure as to which would work... |
django.contrib.auth has User and Group models. I'm using the User model for my users, and the Group model to manage their broad permissions (access to admin site, access logs, etc).
I also have my own Client model (representing a business client corporate entity). Let's say I'm going to have many clients, and I don't ... |
I implemented sync for my app (with a REST backend), it works well but there are some problems:
Blocks - Since I don't want to overwrite possible inputs of the user during sync, I block the UI (progress overlay) during sync. This of course affects negatively the user experience.
Size - If the data is large the request... |
So I'm responsible for maintaining and enhancing a PHP codebase that runs to around 1,100 files and 120,000 lines of code.
In general, it's not terrible, although since it was written over some 10+ years starting in the PHP 4 era, some parts are more terrible than others. However, this entire codebase has a grand tota... |
In Ruby, is there a standard class or gem to work with dates that can be - but are not required to be - historical in nature? The dates have precision (to the nearest million years, decade, century, year, month, second, etc). For example:
20th century
2000's
5th century, BCE
1920's
June, 1945
4.6 million years ago
19... |
I'm looking for suggestions on how to read large Javascript codebases, for example, of a framework. For example, let's say P5js, but this applies to any large framework (i.e like AngularJS, Ember, etc)
My goal is to be able to look through a Javascript framework's source code and be able to understand what various func... |
Case1: There are two snippets of code that are very similar and very gzip-able, one at the start of the document and the other is beyond 32kb at the end of the document. Does the minifier bring the two snippets together so that gzip will reach the second snippet?
Case 2: A snippet of code is used multiple times. Gzip r... |
I have a sample code here:
Dim a As Boolean = False
Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
If a = True Then
Console.WriteLine("Example of a task that needs to be done during tick event")
End If
End Sub
You can see there that I have a timer tick event, but the eve... |
I really like the concept of assertions in Java in the way how to use them. It's much easier than to write an if and then throw an Exception/Error.
But the thing I don't understand is, why do they need to get enabled with -ea to work? That makes them unreliable and that's the reason I don't use them. What is the purpos... |
I'm drawing an activity diagramm and I'd like to know how draw a timed trigger. My process is that when a task is created it should be done immediatly when it has a high priority or once a week if it has a normal priority.
I know there is the time signal symbol but in all examples I saw it's combined with the joinsymbo... |
Here's a skeleton of a class I built that loops through and deduplicates data - it's in C# but the principles of the question aren't language specific.
public static void DedupeFile(FileContents fc)
{
BuildNameKeys(fc);
SetExactDuplicates(fc);
FuzzyMatching(fc);
}
// algorithm to calculate fuzzy similarity... |
Recently I have come across with another way of writing a function expression, like this: setTimeout(() =>{/*code*/},1000); as opposed to: setTimeout(function(){/*code*/},1000);
What is the benefit of using () = > rather than function(){}
Can I use it all the time or only in the certain situations?
Thanks.
|
Let's say I have a function (written in Ruby, but should be understandable by everyone):
def am_I_old_enough?(name = 'filip')
person = Person::API.new(name)
if person.male?
return person.age > 21
else
return person.age > 18
end
end
In unit testing I would create four tests to cover all scenario... |
I have a large customer facing web applicaton (.net mvc if that matters) that I need to split down to a number of services. Some of these services will then be shared with other applications.
At the moment all of the servers I have are part of a web cluster that we use for this app, though this may change in the future... |
I am reading the book "Learning TypeScript" by Remo Jansen. In one section the author describes how to create a very simple proof-of-concept MVC framework including how to create the Model class and says the following:
A model needs to be provided with the URL of the web service that it consumes. We are going to use a... |
We will implement a system , which will receive quite a lot of requests through web service interface. We will have to queue the requests and process them asynchronously. Consequently we will have to have also some output queue with responses (QR).
The web service client will have the possibility to query his (and only... |
So here is the use case:
You have users and they have many addresses. Say you want to filter and eager load on addresses (say...only US addresses). In order to do so you have to filter the eager load AND filter using whereHas so your result set is only those users with US addresses and only their US addresses are retu... |
I am working on an API in C#. I am trying to think about the simplest way to expose my API for consumers of it. In particular, I have a class in my exposed data model that has a dictionary property. I'm trying to decide if the dictionary property should use strings as keys or an enum that I define as keys.
My concer... |
I'm very new to ruby. I have to code in ruby at work and a coworker gave me some tests he wrote in ruby. I have some difficulties to understand a line he wrote.
We have a class like this:
class Port
attr_accessor :nature, :name
def initialize(name)
@name = name
end
end
The test consists in:
x_port... |
here's the problem.
I have developed an Azure-Based Web application which exploits some VMs. On top of these VMs I'm running a modified code which is licensed under the GPL license. Here's the flow:
Now, I would like to sell the access to the WEB-APP in the form of a private login to some customers.
1) Is there any li... |
I have two separate inheritance hierarchies that represent objects that can be "matched" to each other to consitute a FooBarMatch (which contains references to the matched FooBase and Bar partners):
_____________
| FooBarMatch |
|-------------|... |
I have a few questions about how to implement models and what the results are of those implementations:
When I only need a few variables set, isn't it memory consuming to
create an entire object? E.g. an entire site_object just to pass on
site_id's and site_names?
Is it considered to be good practice to put all the da... |
I won't explain what backtracking is, Wikipedia article does it well enough.
Backtracking solver is usually implemented using recursive function that traverses a tree of potential candidates that is discovered at the same time.
Now that function can return early when it finds the first solution or traverse the whole tr... |
I come from a C# background, where LINQ evolved into Rx.NET, but always had some interest in FP. After some introduction to monads and some side-projects in F#, I was ready to try and step to the next level.
Now, after several talks on the free monad from people from Scala, and multiple writeups in Haskell, or F#, I ha... |
It is not unlikely that what I want to do is not possible, but it doesn't hurt to ask.
Imagine a set of lists, each containing positive integers (in my case, a list always consists of four integers, but that shouldn't make any difference).
a = [35, 2, 123684, 647]
b = [453, 346457546457, 6, 0]
c = ...
Then there is an... |
We are a Microsoft shop, developing with Visual Studio. We are building a single page app, and we have elected to use Gulp to handle a lot of the script build tasks (javascript minification, css minification, etc).
We are using typescript, and the thing I find intriguing is that I can use Visual Studio (and MSBuild fr... |
I am a high school student working on a C# project with a friend of mine with about the same skill level as me. So far, we have written roughly 3,000 lines of code and 250 lines of test code in a span of 100 commits. Due to school, I put off the project for a few months and recently I was able to pick it back up again.... |
Let's say I am developing a program for Windows. What are some things I can / can't do if I want it to be usable for 32 / 64 bit platforms?
|
I need some help in answering questions
This is Sprint 1 and I have a 2 week sprint with the first week completed and the current burndown chart looks like:
Day 1 with 50 Story points
Day 2 with 57 Story points
Day 3 with 50 Story points
Day 4 with 34 Story points
Day 5 with 25 Story points
It is assumed that wor... |
The requirement is that once the product has been delivered, user can update the logic as he wants.
An example of logic I have is follows-
An institute teaches English has following requirements -
At the time of registration student can choose either Writing or Reading or both.
Student can choose Speaking only if it ... |
I'm currently refactoring on an older project, which has classes that expose both a single object and also multiple properties from that object. Ex:
public class Foo
{
private MyObj myObj;
public IMyObj Bar
{
get
{
return myObj;
}
}
public int So... |
DevOps means developers now take responsibility for infrastructure and release - but what are the drivers behind this change?
I'll put my cards on the table: I am a developer and having worked in both "DevOps" and non- cultures. Having to worry about infrastructure and releases and QA and the associated ceremony is a h... |
I need some help in answering this question
Some Info on the diagram
On the left it says "Your wait time from here is about 14/18 days"
The numbers at the bottom of the columns are the maximum number of
Kanban cards allowed in each column
Little's Law states that:
The long-term average number of customers in a stab... |
I have a model class like below. I need to edit items, but the model has to know when any object has been modified. Also I need to provide very often with the objects inside to the view, which is who's going to eventually edit them. That's why I need an edit method but I don't know a proper way to do it.
public class C... |
I have a large image distributed over multiple machines for which I need to implement the flood fill algorithm used in MS Paint. I am able to do it with a single machine but what approach must be followed for multiple machines.
|
Let's say I have some library "foo" and I have it listed as dependency of my project. For example in Python I have requirements file saying
foo==1.0
foo library needs "bar" library and it lists it as dependency. At one point I realize "bar" can be useful for my project too, and I have an idea of calling some function ... |
I have been building a personal framework of mine which started off as a way to learn the MVC pattern and has progressed now into something that I like more than most frameworks out there (which is probably because I add what I like and change what I don't like but nevertheless) and for good or bad I use it in some pro... |
In this thread it is discussed if it is legally possible to take on open source project and close its sources. But this seems to refer to someone else's project.
So, my question is: What about my own source? Let's say I release the first version as open source, then I make some changes and I want the code from now on t... |
Initially I needed only one queue to be created by the MessageQueueFactory:
container.RegisterSingleton<IMessageQueueFactory>(() => {
var uploadedWaybillsQueuePath = ConfigurationManager
.AppSettings["msmq:UploadedDocumentsQueuePath"];
return new MessageQueueFactory(uploadedWaybillsQueuePath);
});
Now ... |
Q.1 I know that when we are talking about synchronous HTTP, for each request a Thread may be spawn and get blocked, so when number of simultaneous connections increase, we will encounter massive thread overhead. Asynchronous mode will tolerate some overhead polling responses for something desired, but number of Threads... |
What JSON format is a better choice for key value pairs and why?
[{"key1": "value1"}, {"key2": "value2"}]
Or:
[{"Name": "key1", "Value": "value1"}, {"Name": "key2", "Value": "value2"}]
Or:
{"key1": "value1", "key2": "value2"}
The first variant seems more compact and more "semantically meaningful". The second variant... |
I'm developing a website with some simple HTML exercises (like the ones in Codeschool and Codacademy), and now I'm stuck at the correction phase, how can I compare two HTML strings and decide if the user has submitted a correct one?
For example, suppose we have the correct answer as:
<h1>Hello World</h1>
<h2>Welcome</... |
I am considering learning C.
But why do people use C (or C++) if it can be used 'dangerously'?
By dangerous, I mean with pointers and other similar stuff.
Like the Stack Overflow question Why is the gets function so dangerous that it should not be used?. Why do programmers not just use Java or Python or another compil... |
I want to add some extra methods closely related to Book without extending Book. So I found the decorator pattern.
Most examples I have seen are eg. extending an abstract decorator class which implements an interface etc.
I am wondering if this could be considered as decorator pattern?
class Book { ... }
class MyBookD... |
I want to use two particular open-source libraries, in unmodified form, as dependencies of a project. One of the libraries is published under the MIT license; the other library is published under the Mozilla Public License version 2.0. The project itself is licensed under the Apache Public License version 2.0.
Can I ... |
I'm considering a hash function for a tuple of and maximum-valued integers for example (3 ,2, 5 ) -- where each element of the tuple has some maximum value N.
My plan is to treat the elements of the tuple as the digits of a number in base N, so that in the trivial case of N = 10 the tuple(3 ,2, 5 ) hashes to 325, or 21... |
I have no idea where to start in all honesty. If I make a phone app, for example, how would I go about only allowing people with a university (college) email address to sign up? Would it be as simple as verifying that the input is in fact an email address and then just sending a verification code to that email address?... |
Here is my problem, I have a task to create an android app to display data from our SQL server, the problem is our SQL server is not online.
We have a MySQL server too, the MySQL server is online, so I came up with the idea to mirror data on SQL server to MySQL, because our SQL Sever is not online, I have to use anothe... |
In many programming languages, arrays don't get as much attention as other data structures. In Java, there is no Array<T> type collection to make arrays feel more consistent, such as in inheritance. In Python, there are no arrays, but instead only lists. To have an "array", one has to do something like [0] * size. Arra... |
The current way of knowing if a BigDecimal is greater than another is
bigDecimal.compareTo(otherBigDecimal) > 0
(or one.compareTo(another) == 1), but I find it too clunky and unexpressive. bigDecimal.isGreaterThan(otherBigDecimal) is easier to understand.
For people who are used to Java and know how compareTo() works,... |
I have a very complex math formula/equation which involves exponential.
Formula: X + 2 = Y
*PS: The above is just an example to illustrate my problem. The real formula is way more complex than this.
There is no way for me to form an equation with X variable on the left like X = Y - 2. I tried professional Math softwar... |
Are there any programming languages where the default value of a string is "" ? If so, what are they?
|
On OLX like Website , Anytime a user posts a new ad. It comes in top of the page.
No search is involved in it.
Which technology we can use to make such functions.
Suppose X is visiting my website abc.com.
Should I fetch database each time and generate page dynamically ?
or There is a better approach to to that.
Ques... |
I am looking to implement a custom autocomplete functionality for a travel website with huge amounts of data. I am thinking of implementing it using a trie. But how do I handle it if the data cannot fit on a single machine. Also how can I get the top five items for a query.
|
I usually analyze data of experiments and although I have a general schema of steps I need to do, I might need to tweak it to the specifics of the experiments or the questions behind. I am usually the only one coding.
I looked at wikipedia but I am unsure which methodology I can use, partially because I have never fo... |
I'd like to make an app that has all features enabled for two months, and some disabled afterward. Is that allowed on Google Play or iOS?
The iOS app store guidelines say that:
Apps that are "demo", "trial", or "test" versions will be rejected.
If an app has all functionality disabled after a period, it's obviously a... |
I am not able to search for algorithms which can help me solve this problem, I am not sure under which category this problem falls or which algorithm to use.
Problem statement:
There are N number of suppliers who supply Sugar, each supplier has Supplier Location (latitude, longitude) of their warehouse from which they ... |
I'm making a video game and and I would like to know if my OO Inventory System has any flaws or oversightes.
Here is the the item system anything that can be stored in an inventory system is an item. The composition of the item class is a shield,a weapon, an engine, and a ship.
Item:
Ship ship
Engine engine
Weapon we... |
I'm currently working on expanding the capabilities of my pet programming language project's type system, and have come across an interesting area where my research into other language's type systems hasn't taken me before.
As background, my language is an object-functional language with static types and partial type i... |
I got a webservice that accepts multiple calls that require different handling and validation, using generics I've managed to create a common class that accepts a handler and a validator and it looks like this
public class PetitionService<T1, T2>
where T1 : Headers, Petition
where T2 : Headers
{
Petitio... |
Can someone please highlight the definition and differences between data intensive and form intensive web applications.It would be really helpful if suitable java based web application framework or technology stack that is suitable for each kinf of architecture is highlighted.
I just was doing research on feasibility o... |
Is the following design flawed?
Basically I have a main class used to create an object of a type and then return it as the main interface of the type. The problem with this is that each of the classes that implement the interface all have different properties that need to be set. So I then have to cast them back to the... |
I have a dictionary of words and a stream of incoming characters. I need to create a map of words present in the stream along with their frequencies. How can I achieve this efficiently?
|
.NET applications developed using Visual Studio have an easy way to store and recover user settings. You can add the default value of a setting in a special class and have read/write access to it at run time through Properties.Settings.Default.SettingName.
Some applications have use for values to be remembered between ... |
I have an application that is beiong split out into a number of services. From a previous question on here, I think that initially JSON/REST is the way to go for communication.
Some of my micro services need to be available publicly, for 3rd parties to use.
So I am now wondering about the best way of structuring this. ... |
After taking a look to SCRUM it doesn't same to me "enough" to lead a project since it isn't disucssing the technical side of it, so my questions are:
1-is it possible/recommanded to combine SCRUM with some unified process or any other software development process ? How to make specifications in this case?
2-What about... |
I am a product owner on an agile team. I when doing PO acceptance testing I usually make note to try some edge cases. Its not uncommon for me to discover something and then I pass it back to the the devs. I am getting push back from one of the developers when I reject his stories. He says its unfair since I don't speci... |
Suppose we have a function f that gets a complex (non-flat) object as an input, serializes it, calculates hash of serialization results (e.g. md5) and returns calculated hash.
It may use some exiting serialization method, e.g. msgpack.
But are there any known techniques that may be more efficient than full (reversible)... |
I would like to create a front-end interface in HTML that interacts with a Java program via an HTML form. I would like to be able to publish this project on the Internet.
In other words, the text entered in the input fields of the form would be sent to the Java program as arguments once the user clicks "Submit". The Ja... |
I currently have a web application running with my own backend, but maintaining it is becoming a bit painful so I was considering the option of using an existing BaaS (Firebase).
The main problems I want to resolve by using Firebase are:
Better and more reliable authentication, including other sources of authenticatio... |
I am having a hard time to understand cyclomatic complexity. I went through some videos in youtube for this. I got negative value for cyclomatic complexity when I use this formula M = E - N + P. I found this formula as well E = E - N + 2P. I would be happy to get some brief description about cyclomatic complexity and w... |
We are making a quiz application, I'm trying to integrate my Angular 2 UI with the REST api.
Our Quiz domain model consist of the following (simplified) hierarchy:
-Quiz
-Category
-Question
-Choice
where parent doesn't know its children, but child knows its parent. For example, Choice has a reference for a Question, bu... |
I am designing some polymorphic code to perform mathematical operations. The idea is to abstract out the underlying representation of the data, as different use cases require different representations. Operations can only be performed with data of the same type.
There are many algorithms operating on these things and a... |
I'm fairly new to programming (about four months learning), and have decided to mess about with an attempt at writing a language in C for both fun and practice, and am wondering how objects are implemented when you get down to it.
At the moment I am just looking to turn my 'code' into a c-file, and then compile that, s... |
When you consider Scala and its pass-by-name you could (if I am not mistaken) pack the argument to lambda and pass it by value to the function. Internally the function would use pass-by-name parameter as lambda.
However in Algol you can change the parameter (so it is possible to write swap for example).
My question is ... |
I get confused over min and max functions, in certain contexts.
In one context, when you're using the functions to take the greater or lesser of two values, there is no issue. For example,
//how many autographed CD's can I give out?
int howManyAutographs(int CDs, int Cases, int Pens)
{
//if no pens, then I cannot... |
I have a for loop in C# as below,
int[] dim1, dim2, dim3;
//Initialize dim1, dim2 and dim3
for(int i = 0; i < dim1.Length; i++)
{
DoSomething1(i);
for(int j = 0; j < dim2.Length; j++)
{
DoSomething2(i, j);
for(int k = 0; k < dim3.Length; k++)
{
DoSomething3(i, j, k);
... |
As a part of my master's thesis, I am carrying a research topic on why there are no cross platform mobile applications.
As applications developed in Java can run on any operating system using the JVM, I was wondering why there is no interpreter like JVM for mobile devices through which one application can run under var... |
Redux is essentially functional programming, and it makes a lot of sense. As I move back to a non-javascript OOP language in a different project I would like to apply the same principles such as single state object, reducers which act on parts of that state, a business layer of semantic actions to modify the state.
My ... |
at the moment I have one repo (git) for my project and I use branching techniques for development. This is a very new project and I wanted to get things right from the very beginning. I will create this app for Win32, Win64 and OSX. Now, I want to introduce builds (not really nightly as I am sole developer but frequent... |
I have a solid set of classes that do the following
build tables from data and templates
advanced form serialization
build forms from data and templates
launch overlays with forms/wizards
short poll for new data
post data
..etc
Basically a lot of little classes and modules that work independently. Now I want to write... |
I'm working on a high-performance project where Java 8's lambda functions are enormously useful. I've found, however, that they're memory inefficient when used en masse. For example, suppose I need to apply a lambda function 1,000,000 times:
for (int i = 0; i < 1_000_000; i += 1) {
collection.forEach(thing -> thing.f... |
I have to share parameters/information between two independent applications: an Executable and a PDF file.
By clicking a button within the pdf I want to perform some specific task (or run code) in my exe standalone player.
But I am confused about:
How do two independent application talk to each other
How will I write... |
We are about to start using FreeRTOS with lwip and mbed-tls as a platform for new products.
We're working in an Linux environment and I'm tasked with setting up our first project.
In Linux we typically have the platform (distribution) as a repository and then repos for all our applications.
With the RTOS I'm not sure t... |
Background
Our project, written in Java, is now trying to eliminate unnessceary external dependencies introduced during prototype development. We feel it easy when killing simple static utility methods, later we got a problem. Our project make heavy use of LazyInitializer from apache common-lang3 to implement Singleton... |
So, I'm taking a MIPS course after returning to school; and we're approaching the point where we begin on our final project.
I've always been one for large, well-structured projects: lots of supporting tooling, well-segregated zones of control and concern within the project, extensive testing, so on and so forth. Unfor... |
Did I do something wrong in my code organization ? I still find my own program difficult to follow. I tried to decompose my program on small, easy to understand classes and functions, still I find myself jumping around to follow action process.
I can't post my entire project here, so here is a sample of a process.
My ... |
I am developing internal Android apps for the company I work for. In various places in the apps I need to connect to an internal server. This server is shutdown for maintenance for a period of time every night so there are times when it is not available. There may also be times when the wi-fi connection on the tablet ... |
I have a simple web application built with Angular which fetches some state from a web server and shows it to the user. Additionally I want to implement a feature where users are able to customize the view of this application by dynamically appending new code on the rendered page in a way that the changes would reflect... |
I am creating an application that will manage job interviews and help the employers to choose the job seekers based on a ranking system that's based on some user info.
I've created a database that has the following tables:
UserTable (stores Username, password)
Role Table (stores the Role ID, name and description. The ... |
When following the standard service and repository patterns, should your repository contain a specific method for every database operation or should you just use the general methods, e.g. update? Take for example the following service method:
DisableUser(User user) {
user.enabled = false;
userRepo.update(user);... |
Is there a commonly (or rarely) used pattern for a "confirming you want to do this" message when calling a function from a library?
I have a API that exposes some operations that are potentially dangerous if misused (would cause unwanted changes to the database). I would like to pass a warning back to the caller to do... |
Suppose I have an interface Employee and there are many classes that implement it, such as Bob, Joe, and Mary, none of which may be changed.
public interface Employee{
public void work()
}
public class Mary implements Employee{
public void work(){
//Mary's implementation of work
}
}
I must make a Manager cl... |
I've recently been writing some code that deals with 3rd parties -- obviously errors will happen so I'm using Either/Maybe monads where appropriate. As this is C# I'm also using async Tasks too.
My problem is after it's all said & done my return types are quite verbose.
e.g.
Task<Either<ApiErrorEnum, ActualApiResultDt... |
Background
I have an interface defined for a circular-buffer called ICircularBuffer in a separate project. This ICircularBuffer is something that we use all over the place, so it resides in the CommonInterfaces project.
Well, we have another interface IEquipmentController that controls some very distinct piece of equip... |
I've noticed my software severely degrades when the # of threads is substantially increased.
What I mean is that when I limit the # of threads, the performance is much better than when I just let them all run simultaneously.
My cpu is an i7-3940XM, so very fast for a mobile and still not too shabby compared to desktop ... |
I'm working on creating games on OS X, using the Cocoa framework, the probably only and best way to utilize all the capabilities of this operating system. Since Cocoa is MVC, I have to frame my games around this style. Is there any problem with framing your game using a MVC design? What can I do to make game developmen... |
I'm very comfortable with Swift, Obj-C, and Javascript but for a new project I need to use a library that is only available in Python. How do I integrate python or python scripts into an OSX project?
There is the option of going PyObjc or pyapp to build the entire application but that seems extravagant given that I onl... |
I saw this question that shows it is impossible to programatically determine if a javascript function is pure, but is it sometimes possible to affirm that a function is pure - so something like...
function sq_a(x){ return x * x; }; // no side effects, all variables local
function sq_b(x){ return pow(x, 2); }; // if `po... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.