canon – prime lens has auto focus but it has fixed “focal length”

I am so lost.

  1. Focal length in physics is the distance at which focus is achieved when rays are parallel. Clear!

  2. “focal length” in photography videos (shown below) always talks about sensor distance from lens. Ok!

  3. If a prime lens is one that has a constant “focal length” then why is there a motor to “AUTO FOCUS” in the EF 50mm F/2.5?

I gather, that they use “focal length” and “Sensor distance” interchangeably as sensor distance is much smaller than object distance so it ends up that “focal length” = “Sensor Distance”.

Is my understanding correct? Canon uses “focal length” in the physics sense, while it has an Image sensor that can move?

enter image description here

python – How can I get Youtube video length using selenium webdriver

I’m trying to automate youtube via selenium but I’m stuck in between I want to create a program that will take list of song which user have to listen and then it will play the song on youtube one after the other automatically. So I’m able to play one song but after that i dont know how to get length of the video automatically and then wait until the video ends and then search the next song and play it.(like a loop until the list ends) plz help me My code

import os
from selenium import webdriver
from getpass import getpass
from time import sleep
from import Options

# Adblocker Extension 
executable_path = "/webdrivers"
os.environ("") = executable_path
chrome_options = Options()

# Chrome Driver
driver = webdriver.Chrome(chrome_options=chrome_options)

# Song name to search :
searchbox = driver.find_element_by_xpath('/html/body/ytd-app/div/div/ytd-masthead/div(3)/div(2)/ytd-searchbox/form/div/div(1)/input')
searchbox.send_keys('Can e Sanem - Mean It')

searchbutton = driver.find_element_by_xpath('//*(@id="search-icon-legacy")')

# Play the first song on the list
playbutton = driver.find_element_by_xpath('/html/body/ytd-app/div/ytd-page-manager/ytd-search/div(1)/ytd-two-column-search-results-renderer/div/ytd-section-list-renderer/div(2)/ytd-item-section-renderer/div(3)/ytd-video-renderer(1)/div(1)/div/div(1)/div/h3/a/yt-formatted-string')

# Play the nect song after the first ends
# playnext = driver.find_element_by_xpath('/html/body/ytd-app/div/ytd-page-manager/ytd-watch-flexy/div(4)/div(1)/div/div(11)/ytd-watch-next-secondary-results-renderer/div(2)/ytd-compact-autoplay-renderer/div(2)/ytd-compact-video-renderer/div(1)/div')


c# – How to annotate a BinaryFormatter packet with a header describing its length?

I am working on a project that is sending data from pc to tablet via usb, using android adb. To serialize the data, we are using BinaryFormatter. The problem I’m running into is that the client is sending packets of size 1161 bytes.

Now I could hard code in 1161 as the length of the byte array on the receiving in, and this would fix my problem. But what I would rather do is put the length in the header of the packet being sent, so the receiving end can check that and create the packet according to the size, just incase we get a different packet type of a different size.

However, BinaryFormatter also encodes the names of the fields, so as far as I can tell, you can’t determine the length the object will be before serializing it, at which point, it’s too late to set the length property in the header.

Does any one know a solution to this that will elegantly handle different packet sizes, and packets over the size of 1024 bytes? Thank you!

programming – Generating set of equations of varying length and solving them

I am trying to generate a set of equations that describe a change in density for each variable in the form of:
$frac{dX_i}{dt}=X_i(r_i-s_i*X_i+sum_{j=1,jneq i}^na_{ij}X_j)$
where n is the number of variables/species.
The code I have generates random values for $a_{ij}$ and produces a list of right hand sides of the equations I need. Next I want to solve them where the right hand sides equal to 0

S = -0.5;
M = Table(0, {i, 1, nSpecies}, {j, 1, nSpecies});
  If(i == j, M((i, j)) = S ,
   If(RandomReal() < 0.6,
    M((i, j)) = -RandomVariate(HalfNormalDistribution(1));
    M((j, i)) = -RandomVariate(HalfNormalDistribution(1));
    M((i, j)) = RandomVariate(HalfNormalDistribution(1));
    M((j, i)) = RandomVariate(HalfNormalDistribution(1));
  {j, 1, i}), {i, 1, nSpecies})
(M) // MatrixForm;
variables = Take(Alphabet(), nSpecies);
IM = variables.M;
eqs = Rationalize((IM + 1.2)*variables);
Solve(AllTrue(eqs, # == 0 &), variables, Reals)

However, this produces the error “Solve:a is not a valid variable”. I have not been able to work out how to fix this. I also have a feeling I might be approaching this incorrectly. any help is greatly appreciated

hashing – Testing uniform insertion on a fixed length hash table?

I’m currently testing some hash algorithms for use within a hash table, I’m doing chaining for collision resolution of the index modulo a prime.

Firstly, I’m testing with some dictionaries and word lists, between 400,000 and 1,400,000 words.

Secondly, I generate a random string of 15,000 bytes, and then toggle one by one bit, to generate two-bit different random strings set.

Thirdly, I generate random strings of 15,000 bytes of length, to form a set of 120,000 strings.

My hash function does not present collisions on this different domain sets.

So in turn to use the output hash for the insertion on the hash table, I convert the byte array output to the two’s-complement binary representation of a BigInteger and then reduce modulo the length of the table (actually some prime).

With this index I can do the insertion and for the collision of the index I use the chaining method: linked lists.

With this in mind I graph the length of all the linked lists in red and the empty buckets in some yellow ticks.

This gives me some true representation of the randomness of the algorithms in review.

First image, for some word list:
enter image description here

Second image, two-bit different string set:
enter image description here

Third image, random strings:
enter image description here

So as you can see the maximum size of the linked list is below 10.

So my question is: Do we have another interest domain set for testing the hash algorithm uniform for use inside a hash table?

I give you the link of my java source code:


8 – How do I modify the email maximum length to 320 characters?

You can using hook_element_info_alter.


 * Implements hook_element_info_alter().
function mymodule_element_info_alter(array &$info) {
  if (!empty($info('email'))) {
    $info('email')('#maxlength') = 320;

Flush all caches so hook gets pickedup.

Drupal 8 How to modify Email Max length to 320 Characters

You can using hook_element_info_alter.


 * Implements hook_element_info_alter().
function mymodule_element_info_alter(array &$info) {
  if (!empty($info('email'))) {
    $info('email')('#maxlength') = 320;

Flush all caches so hook gets pickedup.

focal length – How does having a large diameter make the SEL85F1.4 a premium lens?

Why a bigger diameter lens can gather more light.
Consider, on a dark night, you can see the glow of a burning match off in the distance. Your friends standing near you can also see this distant glow. Translated, the light from the match radiates outward in all directions. Your eyes only receive a fraction of its radiated light. For your friends to see its light, some of it must also play on their eyes. If this is true, do you suppose we could use a funnel-like devise and collect or accumulate more of the matches’ light rays? We can! Capturing and accumulating light, and then projecting an image is the job of the camera lens.

Opticians know that big diameter lenses capture more light then small lenses. this principle is used by astronomers. The largest lens ever made is 60 inches (1,524mm) in diameter. Larger is better but the glass lens is thick in the center and thin at the edges. It is believed that a large such lens will crack under its own weight. We can make bigger, but these are mirror lenses, supported from the rear.

Anyway, the bigger the diameter of a lens the more light it can capture. However, the lens must project an image of the outside world onto the light sensitive surface of film or digital sensor. The longer this projection distance, known as focal length, the more magnified the image will be.

Now everything has its pluses and minuses. When we make the focal length long, we get more magnification (telephoto effect). However, with this increased magnification comes a loss of image brightness. This loss can be severe. We need a way to know just how sever this light loss is.

f-numbers to the rescue: The f-number is short for “focal ratio”. When we compare one lens to another, as to image brightness, we use the f-number as a way to make this comparison. We measure the focal length (magnifying power) and the working diameter of the lens called aperture, both in millimeters and divide.

As an example, a 50mm focal length with an aperture of 25mm equal 50 ÷ 25 =2. We call this focal ratio f/2. This method gives us a simple way to compare lenses. Suppose someone has a camera with 500mm telephoto lens with an aperture diameter of 250mm (a big lens). The focal ratio is 500 ÷ 250 = 2 written f/2. Both the 50mm with aperture 25mm and the 500mm aperture 250mm, deliver the same image brightness. In fact, any lens operating at the same f-number as another, will deliver the same image brightness’.

The camera lens is adjustable as to its working diameter. We or the camera’s software make this adjustment. This system mimics the human eye which makes involuntary diameter adjustments based on vista brightness. The colored portion of our eyes, called the iris after the Greek goddess of the rainbow, make this adjustment by altering the pupil diameter.
The f-number system seems complex. It is based on an increment of change that doubles or half’s the amount of light that traverses the lens.
The f-number set from brightest to dimmest:
1 – 1.4 – 2 -2.8 – 4 – 5.6 – 8 – 11 – 22 – 32

Going right cuts the light in half. Going left doubles image brightness, each a 2X change. The f-number intertwines lens aperture (working diameter) with focal length (magnifying power). When we enlarge the aperture diameter we increase the lens’s working area of entry. This sequence sets an increment of adjustment. That increment is a 2X change. The f-number unit is what we use to control exposure via the lens setting and it also controls depth-of-field. The smaller the aperture setting (going right), delivers a greater span of depth-of-field.

To let in more light, the lens must have a larger diameter. It is more costly to make such a lens because the curve of the glass (figure) must be more accurate especially at the edges.

Nobody said this stuff was easy!

Focal length and FStop

I have been reading about Focal length and Fast lenses when I came across this lens which has 85mm focal length and F1.4 as FStop.

Generally lenses with 1.4mm Fstop have focal length below 35mm but here its 85mm!!
As we calculate FStop as FocalLength/diameter this implies that this lens must be having huge diameter to achieve 1.4 Fstop.

Looking at cost this lens is very expensive, so must be a premium lens.

Can someone please explain how having a large diameter makes it a premium lens.

gimp – Software to measure length (in pixels) between multiple points

I have a fairly high resolution map, and use Gimp to calculate distances (pixels -> miles). I use the measure tool, which allows for a maximum of two legs only. This gets tedious quickly (write down the pixels, and then sum the total later), when there are a lot of curves in a road.

Is there a way, perhaps a Gimp plugin, or other software, which allows me to measure more legs, or draw a free format line and get its length?


Draw 9 legs, and get the total length in pixels (pixels can be converted to miles because scale is known).

enter image description here