Як застосувати "Event Pan/Crop" до всього треку (Vegas Pro)?

На жаль, прямо на трек не можна, але можна автоматизувати копіювання та вставлення на всі відеокліпи трека, для цього:

  1. Обираємо перший відеокліп.
  2. Налаштовуємо для нього "Event Pan/Crop" як потрібно.
  3. Копіюємо кліп.
  4. Клік правою кнопкою миші по ньому - обираємо "Select Events to End" - це виділить усі кліпи до кінця треку.
  5. Тиснемо ще раз праву кнопку миші і вибираємо: "Paste Event Attributes" - це, відповідно, вставить налаштування "Pan/Crop" у всі (вибрані) кліпи треку.

Scaling (zoom) and moving the object and rendering area relative to the mouse cursor.

Task

There are certain objects that need to be scaled, for example, a rectangle that should grow/shrink depending on mouse wheel rotation, while scaling should be done relative to a specified point, such as the mouse cursor position.

The complexity arises when the relative point changes: the mouse is moved - a new point.

Moving and scaling an object

  1. Move the object space in such a way that the scaling point is at the origin (0,0).
  2. Perform the actual transformation.
  3. Move the object space back - perform exactly the same transformation but in reverse, without considering the scaling factor.

Visual explanation

Zoom in relative to a point (4, 6)

Zoom in relative to a point (3, 5)

Implementation in Java

public class PointScale extends JPanel {
    
	@Override
	public void paint(Graphics g) {
		super.paint(g);
		final Graphics2D g2d = (Graphics2D) g;
        
		final AffineTransform transform = new AffineTransform();
        
		// Perform a shift of a point (0, 0)
		transform.translate(point.x, point.y);
        
		// Perform a zoom
		transform.scale(zoom, zoom);
        
		// Restore the position to its original state (0, 0) -> point
		transform.translate(-point.x, -point.y);
        
		// Apply all transformations
		g2d.setTransform(transform);
	}
}

Moving and scaling the rendering area

To perform a relative transformation, it's necessary to first execute the initial one, and then on top of it, the new one.

Since in this task we are changing the sizes and positions not of specific objects, but of the entire field, it's necessary to transform the field each time it's redrawn, as it resets to its original state every time.

Find the difference between the shift of the coordinate system of the previous state and the position of the cursor relative to the scaled coordinate system of the previous state.

prevX - newX / prevScale = prevXScaled / prevScale - newX / prevScale = (prevXScaled - newX) / prevScale

Add the new offset in the newly scaled coordinate system:

deltaTranslate + newTranslate = deltaTranslate + newX / newScale = (prevXScaled - newX) / prevScale + newX / newScale

Visual explanation

The principle of calculating transformations:

Original image:

Scaling:

Moving:

Calculation example:

X - Coordinates in the original system
X' - Coordinates in the scaled system

Implementation in Java

private AffineTransform prevTransform = new AffineTransform();

private void applyTransformation(Graphics2D g2d) {
	final Point mousePosition = getMousePosition(); // method of Component class
	if (null != mousePosition) {
		final int x = mousePosition.x, y = mousePosition.y;
		g2d.scale(zoom, zoom);
        // Translate the current coordinates back to the previous coordinate system and perform the previous shift.
		g2d.translate(
        	// translateX(Y) - это уже масштабированное значение X(Y): translateX = prevX * prevScaleX
			(prevTransform.getTranslateX() - x) / prevTransform.getScaleX() + x / zoom,
			(prevTransform.getTranslateY() - y) / prevTransform.getScaleY() + y / zoom);
		if (isDragging) g2d.translate(dragX / zoom, dragY / zoom); // dragX - это dX, delta X, изменение координаты при перетаскивании
		dragX = 0;
		dragY = 0;
	} else {
		g2d.setTransform(prevTransform);
	}
	prevTransform = g2d.getTransform();
}

Sources could be downloaded from Github: https://github.com/asilichenko/mouse-move-scale

Як зменшити яскравість, температуру нагріву та потужність світлодіодної лампочки.

Варіант драйвера світлодіодів (стабілізатора струму) на мікросхемі PT4515

 

Струм стабілізації заданий резистором R1 відповідно до формули:

 


How to output formated JSON from a JSONObject

JSONObject jo = new JSONObject();
.....
ObjectMapper mapper = new ObjectMapper();
Object json = mapper.readValue(jo.toString(), Object.class);
System.out.println("var data = " + mapper.writerWithDefaultPrettyPrinter().writeValueAsString(json) + ";");

How to determine the number of spaces on the beginning of a String

String s = "     London is a capital of Great Britain  ";
int beginningSpaces = s.indexOf(s.trim());

How to output (print) a tree to the console (in text form)

Пример:

x
├── c
│   ├── a
│   └── b
├── d
├── e
│   └── asdf
└── f

Код:

public class TreeNode {

    final String name;
    final List<TreeNode> children;

    public TreeNode(String name, List<TreeNode> children) {
        this.name = name;
        this.children = children;
    }

    public String toString() {
        StringBuilder buffer = new StringBuilder(50);
        print(buffer, "", "");
        return buffer.toString();
    }

    private void print(StringBuilder buffer, String prefix, String childrenPrefix) {
        buffer.append(prefix);
        buffer.append(name);
        buffer.append('\n');
        for (Iterator<TreeNode> it = children.iterator(); it.hasNext();) {
            TreeNode next = it.next();
            if (it.hasNext()) {
                next.print(buffer, childrenPrefix + "├── ", childrenPrefix + "│   ");
            } else {
                next.print(buffer, childrenPrefix + "└── ", childrenPrefix + "    ");
            }
        }
    }
}

Sorce and other implementations: stackoverflow

Windows 7 BSOD MEMORY_MANAGEMENT 1A 403

Что делать если вылетел синий экран смерти на Windows 7, с ошибкой MEMORY_MANAGEMENT и кодом 0x0000001A (0x0000000000000403, .....)


Вероятно в вашем компьютере установлены разнородные планки памяти, например, все характеристики совпадают, кроме таймингов:

  • CL11-11-11-28
  • CL9-9-9-24

Для того, чтобы такая память могла стабильно совместно работать - тайминги должны быть приведены к одному значению. А для того, чтобы уравнять тайминги - нужно изменить частоту работы памяти. В данном случае тайминги должны быть выставлены на меньшее значение, но для этого необходимо понизить также и частоту - до 1333МГц. Если частоту оставить прежней - 1600МГц, то будет вылетать BSOD.

[фото биоса будет позже]

BSOD:

  • 1600 МГц CL9-9-9-24

OK:

  • 1333 МГц CL9-9-9-24

Вывод

Синий экран смерти  MEMORY_MANAGEMENT 1A 403 вылетает в том случае, когда в биосе выставлена неправильная настройка оперативной памяти.


Desperate Housewives Susan's Art s05 e16

Desperate Housewives Susan's Art s05 e16