## ReferenceError: directeres is not defined

Hago un delete con postman en directer y me arroja el siguiente error

ReferenceError: directers is not defined

con este trozo de codigo

exports.deleteDirecter = function(req,res){   var directerId = req.params.directerId;    for(var directerIndex in directers){     var directer= directers[directerIndex];     if(directer.id==directerId){       directers.splice(directerIndex,1);     }   }   res.send(directers); }; 

Cuando tengo otro trozo de codigo igual, con user y no me da fallos

exports.deleteUser = function(req,res){   var userId = req.params.userId;    for(var userIndex in users){     var user= users[userIndex];     if(user.id==userId){       users.splice(userIndex,1);     }   }   res.send(users); }; 

## Is it possible to securely run user defined python code in AWS?

I would like to create an app that accepts users python scripts and executes them as part of its functionality. What I am wondering is if its possible to block I/O, network and other attack vectors so I can have some confidence my AWS resources/account won’t be compromised?

Or if I isolate the process into a linux user account with few permissions would that be good enough?

Or is my best bet trying to adopt it to something like Brython or Jupyter to have it run in the browser and rely on those libraries for security?

I know there are companies like Codility that SEEM to do this successfully. However I know of others like Quantopian, that have been hacked. I apologize I don’t have a lot of experience with this type of issue.

## Sampling over a defined Probability Distribution

I would like to sample over a particular probability distribution that I define, for example (1+k*cos^2(theta)). I would like to do it in python, but ideas on other languages are welcome. I thought it was possible to create a function that we would do a random sampling from. Maybe too naive of me. Could you give me any tips or suggestions?

## UI for parameter which can be defined in two different ways

I develop a desktop app with a wizard like dialog which requires several parameters to be set.

Currently all parameters are displayed in a grid with a label and an appropriate control next to it, e.g.

The design problem that I am facing is that there are two parameters (Number of layers and Layer distance) depict the same thing: As the total range is fixed the number of layers is simply the total range divided by the layer distance. When the user changes either value the other one is updated accordingly.

How can I make it clear that those values are interdependent? All the other parameters in the form are not interdependent but have the same appearance.

Should I try to fuse them into a single control? How?

One solution would be to only provide one way to define the value and let the user do the math but this wouldn’t be very nice.

Another idea I had was to let the user choose which way to define the value by replacing the label with a combobox which can be set to either Number of layers or Layer distance with the textbox displaying and updating the appropriate value:

but the combobox break up the design as it looks quite different than a label.

Do you have a better idea?

## Any holomorphic vector bundle over a compact Riemann surface can be defined by only one transition function?

It is known that any holomorphic bundle of any rank over a noncompact Riemann surface is trivial. A proof can be found in Forster’s “Lectures on Riemann surfaces”, section 30.

Let $$E$$ be a holomorphic vector bundle over a compact Riemann surface $$X$$ with gauge group $$G$$. A consequence of the above theorem is the restriction $$E|_{X-\{p\}}$$ for any point $$p\in X$$ is a trivial bundle. Thus $$E$$ can be recovered by specifying the transition function $$g: D\cap (X-\{p\}) \rightarrow G$$ where $$D$$ is a small disk containing $$p$$.

Is this correct? If not, could you give a counter-example? I am mainly interested in learning about the moduli space of holomorphic bundles over $$X$$ in a concrete way, e.g. using transition functions.

## Split strings that mix upper and lowercase in a well defined way

I have a set of strings of the form:

Team XYZJohn SMITH / Jane SMITH TEAM RacersJohn SMITH / Jane SMITH John McMahon RacingJohn SMITH / Jane SMITH 

and want to split on the joined names to give strings like:

Team XYZ :: John SMITH / Jane SMITH TEAM Racers :: John SMITH / Jane SMITH John McMahon Racing :: John SMITH / Jane SMITH 

I’m R, using Perl, but it’s the regex I’m after.

Via https://stackoverflow.com/a/43706490/454773, this works for TEAM RacersJohn SMITH / Jane SMITH but obviously gives an unwanted split in McMahon and misses the split in Team XYZJohn.

For things like McMahon, I was thinking a heuristic of *don’t split on [A-Z][a-z]{1,2}[A-Z] which would also cope with eg MacDonald.

## Command “site-alias” is not defined

I run this command drush site-alias @self --full --with-optional directly from https://www.drupal.org/comment/reply/1401522#comment-form but it not work and show me the error

I have installed drush it work with this command drush --root=C:/wamp64/www/executive-coatings --uri=dev.ecc-new.pomdev.net status

## Should there not be methods intended to be only called from inside of the package, but from the outside of the class they’re defined in?

Note: This is a follow-up to this question on StackOverflow.

I have to write a wrapper in Python to an external API, accessible through HTTP. The code is supposed to be publicly available on GitHub.

For this reason, I thought, it would be nice if a person cloning this repository wouldn’t see tons of warnings. I opened my own code in PyCharm just to see if that was the case. It wasn’t.

However, since I’m afraid what these warnings are pointing at is a design issue, please let me start by showing (in a simplified way) the design I came with:

Firstly: There are two methods to authenticate the HTTP connection. For this reason, I have a ConnectionBase abstract class, that is implemented by two concrete classes, each using one of the two available authentication methods. So far so good.

But here problems start. There is an ApiClient class that is supposed to contain wrappers of all those API routes. This ApiClient class, of course, has to make use of an instance of ConnectionBase. In addition, since there are so many API calls to provide wrappers for, I thought I’d break them into categories.

Finally, this is how (roughly) the definition of ApiClient looks like:

class ApiClient:     def __init__(self, connection):         self._connection = connection      # forwarding method     async def _make_call(*args, **kwargs):         return await self._connection._make_call(*args, **kwargs)      class _Category:         def __init__(self, client):             self._client = client          # another forwarding method         async def _make_call(*args, **kwargs):             return await self._client._make_call(*args, **kwargs)      class _SomeCategory(_Category):         async def some_api_call(some_arg, other_arg):             return await self._make_call(blah blah)          async def other_api_call(some_arg, other_arg):             if some_arg.some_condition():                 other_arg.whatever_logic_here()             return await self._make_call(yadda yadda)      class _OtherCategory(_Category):         async def yet_another_api_call(some_arg, other_arg, yet_another_arg):             #...             return await self._make_call # etc etc      @property     def some_category(self):         return ApiClient._SomeCategory(self)      @property     def other_category(self):         return ApiClient._OtherCategory(self) 

In this fashion, assuming that the user of my lib wants to make a call to this external API and that client is an instance of ApiClient, they would type:

client.some_category.some_api_call(some_arg, other_arg) 

I believe that my use of underscores is clear: I’m preceding with an underscore all names that are not meant to be called by the end user of my lib. I thought this was the most important distinction: far more important than the distinction between variables private to a class: because the latter is nothing but an aesthetic issue, while the former is a usability issue: after all, exposing a (hopefully) clean, well-defined and intuitive public API is the very purpose of writing libraries!

Yet, PyCharm frequently complains that I’m accessing protected members of classes from outside of these classes. Apparently, and according to the linked SO question, the Pythonic understanding of a name preceded by an underscore is: This member is internal to this class and NOT the way I was understanding it, that is: This member is internal to this package.

So, all such lines are producing warnings:

await self._connection._make_call  await self._client._make_call 

etc etc in other places of my code.

But then: Am I supposed to clearly distinguish between methods supposed to be called by the user of my lib and methods supposed to be called only from within my lib (or users who know the internal workings of my package and know what they’re doing)?

If yes, then how if not by an underscore, which apparently means a different thing?

Or…

Well I don’t know, because as it is clear from my questions on this site, my knowledge of design patterns is underwhelming… But a hypothesis of how this situation should be understood rises up in my mind… A pretty radical hypothesis…

Maybe the correct interpretation is that there should be no methods that are intended to be called from outside of a class but not from outside of the package and/or by the end user?

I mean, I’m constantly seeing talks about the need to break dependencies, about how bad it is to have code that is so closely intermingled and tightly coupled… Perhaps such methods are examples of this unwanted coupling? And in all cases where I’d like to put an underscore in the beginning of a method name but PyCharm complains, this simply means that the existence of such a method constitutes a coupling in my code that should not be there and therefore there should not be such a method at all?

And I was so proud of myself that I made use of dependency injection 😛

On a more serious note: I have strong doubts if the above, dire interpretation is correct. In Uni I had a basic course on OO design. The instructor said something along the lines of, IIRC:

Please do remember that inheritance should be used in case of an is-a relationship, not a has-a relationship. An example of an extremely bad inheritance is a car inheriting from a wheel or from a gas pedal. Such cases should be handled by composition instead.

So, since an API client is not a connection used by this API client and since a category of an API call is not a client, I thought that it would be wrong to make API client inherit from a connection or to make a category inherit from the client – even though doing this would make PyCharm stop complaining and issuing warnings. Instead I used composition. However, if composition is used, I can’t see how can I get rid of methods that are intended to be called from within my lib, but not from within the class they’re defined in and not by the end user.

I suppose there must be a basic design principle I’m ignoring out of ignorance.

<div id="page-wrapper">   <div id="page">     <header id="header" class="header" role="banner" aria-label="{{ 'Site header'|t }}">       <div class="section layout-container clearfix">         {{ page.secondary_menu }}         {{ page.header }}         {{ page.primary_menu }}         <div class="navigation-toggler"><i class="fa fa-bars"></i></div>       </div>     </header>     {% if page.highlighted %}       <div class="highlighted">         <aside class="layout-container section clearfix" role="complementary">           {{ page.highlighted }}         </aside>       </div>     {% endif %}     {% if page.featured_top %}       <div class="featured-top">         <aside class="featured-top__inner section layout-container clearfix" role="complementary">           {{ page.featured_top }}         </aside>       </div>     {% endif %}     <div id="main-wrapper" class="layout-main-wrapper layout-container clearfix">       <div id="main" class="layout-main clearfix">          {{ page.breadcrumb }}         <main id="content" class="column main-content" role="main">           <section class="section">             <a id="main-content" tabindex="-1"></a>             {{ page.front_page }}                 </section>         </main>                 {% if page.bottom %}           {{ page.bottom }}         {% endif %}                    </div>            </div>      <footer class="site-footer">       <div class="layout-container">         {% if page.footer_first or page.footer_second or page.footer_third %}           <div class="footer-top">             <div class="footer-top-inner">               {{ page.footer_first }}               {{ page.footer_second }}               {{ page.footer_third }}             </div>           </div>         {% endif %}          {% if page.footer_left or page.footer_right %}           <div class="footer-bottom">             <div class="footer-bottom-inner">               {{ page.footer_left }}               {{ page.footer_right }}             </div><!-- /.footer-bottom-inner -->           </div>         {% endif %}       </div>     </footer>   </div> </div>  {% if social %}   <ul class="social-links">     {% if social.facebook %}       <li class="facebook"><a href="{{ social.facebook }}"><i class="fa fa-facebook"></i></a></li>     {% endif %}      {% if social.twitter %}       <li class="twitter"><a href="{{ social.twitter }}"><i class="fa fa-twitter"></i></a></li>     {% endif %}      {% if social.pinterest %}       <li class="pinterest"><a href="{{ social.pinterest }}"><i class="fa fa-pinterest"></i></a></li>     {% endif %}              {% if social.google %}       <li class="google"><a href="{{ social.google }}"><i class="fa fa-google"></i></a></li>     {% endif %}                  {% if social.youtube %}       <li class="youtube"><a href="{{ social.youtube }}"><i class="fa fa-youtube"></i></a></li>     {% endif %}       </ul> {% endif %}  {% if to_top %}   <div id="to-top">     <i class="fa fa-chevron-up"></i>   </div> {% endif %} 
That is being used throughout the template from a custom module I created. I think I need to use some sort of hook like hook_preprocess_html(), but I am not quite sure how to proceed.
## Does the linear map $T: l^\infty \rightarrow l^2$ defined by $T(x)(j)= x(j)/j$ bounded?
Consider $$T: l^\infty \rightarrow l^2$$ defined by $$T(x)(j)= x(j)/j$$. Is T bounded? Bijective?