chaining

Naming Suggestions For A Function Providing Chaining In A Different Way

I've coded an experimental function which makes passed objects chainable by using high order functions. It's name is "chain" for now, and here is a usage example; chain("Hello World") (print) // evaluates print function by passing "Hello World" object. (console.log,"Optional","Parameters") (returnfrom) // returns "Hello World" I...

C++ method chaining including class constructor

Hello, I'm trying to implement method chaining in C++, which turns out to be quite easy if the constructor call of a class is a separate statement, e.g: Foo foo; foo.bar().baz(); But as soon as the constructor call becomes part of the method chain, the compiler complains about expecting ";" in place of "." immediately after the cons...

Combine SQL statement

I have 3 tables (follows, postings, users) follows has 2 fields -> profile_id , following_id postings has 3 fields -> post_id, profile_id, content users has 3 fields -> profile_id, first_name, last_name I have a follows.profile_id value of 1 that I want to match against. When I run the SQL statement below I get the 1st step in obtai...

How to determine which thread is created from another?

Is there any way in .NET for a thread to determine its 'parent', i.e. the thread that created it? I'm diagnosing a timing issue with a black box third party API and would like to find out what custom code of mine it is executing on which thread. ...

Need to make context available to C++ ostream insertion operators

For an API that I am working on, I want to allow the user to insert custom objects into an ostream, but these objects have no meaning on their own, and are too memory constrained to include an additional pointer or reference for context. (Think tens of millions of 16-/32-/48-bit objects in an embedded system with limited memory.) Suppo...

c# inheritance & chaining question

public class Parent { public virtual Parent me() { return this; } } public class Child : Parent { } new Child().me() is returning a Parent object. What do i need to have it return the Child object itself (without using extension and generic)?? ...

Linq chain queries execution order

I'm experiencing some performance issues using linq, that led me to my first stackoverflow question: The test function in the following code, is executed a differente number of times for these two linqs queries: int[] mydata = { 1, 2, 34, 5, 67, 8 }; var query = from i in mydata select new { i,v=test(i)}; var query2 = query.Wh...

Chaining a function in JavaScript?

I want to make a function that add an item to my localStorage object. E.g.: alert(localStorage.getItem('names').addItem('Bill').getItem('names')); The first method is getItem which gets the item for localStorage objects... but addItem would be a custom function. This chain of functions would finally alert Bill. So, how would I make t...

Runtime alignment of JComponents + chaining to RowFilters

Hello everybody. I'm currently working on a rather complex application. My job is to build parts of the GUI. The main area is derived for JTable and contains all application relevant data. There are a few elements on top of the Table, that allow the user to control the way the data is shown in the table. The options relevant to the task...

Method to create and store method chain at runtime.

The problem I have is that I need to do about 40+ conversions to convert loosely typed info into strongly typed info stored in db, xml file, etc. I'm plan to tag each type with a tuple i.e. a transformational form like this: host.name.string:host.dotquad.string which will offer a conversion from the input to an output form. For exam...

Chaining method PHP

<?php $sth = Framework::blah()->any_key['any_key_2']; ?> Hello, I want to get 'any_key' and 'any_key_2' in blah(), how I do that? ...

Inference logic rule selection problem

Tommy, jill and travelor belong to the Sc club.Every member of sc club is either a surfer or a bike rider or both.No bike rider likes a rainy day and all the surfers like a sunny day.Jill like whatever Tommy likes and likes whatever tommy dislikes.Tommy likes a rainy day and a sunny day. I want to represent the above information in firs...

Zend Framework Chained routes - getMatchedPath

I have several chained routes that handle the multi-lingual feature of my site. Sample: $languageRoute = new Zend_Controller_Router_Route_Regex('(de|en|es|fr|it|ja|ko|pt|ru|zh)', array(1 => 'en',), array(1 => 'language'), '%s' ); $defaultRoute = new Zend_Controller_Router_Route('*', array('module' => 'default', 'controller' => 'p...

Chaining methods and temporary variables, please clarify

Greetings, everyone! I have a class that receives a pointer to a "circle" (for example) and then adjusts its attributes via some "chaining" methods. Something like this: class CCircleSetter { public: explicit CCircleSetter( CCirclePtr circle ) : m_circle(circle) { } CCircleSetter & Radius( int radius ) { if (m_ci...

Resource garbage collected too early

I've created a PHP extension with SWIG and everything works fine, but I'm observing some strange garbage collection behavior when chaining method calls. For example, this works: $results = $response->results(); $row = $results->get(0)->iterator()->next(); printf('%s %s' . "\n", $row->getString(0), $row->getString(1)); But this seg fau...

Why is the Action Chaining in Struts2 not recommended?

What makes Action Chaining in Struts2 a bad idea? The link above suggests using Redirect After Post, via Redirect Result or Redirect Action Result. Is Redirect Action the way to go? ...

Jquery: how to: when UL is shown, have first LI animate 'left' 20px, then to 0px, then have the second LI do that, then third, etc.

When UL.chapters is 'slideDown', have the first 'chapters LI' animate the 'left' property to 20px, then animate back to 0px, then have the second LI do the same thing, then have the third, and so-on. with my code, they all animate directly after UL.chapters slides down, how do I make them do their animation 1 at a time, with the second n...

Should exceptions be chained in C++?

Hello, This may have been asked previously, but I search the stack and couldn't find any which really hit upon this. I just finished work on a C++-program where I've implemented my own exceptions (although derived from std::exception). The practice I've applied when one exception causes a chain reaction, propagating the error upwards a...

How does this implementation of chaining exceptions work?

Hello, I previously asked a question about how to chaining exceptions in C++, and one of the answers provided a nifty solution to how it can be done. The problem is that I don't understand the code, and trying to have this kind of discussion in the comments is just too much of a bother. So I figured it's better to start a new question e...

Write a jQuery Plugin that return values

I'm writing a jQuery plugin that stores some data in some cases. I'd like to write it in a very flexible way, where I'll can change an input parameter to obtain some value that were stored by the plugin. Explanation: When I call $("#any").myPlugin(), my plugin initializes creating a div and some a inside. Clicking on an a will store i...