Tag Info

New answers tagged

0

I would use Jupyter as my backend execution engine & you then can write your functions in several languages e.g. Julia, python or octave. https://github.com/ipython/ipython/wiki/IPython-kernels-for-other-languages


0

Let's note that how the code is stored is inconsequential; how it is executed is essential. Most probably your functions have a limited repertoire. Implement them properly, without storing in the DB. (I leave alone the question if a numeric integration implemented in Ruby a good idea. Let's assume you use something like Numpy of the Ruby world.) Now you ...


0

You could embed an interpreter (like Lua or GNU guile) into the program using the database. (I am not sure that coding your entire software in Ruby is best; coding it in C++ might be worthwhile) You would either store in the database expressions (that is string containing Guile or Lua source) in Lua or Guile, or you might store some bytecode or some ...


0

I don't know how different the functions you want to store are, but if you can isolate few different "types of functions" you could do something like this : Create several generic methods in your model which can make every special calculus needed with the help of some arguments : def integrate_over_an_area(args={}) #Do your calculus with your args. end ...


6

You are suffering from a common problem among engineers: that of over-optimization in one frame. The two classical constraints of computation are time & space. They are generally opposed; you cannot conserve one without "spending" another. The Y2K bug was in fact an example of this. Space constraints made programmers "save" two digits in the year, ...


9

You are mixing serialize with compress. Can use XML serialzation to store a form or class. You can compress text and store it in a binary. You might get all of 7:1 compression. For that compression you lose the ability to search the text which is the primary purpose of a database.


4

Well for one it would make querying the db outside of your program quite a hassle. I don't think the slight gain is worth the time effort, and this includes support on the db later on. If your goal is quick look ups you are also adding overhead to searching. Sure if you have large blocks of text it might be more worth it but a better approach might be to ...


4

Whenever a database has multiple concurrent writers, there are potential race conditions. In particular, if each writer tries to add a new row, they may all choose the same primary key if they're just doing max(...)+1, and then all but one of the inserts will fail. When a database has an "auto increment" feature, they're not saving you the trouble of ...


3

First of all, I wouldn't approach a clean architecture in PHP. One of the main goals of clean architecture is to allow the user interface to be considered as essentially a plugin to the application, allowing you to change between types of UI easily. By going with PHP you are restricting yourself essentially to web-based interfaces. If you are familiar with a ...


6

If you only care about direct reports, you do not need to use recursion. Every employee (except the CEO) reports to exactly one manager. If you want to know direction and indirect reports, you need recursion. This would answer the question "who are all the reports of this director, including managers, supervisors, and peons." It might not be at the same ...


1

Indeed, you are asking too much from your database. Databases are designed for DBAs and developers. Those are not the sort of persons who would usually consider that a..b = b..a in a context of a database or a program, and would naturally tend to put the minimum first, and the maximum second. Probably for that reason, the designers of the database you are ...


1

Definitely take a look at Waterline.js. It has support for dozens of databases, including MySQL, PostgreSQL, MongoDB, and others. It exposes a uniform query interface that works across relational and non-relational ("nosql") databases Documentation: http://sailsjs.org/documentation/concepts/models-and-orm


0

Similar to this question/answer and I've used the c# algorithim posted there in the past and it works like a charm here's the algorithim from the linked answer: public class SimilarityTool { public double CompareStrings(string str1, string str2) { List<string> pairs1 = WordLetterPairs(str1.ToUpper()); List<string> pairs2 ...


1

Your application code and your EDMX should be portable, i.e. you should not need to change either of them when moving between Environments. That means no database (or schema) names "hard-coded" in there or, if there are, you should be able to replace them using nothing more complex than a global Search-and-Replace. Anything "cleverer" and all bets are off. ...


4

TL;DR: You'd have to restrict all literals, not just the ones in WHERE clauses. For reasons why they don't, it allows the database to remain decoupled from other systems. Firstly, your premise is flawed. You want to restrict only WHERE clauses, but that's not the only place user input can go. For example, SELECT COUNT(CASE WHEN item_type = 'blender' ...


12

SQL injection occurs when a query is built by concatenating text from an untrusted and unvalidated source with other portions of a query. While such a thing would most often occur with string literals, that would not be the only way it could occur. A query for numeric values might take a user-entered string (that's supposed to only contain digits) and ...


44

There are too many cases where using a literal is the right approach. From a performance standpoint, there are times that you want literals in your queries. Imagine I have a bug tracker where once it gets big enough to worry about performance I expect that 70% of the bugs in the system will be "closed", 20% will be "open", 5% will be "active" and 5% will ...


7

SELECT count(ID) FROM posts WHERE deleted = false If you want to put the results of these in the footer of your forum you would need to add a dummy parameter just to say false every time. Or the naive web programmer looks up how to disable that warning and then continues on. Now you can say you would add an exception for enums but that just opens the hole ...



Top 50 recent answers are included