instruction
stringlengths
34
19.9k
I am working in a windows service (using VB.Net) for internal use of my department. When ever a certain type of exception (FooException for now on) is captured, I follow the same logic: Log the exception Send an email to someone. In order to reuse code and not to copy-paste the same lines in every catch FooException ...
I have a large XML file (about 75,000 lines) where I have to build a catalogue (houses) from. Building the lists works fine, but now I have a problem. The catalogue should have a detailed presentation page of one house. One house (<item id="123">) has about 800-1200 lines of data, based on the house type. Which is the ...
I am trying to explain the dependency inversion principle to my (mostly junior) colleagues. How can we define which one is the "high-level policy" and which one is the "low-level detail" in a software? For example, if our software automates workflow of several business applications, why do we say that the workflow auto...
Hello fellow programmers! I have a 2D graph which is best described as a Cartesian grid with traversible and non-traversible cells. I'd like to be able to detect subsets of this graph where the diffusion behaves anisotropically, i.e.: it is constrained by corridor-like passages. I initially turned to diffusion tensor ...
Leave a open database connection throughout the execution of the aplication, or for each time a operation will be executed a new connection will be created? Open throughout the execution: Open aplication -> Open connection; Operations -> use the opened connection -> commit; Close aplication -> close connection; For ea...
I'm pretty sure this is a question purely about aesthetics but I wanted to get all your opinions on it before I start proliferating this type of code in my codebase. Consider the following code: //Foo.h class Bar; class Foo { public: Bar& GetBar(){return *bar.get();} private: std::unique_ptr<Bar> ...
I’ve had this gut feeling about Windows Workflow (WW) for a while now. And, until now, I couldn’t think of the right words to say in order to explain it. Since I think I have a good way to verbalize it now, I thought I’d share. I believe there is a problem in our industry where a great percentage of developers take a l...
Not being a Java practitioner, I recently came to learn about the JAX-RS specification and Apache CXF framework. While still wrapping my head around all these things, I also read the this question on SO. Since MVC is a design pattern while JAX-RS is a specification, I was confused about the comparison. Granted my nasce...
I work in a small web development company (3 programmers) for a while. During the last year the company had hard times (less projects) and a few co-workers were fired, including our Production Manager. Having this person out of our team mean to us that we have to deal more and more with the company bosses (owners). It'...
I have been trying to wrap my head around MVC pattern for about 6 months.I've read tons of articles, Q&A, and blog posts about MVC and HMVC patterns, but I just simply don't get it 100%. I tried learning MVC by exercising one of widely used PHP MVC framework, CodeIgniter. I've implemented few internal websites for my c...
So there are 3 computers that I use to work on this project with, my home PC, work PC, and work Mac (for building to devices). The project has an SVN repository that two other programmers use so I can't commit broken code to it. The lead doesn't know how to use version control so the trunk contains art assets and every...
I am dissatisfied with the file comparison tools I have worked with so far. While no tool would be able to always predict the line matchings that make best sense, at least current tools should be able to do a better job when changes mostly consist of added and removed indentation. But the tools have I used end up match...
I'm working on a wishlist system, where users can add items to their various wishlists, and I plan to allow users to re-order the items later on. I am not really sure about the best way to go about storing this in a database while remaining fast and not turning in to a mess (this app will be used by a fairly large user...
I am trying to understand this: I wrote a code for points on a circle of radius 1. Note that the first and last point intentionally coincide. do i=1,imax X(i,1) = COS(-2*4.0*ATAN(1.0)*(i-1)/(imax-1)) Y(i,1) = SIN(-2*4.0*ATAN(1.0)*(i-1)/(imax-1)) print *, X(i,1)**2 + Y(i,1)**2 end do The code is supposed to be a circ...
I have successfully connected my microcontroller to my TV via through VGA adapter i made that convert digital to analog signals with the help of resistors. Currently i am utilizing 8 pins that I am using as 2 Red 2 Green 2 Blue 1 Hsyn and 1 Vsyn. I was thinking if there is a way to add 'A' Alpha in it, it's used for t...
I would like to convert this Java applet into an equivalent web app. This is my first time creating a web app, but I have some programming experience and time, and am willing to teach myself all of the necessary tools. By "web app", I mean an application which would work in browsers without requiring Java or Flash, for...
References and pointers do the same thing as I know. Is there any difference between them? If there is no difference, why we call them reference not pointer?
In an MVP application, what should be the most appropriate way to implement restriction to some UI actions based on the current user's privileges? For example, in a role-based security, different roles will have different access to some UI interactions on the same view. If, for instance, we have an online store, on the...
The general recommendation to record original scanned images used to be "use TIFF". But programmers need evolution of format for "evolution of software", and I need to evolve my system to change from TIFF to JP2. I have a big image storage (terabytes) for legal and scientific scanned materials, they need original reco...
I have a long time running project. Its been running for about 6 months. The project is very big. The lead developer/team leader designed the project and the whole project is in his brain. He knows all ins and outs. I also know almost everything. But I am not confident like him. Problem is recently he is charging qui...
I've been writing most of my javascript applications in an OO style close to what I would use for most other languages. However, this means that most callbacks need to have a reference to an object, and I generally handle that by using $.proxy (or dojo.hitch, or whatever the framework's tool for this is) to be sure tha...
My cousin (Age 10) who studies in Standard 5. He wants to learn programming and programming logic. Which book or resources should I refer? Is there any Good Data Structure book to improve programming logic specially for children?
I've been working on improving an existing library to be more maintainable after trying to implement a feature I wanted and found the code to be hard to alter. The library is a node.js grunt plugin called grunt-contrib-jshint and my implementation is in a repo called grunt-jshint-bfs. I've run a code analysis tool call...
I am trying to understand how stack frames are built and which variables (params) are pushed to stack in what order? Some search results showed that the C/C++ compiler decides based on operations performed within a function. For example, if the function was supposed to just increment a passed-in int value by 1 (simila...
Originally, this is a part of another question. Why is sizeof called a compile-time operator? Isn't it actually a run-time operator? And if it is indeed a compile-time operator, how does it help in producing portable code which runs the same in different computers ? Please explain in detail.
We have lots of user-generated images on our site. When users upload their images, we only store the original. However, depending on the page, we show different sizes of those images (small, medium, large, original). Is it necessary to store all sizes of these images or is there a better way? Currently, we are resi...
For performance issue I want the logging send to a new thread. While the main program can work, the new thread can write the error or other messages to a file without effect to the main program. How could I send all stdout to the new thread? Work to be done: create a new thread, ok open a file, ok create a pipe inside...
What is a XML schema in plain simple terms? What will be the problem if an XML doesn't have a schema defined? An example can be very helpful.
Can we create a program that print out its source code what if we (or the program itself) compile than the new program would have the same exact functionality what the original program has? So somehow it would reproduce himself in perfect clones that can reproduce too. The program shouldn't use any external files other...
I'm a member of a small new team and with one of our latest builds I noted that, VS2010 code files don't contain language formatting. So for example when I write down a Euro symbol in my code or use a "." or "," in numbers or use Pounds, Euro or Dollar symbols, those look ok in my code, but for a coder in Russia th...
In C# what is the best practice for encapsulating variables I need to use in multiple methods? Is it OK to simply declare them at the top of my class above the two methods? Also if I am using app settings from my config file should I use a getter? like this... private string mySetting{ get { return WebConfigurationMan...
In database managements systems lecture, my professor said that we can use Oracle etc. ui designing tools instead of using Visual C# or etc. He added that SQL is as strong as a programming language. So I wonder why do we still use these programming languages for desktop applications which mostly adds/deletes/updates re...
For example to read data from a website we do: HttpResponse httpResponse = httpClient.execute(httpPost); HttpEntity httpEntity = httpResponse.getEntity(); is = httpEntity.getContent(); The method that executes the HTTP request, returns a response, then we turn the response into an entity, then we turn ...
I notice that a property of codebases that I like hacking on is that it's quick to find the relevant code for some feature, without knowing much about the code base at all. For example, searching for a label in the GUI, and immediately hitting the code that implements that feature. This seems to be in direct tension wi...
here's the link of the app: https://play.google.com/store/apps/details?id=com.iatll.airlock I had studied AI in the final year of b.tech cs programme, and i do remember some algorithm of generating and solving the 8 puzzle game; we had to implement it in Prolog (tough times) But I'm not sure if the above mentioned a...
I have predicate, that enumerates through backtracking list of values. I want to find highest value from this list. For example: ranked_move(X,Y,R) :- between(0,10,Y), between(0,10,X), rank_move(X,Y,R). top_move(X,Y) :- % X, Y for highest R Right now, I have it solved by using findall and custom predicate that goes th...
I have been thinking about it and wanted some feedback, recently I thought about doing it like this: function foo(){ if ( !foo.prototype.statics ){ foo.prototype.statics = { // declare static functions/vars here } } if ( !(this instanceof foo) ){ return foo.prototype.statics; ...
I have written a rather small App with only one activity. From my understanding an activity has to be seen as kind of a view and controller in one class. But even for a little app, with 3 dialogs (made with AlertDialogBuilder and all those anonymous inner classes that come with it) my activity has 500+ LOC and became v...
I am thinking about starting a small project and I want to make its versioning with git. Bitbucket seems a good option for me with their free plan. I want to use it as the main tool for working with git since they have nice tools like a web-interface, Mac OS client, and so on. But, in order to have higher protection f...
Let's say I have BaseA and BaseB classes. BaseB can have to several references of BaseA instances. Now, we have two other classes, DerivedA and DerivedB that respectively inherit from BaseA and BaseB. How can I show in such a diagram that DerivedB should only store instances of DerivedA and not instances of BaseA? It ...
As the title says, if the user wants change their email address in the application, in terms of programming, what approach (process) to use? Where do you store the new email address until the user will confirms it?
I'm reading about SOA and the four tenets required to make a SOA application. I have tried different sources, but the explanations are twisting. I'm searching for something that is a bit less abstract. Is my interpretation correct? The four tenets is: Services have explicit boundaries Services are autonomous Services ...
Let's say we have an abstract class and let this class has only abstract methods. Is this abstract class different from an interface that has same methods only? What I am looking to know is if there are any differences both philosophically, objectively and in the underlying programming language implementation between a...
Working on my own I tought I need to learn that css3 shorthand properties, because - as I know now, it affects website's loading time, so I need to optimize it a little bit. I was thinking - is there any order how to write property values, when using shorthand prop's? For example: font: 1em/1.5em bold italic serif
I have a database that contains projects and each project contains many samples. I want a project level threshold value, to trigger highlighting when a field on the sample is above this threshold. I also want to be able to override the threshold at the individual sample level. So I can see two ways to implement this: ...
I have an internal database at my work. At the moment we are using excel to import data, but this is very error prone, so I would like to replace this with some javascript based application which exposes some of the data in lookup tables in dropdown menus, for our customers to fill in, on a public website. So my intern...
I put up a webpage advertising a particular birthday party. A simple html page served by apache2 on ubuntu server 12.04. I have a link on the page to a cgi script-Python-that asks the requester to submit text values that will be formatted and relayed in an email to the bithrday boy. What's a simple way to authenticate ...
The questions says it all, but a quick overview of the situation. I'm creating a Model which contains classes (all inherriting myObject) which have a large amount of interconnection. I want the controller to be able to create any of these objects any time, without modifying the Model. Only an explicit cal to the mod...
So my company is using TFS and SQL to Manage their Database (MS SQL Server). It integrates with the nightly build servers to do builds and produce scripts to build the entire Database. Also the Compare Schema tool that visual studio offers is really handy. We want to do the same with Oracle, Preferably with TFS if that...
How should we load balance listeners to a 3rd party service? e.g. We need to read gtalk messages via XMPP Listener and build an application using the interactions of the user with a chatbot. In such a case, how would we ensure that we can have XMPP listeners on multiple servers and we load balance the messages between ...
Is there a difference between HttpRequest and xmlHttpRequest in terms of security? Is one more secure than the other? Is it more secure to send important data such as passwords via HttpRequest than via xmlHttpRequest ? Is data packing in both done the same way?
Is it good to use nested classes or should I use namespaces instead? In context: I have a templated codec loader and a codec have In objects and Out objects template<class TypeOfData> class Codec { private: typename TypeOfData::In* reader; typename TypeOfData::Out* writer; }; On the other h...
In a recent interview I asked the interviewers "how do you go about evaluating new technologies and libraries (such as SignalR) and bringing them in to use?". They said they don't, that instead they write everything themselves so they don't have to rely on anyone else. The firm doesn't work for the government or defenc...
In Software Engineering Methodologies... The Evolutionary Development contains Exploratory & Prototyping... Is Exploratory Development same as Incremental Development... What do you mean by exploratory Development? The terms are taken from Software Engineering - Ian Sommerville
Been brushing up on my C++ lately, on Ubuntu QQ. I love the Qt framework for everything, especially building GUI's. I became quite familiar with it when using PyQt over the last few years. When using PyQt, I had some issues that are now more pronounced when using C++ with Qt: Qt has many extensions to C++ that are Qt ...
I'm looking into developing my entities so that they cannot be in an invalid state. In particular I'm starting with my Customer entity. This would have fields like: Title (enum) FirstName (string) LastName (string) Address (value object with another 6 fields) MainTelephone (string) AlternateTelephone (string) EmailAd...
I am talking about 20-30+ millions lines of code, software at the scale and complexity of Autodesk Maya for example. If you freeze the development as long as it needs to be, can you actually fix all the bugs until there is simply not a single bug, if such a thing could be verified by computers? What are the arguments f...
Does anyone know how to create an algorithm capable of making the figure just like in the picture, when given a set of specific points (3D array)
I'm trying to include a feature on my website that verifies retail gift card balances on cards previously registered at the retailer's website by the card holder. Can this simply be done by writing an algorithm that pulls and aggregates this data on my site?
Sometimes I hesitate between "More code to avoid unnecessary operations" and "less code but with redundant operations". Let me just take an example (Win32 API): I try to paint some controls manually when the cursor is over it. If the cursor is over this control and it is painted, then it doesn't need to be painted agai...
I have read that equivalence partitioning can be used typically for intervals or lists, e.g. I assume it can be used for every set of inputs. Anyway if the requirement says that allowed colors are (RED,BLUE,BLACK, GREEN), I cannot treat them like a list, right? I mean, testing one of them would not be enough because de...
Is it bad that I often find myself spending more time on program structure than actually writing code inside methods? Is this common? I feel I spend more time laying the foundation than actually building the house (metaphorically). While I understand that without a good foundation the house will cave in, but does it le...
I'm working in an organisation with limited funds. They can't afford a business account on Dropbox. However, they would find it useful to have all their files synchronized on local machines. I've recently looked at Python Sockets and it looks as though a custom script could achieve what they're looking for. I'm concer...
The values ​​of a function of two variables z = f (x, y), where x, y, z take integer values are stored in sql db. Calculate (appoint) the largest surface area of ​​the flat. By 'flat area' we mean an area about which for each pair of x and y lying inside the area about the value of the function is constant (z = const)....
I am in charge of a project on github that has files that are and are not code based. Specifically, I am worried about our SolidWorks files. How do I ensure these files are covered by the GPLv3 license?
I am working on an application, a module of which does the following financial operations sequentially: When a user requests for a certain amount to be transferred into her bank account: check whether any transaction can happen now? (transaction can be carried out only during a certain time period) check whether the u...
It seems that NoSQL concept not something very new and innovative, but these days become very popular. Why it become popular recently but not happen in the time when SQL is very popular?
I am learning how to draw a UML class diagram and after reading a few tutorials, I am still confused about the appropriate usages of Association type (The clear diamond and black diamond). I understand their usages but I haven't got a very concrete understanding on when to use them and when not to. For example in the ...
Let me explain my situation. I'm planning a kind of test case runner for doing testcases on external devices, which are microcontroller based. Lets consider the devices: Device 1 Device 2 There exist a lot of test cases which can be run with one of the devices above. For example: Testcase 1 Testcase 2 The main reas...
I'm a self-taught intermediate Python programmer; I frequently come across popular books on software development and programming written in other languages (often Java). Typical examples: Refactoring: Improving the Design of Existing Code Design Patterns, Gang of Four Test Driven Development: By Example The Art of Un...
As part of a ray tracer implementation, I need to compute the barycentric coordinates in a triangle in 3D in order to decide if a ray hits the triangle or not. In theory this could be done by simply solving a few linear equations. But due to the fact that the vertices of a triangle could have the same x, y or z coordin...
I assume that negative testing is an approach to design the test cases and so is equivalence partitioning. But I am not sure if NT is a part of ET. An example: A field can accept a numeric value from the range 0-10. So I have three partitions: to 0, from 0-10 and more than 10. Another invalid partitions would represent...
I was reading some Cthulhu Mythos stuff and started to think about those various signs and symbols that are used in the texts. Of course those are made by humans but point is that they look natural to human eyes. So, what kind of algorithm would be needed to create natural looking symbols and signs? How this problem c...
Many PHP web applications follow this model for installation and upgrade: Un-tar a source tar ball. Point Apache at the source. Navigate a web browser to the home page. Go through several web pages of set-up (e.g., checks for existence of libraries, asks for database connection information, creates or updates database...
I need some opinion. GCC was always a very good compiler, but recently it is losing "appeal". I have just found that on Windows GCC does not have std::thread support, forcing Windows users to use another compiler because the most exciting feature is still missing. But why really doesn't GCC still have threads support u...
In many languages (a wide list, from C to JavaScript): commas , separate arguments (e.g. func(a, b, c)), while semicolons ; separate sequential instructions (e.g. instruction1; instruction2; instruction3). So why is this mapping reversed in the same languages for for loops: for ( init1, init2; condition; inc1, inc2 )...
I'm just investigating the security and control of the Linux platform in comparison to Android. In Android there seems to be a huge development around security - Applications are required to ask for system permissions, and if the user grants that permission, then the system allows that application to execute with thos...
I am trying to calculate 95th Percentile from the data sets which I have populated in my below ConcurrentHashMap. I am interested in finding out how many calls came back in 95th percentile of time My Map will look like this and it will always be sorted in ascending order on the keys- In which key - means number of mill...
HTML5 is becoming more and more popular everyday. Many great online applications are now being created and described as pure HTML5 apps. (Like Muro) But I don't understand what is exactly so cool about HTML5? As far as I understand, it just adds few features for graphics that make good alternative for jQuery or Flash. ...
I started logging failed logins attempts on my website with a message like Failed login attempt by qntmfred I've noticed some of these logs look like Failed login attempt by qntmfredmypassword I'm guessing some people had a failed login because they typed their username and their password in the username field. Passwor...
Background: I have a updator feature in my program which will downloads updates to a directory specified be the user. Then user can install these updates whenever he/she wants by just opening them. These updates are nothing but a compressed archive file which is associated to be opened by my app. Problem: Now, I want w...
While learning to develop in PHP it has been easy enough that my short, one page, 20 line little scripts I could add "testing code" directly to my functions to figure out where I am or get close to the area in the code where the issue is found (for example, "print_r($var)," "var_dump($var)," "print 'you are here') type...
I am developing an app which allows a user to upload a maximum of 20 photos, the straight forward way is of course adding 20 columns to my database table but if the user only uploads 1 image, the remaining columns becomes redundant. Anyone can advice me on a more efficient way to design it? Thanks.
I have an epic which involves creating a mobile application which retrieves a user's data they have previously created in a web application and act on it locally. It seems logical to split the epic as follows; Mobile app which acts on local, mocked up data Mobile app which downloads data from the web app's api but wit...
Argument which is always made in favour of Clojure is that. The syntax is simpler and there is only one way of expressing code with no complicated rules. However Scala has loads of different types of syntax and constructs as compared to Clojure. But from last one week while trying to learn Clojure, I have noticed that ...
I'm working on a project where I have to give users the ability to build their own tables, each user can create more than one table. (the type of all data is string). The user can create a table and specify what columns he wants inside it. What is the best way to do that: to create databases dynamically to have a tabl...
I would like to know if there is a best practice for creating demo environments that substitutes database interaction into other forms of resource i.e. creating .json files containing the data that was supposedly returned from a webservice call. I wanted to know if there is already a standard way of obtaining the same ...
It's not clear how data consistency is provided for different branches. We have a large knowledgebase which is filled by the experts and delivered as updates to our clients. This data is also used for testing the product. But if we have quite a few feature branches (being developed in parallel) and each feature requir...
Why does Haskell have a built-in if/then/else, which is dependent on the Bool type, instead of having a simple library function? Such as if :: Bool -> a -> a -> a if True x _ = x if False _ y = y
I am new to C/C++. Wanted to know why we cannot declare 'extern C' for C++ macro's similar to methods/functions...which will allow macro's defined in C++ file to be accessed in .c files. Thanks in Advance
FP proponents have claimed that concurrency is easy because their paradigm avoids mutable state. I don't get it. Imagine we're creating a multiplayer dungeon crawl (a roguelike) using FP where we emphasize pure functions and immutable data structures. We generate a dungeon composed of rooms, corridors, heroes, monste...
Imagine we're creating a multiplayer dungeon crawl (a roguelike) using FP where we emphasize pure functions and immutable data structures. We generate a dungeon composed of rooms, corridors, heroes, monsters and loot. Our world is effectively an object graph of structures and their relationships. It sounds to me that...
I'd also want to know how can I draw them.
I am trying to measure the running time of different crypto algorithm. e.g. how long it takes to encrypt/decrypt a block of plaintext. May I ask if C with OpenSSL is the best PL to do this?
There are a lot of methods like this in iOS/Objective C: - viewDidLoad - viewWillAppear: - applicationDidFinishLaunching I've just been having a discussion with some colleagues about this design choice and why they would choose to be so verbose in preference of the more "standard" ways of event propagation for instanc...
I have created an ObjectParser class which parses data into strongly typed objects using an IObjectParserDataSource as the data source (the data could be an Excel file, text file, array, query string, etc). Examples of my implementations of IObjectParserDataSource are: TextFileObjectParserDataSource ExcelFileObjectPar...
What is the best way to prove to my boss that in code documentation is greater than extensive external documents containing documentation and screenshots of code/ui? We have a group in the company running SAP code. Their documentation process involves hours of laborious documentation and screenshots of the code and th...
I have built a framework for my applications that has been working well, and I have always referred to it in my mind as an MVC. However, after reading some more on what an MVC is (not that I didn't to start with, but I gave it a very brief overview, and looked at other frameworks that used the mvc pattern), and it has ...
As many know, mobile development is skyrocketing these days and, I believe, it affects what we code. To be specific, I am interested in developing web services for a mobile application. I see two possible architectures - RPC and REST. I have developed both, REST and RPC services and what I have observed is that RPC ser...
It is our first game and we are a start-up. We had a programmer who suddenly is seeming to be a dead weight. Though we knew him personally we thought that he was as motivated as we are and hence I never looked for a code review or documentation. Now it seems that he is slacking a lot and we want him out. Now during a c...