batch-processing

How to store MySQL results to a file in table format

不打扰是莪最后的温柔 提交于 2019-11-30 19:50:26
I am trying to create a file and store in it the results from my query. I have a batch file that contains the single query, USE database1; SELECT * FROM table WHERE name = "abc" INTO OUTFILE output.txt; QUIT Executing this batch file using, mysql -u root -p -t -vvv < select.sql However, the result is not table formatted and fields' names are missing from the top. 100 abc Brown 32 101 abc Flair 25 102 abc McDonald 45 . . . If I remove the INTO OUTFILE statement and print the results on terminal, then is working OK. +----+------+---------+-----+ | id | name | surname | age | +----+------+-------

PBS, refresh stdout

∥☆過路亽.° 提交于 2019-11-30 18:44:41
I have a long running Torque/PBS job and I'd like to monitor output. But log file only gets copied after the job is finished. Is there a way to convince PBS to refresh it? Unfortunately, AFAIK, that is not possible with PBS/Torque - the stdout/stderr streams are locally spooled on the execution host and then transferred to the submit host after the job has finished. You can redirect the standard output of the program to a file if you'd like to monitor it during the execution (it makes sense only if the execution and the sumit hosts share a common filesystem). I suspect the rationale is that it

How to create a batch file which work for both Program Files and Program Files(x86)?

断了今生、忘了曾经 提交于 2019-11-30 18:20:25
I have created a batch file which automatically copy a .sql file to the path of installed Jasper server(it could be any software installation directory). This is my batch script-- C:\PROGRA~2\JASPER~1.0\mysql\bin\mysql.exe -u root -proot < create_database.sql that is working when jasper is installed in Program Files(x86). How can i generalize it for both Program Files and Program Files(x86). You want to use environment variables to look up things like this. On 32bit Windows, %ProgramFiles% is your friend. On 64bit Windows, things are a little more complicated, as application can be installed

How do I get the error level of commands in a pipe in Windows batch programming?

你离开我真会死。 提交于 2019-11-30 17:00:19
Batch files return the error code of the last command by default. Is it somehow possible to return the error code of a former command. Most notably, is it possible to return the error code of a command in a pipe? For example, this one-line batch script foo.exe returns the error code of foo . But this one: foo.exe | tee output.txt always returns the exit code of tee , which is zero. I had a similar problem and settled on the following solution as I did not need to detect the exact error code just success or failure. echo > .failed.tmp ( foo.exe && del .failed.tmp ) | tee foo.log if exist

How to delete a line of a text file, given the line number using batch (.bat) script?

心已入冬 提交于 2019-11-30 16:40:13
I want to write a batch script where the user can enter the line number and the script will delete that line of a text file. Eg: tmp.txt 1. aaa 2. bbb 3. ccc 4. ddd I want when i execute my script and user inputs 3, the tmp.txt to be 1. aaa 2. bbb 4. ddd I am trying something like this: @ECHO OFF SET /P LINENUMBER=Enter the Line No: FOR /F "tokens=1* delims=[]" %%a IN ('FIND /n /v "" ^< tmp.txt') DO ( IF %%a equ %LINENUMBER% ( ???????????????????? ) ) You cannot modify the file directly. You must create a new file with the desired content and then replace the original file with the new file.

Creating multiple videos with Avisynth

孤街醉人 提交于 2019-11-30 14:13:12
I have a bunch of individual files that I want to each run through Avisynth. However, an AVS file can only create one video. As far as I know, there is no way to declare a variable's value from the command line. I know that you can probably create a script that generates a bunch of AVS files and then somehow convert each AVS file to a video. However, since Avisynth is a scripting system, this seems kind of complicated. There must be some way to run different videos through a script, right? What is the best way to do this? Thanks in advance. I've never found a way to pass a command line

Spring Batch: Which ItemReader implementation to use for high volume & low latency

余生颓废 提交于 2019-11-30 08:35:32
Use case: Read 10 million rows [10 columns] from database and write to a file (csv format). Which ItemReader implementation among JdbcCursorItemReader & JdbcPagingItemReader would be suggested? What would be the reason? Which would be better performing (fast) in the above use case? Would the selection be different in case of a single-process vs multi-process approach? In case of a multi-threaded approach using TaskExecutor, which one would be better & simple? To process that kind of data, you're probably going to want to parallelize it if that is possible (the only thing preventing it would be

Spring Batch how to filter duplicated items before send it to ItemWriter

僤鯓⒐⒋嵵緔 提交于 2019-11-30 07:18:15
问题 I read a flat file (for example a .csv file with 1 line per User, Ex: UserId;Data1;Date2 ). But how to handle duplicated User item in the reader (where is no list of previus readed users...) stepBuilderFactory.get("createUserStep1") .<User, User>chunk(1000) .reader(flatFileItemReader) // FlatFileItemReader .writer(itemWriter) // For example JDBC Writer .build(); 回答1: Filtering is typically done with an ItemProcessor . If the ItemProcessor returns null, the item is filtered and not passed to

How do you enable batch inserts in hibernate?

狂风中的少年 提交于 2019-11-30 06:21:43
问题 With hibernate, when I attempt to enable batch inserts with <property name="jdbc.batch_size">50</property> I get the following output: [...] cfg.SettingsFactory INFO - JDBC batch updates for versioned data: disabled [...] cfg.SettingsFactory INFO - Order SQL inserts for batching: disabled And then this: [...] jdbc.AbstractBatcher DEBUG - Executing batch size: 1 never more than batch size: 1 basically. Am I missing a setting? 回答1: To enable batching for both INSERT and UPDATE statements, you

Best way to insert a good amount of records in hibernate

时光毁灭记忆、已成空白 提交于 2019-11-30 05:08:26
I'm using hibernate + play! framework at work, is there a "best practice" on inserting a good amount of records using hibernate? They are around 6,000 to 10,000 per text file so I don't know if Hibernate is going to choke on the job or throw an exception. Any suggestion let me know, let me know if I have to explain more From *Java Persistence and Hibernate" (Manning) and following a comment from Pangea, use a stateless session (which doesn't have a persistence context cache) : StatelessSession session = sessionFactory.openStatelessSession(); Transaction tx = session.beginTransaction(); for (