Is it a bad idea to model dependencies using a project’s directory structure?

Let’s say I have three classes: A, B, and C. All of these classes are simple and they create a cohesive unit. In addition, B depends on C and C depends on A.

Most people would put these classes into one directory:

java ├── A.java ├── B.java ├── C.java 

It’s simple, but it’s difficult to tell where the logic starts. You have no idea that B is at the root of the dependency chain. You would have to open up the files to understand the architecture.

Instead, you could use this directory structure:

java ├── B.java ├── C │   ├── C.java │   ├── A │   │   └── A.java 

With this directory structure, you can easily tell that logic begins in B and ends in A. But it’s more complicated. You might have a single file in a folder. You might have to duplicate the file name in the directory name. You also may quickly create a highly nested directory structure. But I think the advantages could outweigh the disadvantages.

I haven’t seen this idea discussed anywhere, so I feel like it might be a bad idea. Would this over-complicate a project structure? Would others be able to follow along? If applying this idea to a language like Java/Python/C#, would this create too many packages/modules/namespaces and make importing too difficult? Is this a bad idea?

Send email on Tuesday or Thursdays using SP 2013 Workflow

I have created an approval request from using InfoPath that is connected to a Sharepoint 2013 list. My goal is to create a workflow that sends an email containing certain elements of the information collected on the form to managers but the challenge is that management only wants to receive these type of request on either a Tuesday or a Thursday of each week.

Would greatly appreciate your help on how I could build that functionality in a workflow.

Thanks!

Using Count values in another function for my Chart.js Pie Chart

Using Chart.js to display a Pie Chart.

However, I’m hard coding the data values.

Below is the entire code:

$  (function(){  //Start Data Pull  //End Data Pull   //get the pie chart canvas   var ctx1 = $  ("#pie-chartcanvas-1"); //alert("after the JQuery " + countPie);   //pie chart data   var data1 = {     labels: ["Dog", "Cats", "Fish"],     datasets: [       {         label: "Pets",         data: [5, 4, 5],         backgroundColor: [           "#DEB887",           "#A9A9A9",           "#DC143C",          ],         borderColor: [           "#CDA776",           "#989898",           "#CB252B",          ],         borderWidth: [1, 1, 1]       }     ]   };    //options   var options = {     responsive: true,     /*title: {       display: true,       position: "top",       text: "Pets",       fontSize: 18,       fontColor: "#111"     },*/     legend: {       display: true,       position: "bottom",       labels: {         fontColor: "#333",         fontSize: 10       }     }   };    //create Chart class object   var chart1 = new Chart(ctx1, {     type: "pie",     data: data1,     options: options   });  }); 

It works great. However, I don’t want to hard code the data values

data: [5, 4, 5], 

Now I am using a count function on another feature on my SharePoint site. It is coming up with the 3 values I want to use on the chart. Here’s the code for that

<script type="text/javascript">      //alert("test");     var clientContext = null;     var web = null;     ExecuteOrDelayUntilScriptLoaded(Initialize, "sp.js");     function Initialize()     {         clientContext = new SP.ClientContext.get_current();         web = clientContext.get_web();         var list = web.get_lists().getByTitle("Animals");         var camlQuery = new SP.CamlQuery();         var camlQueryCa = new SP.CamlQuery();         var camlQueryCo = new SP.CamlQuery();         var camlQueryT = new SP.CamlQuery();         var q = "<View><Query><Where><Eq><FieldRef Name='Pets' /><Value Type='Text'>Dog</Value></Eq></Where></Query><RowLimit>0</RowLimit></View>";         var ca = "<View><Query><Where><Eq><FieldRef Name='Pets' /><Value Type='Text'>Cat</Value></Eq></Where></Query><RowLimit>0</RowLimit></View>";         var co = "<View><Query><Where><Eq><FieldRef Name='Pets' /><Value Type='Text'>Lizard</Value></Eq></Where></Query><RowLimit>0</RowLimit></View>";              var t = "<View><RowLimit>0</RowLimit></View>";               camlQuery.set_viewXml(q);         camlQueryCa.set_viewXml(ca);         camlQueryCo.set_viewXml(co);         camlQueryT.set_viewXml(t);         this.listItems = list.getItems(camlQuery);         this.listItemsCa = list.getItems(camlQueryCa);         this.listItemsCo = list.getItems(camlQueryCo);           this.listItemsT = list.getItems(camlQueryT);                 clientContext.load(listItems, 'Include(ID)');         clientContext.load(listItemsCa, 'Include(ID)');         clientContext.load(listItemsCo, 'Include(ID)');              clientContext.load(listItemsT, 'Include(ID)');           clientContext.executeQueryAsync(Function.createDelegate(this, this.onListItemsLoadSuccess),          Function.createDelegate(this, this.onQueryFailed));     }     function onListItemsLoadSuccess(sender, args) {          var count = this.listItems.get_count();         var countCa = this.listItemsCa.get_count();         var countCo = this.listItemsCo.get_count();      }      function onQueryFailed(sender, args) {         alert('request failed ' + args.get_message() + '\n' + args.get_stackTrace());     }  </script> 

Is there a way I can add the value count, countCa and CountCo in the data labels? In other words

data: [count, countCa, CountCo], 

Reversing a linked list using recursion, C programming. Return not working

I have the following code

node* reverse_ll_recr(node* head) {  if(head->next == NULL) return head;  reverse_ll_recr(head->next);  head->next->next = head;  head->next = NULL; } 

And in main i call it with

head = reverse_ll_recr(head); 

Problem is that head is not updated and would only print the last element since it is pointing to NULL after reversal. Does anyone know why this is happening?

Can a kensei/swashbuckler use an offhand finesse weapon to trigger sneak attack, without using a bonus action?


Context

For a relatively new campaign I’ve built a kensei (monk). At level 7, 8 and 9 (we’re level 4 now) I’m planning on taking three levels in swashbuckler (rogue). Now I’m exploring my options for triggering Sneak Attack with this character, in melee.

My character’s Kensei Weapons are a longsword and longbow. So with this multiclass idea I won’t be able to trigger Sneak Attack with the trusty longsword, or with my Unarmed Strikes, because Sneak Attack states:

Once per turn, you can deal an extra 1d6 damage to one creature you hit with an attack if you have advantage on the attack roll. The attack must use a finesse or a ranged weapon.

You don’t need advantage on the attack roll if another enemy of the target is within 5 feet of it, that enemy isn’t incapacitated, and you don’t have disadvantage on the attack roll.

Combat situation

When engaged in melee combat, my game plan is to wield a longsword in my main hand and a finesse weapon (dagger) in my off-hand, while still having the rest of my body ready for making Unarmed Strikes (knees, elbows, kicks, headbutts, etc). When the circumstances are right for making a Sneak Attack, I would like to strike with the dagger, without the need for swapping weapons and without taking a bonus action.

Question

My goal is to use my usual attack and damage roll for the dagger when I declare the off-hand weapon attack during my Attack action or Reaction. I would be wielding my longsword too, but not necessarily attack with it on the same turn. Would this work by RAW? Or would I be needing to have the dagger in my main hand for this?

I’m new to the workings of Two Weapon Fighting, so I might be overlooking something here.


Related:

  • Rogue using Dual Wield and Sneak Attack

Remote server not using the client syslog template

I have following as a template to be used by the remote server:

$  template tpl1,"%timegenerated:::date-rfc3339% %HOSTNAME% %msg%\n" $  ActionForwardDefaultTemplate tpl1 

When i look at my own machine’s syslog, the logs use this format perfectly. The targeted remote server does show messages received in the log but they don’t show them using the template i send them in. I do the following on client side:

1xx.xx.xx.xxx:514;tpl1 

Am i doing something wrong or is there something i need to do on the server side as well.

Two text files should open in Notepad.exe using Python

Need a program in Spyder that Two text files ( name_1.txt and name_2.txt) should open in Notepad.exe. I’m able to with one text file opening in Notepad.exe. this is program that I used to work.

import subprocess as sp programName = "notepad.exe" fileName = "name.txt" sp.Popen([programName, fileName]) 

Help me in getting work with two file to open.