declarative

How can I represent business rules in Excel financial models?

I'm creating a "one-period" financial model in Excel - that is, a model where the formulas are consistent in each column, so you can copy/paste/extend them as desired. I'm breaking out the model's assumptions into a separate sheet. For instance, I have a cell named monthly_sales; that's how many new customers I add each month. The formu...

Best way to explain declarative fallacy in C++?

Is anyone willing to help me craft a good explanation of why the following code is not correct, in that the author is attempting to write C++ code declaratively rather than procedurally? const double NEWTONS_PER_POUND = 4.448; int main() { double pounds, newtons; pounds = newtons/NEWTONS_PER_POUND; /* pounds equals 'unassigned va...

Dictionary of tags in declarative SQLAlchemy?

I am working on a quite large code base that has been implemented using sqlalchemy.ext.declarative, and I need to add a dict-like property to one of the classes. What I need is the same as in this question, but in a declarative fashion. Can anyone with more knowledge in SQLAlchemy give me an example? Thanks in advance... ...

User Interface Markup Language pros and cons...

I learnt about some declarative UI languages such as XUL for Mozilla/Gecko and HTA for Microsoft at Wikipedia. What would be the advantages/disadvantages of these markup languages? Why don't common OSes and Applications use these techniques? Do these languages impart flexibility to the system? Are there any OSes that use markup lan...

Problem with declarative statement at asp.net 2.0

Hi guys, wanna ask you for help. I am bit lost with declarative statement in asp.net 2.0. I want add specific class "selected" or "noselected" for A tag when current path is equal to path I provide. I tried st., but it is not working. The code is below: <a href="<%# DataBinder.Eval(Container.DataItem, "Url") %>" class="<%# (DataBind...

Is there a language and platform agnostic declarative GUI language that isn't XML?

Basically, I'm looking for a least common denominator declarative GUI language that would be perfectly suitable for rendering with JavaScript to HTML/CSS, with Python to wxPython and with C# to WinForms... emphasis on the least common denominator. Otherwise, I'm perfectly aware this is almost impossible. Basically, JSON for declarative G...

Appropriate operators for assignment semantics in a non-pure declarative language

I'm designing a declarative language for defining signal networks. I want to use variable bindings to represent groups of nodes in the network. It occurred to me that there are two types of "assignment" I wish to do for these variables. On the one hand, a variable should represent the output of a specific group of signal operators. T...

On declarative programming in C++

Often I face the problem of mapping the parameter space of one API onto the parameter space of another one. Often I see this solved by nested nested nested ... switch statements. And I was wondering if there would happen to be a library or a technique that allows you to 'declare' the mapping instead of 'program' it. A trivial example ...

SQL Alchemy default value function for simulating autoincrement within a unique group of parent-child records

I have a small problem that I think should be easily handled by SQL Alchemy but I can't seem to get it right. I have two tables with one being a parent table and the other a child table. For each child record it needs a unique ID but only with the context of the unique parent record. I am using the Declarative Base approach. I setup ...

C++ Declarative Parsing Serialization

Looking at Java and C# they manage to do some wicked processing based on special languaged based anotation (forgive me if that is the incorrect name). In C++ we have two problems with this: 1) There is no way to annotate a class with type information that is accessable at runtime. 2) Parsing the source to generate stuff is way to compl...

Why is SQLAlchemy/associationproxy duplicating my tags?

I'm trying to use association proxy for tags, in a very similar scenario to the example in the docs. Here is a subset of my schema (it's a blog), using declarative: class Tag(Base): __tablename__ = 'tags' id = Column(Integer, primary_key=True) tag = Column(Unicode(255), unique=True, nullable=False) clas...

Declarative_Authorization nested rules

My models are setup as Film :has_many :sections Section :belongs_to :film within my authorization_rules.rb I have role :author do has_permission_on :films, :to => [:edit. :update] do if_attribute :user => is {user} end end Which works fine when editing the film as their is a user_id field within film. Can I nest r...

What problems have you solved using constraint programming?

I'd like to know about specific problems you - the SO reader - have solved using constraint programming and what constraint logic language you used. Questions: What problems have you used constraint programming to solve? What constraint logic language did you use? I'm looking for first-hand experiences, so please do not answer unles...

declarative_authorization is_in operator

I have what seems to me to be a simple declarative_authorization rule, but I'm sure it's just my newness that is causing me to have problems getting it to work. I have a user and a group. A group has a many-to-one relationship with a user. A particular class (:asset) can have a user & group associated with it. I want to determine au...

Binary files parsing libraries for .NET

Hi. Recently I had a task to make a binary files parser, however it was the first time of using C#/.NET for this kind of problems. It was really simple to parse and extract data from the required binary files because of their simple structure (though I have to say it was unusual rather than the simple way C/C++; also as far as I digged ...

Retrieving many-to-many relation properties using SQLAlchemy

I have a many-to-many relationship in which the relation-table contains more columns than only the primary key. As an example, consider a slide show system in which each image could have it's own timeout, and a different timeout depending on the slideshow. A daft example, but it will have to do for the sake of illustration ;) So I imagi...

Are the implementation details of declarative languages inherently imperative

I'm reading 'Functional Programming' by Tomas Petricek & Jon Skeet and I understand the difference between declarative & imperative programming. What I was wondering is how are the primitive operators & functions implemented, are declarative languages constructed from imperative operators & functions. Cheers AWC ...

Authlogic and declarative authorizsation

Hello, I have a rails application based on Authlogic with LDAP for authentification, and declarative authorization for roles requirements. The problem is when i put filter resource_access in my controller, i got this error : undefined method `current_user'.... I had define the method current_user on the application_controller Any hel...

SQL: Help with a nested queries

Here is my schema: Suppliers(sid: integer, sname: string, address string) Parts(pid: integer, pname: string, color: string) Catalog(sid: integer, pid: integer, cost: real) bold indicates primary key. I want to write a query to find all suppliers who supply every part. Here are two queries I have already: -- get all parts for a giv...

GUI declarative language implementation

I've recently begun working on a project regarding GUI building using some form of declarative language. What i mean is that i need to describe an hierarchy of objects, without specifying the type of GUI widgets that will be used to "show" that hierarchy. For example, for some existing hierarchy H, using JSON notation (or something like ...