Keeping steps in sync of long running process and creating common layer for code repetition

I have 1 long running process wrapped inside a method and it is for 2 different types like below:

  • Type1
  • Type2

Code:

public interface IBaseType     {         MyResult LongRunningProcess(int jobId,int noOfTimes); //doenst save long running process data in database.just returns the results to consumer         void LongRunningProcess(int noOfTimes); //Save results of long running process in database.Background job with on-demand as well as scheduled     }  public class Type1 : IBaseType {     public void LongRunningProcess(int jobId,int noOfTimes)     {         try         {            //Step1 :             var type1Manager =  new Type1Manager(params);            for (int i = 0; i < noOfTimes; i++)                {                  var con = ConnectionFactory.OpenConnection();                  type1Manager.Start(con);                 //Save results of those processing             }            //Step2:           IVersioning versioning = new Versioning();           string version = versioning.GetVersion();           using (connection = new SqlConnection(connectionString))           {                connection.Open();                using (var transaction = connection.BeginTransaction())                {                   try                   {                      Repository.UpdateVariantVersioning(connection, transaction,jobId, version);                      Repository.UpdateCategoryWithVersion(connection, transaction,versioning.Category,version);                      transaction.Commit();                   }                   catch(Exception ex)                   {                        transaction.Rollback();                        //code to delete everything that has been performed in step1                        throw ex;                   }                 }             }         }         catch (Exception ex)         {             Repository.UpdateErrorDetails(connectionString,jobId,ex.Message);         }          //Step3 : if step1 and step2 successfull than mark this job as succeeded else failed         // Updating time of whole process in table     }  }      public class Type2 : IBaseType {     public void LongRunningProcess(int jobId,int noOfTimes)     {         try         {            //Step1 :              var type2Manager =  new Type2Manager(params);             for (int i = 0; i < noOfTimes; i++)                {                  var con = ConnectionFactory.OpenConnection();                  type2Manager.Start(con);                 //Save results of those processing             }            //Step2:           IVersioning versioning = new Versioning();           string version = versioning.GetVersion();           using (connection = new SqlConnection(connectionString))           {                connection.Open();                using (var transaction = connection.BeginTransaction())                {                   try                   {                      Repository.UpdateVariantVersioning(connection, transaction,jobId, version);                      Repository.UpdateCategoryWithVersion(connection, transaction,versioning.Category,version);                      transaction.Commit();                   }                   catch(Exception ex)                   {                        transaction.Rollback();                        //code to delete everything that has been performed in step1                        throw ex;                   }                 }             }         }         catch (Exception ex)         {             Repository.UpdateErrorDetails(connectionString,jobId,ex.Message);         }          //Step3 : if step1 and step2 successfull than mark this job as succeeded else failed         // Updating time of whole process in table     }  } 

So as you can see here that step2 and step3 code are getting repeated for both types so I want to this code repetition.

Secondly I want to keep step1 and step2 in sync so that when step2 fails, then rollback whatever has been done inside the entire step1 process.

I am a bit confused with moving versioning in base abstract class because that would probably be tightly coupled with this long running process. I want to design it in a way that tomorrow if I think of removing versioning then it should not hamper my current design and code.

Can anybody please help me with this?

Update : Added versioning code

interface IVersion {     string CreateVersion(); }  Public class Version : IVersion {      public string Category { get; private set; } } 

Does any algorithm exist for computing the state of a non-trivial cellular automaton after an arbitrary number of time steps?

If have a cellular automaton, can I see the state of the board after something like $ 10^{{10}^{10}}$ time steps? For trivial cases, this is possible – for example, a cellular automaton where the board repeats after some finite period.

But are there any cellular automata (or perhaps even similar computational structures) that display chaotic behavior but can also be very quickly evaluated to extreme time steps into the future?

My first time in emergency mode. Don’t know what to do. Steps to debug

Hello yesterday I was happy because I installed a second drive myself without annoying the people in this forum.

All was working good. Today I turned on my PC and it was in emergency mode. I don’t know why…

What are the steps to Debug and to know whats happening in my case.

I run Kubuntu 19.04. (ONLY – no other system)

1 SSD & 1 HDD

Something I’ve done is typing

nano /etc/fstab 
 #file system mount point type options dump pass #was on /dev/sda1 during installation  UID=49cc34c5-f01e-4ee0-929d-ef4f06c515be  / ext4 errors=remount-ro       0     1 /swapfile none swap SW 0 0  /dev/sdc1  /HDD  ext4  defaults 0 0 

Thank you

Are tabs and/or steps in a wizard displayed as separate boxes in a sitemap diagram?

I’m creating a sitemap for an enterprise application.

For one section in the application, there is an edit calendar feature. Once clicked on, there are three sections/or different types of calendars to set up.

  1. Start/end dates for the entire project
  2. Blocked-out dates (holidays and nonworking days, etc.)
  3. Start/end dates for specific tasks within the project

We currently use a step wizard to edit the calendar so the user has to set up the dates in that order.

In my sitemap, do I draw out each step as a separate box, or would that go in a separate user flow diagram?

Sitemap sketch

Number of steps – Count Change Procedure

I don’t know if this is dupp question, i’ve already seen some explanations on why the procedure below is equal to $ \theta(n^d)$ in terms of time complexity, being $ d$ the number of coins. My question here resides on the exact number of steps required by this procedure when, e.g, $ d=2$ .

Being known that for $ d=1$ , the number of subtrees generated is equal to $ (2n+1)$ and that for $ d=2$ , (cc n 2) initially generates two subtrees, (cc n 1) and (cc n-d 2). To get the total number of steps, I know that we have $ 1 + (n/5) + (..) $ . I’m with doubts as how I can express the rest of the expression, more precisely the number of subtrees generated by (cc n 2) with 1 coin as they are subtracted, until it reaches the limit $ (n/5)$ , being $ 5$ the denomination of the coin when there are two types of coins available.

 (define (count-change amount)    (define (cc amount kinds-of-coins)      (cond ((= amount 0) 1)            ((or (< amount 0) (= kinds-of-coins 0)) 0)            (else (+ (cc (- amount                            (first-denomination kinds-of-coins))                         kinds-of-coins)                     (cc amount                         (- kinds-of-coins 1))))))    (define (first-denomination kinds-of-coins)      (cond ((= kinds-of-coins 1) 1)            ((= kinds-of-coins 2) 5)            ((= kinds-of-coins 3) 10)            ((= kinds-of-coins 4) 25)            ((= kinds-of-coins 5) 50)))    (cc amount 5)) 

Can anyone help? Thank you in advance.

METHOD: FOLLOW THESE STEPS TO GET DAILY CASH OUT FROM THIS FREE BITCOIN FUNDED E

Return on investment is what every entrepreneur strives for. That is why we buy domains, hostings and marketing tools and hope we make good returns after such investments.

This method will let you invest just $ 1 worth of bitcoin and get good ROI if you follow the same steps I have outlined here.

Before i proceed, let me give a brief background on how i discovered this method.Just recently i needed to demonstrate to a non crypto savvy friend that with cryptocurrencies, crossborder transfers…

METHOD: FOLLOW THESE STEPS TO GET DAILY CASH OUT FROM THIS FREE BITCOIN FUNDED E

Validação usando plug-in Jquery steps

Eu estou tentando fazer um Jquery steps wizard mas não consigo colocar pra ele parar caso não tenha sido preenchido o formulario no segundo passo.

http://www.jquery-steps.com/Examples

     if (newIndex === 2 && $  ("#Rua").val() == "") {         return false;      }          $  (document).ready(function() {               $  ("#wizard").steps({                headerTag: "h2",           bodyTag: "section",           transitionEffect: "slideLeft",           stepsOrientation: "vertical",           labels: {             current: "current step:",             pagination: "Pagination",             finish: "Finalizar",             next: "Confirmar",             previous: "Voltar",             loading: "Carregando ..."           },           onStepChanging: function(event, currentIndex, newIndex, cepError) {             if (currentIndex > newIndex) {               return true;             }                  if (newIndex === 1) {               return true;             }                  if (newIndex === 2 && $  ("#Rua").val() == "") {                    return false;             }                }         }            )     });         
     <div id="wizard">             <h2>Verificação pedido</h2>             <section>                 <h2><strong>Pedido:</strong></h2>                  <div class="lista-carrinho"></div>              </section>              <h2>Local de entrega</h2>             <section>                 <div class="informações-usuario">                      <form method="get" action="." id="#form-cep">                         <div class="form-row">                             <div class="form-group col-md-6">                                 <label for="cep">Cep:</label>                                 <input name="cep" type="text" class="form-control" id="cep" placeholder="09572-660" value="" size="10" maxlength="9" required>                             </div>                             <div class="form-row">                                 <div class="form-group col-md-6">                                     <label for="rua">Rua:</label>                                     <input name="rua" class="form-control" type="text" id="rua" placeholder="Sete de Dezembro" size="60" maxlength="" />                                 </div>                             </div>                             <div class="form-row">                                 <div class="form-group col-md-6">                                     <label for="bairro">Bairro:</label>                                     <input name="bairro" class="form-control" type="text" placeholder="Nova Gerty" id="bairro" size="40" maxlength="40" />                                 </div>                             </div>                             <div class="form-row">                                 <div class="form-group col-md-6">                                     <label for="n">N°:</label>                                     <input name="n" class="form-control" type="text" placeholder="2" id="n" size="6" maxlength="10" />                                 </div>                             </div>                             <div class="form-group col-md-6">                                 <label for="complemento">Complemento:</label>                                 <input name="complemento" type="text" class="form-control" id="complemento" placeholder="Ao lado do extra" value="" size="10" maxlength="9" requerid>                             </div>                             <div class="form-row">                                 <div class="form-group col-md-11">                                     <label for="cidade">Cidade:</label>                                     <input name="cidade" class="form-control" type="text" placeholder="São Bernardo do Carpo" id="cidade" size="40" maxlength="40" />                                 </div>                             </div>                           </div>                     </form>                 </div>              </section>              <h2>Forma de pagamento</h2>             <section>                 <div class="row d-flex justify-content-center col-sm col-md col-lg m-5 ">                     <h2>Informe sua forma de pagamento :</h2>                 </div>                 <div class="row d-flex justify-content-center col-sm col-md col-lg m-5 ">                      <div class="col-2">                         <li class="list-inline-item">                             <div class="pure-radiobutton">                                 <input id="Dinheiro" name="dinheiro" type="radio" class="radio">                                 <label for="Dinheiro">Dinheiro</label>                             </div>                         </li>                     </div>                     <div class="row">                                          </div>                     <div class="col-2">                          <li class="list-inline-item">                             <div class="pure-radiobutton">                                 <input id="Cartao" name="cartao" type="radio" class="radio">                                 <label for="Cartao">Cartão</label>                             </div>                         </li>                     </div>                 </div>              </section>          </div>

The Easy Steps To 50,000 Unique Visitors To Your Website Daily. Get Your Website Flooded Now. for $8

The Secrets Of Massive Traffic Generation Revealed To You Now! Let’s face it – We all know the fact that traffic generation is the bloodline of an internet business. If we are good at traffic generation, we’d be making hundreds of thousands of dollars selling products online. But as time goes on, more and more people have been learning more about traffic generation methods and how they can build their own business empire online. “Here’s The Good News!” Anybody – Regardless of their circumstances can equip themselves with these information. But before we go into that, ask yourself, have you ever faced any of these problems in your life? There’s no traffic to your website Wanted to learn effective traffic generation methods Not sure which traffic generation methods that suits you Well, you are not alone. I’ve once walked down this lost path and I told myself that I would do whatever it takes to figure out the solutions. And after years of research and hardship, I’ve finally found the solution, which I want to share with you today. Introducing… Here’s What You’ll Learn: What is traffic Generation Traffic generation and personality type Winning strategies for a Traffic generation The characteristics of good and stable traffic Factors to consider in choosing a traffic generation for you And more “Let Me Shed Some Light On Some Things That May Be On Your Mind!” Will this help me in understanding traffic generation? Absolutely! The information in this book have been put together to make you understand the traffic generation techniques. Will I be able to put these information to practice easily? Most definitely! The strategies and techniques have been mapped out clearly in this guide so that anyone can start using it. Wow, this is too good to be true! Will this cost me a bomb? Here’s the good news, NO. I want everybody to be able to have access to this information because I knew what it was like, struggling without anyone to guide me… Now that I’ve found the way, I want this ultimate guide to help you! “Here Is Your Unbeatable Money Back Guarantee!” This book could be the most important book you will ever read. Make no mistake about it because if you do not equip yourself with the right knowledge, you will get into a LOT of trouble and waste tons of money (even more than the price of this book by 10 to a hundred times, in fact!) Get this… it’s yours for only $ 8.

by: oforce500
Created: —
Category: eBook
Viewed: 154


Steps to creating custom conditional logic (Form API #states) in webform

I have the need to set visibility state of a checkbox option in one question (Table checkbox select) based on the value of another checkbox in the same table. I also have other scenarios where I would need same functionality but across different questions in the same webform.

I know I can easily do it between two questions with the built in conditional logic UI in webform but no such UI option for my case now (afaik) so I’m trying to set it via the custom one and this is my first time with form states and custom condition in webform so I appreciate your kind help so greatly.

I tried this but it is not saving and idk if it’s correct or not:

// Hide q8 if q9 checkbox is checked. $  form['some_question[q8]'] = array(   '#states' => array(     'invisible' => array(       ':input[name="some_question[q9]"]' => array('checked' => TRUE),     ),   ), ); // Hide q9 if q8 checkbox is checked. $  form['some_question[q9]'] = array(   '#states' => array(     'invisible' => array(       ':input[name="some_question[q8]"]' => array('checked' => TRUE),     ),   ), ); 

I got the selectors from the “Available selectors” list by clicking on the “Help” link under “Learn more about Drupal’s Form API #states.” on the “Conditional Logic” for the element editing tab in my webform.

EDIT:

I tried this but still no luck:

// Hide q8 if q9 checkbox is checked. $  form[name="some_question[q8]"] = array(   '#states' => array(     'invisible' => array(       ':input[name="some_question[q9]"]' => array('checked' => TRUE),     ),   ), ); // Hide q9 if q8 checkbox is checked. $  form[name="some_question[q9]"] = array(   '#states' => array(     'invisible' => array(       ':input[name="some_question[q8]"]' => array('checked' => TRUE),     ),   ), ); 

What am I doing wrong ?!! Thanks so much for your help