Coming from PHP, I’m well versed in using the handy implode function to flatten an array into a string, specifying the delimiter character to be used to indicate the border between the flattened array elements.
From the official definition: The join() method joins all elements of an array into a string, and returns the string.
The elements will be separated by a specified separator. If this is ommitted, then the default separator of a comma (,) will be used.
A few examples on using join:
var fruits = ["Banana", "Orange", "Apple", "Mango"];
//a few example usages
document.write(fruits.join() + "<br />");
document.write(fruits.join("+") + "<br />");
document.write(fruits.join(" and "));
//Banana and Orange and Apple and Mango
Sometimes you will encounter files that have been split into segments in order to make them more manageable for either download or fixed size media transfer purposes. For example, a common method for doing this on Windows is to make use of the excellent dinosaur (in other words, it appears to have been available on PCs since the dawn of the computing age) application, HJ Split, which neatly chops any files fed to it into nice little manageable chunks of bits.
But now the question arises: say you encounter a AVI video file that you have downloaded all the segments for, but now want to put everything together via your Ubuntu desktop in order to view the full video. How will we do it?
Well a remarkably simple way is to open up a standard terminal window and then concatenate all the pieces together with the bog-standard cat command:
cat video1.avi.001 video1.wmv.002 video1.avi.003 > video1.avi
This should result in a fully watchable, complete AVI video file.
However, this process can sometimes cause the video and audio to fall slightly out of synch. One way of dealing with this is to use the clever little mplayer/memcoder application bundle.
First, install with:
sudo apt-get install mencoder mplayer
Now, force a audio/video resynch with:
mencoder -forceidx -oac copy -ovc copy video1.avi video1-fixed.avi
This should work on a couple of other formats as well, such as MPG or MPEG video files for example.