Search Results

Search found 7 results on 1 pages for 'arkadiy'.

Page 1/1 | 1 

  • Is this a pattern? Should it be?

    - by Arkadiy
    The following is more of a statement than a question - it describes something that may be a pattern. The question is: is this a known pattern? Or, if it's not, should it be? I've had a situation where I had to iterate over two dissimilar multi-layer data structures and copy information from one to the other. Depending on particular use case, I had around eight different kinds of layers, combined in about eight different combinations: A-B-C B-C A-C D-E A-D-E and so on After a few unsuccessful attempts to factor out the repetition of per-layer iteration code, I realized that the key difficulty in this refactoring was the fact that the bottom level needed access to data gathered at higher levels. To explicitly accommodate this requirement, I introduced IterationContext class with a number of get() and set() methods for accumulating the necessary information. In the end, I had the following class structure: class Iterator { virtual void iterateOver(const Structure &dataStructure1, IterationContext &ctx) const = 0; }; class RecursingIterator : public Iterator { RecursingIterator(const Iterator &below); }; class IterateOverA : public RecursingIterator { virtual void iterateOver(const Structure &dataStructure1, IterationContext &ctx) const { // Iterate over members in dataStructure1 // locate corresponding item in dataStructure2 (passed via context) // and set it in the context // invoke the sub-iterator }; class IterateOverB : public RecursingIterator { virtual void iterateOver(const Structure &dataStructure1, IterationContext &ctx) const { // iterate over members dataStructure2 (form context) // set dataStructure2's item in the context // locate corresponding item in dataStructure2 (passed via context) // invoke the sub-iterator }; void main() { class FinalCopy : public Iterator { virtual void iterateOver(const Structure &dataStructure1, IterationContext &ctx) const { // copy data from structure 1 to structure 2 in the context, // using some data from higher levels as needed } } IterationContext ctx(dateStructure2); IterateOverA(IterateOverB(FinalCopy())).iterate(dataStructure1, ctx); } It so happens that dataStructure1 is a uniform data structure, similar to XML DOM in that respect, while dataStructure2 is a legacy data structure made of various structs and arrays. This allows me to pass dataStructure1 outside of the context for convenience. In general, either side of the iteration or both sides may be passed via context, as convenient. The key situation points are: complicated code that needs to be invoked in "layers", with multiple combinations of layer types possible at the bottom layer, the information from top layers needs to be visible. The key implementation points are: use of context class to access the data from all levels of iteration complicated iteration code encapsulated in implementation of pure virtual function two interfaces - one aware of underlying iterator, one not aware of it. use of const & to simplify the usage syntax.

    Read the article

  • Sync between ms exchange calendar and Java app

    - by arkadiy
    Hi, we are developing a CRM app which holds customer meeting info. Users have requested that their Outlook calendars should reflect the activity they have booked in the CRM application and vice versa. Is there any solution to achieve this? Preferably not using any plugins or installs on the end user's PC?

    Read the article

  • jruby/activerecord-jdbc/tomcat/DB2 ready for enterprise?

    - by arkadiy
    I am trying to introduce RoR to my company and I have two ways of doing so in my mind: (1) rails/ibm_db2/passenger/DB2 - which is my preferable way but it is not really supported by company's infrastructure. (2) jruby/activerecord-jdbc/tomcat/DB2 - probably easier way to migrate relying on current infrastructure and java libs IF I have a proof this is an enterprise ready technology. Does anyone know if there is any prof that jruby/aciverecord-jdbc-adapter/DB2/tomcat is mature enough for production? Are there any problems I should know about during Development/Deployment/Runtime? My webapp is for a company intranet, around 200~400 active users.

    Read the article

  • How do I get this linearlayout working on android?

    - by Arkadiy
    I'm trying to create a scrollview that contains a linearlayout with some options inside of it. I'd like for the options to show up at the top and grow downwards, and to have "save," "delete," and "cancel" buttons which show up at the very bottom of the screen (if there is space left in between the bottom of all the options and the top of the buttons). Here's a screenshot of my attempt: http: //img375.imageshack.us/img375/3628/10370572.png (StackOverflow was only letting me post a single link so you'll have to get rid of the space in between http: and the rest) As you can see, the buttons show up directly below the options rather than at the bottom of the screen. In fact the top level (green) linearlayout doesn't even extend all the way down, despite having a height of fill_parent and a weight of 1 (and the blue is the scrollview, so there is room to expand). I've tried every possible combination of heights, weights, gravities, and anything else to get this working and still can't do it. Everytime I pasted my xml layout into here, the top and bottom portions got cut off, so instead I pasted it here: pastey link Can anyone see what I'm doing wrong?

    Read the article

1