output

Is there a “null” printf code that doesn't print anything, used to skip a parameter?

依然范特西╮ 提交于 2019-12-07 00:01:06
问题 If I want a program to have multiple text output formats, I could do something like this: const char *fmtDefault = "%u x %s ($%.2f each)\n"; const char *fmtMultiLine = "Qty: %3u\nItem: %s\nPrice per item: $%.2f\n\n"; const char *fmtCSV = "%u,%s,%.2f\n"; const char *fmt; switch (which_format) { case 1: fmt = fmtMultiLine; break; case 2: fmt = fmtCSV; break; default: fmt = fmtDefault; } printf(fmt, quantity, item_description, price); Since the price is specified last, I could also add one that

How do I putStrLn a Data.ByteString.Internal.ByteString?

霸气de小男生 提交于 2019-12-06 23:58:15
问题 I'm learning haskell and decided to try writing some small test programs to get use to Haskell code and using modules. Currently I'm trying to use the first argument to create a password hash using the Cypto.PasswordStore. To test out my program I'm trying to create a hash from the first argument and then print the hash to screen. import Crypto.PasswordStore import System.Environment main = do args <- getArgs putStrLn (makePassword (head args) 12) I'm getting the following error:

springboot jackson returns array instead of proper json object

好久不见. 提交于 2019-12-06 16:42:20
I have the following controller code. @RequestMapping(value = "/testService/test", produces = MediaType.APPLICATION_JSON_VALUE) public HttpEntity<TestBean> test(@RequestParam Map<String,String> testReq) { ... List<Test> objList=testRepository.test(); testBean.setObjects(objList); ... return new ResponseEntity<TestBean>(testBean, HttpStatus.OK); } TestBean holds a list of Test objects(with getters/setters and some other attributes) as below private List<Test> objects; Test class is defined as below @Entity @Table(name="TEST") @JsonIgnoreProperties(ignoreUnknown = true) public class Test

How to print several array elements per line to text file

こ雲淡風輕ζ 提交于 2019-12-06 16:10:08
问题 I have a 1D array e.g. arr1 = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, ...] of arbitrary length. How do I print this to a text file (with integers/floats separated by spaces) so that every 7 elements are printed on the same line in the text file? So I want the text file to look like this: Line 1: 1 2 3 4 5 6 7 Line 2: 8 9 10 11 12 13 14 回答1: you could do this: liNums = xrange(1, 20) x = 0 line = "" for i in liNums: x+=1 line += "%s " % i if not x%7: line += "\n" #send line to output,

How to name output files, making it related to a variable (in fortran)? [duplicate]

心不动则不痛 提交于 2019-12-06 15:25:07
This question already has answers here : Convert integers to strings to create output filenames at run time (9 answers) Closed 4 years ago . Eg. The integer variable (m) will take the following values one by one: 1 , 2 , 3 , .... For each value of m, an array p(i) (i=1,2,..., 1000) is obtained and written in a output file with open() and write() Could you tell me how to name these output files as file1.dat , file2.dat , file3.dat , … Thanks. So, here is a suggestion: integer :: m integer :: fu character(len=10) :: file_id character(len=50) :: file_name ! Write the integer into a string: write

R Shiny: Isolate dynamic output within dynamic tabs

夙愿已清 提交于 2019-12-06 15:18:48
I am trying to create an app where you choose certain inputs in the sidebar, and when you click on a button it will show the results in a separate tab. I created a tiny example that you can use below. In this example, you choose 4 letters in the sidebar and if you click on the button, it dynamically creates a separate tab with text output. However, when you change the letters and click on the button again, all previous tabs will update with the new results. I'd like to isolate the result in each tab but I don't know how to do that. I tried to do this by using different output names (see

Output from 'choice' in R's kml

冷暖自知 提交于 2019-12-06 14:49:46
I'm having trouble getting 'choice' to create output. When the graphical interface launches, I am selecting a partition with the space bar. This creates a black circle around the partition, indicating it has been selected. When I click 'return', nothing happens. I checked my working directory to look for the output files, but they are not there. I used getwd() to ensure that I have the correct setwd(). No dice. There was a similar question posted: Exporting result from kml package in R ; however, the answer does not work for me. Any suggestions? I am using R 3.1.0 GUI Mavericks build(6734) and

How to interpret the output of choicemodelr (rhierMnlRwMixture) in R

我怕爱的太早我们不能终老 提交于 2019-12-06 13:21:45
My Problem I just started using the R library 'choicemodelr' and succeded in getting some beta values as a solution. But I wonder how do I assign these values to the specific attribute-levels. As a result I only get values for A1B1, A1B2, A1B3,... etc. How does this generic output generally connect to my Design? Didn't find a hint in the documentation. Neither for the choicemodelr libraray, nor the bayesm library (rhierMnlRwMixture) to which it is connected to. I hope you can help me with this one. Thanks in advance, Phil to illustrate this, some code and output: my code in R # loading

C++: Do not show glibc's Backtrace and Memory map on crash

纵饮孤独 提交于 2019-12-06 12:46:54
I'm working on automatic C++ code testing using Python. So I have a Python script that compiles and executes C++ code. When the C++ code crashs, libc output is visible from my Python script output, even if I redirected cout and cerr of the C++ program being executed to /dev/null . Here is a sample isolating the problem: #! /usr/bin/env python # -*- coding: utf8 *-* import sys import os.path import subprocess import shutil import tempfile import string import argparse bug_folder = tempfile.mkdtemp("bug") # Create main.cpp with open( os.path.join(bug_folder,'main.cpp'), "w") as mainfile:

C# SQL output to text like SSMS message tab

穿精又带淫゛_ 提交于 2019-12-06 11:57:15
I'm having some trouble finding a way to get the results from updates/inserts/deletes/table creates... I would like to get it like you see in the SSMS (SQL Server Management Studio) message tab (guess the tool is done_in_proc). At the moment, I can get the exceptions, and I can capture the prints done in the SQL script. I already tried ExecuteScalar, ExecuteReader, ExecuteWithResults and got nothing. Thanks, Code: public void conn_InfoMessage(object sender, SqlInfoMessageEventArgs e) { foreach (SqlError err in e.Errors) { richTextBoxDeployCopy.AppendText("Info : "+err.Message + Environment