instruction
stringlengths
34
36.1k
I downloaded one of the projects using vc++ and using visual studio 2008. The problem is some of the files are in .lib format, to understand the project completely i want to know the contents of this lib files. Is it possible to extract this .lib files into C files (I am assuming they are written in C).
I'm trying to convert a set of SOAP-based services to a RESTful API. I started by identifying resources by analyzing operation names and I got the resource Subscription. When I need to update the state of the subscription, I cannot simply send a POST request to the server, because I don't have direct access to the res...
I have some network device(IOT) that contain temperature sensors to collect the temperature of milk mixing tanks and send that temperature to another networked computer.I have more than 100000 of tanks to collect data.Data collecting interval is 5 seconds.It's requirement and cant change the 5 second interval. Then an...
I read on http://spark.apache.org/ that Spark supports cyclic data flow. How can data flow be cyclic if the RDDs used by Spark are immutable? I thought the processing done by Spark looks like an acyclic graph where the nodes are RDDs and the edges are transformations.
I know MP3 is not open source format but proprietary and I found this website http://mp3licensing.com/help/developers.html that states that you need a license for basically everything that uses MP3. But the thing is that even hardware devices that support MP3s need license. So if a mobile phone is able to play MP3s al...
I'm starting the modeling of the following problem: I have many clients (millions) that interact in a network forming a graph. At the highest granularity of my business problem, each realationship has 3 attributes. In the "realistic" worst case scenario, the nodes compose a unique mesh, having relationships with ~100 o...
I'm not so sure whether this questions fits here, but I need help in this case, cause I'm searching for days to apply this. I have a website of rugs and carpets, in this website I would like customers to be able to change the rug colour by clicking on some part of a rug and change the colour using colour-picker. For ex...
I am looking to formalise an algorithm that I have created, however, I am having trouble knowing how to correctly use Greek symbols (such as Epsilon, Omega etc.). Are there any guides/standardised way of doing this? This is an example of an algorithm that was previously worked on that a college formalised. Does a "glo...
I am using mercurial on my project. Now I face following problem: I have two separate mercurial repositories with their own history. Now I need to have identical branches/bookmarks for both of them. But this leads to lots of potential problems: somebody merged first repo and forgot do same for second created a bookma...
In one of youtubes videos about scalling web sites I found the statement that, however, in term of scallability, noSql is easier and more flexible, though it is better to use SQL for data important enough to not want them be lost (not necessarly secure). Why is so? What mechanism make SQL safer in such term? I'm very V...
I have question based on the following fragments of "Clean Code". Those have been cited before, but I wanted to ask more basic question. 1. Data/Object Anti-Symmetry (...) the difference between objects and data structures. Objects hide their data behind abstractions and expose functions that operate on that data...
I have a stream parsing method in C# that reads portions of a protocol frame from the STOMP protocol; the specification isn't the important part for the question though. What is important is that I have written the code in an imperative style, since that is what I know. Can anyone give some examples of processing in a...
I'm writing the Fortran bindings for a static library written in C++. This will be distributed with the library (both open source). The bindings consist of modules containing interface blocks and no executable code. The question is: Should the modules be compiled with the library (possibly at the user's request through...
This is probably a common question and I've been reading a lot about this, but I can't look into a solution. Let's say I have an enterprise application in one glassfish server located in New York. Then, my application grows very fast and I need another server with a loadbalancer. Now my application is running in two d...
OK so a lot of code review is fairly routine. But occasionally there are changes that broadly impact existing complex, fragile code. In this situation, the amount of time it would take to verify the safety of the changes, absence of regression, etc. is excessive. Perhaps even exceeding the time it took to do the develo...
Is it good practice to code entire business form as single component (control) and then proudly put it on window/form as the final step in development? Of course, this form can involve some other custom components/controls, e.g. business applications can use custom controls for selecting partners, stores, goods, becaus...
I’m implementing glossary/dictionary in Javascript. It is populated with a set of terms and their definitions internally, then gets handed jQuery elements and searches the HTML, replacing any of the terms it finds with a link to their definition. The current implementation runs by forEaching the dictionary over the H...
C# has made a language feature of the NotImplementedException. It's added to a lot of auto-generated code, such as event handler stubs: // Auto-generated private void TextBox_MouseDown(object sender, MouseEventArgs e) { throw new NotImplementedException(); } What makes this exception useful? a good language featu...
Suppose you have top level Dependency A. Dependency A is licensed under MIT. Dependency A packages Dependency B as part of its distribution. Dependency B is licensed under GPL. In order to use Dependency A, do you need to agree to the terms of both MIT as well as GPL, or just MIT.
Generally what kind of algorithm is used to solve when dealing with overlapping data sets . In the below problem set, we can see that region (point 2 to point 3) is common to both statement A and statement B. Problem Set Statement A : Point 1 to 3 --> Speed is 30kmph Statement B : Point 2 to 5 --> Speed is 50kmph Goal...
I'm so confused about how Void operator (in javascript) works and what is it's role. as i read, Void is an operator that evaluate an expression without returning a value, but by executing that script for example: <html> <head> </head> <body> <a href="javascript:void(alert(1+1))">Click me!</a> </body> </html> ...
I am having a concept problem at this point & I can't find any info about the differences between Test (UnitTest, etc) vs Spec (Rspec, etc). As far as I know, specs is into Integration tests and test is into UnitTest but just that. Can you explain what the differences are?
Say you've just started working in a very small team on a {currently relatively small, though hopefully bigger later} project. Note that this is an actual project intended to be used by other developers in the real world, not some academic project that is meant to be scrapped at the end of a semester. However, the code...
I'm unit testing a class which has two dependencies, both of which are external packages (I'm using C# so these are NuGet packages, AutoMapper and CompareNETObjects). (NOTE: Both are just utilities, related to converting an object from one type to another, and to comparing objects. Neither makes any external calls) ...
I have a Windows Form for creating configs. It has around 50 fields of data, which represent a group of entities, that I need to capture when the user presses the save button. Currently, on the press of the save button I build the group of Entities by creating each entity, extracting the information from the controls a...
I have one ArrayList in Java and a save the socket and one unique id. When someone client is add in the ArrayList, the unique id i have is NOT the same with position in ArrayList. When someone client is gone i remove the client from ArrayList put i need to find the unique id. My problem: Is when i want to send informa...
Is concurrency and idempotency mutually exclusive for a REST web service or can it be done so a service can be both concurrent and idempotent? Using a optimistic lock methodology like using Version property seem to be preventing a method to be idempotent if I'm not mistaken? For example, let's say you have User A wanti...
In my last company, on handling view commands, in the ViewModelBase there were one central command implemented, like public ICommand ToolCommand { get; set; } And in the ViewModelBase, it's been initialized, and all buttons hooked to this Command were differentiated by its Command Parameter: public ViewModelBase() { ...
I made a simple responsive single page web app (about 5 views) to replace our old jsf web application using angularjs+bootstrap. Now looking into frameworks like ionic, cordova and trigger.io. what I don't understand is, am I supposed to directly reuse my responsive web app code in, say, ionic framework? I know there a...
Martin Fowler describes the Flag Argument code smell as a "kind of function argument that tells the function to carry out a different operation depending on its value". Answers to Is it wrong to use a boolean argument to determine behavior? seem to conflate all boolean arguments with flag arguments. I think that quest...
I come from java, when I got an expected error I printed stack traces. I'm coming now to work on nodejs (never really worked on javascript). and in the nodejs project which I need to maintain (project was already coded by other javascript developers) I see error logging following: logger.error('some message ' + e.mes...
This may be more of a software design question - but I've been working on my first "real, non-academic" Java project and have recently learned about good code practices (such as breaking down methods into respective classes, so that my controller class doesn't necessarily have 50+ methods all together) - and it's led m...
tl;dr: "Am I, with any given location, inside of any number of circles with varying radii" Assume you have a database full of locations (coordinates) with arbitrary radii. Now the user enters and provides the backend with their current location. How would the backend efficiently figure out which locations to return? ...
I am relatively new in terms of Java web development skills. I have a project that I think would make a good candidate for a RESTful service from what little I understand about APIs. I'm trying to get into the details of how this is supposed to be structured, but not really getting anywhere in terms of google searches ...
My college professor told me that main functions should be defined on top of other function definitions. We should use a forward declaration in order to accomplish this (we use C at that time). So yes, my question is why should main() be on top of other function definitions? Does this apply to all programming languages...
I am looking at A SAT-based Public Key Cryptography Scheme and got inspired to challenge myself to write an implementation of this Cryptography Scheme on Python. A part of the cipher encoding would be to generate random Boolean functions in Algebraic Normal Form in a certain set of binary variables. I am new to codin...
Modern PHP is mostly written Object Oriented. Other than the fact that there is inertia towards the Object Oriented in the PHP community, is there anything about the language itself that would make it a poor idea to use functional programming?
I'm looking at the alternative that can substitute the use of eval() and new Function() javascript techniques. I'm developing a solution build with javascript and the platform on which it is built (Salesforce) recently has announced they're introducing CSP (content security policy) that will block the use of eval(), an...
I am working on the frontend of a product, and it is now broken due to bad data from the backend. This can be caught internally before it gets anywhere close to production, but we end up fiddling with our fingers as the backend is being fixed. (Hence why I'm here...) I have some hackish fix that does a sanity check, in...
The very popular IntelliJ IDEA‎ has currently saved a lot of dependencies as actual jar files in their git repository e.g.JUnit, which I don't understand. Build tools like Maven provide excellent dependency management abilities. Of course Maven dictates a lot of how the build has to happen (source), but imho that is a...
How do I create a dictionary of synonyms that is efficient in terms of retrieving synonyms of a word? Basically, I want to use some sorts of data storage to store groups of words, and enable an end-user to request any word and be prompted with all the other words in its group (its synonyms). Afterwards, I want to be ab...
So I have been working on a C# Matrix library. I've been documenting it really good so far. The thing is I don't know if I should document my overloaded operators, I mean, it is kind of obvious, isn't it? Sample code: public static Matriz operator *(Matriz A, Matriz B) { if (A.map.GetLength(1) != B.map.GetLength(0...
A method getReminder takes two integers and returns r = (a^5)%m. This method relies in two BigInteger numbers BigInteger.valueOf(a).pow(5) and BigInteger.valueOf(m), but BigInteger was never declared. At the same time, int was declared twice even though just one int is enough. I realize that int doesn't cost much spac...
How do I name API endpoints that serve the same entity in different ways and still adhere to the RESTful API guidelines? Let's consider I'd like to get a customer with ALL his details. I just expose a GET endpoint at address "/customer". Now I'd like to check if a customer with a particular customerId exists. What d...
This problem came up while designing the API for a SPA web application, which communicates with the server via AJAX. On one page the user, who is creating a list of people to invite to an event, has the option to add people who were invited to previous events. Imagine a dropdown containing the names of the previous ev...
In other words, is it possible to create a PCRE "regular" expression which takes Ackermann(m,m) time for an m length string?
We have multiple tables which we need to retrieve data from and dump to one centralized table. Currently what we are doing is running an ETL job made from Pentaho, retrieve the records from the source tables, and dump it in the destination table, this runs every 5 mins. But now, we are required eliminate or at least le...
I've got a Java Script object like this: let obj = { selected; true, level1: { level2: { selected: true } } level1: { selected: true, level2:{} } }; I want to remove all instances of 'selected: true'. How can I do this? I need to solution to be generic be...
abstract class Product { public abstract Product createProduct(); ... } class OneProduct extends Product { ... static { ProductFactory.instance().registerProduct("ID1", new OneProduct()); } public OneProduct createProduct() { return new OneProduct(); } ... } class ProductFactory { p...
I am currently using MVP pattern to develop an android application. I have to implement pagination (i.e. on scrolling at the bottom of the RecyclerView I need to fetch new data). So what is the best way to handle current page state in this scenario?
We are a few developers develoing an enterprise project includes several modules and approximately 200 UI resources for our company. Project will be written/programmed in Asp.NET MVC, WCF services for each module, and layered structure adhering to design pattern pirinciples and within the scope of an enterprise applica...
So me and my friend came up with a rather interesting (maybe?) algorithm question but ironically, we are having a hard time solving it. The question goes like this: There is a sale of precious stones going on in a city of the Rich. Each stone on sale has one or more variants of it. For example, a diamond can be round, ...
We have a REST Webservice build with Symfony3 and PHP7. The application is served via Nginx and PHP-FPM. The Webservice returns a list of products. Products inside the list are filtered by attributes. The result would be the list with a subset of its products, filtered by attributes. Those attributes are send via GET p...
I am currently trying to refactor a piece of C# code that is somewhat procedurally written. I want to make the design clean, object oriented and using classes with single responsibilities. The code contains a class "Solution", which represents a Visual Studio solution and only contains data. This class is used by other...
Why does Twilio offer: Trunking REST API docs - Provision, configure, and modify SIP Trunks and phone numbers with the REST API. What are the top usages for this API? I appreciate that the process can be automated, but to what end? Is it really so time consuming to click the buttons? I'm having a fundamental diffi...
I am transcribing thousands of lines of computational code from MATLAB to C++. I don't fully understand the math myself, but I can run it with MATLAB, assume it's correct, and compare the results to my C++ code. The issue is that the precision I get is very inconsistent. Sometimes MATLAB gives me four significant digit...
Today, an interesting discussion with a colleague. We're going to create a wrapper for WCF's channels, that will handle the Close(), Abort() and Dispose() correctly. This wrapper is to be used instead. A coworker argued that this was like creating a domain specific language. He opposed the idea, saying it would impose ...
Assume an application with a layered architecture, i.e. presentation, business/domain/logic, data access: it makes sense to plug access to external APIs in at the data layer if what they do resembles data operations. For instance, a DLL that simply performs CRUD operations against a particular data repository would g...
In the accepted answer to "Encrypting stored data for multiple unique users to access information", @lserni describes a mapping table for users. But among the operations for the table, they didn't mention adding a user, nor "forgot my password" reset requests, which are required for my (growing/changing) environment. H...
Say I have a company directory application, so Companies have Employees. It's pretty clear to me why you would have the following GET endpoints: api/companies # Get all company records api/companies/{id} # Get company with specified id api/companies/{id}/employees # Get all employees for the co...
In OOP there is a common pattern of using listeners and events. Recently I've come upon a task where two opposite listeners were setup to accomplish needed logic: private ValueChanger createValueChanger(UIComponentFactory f) { // ValueChanger is some kind of user facing UI component ValueChanger comp = f.create...
In my web application users can submit their advertises and buy package for advertise (packages are used for priority of showing advertises) Database schema is like this: **Package: id, title, priority(integer) **PackageDuration: id, package_id(fk), duration, title **Advertise: id, title, content, ... **Order: price, u...
This is a small C++ application (and the table is not huge either) so if possible I would like to avoid include anything other than STL (and boost). So to the problem: I have a table of predefined matching of input and output conditions. This table contains 4 input variables (states), and their combination leads to 1 o...
So I've developed a website for a client, however he used to use this url with a re-direct to 'another' site of his. I had the re-direct cancelled, but whoever visited their old website before, still has it in their cache that it redirects to the old site. This can be solved by a browser cache clean-up, but I was wonde...
I'm looking for information on searching (filtering) high-dimensional data. I'm not interested in nearest-neighbour search or clustering, but rather filtering/sorting by subset of dimensions - like in relational algebra. Unfortunately my google-fu points me mostly towards spatial indexes or already mentioned nearest-ne...
Let's say I have an object A, which is too big(having too many methods and variables). So, I break it down to smaller objects. After that, I have Object A, B, and C. Obviously, Object A is from Class A, Object B is from Class B and so on. Unfortunately, I got dependencies: A depends on B, and B depends on C. Ultimately...
I've decided to lean SDL and make a Snake game. I have gotten to coding the spawning of a fruit, which the snake eats to get longer. Every time the snake eats the fruit, the fruit needs to change to a random position on the screen. I can either simply change its coordinates to new random ones, or I can trash the old fr...
I created a Python package and licensed it under GPLv3. When I created an account on PyPI, I had to agree to the following: The PSF is free to use or disseminate any content that I upload on an unrestricted basis for any purpose. In particular, the PSF and all other users of the web site are granted an irrevocable...
This question on StackOverflow presents a minimal Win32 program written in C which launches some processes (Notepad and Calc) using CreateProcess. The OP's issue is that the windows of these programs appear in the background, behind the Explorer window from where the sample program is launched. Though the question is ...
Even though I have a decent bit of professional experience with object oriented programming in Java and a basic familiarity with C, I've run into a bit of a mental block with C++ that I was hoping other developers could help me shine a light on. In Java, almost every time I define a class I naturally create a new .java...
As an example, I have database select query that returns n columns and I didn't know how many rows return (lets call x number of rows return). Sample code (c++ and SQLite): while (sqlite3_step(res) == SQLITE_ROW) { printf("\nCOLUMN1 :%s", sqlite3_column_text(res, 0)); printf("\nCOLUMN2 :%s", sqlite3...
This is ALMOST a direct duplicate of (What is the netiquette for forking other people's open source projects?) except that I could not find my answer there, and I cannot comment (because I don't have enough reputation yet). Here's my scenario: I have a public fork of a public GitHub project (https://github.com/fengyuan...
I am writing a program for monitoring communications between a server and multiple clients on a network. In particular Websocket protocol based communications. I construct monitoring objects for every client that connects to the server and route the information and trigger events for logging purposes. I am looking for ...
I am working on a complex widget with a "preferences" object tree with 50-100 objects and 3-5 properties in each object. Each property is watched by Angular and controls how some aspects of the data are displayed. The user can directly change each preference via inputs in the widget and I want to save the preference tr...
Is it wrong to add fields to exceptions? I have a problem that happens and I'm thinking of adding considerable information to an exception, but it sounds weird: an exception with getters. What you think about this?
Say you have a smartphone with two browsers, DefaultBrowser and OtherBrowser. You visit the webshop by opening Otherbrowser, and proceed through the cart steps At the end, you go from OtherBrowser to PaymentApp to pay. After you've paid, PaymentApp closes and opens the confirmation URL in the DefaultBrowser. And th...
Java arrays only allow subscripts to range between 0 and N-1 for an array of size N. The class below aims to remove that constraint by allowing the class user to specify the valid subscripts for a one dimensional array of integers. public class BoundedIntArray { private int[] array; // further state required ...
So, there are many times where I have to do things with my REST API that seem outside the boundaries of REST. In this particular instance I need to have an endpoint that checks whether a member is eligible for free training or not. I could possibly add this information onto the Read endpoint but that means that its go...
I've been looking at the Dolphin 5.0 release trailer. They made a big deal about "zfreeze" fixes, and proceeded to show a few comparisons between the old and new versions. They keep mentioning how it was previously thought to be impossible to implement zfreeze in the emulator. My question is, what is zfreeze, why's it...
I was reading this post on what it takes to become an elite developer: http://www.aaronstannard.com/what-do-you-need-to-become-an-elite-developer/ It says: "Write code for patterns, not specific instances". What does that mean? Always write your program using a predefined design pattern rather than your custom solution...
Consider a web page where a user changes his password after clicking on an emailed password reset link. The page will be implemented against an API using ajax, rather than as an ordinary form submission. That is, this question is about designing an API endpoint for changing a password. Requirements Any time a password...
Is there a single word that can describe JavaScript functions, variables, and objects? I was thinking "entities", but that word is usually used to describe the mapping between objects and a database. And I'm trying to be more descriptive than calling them just "things". Also, "concepts" or "ideas" seem a bit too abs...
How is the C language portable to any instruction set (I mean for new architectures)? Do we have to write a new C compiler for each new architecture?
I am searching for a universal algorithm that shifts pitch and time while keeping the sample rate. (I am trying to program a sound generator (sine, triangle...) as an exercise) I just want to squeeze the samples of the sound together so it appears to be shorter and pitched higher. It's easy if you want to speed it up w...
I am about to release my first ever app, I have used a library that is licensed under Apache 2.0, my question is do I need to communicate with the library owner before I release it or in case I decide to monetize my app am I by any means obligated to sharing my revenue with the library developer? lastly do I need to ma...
In object oriented, we have requirements, use cases, and UML which can form a nice conceptual framework. The goal there, is to define objects, their responsibilities, behaviors and communications between them. What would be the equivalent in functional programming world of objects / responsibilities, behaviors and com...
I have the following scenario: client asks to develop an application for his company. It will be a simple frontend, rest api and Oracle database. It needs to be installed on 15 devices which will work in a local network and use some rest api to save/read data from database. Now the question is: can I deploy this app to...
The 0-1 knapsack is a well-known algorithm that solves the problem of finding the maximum profit P of putting some of n object( each of weight w and profit p) in a bag of capacity W. How can I use the same algorithm to find the maximum profit of putting sum of the n elements in more than one bag? I'm trying to solve th...
I have modeled a problem as a graph that consists of many trees. Some of the nodes in the graph may belong to more than one tree. I am trying to describe a subset of paths in the graph with as few nodes as possible in order to store them efficiently. All paths start from a root and end at a leaf node. Below are a few e...
Let's say I have such code (and its meaning is like in C#): class Foo<T> { public T my_field; } and later in code I have: var foo = new Foo<int>(); foo.my_field = 5; My problem starts with the Foo<int>. What I currently do is I take type Foo<T> and mapping T -> int and clone the surface of that type. Surface beca...
I am trying to create a program for managing employees. I cannot, however, figure out how to design the Employee class. My goal is to be able to create and manipulate employee data on the database using an Employee object. The basic implementation I thought of, was this simple one: class Employee { // Employee data...
In the merge_sort part, there are multiple calls to the same function within the recursive. How are the other two executed when the definition holds that till a condition is false, the recursion does not stop? T tempArray[right - left + 1]; int pos = 0; int left_pos; int right_pos = mid + 1; ...
When modeling bigger domain entities you will probably have some kind of relation between these entities. These relations will usually result in entities referencing different entities. If i am not mistaken, there are two ways of modeling these relations: Aggregation ( A uses B ) Composition ( A owns B ) When modelin...
My Controller code: ObjectMapper objectMapper = new ObjectMapper(); objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); ObjectReader objectReader = objectMapper.reader(User.class); ..... .... response.setData(userControllerDao.updateUserDao(user, id)); My Dao code: public List<User> updat...
While I'm trying to design classes based on DDD principles, I'm quite confused for this particular "pattern". For example, ScholarshipProgram contains many Cycle. They seem to be aggregate to me. But Student only apply to a Cycle not the ScholarshipProgram. Should I design it to be like this: This seems to break ag...
I am reading the classic book on C - The C Programming Language Book by Brian Kernighan and Dennis Ritchie. The preface of the book says All examples have been tested directly from the text, which is in machine-readable form. What does this mean?
I have a video coming from a stationary camera. Both the resolution and the FPS are quite high. The data I get is in Bayer format and uses 10 bit per pixel. As there's no 10 bit data type on my platform, the original data is stored in memory using 16-bit words. I want to implement some kind of lossless compression of t...
Please forgive me if this question belongs on different StackExchange site. A much more experienced colleague (like, 8 times more experienced than me) has vigorously defended an idea that you should check multiple hash types (md5, sha1 etc.) as well as size to be absolutely sure that given file is not a duplicate of an...
I was recently hired, and I found two exact applications with a single extra service in the duplicated version, and of course each application points to separate databases. However, the original version had some vulnerabilities that I need to duplicate again on the copied version. Thus, the raised question is: should w...
Can one define a section of an HTML webpage to download (typically using HTTP), instead of the whole file, and utilize this in a program to save bandwidth? For example, in C# (but I guess the language is not important).