w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
Stop avconv Bash script on user input and continue loop
UPDATED Try something like this (OP's code modified a little bit): #!/usr/bin/bash stop() { [ $CPID -ne 0 ] && kill -INT $CPID && wait $CPID && echo "Killed $CPID"; } trap "stop; exit" INT CPID=0 while :; do read -p "Enter your number here: " YOURNUMBER stop [ "$YOURNUMBER" == quit ] && break; TIMESTAMP=$(date +"%Y.%m.%d_%H.%M") avconv -f video4linux2 -r 3 -fs 52428800 -i /dev/video0 /home/$USER/orders/$YOURNUMBER/$TIMESTAMP-$YOURNUMBER.avi& CPID=$! echo -e "Video complete!" done This starts avconv in the background so the user can enter a new number. Maybe the stdout and stderr of avconv should be redirected to a log file or to /dev/null. Also it should be tested which signal stops avconv gracefully. -INT is equivalent to ctrl+c. It

Categories : Bash

MySQL Cross Join with concat field
Are you looking for this? CREATE VIEW vw_products_types AS SELECT CONCAT(p.code, t.code) combined_code, p.product_name, t.type_name FROM Products p CROSS JOIN ProductsType t Here is SQLFiddle demo

Categories : Mysql

Select multiple files (different files from different directory) with 1 input type file element.
Using more than one <input type="file" /> element for your form is the best you can do. It's not possible to select multiple files from different directories in a single upload dialog.

Categories : HTML

Can boost:algorithm::join() concat a container of floats?
Sure, you can combine boost::algorithm::join and boost::adaptors::transformed to convert the doubles to strings and then join them together. #include <iostream> #include <vector> #include <string> #include <boost/algorithm/string/join.hpp> #include <boost/range/adaptor/transformed.hpp> int main() { using boost::adaptors::transformed; using boost::algorithm::join; std::vector<double> v{1.1, 2.2, 3.3, 4.4}; std::cout << join( v | transformed( static_cast<std::string(*)(double)>(std::to_string) ), ", " ); } Output: 1.100000, 2.200000, 3.300000, 4.400000

Categories : C++

How to concat 2 files
Replace int temp; while((temp = sistream.read()) != -1) { fostream.write(temp); } with a buffered copy: int count; byte[] temp = new byte[4096]; while((count = sistream.read(temp)) != -1) { fostream.write(temp, 0, count); } This will read at most 4096 bytes at once, not 1 byte at a time. BufferedReader / BufferedWriter may improve performance even more.

Categories : Android

Bash shell read names of files from folder and create an output file for each input file with the same name:
The underscore is a valid character in variable names. Do: ./"$f" > "${f}_july_15.txt" Your code was trying to use a variable named f_july_15. You need to use braces to delimit the variable name when it's followed by a character that can be part of a variable name.

Categories : Bash

Concat video files of different resolutions using FFmpeg
For merging videos you need to work with the same resolution, you should scale the 640x480 video or compress the 1280x720, it is up to you. I would recommend you compress the bigger one it is faster. Moreover, for merging videos you need a media file with audio and video part. You can create a silence audio with the same duration of your video and after you can add it to your video. Videos should be merged with audio. ffmpeg -ar 48000 -t 60 -f s16le -acodec pcm_s16le -i /dev/zero -ab 128K -f mp2 -acodec mp2 -y silence.mp2 ffmpeg -i video_without_audio.mpg -i silence.mp2 video_to_merge.mpg

Categories : Android

bash: clean outer join of three files, preserving file-membership
This awk script will do what you want: $1=="id"&&$2=="name"{ ins[$3]= 1; lastin = $3; } $1!="id"||$2!="name" { ids[$1] = 1; names[$2] = 1; a[$1,$2,lastin]= $3 used[$1,$2] = 1; } END { printf "id name" for (i in ins) { printf " %s", i } printf " " for (id in ids) { for (name in names) { if (used[id,name]) { printf "%s %s", id, name for (i in ins) { printf " %d", a[id,name,i] } printf " " } } } } Assuming your files are called list1, list2, etc., and the awk file is script.awk, you can run it like this $ cat list* | awk -f script.awk id name in1 in2 in3 1 jon 1 0 0 2 sue 1 1 1 3 bob 0 1 0 3 adam 0 0 1

Categories : Bash

How to concat a number with "Kg" using Jquery. I want to concat the TotalWeight field with unit "Kg"
$(document).ready(function () { $("tr.item").each(function () { var weight = $(this).find('td.Weight').text(); // you left out the quotes and the closing paran var unit = "Kg"; $("#TotalWeight").text(weight + unit); }); }); jsFiddle DEMO

Categories : Javascript

search box -> I need to concat first name and last name from one table and join it to a 2nd and return item from 2nd table
Why doesn't this work? select lname + ', ' + fname as playerName , team as teamName from table1 join table2 on table2.username = table1.username Update: where (fname + ' ' + lname) like '%Ozzie Smith%'

Categories : Mysql

Parse an input file into two separate files in java
Since this sounds like homework, I will not go into too much code detail, but you could read the first line, and then use the .split("\s+") method from the String class. Once you do this, you will end up with an array with 10 in the first location and 12 in the second. While you iterate over the next lines, simply keep a counter and check if the value of the counter is less than or equal to 10. If this holds, then you know that you need to output one file. If the condition no longer holds and the counter is now greater than 10 but less than or equal to 10 + 12, then you know that you should print in the second file.

Categories : Java

Node.js concat array after async.concat()
Instead of callback(dialog);, you want callback(null,dialog); because the first parameter to the callback function is an error object. The reason that console.log(arguments) is getting called after the first iteration is because async thinks an error occurred.

Categories : Javascript

Get the files chosen using the input type file (multiple) and store them in an array
This should work for you... function loadfiles() { var x=document.getElementsByTagName("input"); for (var i=0;i<x.length;i++) { if(x[i].type == "file"){ document.write(x[i].value); } } }

Categories : Javascript

Bash parallel process on multiple input files, one output file
Yes, your output file gets overwritten by each process. Make each script output to its own file, and once all the scripts are finished, concatenate the output: i=0 for x in /home/moleculo/x* ; do ExtractOutCalls2.sh /home/Scripts/000 $x > OUT.$i & (( i++ )) done wait cat OUT.* > OUT rm OUT.* You have to change the script to output to standard output instead of the file, or make it accept the name of the output file to be created.

Categories : Bash

javascript concat() , want to concat 5 different value of string
If your problem always involves 5 numbers, you could simply use 111110-num2. E.g., 111110-12345=98765. To solve the issue for a dynamic amount of numbers, you could make the number of 1s depend on how long the entered number is.

Categories : Javascript

shifting chars in C with modulus, outputting to file produces unsupported file format on one input, txt file on other input
Nominally, a text file must end with a newline. Your program does not ensure that there is a newline at the end of the file, so it does not always generate a text file. Indeed, it probably does so one time in 256 (or maybe 255; what do you do about null bytes?). Most Unix programs aren't that fussy about the last line, but some are. So, if that's the definition of a text file, it isn't very surprising that you don't produce one. In any case, the intermediate file is likely to contain a whole bunch of characters that make it look unlike a text file — depending on the password, of course. You use the password to generate a value for a Caesar shift. This means that most of your alphabetic characters are going to be shifted to a non-alphabetic position. This is fairly normal for an e

Categories : C

Adding 2 pictures to a video with avconv
Yes, just add another set of movie and overlay filters. Something like (split over multiple lines for clarity) -vf " movie=logo1.png [watermark1]; movie=logo2.png [watermark2]; [in][watermark1] overlay=x1:y1 [watermarked1]; [watermarked1][watermark2]overlay=x2:y2[out] "

Categories : Misc

Grunt concat: Use file instructions a la Codekit
I do not know about codekit syntax, but if all you need is the prepend feature, then take a look at https://github.com/miensol/grunt-concat-in-order, and specifically the filebased approach. You could customize the syntax to extract your codekit prepend syntax or replace that to something like @depend used in the example. (for a cross platform example check out my fork, it has a windows safe example, using path.normalize)

Categories : Javascript

Golang + Avconv error (exit status 254)
You are running the equivalent of avprobe "inputfile.mp4 -loglevel quiet -show_streams -frame_size -print_format -show_format -of json" I am guessing avprobe doesn't like that, try command := exec.Command("avprobe", "inputfile.mp4", "-loglevel", ...) You can also use exec.CombinedOutput() to get the output from avprobe and see what it says.

Categories : Go

jquery set value from input type file multifile to input type file single file for multiple file upload
It is not possible to programatically select files into a an <input type="file" />. The reason for this is security. Consider if it was possible - it would mean that unscrupulous developers could essentially steal files from visitors computers by using Javascript to select a file and submit the form without the user knowing.

Categories : Jquery

mysql concat data if null to end and if not null to continue concat
Are you looking for this? SELECT id, CONCAT_WS(' ', COALESCE(col1, ''), COALESCE(col2, ''), COALESCE(col3, ''), COALESCE(col4, ''), COALESCE(col5, '')) bullet FROM Statements_1 Output: | ID | BULLET | ---------------------------------- | 1 | my dog runs | | 2 | 14 apples taste good | | 3 | yes this is fun | | 4 | I am wasting my resources | Here is SQLFiddle demo COALESCE returns the first non-NULL value from the list. In the example if a column value is NULL it returns an empty string otherwise the value itself. Now CONCAT_WS() is a convinient way to concatenate a bunch of values with a separator.

Categories : Mysql

How to read from input file (text file) and validate input as valid integer?
I would probably read the line with std::getline, then use a Boost lexical_cast to convert to int. It will throw an exception unless the entirety of the input string can be converted to the target type -- exactly what you want. Of course, you'll also need to check that the converted result is in the correct range, and also throw the exception if it's out of range.

Categories : C++

Customizing the specific output files for various Typescript input files
The direction you're going is the optimal way (on save). In the meantime you can use post-build events to transform the typescript. Right click on your project and select properties. Select Build Events and in the Post-Build area you can specify command line parameters to use tsc.exe. On the direction you're going (compile on save) I think the project file may be missing the following on each file you want compiled: <TypeScriptCompile Include="app.ts" /> The configuration is also likely missing the environment settings. <PropertyGroup Condition="'$(Configuration)' == 'Debug'"> <TypeScriptTarget>ES5</TypeScriptTarget> <TypeScriptIncludeComments>true</TypeScriptIncludeComments> <TypeScriptSourceMap>true</TypeScriptSourceMap> &

Categories : Visual Studio 2012

How to input .apk file and read classes and xml file from the input apk file in eclipse?
It's called "Decompile". You can try google searching "Android apk decompile." One popular tool to do this is APKTool.

Categories : Android

Why is the input not being written to file even if fprintf is used to pass the input to the file pointer?
scanf() doesn't set its argument to EOF when it has no more characters to read. So your for loop is an infinite loop. Two things to change: Instead of making assumptions, read the documentation. Use fgets() instead of scanf(). (Forget scanf(), after all, it doesn't do what you think it does, there are a lot of much better and friendly functions out there, especially for a beginner.) "Okay, okay, but I can haz the codez?" You can: #include <stdio.h> #include <limits.h> #include <assert.h> int main() { char buf[LINE_MAX]; fgets(buf, sizeof(buf), stdin); FILE *fp = fopen("old.out", "w"); assert(fp); fputs(buf, fp); fclose(fp); fp = fopen("old.out", "r"); assert(fp); if (fgets(buf, sizeof(buf), fp)) puts(buf); fclose(

Categories : C

How to provide the output of the first input file as the second input file in one pass in C?
Create a pipe and open it for writing and assign it to yyout and open the pipe for reading and assign it to yyin See http://www.gnu.org/software/libc/manual/html_node/Creating-a-Pipe.html

Categories : C

How to join a PDF files in R?
To do this in R, follow @cbeleites' suggestion (who, I think, is rightly suggesting you move your whole workflow to knitr) to do just this bit in Sweave/knitr. knit the following to pdf, where "test.pdf" is your report that you're appending to, and you'll get the result you want: documentclass{article} usepackage{pdfpages} egin{document} includepdf{test.pdf} % your other document <<echo=FALSE>>= x <- rnorm(100) hist(x) # or whatever you need to do to get your plot @ end{document} Also, the post you link to seems crazy because it's easy to combine plots into a single pdf in R (in fact it's the default option). Simply leave the pdf device open with its parameter onefile=TRUE (the default). x <- rnorm(100) y <- rnorm(100) pdf("test.pdf") hist(x) hist(y) dev.off() P

Categories : R

Join two xml files
You need to take the namespaces into account: XDocument doc1 = XDocument.Load("../../XMLFile1.xml"); XDocument doc2 = XDocument.Load("../../XMLFile2.xml"); XNamespace df = "http://schemas.microsoft.com/sharepoint/soap/"; var joinedData = from version in doc1.Root.Elements(df + "Version") join version2 in doc2.Root.Elements(df + "Version") on (DateTime)version.Attribute("Modified") equals (DateTime)version2.Attribute("Modified") select new { modDate = (DateTime)version.Attribute("Modified"), status = (string)version.Attribute("Status"), edited = (string)version2.Attribute("Edited") }; foreach (var data in joinedData) { Console.WriteLine("{0} edited at {1} with status {2}.", data.e

Categories : Misc

Join two files in powershell
Use a hashtable where the key is the ID. $ht = [ordered]@{} foreach ($line in $file1) { $id,$rest = $line -split ',',2 $ht[$id] = $line } foreach ($line in $file2) { $id,$rest = $line -split ',',2 if ($ht.ContainsKey($id)) { $ht[$id] += ",$rest" } else { $ht[$id] = $line } } $ht.Values > newfile.txt

Categories : Arrays

Inner join same multiple times based on input
If you have a variable number of states coming in, then don't use the join method. It'll quickly get out of control. I'd suggest something more like: SELECT PlanID, COUNT(stateID) AS count FROM yourtable WHERE (stateID IN (x,x,x,x,x)) GROUP BY PlanID HAVING count = ($number_of_states_being_searched_for) You'd still have to count up how many states you're looking for, but this will still be a much cheaper query than doing N self-joins.

Categories : Sql Server

Linux - Join multiple CSV files into one
UNIX join should get you a long way: join -a 1 -e '0' "-t " -j 1 <(sort <(join -a 1 -e '0' "-t " -j 1 <(sort file1) <(sort file2))) <(sort file3) (all on one line). Note that "-t " has the TAB character within quotes. Enter it using ^V<Tab>. If you know the input is sorted, it would be better to use join -a 1 -e '0' "-t " -j 1 <(join -a 1 -e '0' "-t " -j 1 file1 file2) file3 (all on one line) prints: id header1 header2 header3 header1 header2 header3 header1 header2 header3 result_A 10 11 12 result_B 13 14 15 40 41 42 result_C 16 17 18 60 61 62 result_D 19 20 21 63 64 65 result_E 22 23 24 result

Categories : Linux

Python : How to join multiple video files
I'm not sure, if you can append one video file by the other. Every videofile has a specific format with header, tracks and so on. Take a look at http://en.wikipedia.org/wiki/MPEG_transport_stream. However, with ffmpeg you can do it like this : ffmpeg -i "concat:input1.mpg|input2.mpg|input3.mpg" -c copy output.mpg Have a nice day ;)

Categories : Python

hadoop streaming - how to inner join of two diff files using python
You would need to look into using Hive. This would allow you to join multiple source files into one, just like you need. it allows you to join two data sources, almost like you do in SQL and then push the result into your mapper and reducer.

Categories : Python

Take the output of "select" in hive as the input of Hadoop jar input file
It seems that you are gonna run two rounds of Mapreduce: 1st is a Hive query and 2nd is MapReduce stream. As far as I am concerned, to use multi-round Mapreduce jobs, we always need to write/read to/from hdfs between the rounds. That's why MapReduce is always called batch operation. So, the answer to your question is NO.

Categories : Hadoop

pig join gets OutOfMemoryError in reducer when mapred.job.shuffle.input.buffer.percent=0.70
Generally speaking, mapred.job.shuffle.input.buffer.percent=0.70 will not trigger OutOfMemory error, because this configuration ensures at most 70% of reducer's heap is used to store shuffled data. However, there are two scenarios that may cause OutOfMemory error in my practice. 1) Your program has combine() function and your combine() is memory-consuming. So the memory usage may exceed 70% of heap in shuffle phase, which may cause OutOfMemory error. But in general, Pig does not have combine() in Join operator. 2) JVM manages the memory itself and divides its heap into Eden, S0, S1 and old space. S0 and S1 are used for GC. In some cases, S0 + S1 + partial shuffled data (70% heap) > heap size. So the OutOfMemory occurs. As you mentioned, when mapred.job.shuffle.input.buffer.percent=0.30

Categories : Hadoop

How to prompt user for input and use input else where in batch file
set /p "SourcePath=Enter directory path containing files to be converted: " echo %SourcePath% set /p "TargetPath=Enter directory path to save files to once converted: " echo %TargetPath% pause

Categories : Batch File

How to search for few files out of hundred files in UNIX and if not find replace with 0 byte file
Assuming by shell u mean bash: Skeleton to start with: luk32:~/projects/tests$ cat ./process_files.sh #!/bin/bash DEST=./copies for num in "$@"; do file="AllResponses_"$num"_6_20_2013.txt" if [ -f $file ]; then cp $file $DEST else touch $DEST/$file fi done; It takes numbers as arguments, then tries to find a file with given pattern in current working directory. If found copy to destination folder, else touch the file. You will probably have to tinker a little bit to get friendlier than hard-coded date handling. Example: luk32:~/projects/tests$ ls -l total 40116 -rw-r--r-- 1 luk32 luk32 4 cze 21 11:33 AllResponses_1_6_20_2013.txt -rw-r--r-- 1 luk32 luk32 5 cze 21 11:33 AllResponses_3_6_20_2013.txt -rw-r--r-- 1 luk32 luk32 0 cze 21 11:32 AllResponses_4_6_20

Categories : Unix

Can I set the input a Mapper as a hashMap instead of an input file
I think you want to read your file as a key-value pair not as a standard way to read inputSlipt(Line number as a key and Line as a value). If it is waht you asked then you can use KeyValueTextInputFormat below description can be found on Hadoop: definitive guide KeyValueTextInputFormat TextInputFormat’s keys, being simply the offset within the file, are not normally very useful. It is common for each line in a file to be a key-value pair, separated by a delimiter such as a tab character. For example, this is the output produced by TextOutputFormat, Hadoop’s default OutputFormat. To interpret such files correctly, KeyValueTextInputFormat is appropriate. You can specify the separator via the key.value.separator.in.input.line property. It is a tab character by default. Consider th

Categories : Hadoop

Trying to print from an input file but printing the last input twice
EOF mark not read yet, which calls for the next iteration, hence last line twice. Check for EOF inside the loop, like this :- if (orders.is_open()) { cout << "Order Number" << setw(16) << "Quantity" << setw(22) << "Total Cost" << endl; while (true) { orders >> idNum >> quantity >> totalCost; if( orders.eof() ) break; cout << " " << idNum << setw(18) << quantity << setw(23) << totalCost << endl; } orders.close(); } Following should also achieve the expected result: if (orders.is_open()) while (orders >> idNum >> quantity >> totalCost) cout << " " << idNum << setw(18) << quantity << setw(23) <

Categories : C++

Concatenate / Join MP4 files using ffmpeg and windows command line batch NOT LINUX
From reading your question, I'd suggest that the configuration file might look like this: # this is a comment file 'C:UsersJoe1Maysession3 eadyforfinalconversionTitlefile.mp4' file 'C:UsersJoe1Maysession3 eadyforfinalconversionEnglishfile.mp4' It may need double quotes around the pathfilenames instead of single quotes, for Windows. Try it both ways.

Categories : Windows



© Copyright 2017 w3hello.com Publishing Limited. All rights reserved.