runtime

compile and run c++ code runtime

左心房为你撑大大i 提交于 2019-12-02 11:37:28
问题 Does anyone know how to compile your c++ code wich you write while your program is already running? And later i would like to run that code. I want to do this because I am trying to make a game that woul teach you programing and so the user would have to write the code while the game is running and test it. Thanks for any help 回答1: You'd have an easier time if you chose a language that was designed with embedding in mind - like LUA or python. For C++, you'd have to go for something extremely

Implementation of simple Java IDE using Runtime Process and JTextArea

泪湿孤枕 提交于 2019-12-02 11:29:16
I am developing a simple Java IDE like Netbeans/Eclipse. My GUI includes two JTextArea component, one used as a TextEditor where the end user can type in his programs and the other used as an output window. I am running the users programs by invoking the windows command prompt through Java Runtime and Process classes. I am also catching the IO streams of the process using the methods getInputStream(), getErrorStream(), getOutputStream(). If the program contains only the statements to print something onto the screen, I am able to display the output on the output window(JTextArea). But if it

Using CSharpCodeProvider to allow user created functions

偶尔善良 提交于 2019-12-02 11:04:39
问题 I have an existing asp.net (c#) application. I need to provide users with a way to create flexibles rules to calculate an effective date given a hiredate and an enrollmentdate. Some examples of rules that might be used: The later of hiredate or enrollmentdate HireDate + 90 Days The first of the Month after the enrollment date If the enrollment date is before the 15 of the month, then the effective date is the 1st of the next month. If it is on the 15 or after, it's the 1st of the month after

Go pprof性能调优

て烟熏妆下的殇ゞ 提交于 2019-12-02 11:00:14
Go性能调优 在计算机性能调试领域里,profiling 是指对应用程序的画像,画像就是应用程序使用 CPU 和内存的情况。 Go语言是一个对性能特别看重的语言,因此语言中自带了 profiling 的库,这篇文章就要讲解怎么在 golang 中做 profiling。 Go性能优化 Go语言项目中的性能优化主要有以下几个方面: CPU profile:报告程序的 CPU 使用情况,按照一定频率去采集应用程序在 CPU 和寄存器上面的数据 Memory Profile(Heap Profile):报告程序的内存使用情况 Block Profiling:报告 goroutines 不在运行状态的情况,可以用来分析和查找死锁等性能瓶颈 Goroutine Profiling:报告 goroutines 的使用情况,有哪些 goroutine,它们的调用关系是怎样的 采集性能数据 Go语言内置了获取程序的运行数据的工具,包括以下两个标准库: runtime/pprof :采集工具型应用运行数据进行分析 net/http/pprof :采集服务型应用运行时数据进行分析 pprof开启后,每隔一段时间(10ms)就会收集下当前的堆栈信息,获取格格函数占用的CPU以及内存资源;最后通过对这些采样数据进行分析,形成一个性能分析报告。 注意,我们只应该在性能测试的时候才在代码中引入pprof。

Current thread not owner exception

痞子三分冷 提交于 2019-12-02 10:30:00
in my application i am using a code that run a batch file, on executing it i am getting a exception i.e. current thread is not owner. Here i want to mention that my application is based on eclipse plugin development. Following is my code, please have a look and find out what is the problem to help me.. /*.......any code.........*/ try { Runtime runtime = Runtime.getRuntime(); String cmd = new String(C:\\abc.bat); process = runtime.exec("\"" + cmd + "\""); process.wait(); } catch (Exception e) { e.printStackTrace(); } /***********any code**************/ The wait is the method owned by Object,

Big O notation of a constant

陌路散爱 提交于 2019-12-02 09:36:25
I calculate my runtime complexity to be 4 , what is the Big O notation of this? For example if my runtime complexity is 4 + n then its Big O = O(n) . Let's look loosely at the definition of what we mean by f(n) is in O(g(n)) : f(n) is in O(g(n)) means that c · g(n) is an upper bound on f(n) . Thus there exists some constant c such that f(n) ≤ c · g(n) holds for sufficiently large n (i.e. , n ≥ n0 for some constant n0 ). You can treat a constant function just as any other function, w.r.t. analysing its asymptotic behaviour using e.g. big-O notation. f(n) = 4 g(n) = 1 f(n) ≤ c · g(n) = c · 1,

Lowering build size

孤街浪徒 提交于 2019-12-02 08:37:11
Is there any way I can lower my build size when I am using static linking for the C++ runtime libraries in VS2013? My original file was just 15kb, but I couldn't run it on my other computers without a missing .dll message popping up. I decided to use static linking and now the size is ~100kb. I am using the Windows.h header and WinAPI functions. If you're only going to display a MessageBox, you don't need to link to any static libraries. #include <windows.h> void entry(void) { MessageBox(NULL, "Hello, World!", "", MB_OK); ExitProcess(0); } Compile and link using VC++2013, with the following

java runtime.getRuntime.exec( cmd ) with long parameters

旧时模样 提交于 2019-12-02 08:22:22
I'm making a frontend for a command line app. It has a very long The command line is something simliar to this: public String liveShellCommand(){ String cmd="command mode --parameter arg --parameter2 arg2 --parameter3 arg3"; Runtime run = Runtime.getRuntime() ; Process pr ; try { log.progress("sending command: " +cmd); pr = run.exec( cmd ); pr.waitFor() ; Everything seems to work until I add the "mode" switch into it. The "mode" switch executes from the command line. I've tried a few combinations splitting the parameters into an array which does not execute either. I think it has something to

Can Java Runtime.exec another java program that uses stdin?

拜拜、爱过 提交于 2019-12-02 08:05:45
I have run into an issue where , when using Java Runtime to run another java program, the program freezes because the other program requires stdin . There is a problem with handling the stdin after executing another java program with Runtime exec() . Here is sample code that I can't get to work. Is this even possible? import java.util.*; import java.io.*; public class ExecNoGobble { public static void main(String args[]) { if (args.length < 1) { System.out.println("USAGE: java ExecNoGobble <cmd>"); System.exit(1); } try { String[] cmd = new String[3]; cmd[0] = "cmd.exe" ; cmd[1] = "/C" ; cmd[2

Java - Execute a .SH file

你说的曾经没有我的故事 提交于 2019-12-02 07:11:21
问题 How would I go about executing a .SH file (this is localhost, no remote connection or anything)? I've seen lots of Runtime.exec and other things when I searched but those didn't seem to work. This is Java 6. Also if it matters, all the SH is doing is moving two folders around. Thanks! 回答1: You could use ProcessBuilder ProcessBuilder pb = new ProcessBuilder("myshell.sh", "myArg1", "myArg2"); Process p = pb.start(); BufferedReader reader = new BufferedReader(new InputStreamReader(p