nodes – Change max length of title in a custom block added via a template file

A drupal 7 website has a custom block added via a template file. The block displays previews of article content type belonging to a certain rubric. It uses the following line to do so:

$block = module_invoke('views', 'block_view', 'given-block-name'); echo render($block('content'));

The articles displayed have their titles truncated at the length of 50 characters. I could not find the number 50 in the files on the hosting, so it should be somewhere in the database, and so somehow changeable via the admin panel. Yet I am having a very hard time finding where to change this number. I have changed the length of the teaser for the article content, but that apparently bears no influence on what is displayed in the given block.

worksheet function – How to get the max number in a column up to a cell google sheets and excel

This code would be in B8: =if(C8=””,””,1+max(C5:C7))
Then in B9 i would have this: =if(C9=””,””,1+max(C5:C8))
and Eventually ending with: =if(C8=””,””,1+max(C5:C365))
I copied the code to each cell but it auto changes the C5 to correspond with the new cell
I started manually changing each cell so the MAX Function will range from C5 and up but by the time i got to row 40 i found myself on this page. all cells need the max function to start at C5 and then stop at the cell to the right and above.
Is there a better way than copying the code cell by cell and changing the C# and changing it to a C5?

mysql – Find max sum of daily total within date range

MYSQL question (NOT spreadsheet question) I’ve been stumped on this for a week (spreadsheet below is just for illustration purposes)

Orders are entered per customer within date range

  • order_number, quantity, start_date, end_date

  • 01, 100, 2021-01-14, 2021-01-16

  • 02, 125, 2021-01-14, 2021-01-16

  • 03, 200, 2021-01-17, 2021-01-23

  • 04, 050, 2021-01-14, 2021-01-19

  • 10, 150, 2021-01-21, 2021-01-16

I need to find the MAX within an entered date range as illustrated in the table below.
ie. I enter variable start_date_search (2021-01-14) and end_date_search (2021-01-23), and I come up with the MAX on any given day within the range (675 in this example below.)

I don’t need to output the totals for each day, but that would be cool too.

data table of reservations by date

[Hostbazzar.com] Linux Reseller Hosting | Max CPanel Accounts | $4 for the Months

————
Why us?
————
Satisfaction Guaranteed
A 30-day Refund guarantee
24X7 Live Chat Support
SLA 99.95%
1 Gbps port speed
Morden Technology
3 years in business
fast and helpful support

Hostbazzar has been providing Business Class Web Hosting Solutions since 2018. We pride ourselves in customer relations
and customer satisfaction along with the guarantee to offer you the best service possible to make your online experience
profitable and enjoyable. Hostbazzar is focused on creating a streamlined & pure hosting environment that lets customers
focus on their websites instead of the
status of our hosting servers. We do not mislead our customers with “unlimited space” or “unlimited” bandwidth as we offer
them in actual.

High Speed SSD Reseller, 20x Fast Reseller, 24×7 Customer Support

Our Hosting Service Packges
>Linux Reseller Hosting First packed! Just for $4
-Unlimited Monthly Traffic
-Unlimited Disk Space
-CPanel Accounts-10
-Unlimited MySQL Databases
-PHPMyAdmin
-Private Name Servers
-Softaculas Supported
-24X7 Live Chat Support

>Linux Reseller Hosting Second packed! Just for $7
-Unlimited Monthly Traffic
-Unlimited Disk Space
-CPanel Accounts-20
-Unlimited MySQL Databases
-PHPMyAdmin
-Private Name Servers
-Softaculas Supported
-24X7 Live Chat Support

>Linux Reseller Hosting Third packed! Just for $10
-Unlimited Monthly Traffic
-Unlimited Disk Space
-CPanel Accounts-40
-Unlimited Mysql Databases
-PHPMyAdmin
-Private Name Servers
-Softaculas Supported
-24X7 Live Chat Support

>Linux Reseller Hosting Forth packed! Just for $15
Unlimited Monthly Traffic
Unlimited Disk Space
CPanel Accounts-60
Unlimited MySQL Databases
PHPMyAdmin
Private Name Servers
Softaculas Supported
24X7 Live Chat Support

Have questions Linux Reseller Hosting ? Need more information? Click here-: https://hostbazzar.com/linux_reseller_hosting.php

Thank You

complexity theory – Trouble finding average case of a find max algorithm

I’m trying to find the average case number of times that max is assigned by the algorithm findMax included below.

findMax(list):
    maxNum = -oo  # negative infinity
    for k = 0 to len(list)-1:
        if list(k) > maxNum:
            maxNum= list(k)
    return maxNum
  • The distribution I have considered is uniformly random.

At the back of the textbook I am currently using, the solution is said to be $O(logn)$, however, using the approach that I have came up with (which I’m not quite sure why is incorrect), I got $O(n)$ instead.

In my approach: I have used the following formula $$E(t_n) = sum^{n}_{t=1}t cdot Pr(t_n=t)$$
And, I considered how many times maxNum was updated to calculate the expected value. First, I noticed that if the max would have been the first element, maxNum would have only been updated once. If the max was the second element, then it would have been updated twice, and so forth. Using this reasoning, I deduced that the probability of maxNum appearing in the nth position is $frac{1}{n}$. Then, I got
$$E(t_n) = 1 cdot Pr(t_n = 1) + 2 cdot Pr(t_n = 2) + … + n cdot Pr(t_n = n)$$
$$=frac{n+1}{2}$$
$$Rightarrow O(n)$$.

I am a bit lost and am unsure where my mistake took place exactly.

US/UK/Netherlands/Romania Openvz VPS | Max Space | Max RAM

Raisinghost is a leading web, reseller, vps and dedicated hosting provider and which has been providing quality web hosting solutions to businesses and individuals at affordable pricing. Our goal is to provide outstanding services for the best possible price with feature packed resources. To achieve these goals we are constantly innovating and upgrading our services at no additional cost to our customers also have easy billing cycles.

So think of VPS hosting like living in a block of flats and have the freedom of your own space, but you’re still sharing a building with other residents / services.

Economy-VPS : $15/M

1 GB Memory
VPS Type OpenVZ
30 GB Raid 10 Storage
2 TB Monthly Traffic
Root Shell Access

Value-VPS : $24/M

2 GB Memory
VPS Type OpenVZ
60 GB Raid 10 Storage
3 TB Monthly Traffic
Root Shell Access

Deluxe-VPS : $45/M

4 GB Memory
VPS Type OpenVZ
120 GB Raid 10 Storage
4 TB Monthly Traffic
Root Shell Access

Ultimate-VPS : $80/M

8 GB Memory
VPS Type OpenVZ
180 GB Raid 10 Storage
8 TB Monthly Traffic
Root Shell Access

Buy Now : https://raisinghost.com/best-cheap-vps-hosting.php

Thank you.

algorithms – Approximate max weight path in directed graph

Context

This question is related to the fact one can’t use Bellman-Ford to find max weight paths in directed graphs with cycles. The reason is that giving a new graph $tilde{G}$ with negative weights (e.g. $tilde{w}_{ij} = – w_{ij}$) will result in cycles with negative sum, thus no minimum cost walk exists in $tilde{G}$.

General question

How well can we approximate the maximum weight path between $i$ and $j$ in $G$, using the shortest path algorithm on a graph $tilde{G}$ with transformed weights $tilde{w}_{ij}$ ?
In my case, one has $w_{ij}inmathbb{N}setminus{0}$. The transformed weights $tilde{w}_{ij}$ can be obtained using any function, but I assume a decreasing function $f$ is well adapted so that $w < w’ iff f(w) > f(w’)$.

My approach

I am currently trying to use $f(w) = dfrac{1}{w}$, in this context we have two important paths given a fixed path length $L$.

Denote a path $p = (i_0i_1, i_1i_2, i_2i_3, dots i_{L-1}i_L$) with weights $W = (w^{(1)}, w^{(2)}, w^{(3)}, dots, w^{(L)})$,

denote the maximum weight path of length $L$ by $p^*$ with weights $W^*$ achieving
$$ W^* = argmax_W{mathtt{Cost}(W)} = argmax_W sum_{k=1}^L w^{(k)}$$
and the path $p_*$ achieving minimum transformed cost with weights $W_*$
$$ W_* = argmin_W sum_{k=1}^L tilde{w}^{(k)} = argmin_W sum_{k=1}^L f(w^{(k)}) = argmin_W sum_{k=1}^L dfrac{1}{w^{(k)}}$$

Specific question

In this specific context, do we have the approximation $mathtt{Cost}(W^*) approx mathtt{Cost}(W_*)$ ?

Or is it “very wrong” to replace $W^*$ by $W_*$ ? What would be the distribution of the relative error defined as
$$E_r = dfrac{lvertmathtt{Cost}(W^*) – mathtt{Cost}(W_*)rvert}{mathtt{Cost}(W^*)}$$

Statistical analysis

I have tried a quick statistical analysis as follows:

  • Letting $Lin{3,4,5,6,7,8}$
  • sampling $w sim mathrm{Uniform}(1,w_{max})$
  • The value for $w_{max}$ was also picked from the set ${50, 100, 150, 200, 500}$
  • for each combination of $L,w_{max}$ I computed $10^5$ values of $W^*, W_*$ using $10^3$ candidate weights $W_i$

The results:

  • In $80.8%$ of cases we have $mathtt{Cost}(W^*) = mathtt{Cost}(W_*)$ and even better $W^*=W_*$
  • When computing the relative error $E_r$ one finds that $82.6%$ of error values are less than $0.001$, $89.7%$ less than $0.01$ and $99.9%$ less than $0.1$

The histogram for $E_r > 0$ is as follows

relative_error distribution

procedural programming – The max memory used in the loop calculation

The max memory used is apparently different during the first and the second running of an identical do-loop. Following is an easy example,

In[1]:= tmp = 0;
AbsoluteTiming[Do[tmp = tmp + i, {i, 10^8}];]
MaxMemoryUsed[]

Out[2]= {33.7427,Null}

Out[3]= 68741504

In[4]:= tmp = 0;
AbsoluteTiming[Do[tmp = tmp + i, {i, 10^8}];]
MaxMemoryUsed[]

Out[5]= {33.0666,Null}

Out[6]= 116270120.

Furthermore, in some other cases I can do the calculation by the while-loop but the do-loop will exhaust my memory. The Max memory used in the do-loop is even more than twice of the cost in the while-loop.

What is the principle of the memory use during the loop-calculation of mathematca? My mma version is 12.0

sql server – Max of a query which is inside

Create a database for a drone delivery startup that distributes pizzas via drones. The startup has partnerships with several drone manufacturers and pizza shops. The entities of interest to the problem domain are: Drone Manufacturers, Drone Models, Drones, Pizza Shops, Customers, and Deliveries. A drone manufacturer has a name and can produce different drone models. A drone model belongs to a drone manufacturer; it has a name, battery life (in minutes, integer number) and maximum speed. An actual drone is of a particular model and has a serial number. A pizza shop has a name and address. A customer has a name and loyalty score. Pizza shop names and customer names are unique. For each delivery, the system records the corresponding customer and pizza shop, the drone that is used, as well as the date and time. This is how I proceeded:

CREATE TABLE DroneManufacturers(
    id INT PRIMARY KEY IDENTITY(1,1),
    name VARCHAR(30)
);

CREATE TABLE DroneModels(
    id INT PRIMARY KEY IDENTITY(1,1),
    manufacturer_id INT REFERENCES DroneManufacturers(id),
    name VARCHAR(30),
    battery_life INT,
    max_speed INT
);

CREATE TABLE Drones(
    serial_number VARCHAR(10) PRIMARY KEY,
    model_id INT REFERENCES DroneModels(id),
);

CREATE TABLE PizzaShops(
    name VARCHAR(30) PRIMARY KEY,
    address VARCHAR(50)
);

CREATE TABLE Customers(
    name VARCHAR(30) PRIMARY KEY,
    score INT
);

CREATE TABLE Deliveries(
    pizza_shop VARCHAR(30) REFERENCES PizzaShops(name),
    customer VARCHAR(30) REFERENCES Customers(name),
    drone VARCHAR(10) REFERENCES Drones(serial_number),
    delivery_time DATETIME
);

I think the design is ok, but I have some problems in the next query:

Create a view that shows the names of the startup’s favorite drone manufacturers, i.e., those with the largest number of drones used by the startup.
Example: suppose the startup has partnerships with 3 manufacturers: M1, M2, M3; it has 10 drones from M1, 10 drones from M2, and 8 drones from M3. M1 and M2 are the manufacturers with the largest number of drones.

I have tried like this:

SELECT t.name
FROM (
    SELECT dman.id, dman.name, COUNT(*) AS counts
    FROM Drones d
    INNER JOIN DroneModels dm
        ON d.model_id = dm.id
    INNER JOIN DroneManufacturers dman
        ON dm.id = dman.id
    GROUP BY dman.id, dman.name
    ) t
WHERE t.counts = MAX(t.counts)

And I get an error because the last “where” clause is not written properly. Can somebody help me with this query, please?

mysql – ¿Cómo puedo obtener el max() de una tabla derivada?

Estoy haciendo un ejercicio de MySQL en donde debo hacer las consultas correspondientes para obtener el nombre del ganador de una partida de tenis según una tabla en donde se alamcena el id del jugador, el id de la partida, el número de set y su correspondiente puntutacion.
Hasta ese punto no tengo ningún problema para obtener el nombre del jugador junto con la suma de las puntuaciones de todos sus sets (para saber qué jugador anotó más puntos).
El código que utilizo para obtener esos datos es el siguiente:

select j.apellido as nombre, sum(s.puntos) as total
from 
    grand_slam.modalidad m, grand_slam.fase f,
    grand_slam.torneo t, grand_slam.partida p,
    grand_slam.partida_jugador pj, grand_slam.jugador j,
    grand_slam.set_individual s
where 
    m.modalidad = "Individual masculino"
    and f.fase = "Cuartos de final"
    and t.nombre = "Roland Garros"
    and year(t.fecha_inicio) = 1979 
    and t.id_mod = m.id_mod
    and p.id_fase = f.id_fase
    and p.id_torneo = t.id_torneo
    and pj.id_partida = p.id_partida
    and j.id_jugador = pj.id_jugador
    and s.id_jugador = j.id_jugador
group by apellido

Al ejecutar este código obtengo este resultado, que es correcto:

+------------+-------+
| nombre     | total |
+------------+-------+
| Connors    |    23 |
| Gerulaitis |    14 |
+------------+-------+

Como necesito obtener el nombre del ganador pensé que podría utilizar esta consulta dentro de otra en donde solo obtenga la tupla con max(total), e hice esto:

select nombre from(
select j.apellido as nombre, sum(s.puntos) as total
from 
    grand_slam.modalidad m, grand_slam.fase f,
    grand_slam.torneo t, grand_slam.partida p,
    grand_slam.partida_jugador pj, grand_slam.jugador j,
    grand_slam.set_individual s
where 
    m.modalidad = "Individual masculino"
    and f.fase = "Cuartos de final"
    and t.nombre = "Roland Garros"
    and year(t.fecha_inicio) = 1979 
    and t.id_mod = m.id_mod
    and p.id_fase = f.id_fase
    and p.id_torneo = t.id_torneo
    and pj.id_partida = p.id_partida
    and j.id_jugador = pj.id_jugador
    and s.id_jugador = j.id_jugador
group by apellido
) as Resultado
where Resultado.total = (select max(total) from Resultado);

Intento seleccionar solo el nombre de la ‘nueva tabla’ que llamé Resultado que tuviera el valor maximo para total, pero al ejecutarla recibo el error:

Error: ER_NO_DB_ERROR: No database selected
(Done) Finished MySQL query.

No se porque me marca ese error 🙁
O no se si exista otra forma más fácil de obtener el maximo valor de un atributo de una tabla creada en una subconsulta.