user-defined

What is the best way to model user defined hierarchical relationships in a database?

Essentially, I want the user to be able to define a hierarchical model, but then I need to allow the user to store data within their defined model. Does this make sense? So the users will be able to create new "unit types" to be organised in a hierarchical way and decide how units of these types are allowed to be organised. A simple exam...

MPI user-defined datatypes, is what I'm doing safe?

First time using MPI outside some simple practice apps, and something's not going right. I have a class defined with the following members (methods omitted for the sake of readability and conserving screen space): class particle { public: double _lastUpdate; float _x, _y, _xvel, _yvel; bool _isStatic; bool _isForeign; ...

jQuery val() Method on a Custom Object

I have an object called ValueBox that I created like this: function ValueBox(params) { ... $.extend(true, this, $('/* some HTML elements */')); ... var $inputBox = $('input[type=text]', this); ... this.val = function(newValue) { if(typeof newValue == "number") { $inputBox.val(newValue); $inputBo...

ASP.NET User Defined Wizard

I am starting a project in which the end user would like to create a wizard via our web application in order to drive users to specific pages within the application by answering a series of questions. Has anyone had to do anything similar before? Are there any open source or purchaseable products that I can implement or build off of to...

How can I define a "Do-Nothing" sort?

Hi, I'm working on a system where I need to be able to sort a vector by a given predicate, which my classes shouldn't have control over. Basically, I pass them a derived class and they blindly sort on it. As one of the "delightful quirks", one of the sort patterns is order of entry. Here's what I've got so far. struct Strategy { vi...

User defined top level control in XAML

A normal UserControl looks like this in XAML: <UserControl x:Class="mynamespace.foo" ...namespaces...> <!-- content --> </UserControl> I'd like to be able to define my own top level object, along the lines of: <MyControl x:Class="mynamespace.mycontrol" ...namespaces...> <!-- content --> </UserControl> Where MyControl derives from a...

User defined conversion operator as argument for printf

I have a class that defined a user defined operator for a TCHAR*, like so CMyClass::operator const TCHAR*() const { // returns text as const TCHAR* } I want to be able to do something like CMyClass myClass; _tprintf(_T("%s"), myClass); or even _tprintf(_T("%s"), CMyClass(value)); But when trying, printf always prints (null) ...

call user defined function in jquery

Hi, I am trying to call user defined function in jquery. $(document).ready(function() { $('#btnSun').click(function(){ myFunction(); }); $.fn.myFunction = function() { alert('hi'); } }); I tried following as well function myFunction() { alert('hi'); } but it doesn't seems to work !! Any idea where I am wrong? Regard...

When to use a user defined Exception and some good examples/best Practices?

I would assume that most User-defined Exceptions are for Business Logic level exceptions, but what are some good reasons to use a User-Defined Exception and what are some good examples? Is a user-defined exception's only advantage that you can define a consistent Error Message? What logic can be written inside exceptions to make them t...

Performance - User defined query / filter to search data

What is the best way to design a system where users can create their own criterias to search data ? By "design" i mean, data storage, data access layer and search structure. We will actually refactor an existing application which is written in C# and ASP .NET and we don't want to change the infrastructure. Our main issue is performance ...

Where To Put User-defined Classes in Rails

I'm trying to to use this class http://robbyonrails.com/articles/2005/05/11/parsing-a-rss-feed but am not sure where to place the file so that it functions like a helper. ...

Deleting user-defined vectors - C++

Hi, I have 2 classes, say A & B. Class B has a destructor of its own. Within class A, I have a vector of pointers to objects of class B. The vector is as follows: vector<B*> vect; In the destructor for class A, how do I retrieve memory? If I cycle through the vector, do I retrieve each object and use delete on every retrieved object?...

Cast to user-defined data type in PostgreSQL

I have created a data type called id which consists of two text values: id(text, text) I now need to cast values to this data type before they are inserted into my table. How would I go about doing this? I created the type as follows: CREATE TYPE ID AS(id text, source text); ...

Set table names using user-defined variables in MySQL stored procedures

Hello, I want to create a table with a name taking from a user-defined variable. The following code doesn't seem to work (I get a MYSQL syntax error near CREATE TABLE line) Thanks in advance for the help SET @ratingsNewTableName = CONCAT('ratings_', 'anotherString'); CREATE TABLE IF NOT EXISTS @ratingsNewTableName ( `id` INT(11) N...

How is __eq__ handled in Python and in what order?

Since Python does not provide left/right versions of its comparison operators, how does it decide which function to call? class A(object): def __eq__(self, other): print "A __eq__ called" return self.value == other class B(object): def __eq__(self, other): print "B __eq__ called" return self.value...

How do I query an object collection using user defined conditions?

Sorry if this is a little abstract. I'm in the early stages of development. I have two object types: An object that needs to store a series of user defined conditions. An object that matches zero or more of the conditions defined in the first object. Here's a simple example of how it would run. A user creates several objects of ty...