I am trying to create a configuration script in perl that will make changes in two parameters , I need to know the ideal construct [closed] - perl

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 9 years ago.
Improve this question
So far I am using the following construct
configure.pl <$ARGV[0]> <$ARGV[1]>
each given argument can be
+n = to increase the current service by n
-n = to decrease the existing services by n
n = to create n number of services ( irrespective of the number of existing services )
I have a doubt whether this is the correct construct , I also have problems in fixing what should i have for nochange (ie existing services should continue ) .

The command-line interface you propose is perfectly fine as long as it's documented.
The GNU coding standards recommend providing long options. It is easy to have those in addition to the short options with Getopt::Long::Descriptive.
--inc=n
+n
to increase the current service by n
--dec=n
-n
to decrease the existing services by n
--abs=n
n
to create n number of services (irrespective of the number of existing services)
--no-op
no change in operation, existing services continue as is

Related

What is the difference in PostgreSQL between int2vector and int2array? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about programming within the scope defined in the help center.
Closed 3 months ago.
Improve this question
I have been looking around in the documentation, but could not find an explanation of what the "int2vector" type really is. It is found in some system tables like pg_trigger, but that's all a documentation search returns...
It seems to be vaguely similar to int2array, but has a different OID (INT2VECTOROID is 22, INT2ARRAYOID is 1005).
I have found ways to generate int2array in SQL (for instance with SELECT cast('{1,2}' as int2[])), but not int2vector.
The question applies to int4vector & int4array as well, and the uses case is when interfacing with libpq in binary format.
int2vector is an obsolete data type for arrays of smallint from the time before PostgreSQL had array data types. Today you would use smallint[].
You shouldn't use int2vector in your table definitions, as it is not documented. On the other hand, it is unlikely to get removed, since the catalog tables make use of that data type for historical reasons. There is no advantage to be had by using int2vector.

How do you represent either / or within a use case diagram? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 1 year ago.
Improve this question
I am making a use case diagram for a school and was wondering how I can show a degree course is either full time or part time and then each degree contains 1 to 10 courses.
Thanks!
The rules you are giving in your question are not captured in the use case model, but in the domain model. The description of a use case is influenced by the domain model. Like for example a use case enroll for term will describe steps where the user enters one or more courses. For a domain model you would create a class diagram.

RESTful API - Get last of an element [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 4 years ago.
Improve this question
What's the best practice for getting the last added element (let's say we know that because of a created_at field on the resource).
Should it be a call to the get all with max results on 1 like:
GET ../rest/v1/article?page=0&size=1&order=created_at,desc
and will return an array of one element
or maybe an "special" call like:
GET ../rest/v1/article/last
and will return an element.
I am looking for a best practice if there's one pattern for this.
Thanks!
I'm not a RESTful expert, but in my opinion the first solution seems the best.
The second is more practical, but routes are often associated with resources, the addition of a "last", especially preceded by a "/" seems strange to me.
In addition, API users usually use the sorting parameters, and what about users which need 10 last elements ?
If you add something after ../rest/v1/article, it must be an ID for one particular element, a sub-resource, or for actions that are outside the CRUD like ../rest/v1/article/:id/subscription.
Both URLs are RESTful and identify a Resource. Of course the first would return a collection containing a single element while the second would return this element directly.
The first form will be automatically supported if you support paging and sorting at all.
You write
or maybe an "special" call
I don't see this as an 'or', it should be an 'and'. The second form is optional and it could be helpful. If you have an URL pattern like
GET ../rest/v1/article/{id}
it is easy to implement logic that can distinguish normal IDs like, for example, 123 or A567 from special IDs like 'last`.

What would be a good/correct term to designate a group of microservices? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 3 years ago.
Improve this question
I am opening this topic looking for an advice to solve/help in the following problem:
I am currently working with other people on a project with a microservices architecture, using cloud computing.
There are 6 different microservices, and there are some couples of microservices that are not compatible, therefore not able of being instantiated within the same machine.
Each microservice has a version number.
In order to launch one or more new instances of any microservice, we have to define which microservices will run on this new machine, via a static configuration.
This static configuration, that we call so far as a "deploy" contains the microservices that are being deployed, and the version of each microservice. (ex: (XY,[(X,v1),(Y,v2)]) - X and Y are microservices, and the XY deploy instantiates version 1 of X and version 2 of Y)
Those "deploys" also have their own version number. Altering the version number of a microservice within a deploy requires altering the version of any "deploy" containing the microservice. (ex: (XY,v1,[(X,v1),(Y,v2)]) and (XY,v2,[(X,v1),(Y,v3)]))
The question is: what would be a correct, or at least, a good term to refer to this entity that I have previously called a "deploy"?
Many developers are writing programs around our architecture and using different names for such entity, which causes syntaxic and semantic incompatibility inside our team.
Of those different names, all have pros and cons:
deploy: makes sense because you are deploying all the microservices in the list. However, the term deploy already designate another part of our process, and there could be some over utilization of the same term. (Deploying the XY deploy will deploy microservices X and Y in a machine)
cluster: good name for a group of things, but you can deploy multiple machines from a configuration, and the term cluster already applies to this group of machines.
service: a service would be a group of microservices. Makes sense, but many pieces of codes refer to a microservice as 'service', and that could lead to a confusion. (def get_version(service) - Is he talking about a service or a microservice?)
Does any of you could give us any opinion or enlightenment on the question?
Thanks!
You might take a hint from the 12-factor App, and call them releases (http://12factor.net/build-release-run)
You then deploy a versioned release.
It sounds like you want a suitable collective noun. I suggest you Google "collective nouns", to find numerous lists. Read some of the lists and pick a noun that you think is appropriate.
Alternatively, the term cooperative (or co-op for short) might be suitable if one of the defining characteristics of an instantiation collection of microservices is that they complement, or cooperate with, each other.
I have used the term "complex" (as in the "mortgage risk" complex vs the "compliance" complex). It seemed unambiguous.
People also used the term within a project for deployed sets of microservices (e.g the production complex vs the test complex).

Example of State monad in business application [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 9 years ago.
Improve this question
I am looking for a simple example of State monad in a business application.
I have found good examples -- memoisation to calculate Fibonacci numbers and random numbers generation -- but I would like to see an example from a business domain (preferably in Scala).
For example, I can easily find examples of using Option, Either, List, Reader, and Writer monads:
option : look up an entity (order, product, customer, whatever) which does not exist
either : any failure
list : customer orders, order items, etc.
reader : read any entity from the database
writer : write to the log
Now I am looking for something similar for State monad, i.e. any stateful computation with a mutable state, as I understand it.
The typical application where I reach for State is where I need a supply of values, like a random number generator or a supply of unique identifiers.
Another typical use case is testing an application that interacts with a database. Using State, you can simulate an in-memory database and check that the program manipulates the database in the expected way.