runtime

Runtime.exec() command with utf-8 characters

孤者浪人 提交于 2021-02-07 04:38:11
问题 I'm trying to execute Runtime.getRuntime().exec() command which contains polish characters. Command is cutted from the first polish letter. Instead of polish letter i'm getting "?". How can I set correct encoding to exec this command properly? Command which i'm using : execCommand("php /home/script/url param1 param2 param3) execCommand looks like : private String execCommand(String command) { String output=""; try { Process proc = Runtime.getRuntime().exec(command); BufferedReader read = new

Is it possible to define structs at runtime or otherwise achieve a similar effect?

风格不统一 提交于 2021-02-04 22:17:27
问题 I want to create a function (for a library) which will output a struct for any CSV which contains all the columns and their data. This means that the column names (unless explicitly provided by the user) will not be known until runtime. Is it possible to create a struct definition at runtime or mutate an existing struct? If so, how? For example, how can I mutate the following struct structure: struct Point { x: String, y: String, } To the following (in memory only): struct Point { x: String,

How can I write to Big Query using a runtime value provider in Apache Beam?

末鹿安然 提交于 2021-02-04 06:14:37
问题 EDIT: I got this to work using beam.io.WriteToBigQuery with the sink experimental option turned on. I actually had it on but my issue was I was trying to "build" the full table reference from two variables (dataset + table) wrapped in str(). This was taking the whole value provider arguments data as a string instead of calling the get() method to get just the value. OP I am trying to generate a Dataflow template to then call from a GCP Cloud Function.(For reference, my dataflow job is

what is the Java equivalent of Pythons's subprocess shell=True property?

↘锁芯ラ 提交于 2021-01-29 17:14:38
问题 I've been using python for a long time. python's system and subprocess methods can take shell=True attibute to spawn an intermediate process setting up env vars. before the command runs. I've be using Java back and forth and using Runtime.exec() to execute shell command. Runtime rt = Runtime.getRuntime(); Process process; String line; try { process = rt.exec(command); process.waitFor(); int exitStatus = process.exitValue(); } I find difficulty to run some commands in java with success like

Python: speed for “in” vs regular expression [duplicate]

試著忘記壹切 提交于 2021-01-29 10:15:17
问题 This question already has answers here : What's a faster operation, re.match/search or str.find? (6 answers) Closed 6 years ago . When determining whether an instance of substring exists in a larger string, I am considering two options: (1) if "aaaa" in "bbbaaaaaabbb": dosomething() (2) pattern = re.compile("aaaa") if pattern.search("bbbaaaaaabbb"): dosomething() Which of the two are more efficient & faster (considering the size of the string is huge)?? Is there any other option that is

Why is the per sample prediction time on Tensorflow (and Keras) lower when predicting on batches than on individual samples?

∥☆過路亽.° 提交于 2021-01-28 18:54:04
问题 I am using my trained model to make predictions (CPU only). I observe that both on Tensorflow and Keras with Tensorflow backend, the prediction time per sample is much lower when a batch of samples is used as compared to an individual sample. Moreover, the time per sample seems to go down with increasing batch size up to the limits imposed by memory. As an example, on pure Tensorflow, prediction of a single sample takes ~ 1.5 seconds , on 100 samples it is ~ 17 seconds (per sample time ~ 0

How to get the full stacktrace of a StackOverflowError without restarting the application

╄→гoц情女王★ 提交于 2021-01-28 11:14:31
问题 I currently hava a running Java application, which has a bug. I don't know how to fully reproduce it and it didn't happen for weeks until now. When it occurs one times, I can reproduce it over and over again easily until I restart the application. The bug causes a StackOverflowError because of a recursion and I don't know how this happens. The printed stacktrace of the StackOverflowError isn't helpful because it contains only the repeating part, but not the more insteresting initial part,

Adding picture boxes dynamically in VB.Net

只愿长相守 提交于 2021-01-28 02:50:49
问题 I'm sure there is someone out there who can explain this clearly. I would have assumed that I could simply use: Dim pb As PictureBox then I could use pb = New PictureBox but apparently not. I would also assume I can set parameters pb.Width pb.Height pb.Top pb.Left etc. If anyone can help me create a picture box dynamically where I can set the properties I would be so grateful, thanks. I'm also sorry if this question has already been asked, but I have been looking for a few hours now and

Class in jar not found at runtime, but was used to compile

佐手、 提交于 2021-01-27 14:51:59
问题 After I build this project from an ant file, I recieve a jar that contains all of the classes I built. When I try to run this jar, I get the following error: Exception in thread "main" java.lang.NoClassDefFoundError: javax/media/j3d/SceneGraphObject This error indicates that a one of the jars, specifically the j3dcore.jar from java3d, I am using can not be found. However, this jar is on the classpath when compiling through the ant build into the class files. Why can this class not be found at

Class in jar not found at runtime, but was used to compile

半世苍凉 提交于 2021-01-27 14:37:01
问题 After I build this project from an ant file, I recieve a jar that contains all of the classes I built. When I try to run this jar, I get the following error: Exception in thread "main" java.lang.NoClassDefFoundError: javax/media/j3d/SceneGraphObject This error indicates that a one of the jars, specifically the j3dcore.jar from java3d, I am using can not be found. However, this jar is on the classpath when compiling through the ant build into the class files. Why can this class not be found at