What is the specifications for Motion JPEG?

There isn’t an official standard. In practice, in its simplest form, an mjpeg is just a concatenation of jpeg files, one after the other in the same file. ffmpeg supports this using the -f mjpeg or -vcodec mjpeg switches. JPEG decoders that decode multiple images should remember and use the same jpeg tables for subsequent … Read more

What are the key differences between JavaScript and ActionScript 3?

First of all ActionScript 3 and JavaScript are both defined in ECMA-262 so they have a lot in common. Both languages feature prototype inheritance for instance. It is however not correct that ActionScript fully implements ES4. ActionScript implements a couple of features that are not defined in ECMA-262 and some — but definitely not all … Read more

What is the best way to get the minimum or maximum value from an Array of numbers?

The theoretical answers from everyone else are all neat, but let’s be pragmatic. ActionScript provides the tools you need so that you don’t even have to write a loop in this case! First, note that Math.min() and Math.max() can take any number of arguments. Also, it’s important to understand the apply() method available to Function … Read more

Insert commas into number string

If your language supports postive lookahead assertions, then I think the following regex will work: (\d)(?=(\d{3})+$) Demonstrated in Java: import static org.junit.Assert.assertEquals; import org.junit.Test; public class CommifyTest { @Test public void testCommify() { String num0 = “1”; String num1 = “123456”; String num2 = “1234567”; String num3 = “12345678”; String num4 = “123456789”; String regex … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)