runtime

Is not using & with a variable in scanf() a syntax error or a runtime error?

大城市里の小女人 提交于 2019-12-02 02:52:33
问题 I was taught that a syntax error comes from a single mistake and doesn't execute the program. However, a runtime error still starts the program but crashes in the middle. If I accidentally didn't put & in front of a variable in a call to scanf() , would that considered to be a syntax error or a runtime error? For example int main(void) { int a; printf("input a integer number >>"); scanf("%d\n", a); printf("the input number is %d\n", a); return 0; } In the scanf statement, I don't have & in

Castle Windsor: How to specify a runtime value as a parameter (E.g. value returned from static function call)

我怕爱的太早我们不能终老 提交于 2019-12-02 01:32:24
I want to perform this CODE equivlant in the castle xml config file. // Foo(string name) IFoo f = new Foo(StaticBarClass.Name); XML Now for the XML, I know everything (e.g. the blah) except for the stuff inside the parameter part. What would the parameter part look like? <component id="blah" service="blah" type="blah"> <parameters> <name>StaticBarClas.Name_THAT_I_NEED_HELP_WITH</name> </parameters> One approach you could use is to replace the configuration parameters inspector with your own variant that can introduce some additional behaviour - here's a quick prototype: public class

.NET 3.5 runtime and .NET 4 runtime compatibility

狂风中的少年 提交于 2019-12-02 01:28:53
Is it possible to run an application built on .NET 3.5 with a plug-in built with .NET 4? You will need to rebuild (not exactly true, check update) the .NET 3.5 application to target .NET 4.0 because by default it will start in the .NET 2.0 runtime which will then not support the plugin. If the machine only has .NET 4.0 framework installed the application will not run unless rebuilt to target it specifically . Update: Well, you don't need to rebuilt after all. Chris comment got me thinking and I just tested with a console application built for .NET 3.5. You can just specify in its application

How to force a XmlSerializer to serialize elements as attributes of a compiled type?

僤鯓⒐⒋嵵緔 提交于 2019-12-02 01:17:38
I've given some predefined XML similar to this: <?xml version="1.0" encoding="utf-8"?> <Root xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <Points> <Point X="1.345" Y="7.45" /> <Point X="1.123" Y="5.564" /> <Point X="3.34" Y="2.5345" /> </Points> <!-- and a bunch of other attributes and structures which are perfectly serialized and deserialized by the XmlSerializer --> </Root> And my goal is to deserialize it into a List<System.Windows.Point> using a XmlSerializer instance and vice versa. Therefore I've defined type like the following:

Build with runtime packages on Delphi XE2

家住魔仙堡 提交于 2019-12-02 00:59:59
I found a similar question but did not find the answer. The question is how easily to add all installed runtime packages to the list in "project options/package/runtime packages" in a Delphi XE2 project? In XE and earlier versions you can do it by simply checking/unchecking "build with runtime packages" and those packages immediately appear in the edit below. Create a new project and copy list from its options. Check Link with runtime packages . Check Inherit for ´Runtime packages`. The default (inherited) runtime packages are shown at the bottom list and is included in your project. Only add

Changing Enum at Runtime Java

拟墨画扇 提交于 2019-12-02 00:50:16
问题 Is there any way to add elements to a built in enum class in Java? My question is similar to Can I add and remove elements of enumeration at runtime in Java, but that question seems to be geared towards constructing your own enum and then modifying it. I'm assuming there's an existing enum somewhere I can't change, something like enum Days{ MONDAY, TUESDAY, WEDNESDAY } and I want to add Thursday, Friday, etc. to it. So unfortunately, suggestions of how to use an interface to accomplish my

Why does an Ada compiler let range violations pass? Why is my type declaration a runtime entity?

我的梦境 提交于 2019-12-02 00:42:12
问题 Why does Ada compiler let range violations pass? It does give warning, but why does it let it pass if it is an error in any case? Is there a practical scenario in which this is a useful behaviour? And most importantly: Why is type declaration a runtime entity? I mean the 3rd line of the code example is something I expect to be evaluated ahead of time. I thought that only the 5th line will "make it" into the executable. Why not? Is that something useful? Am I missing or misinterpreting

Is not using & with a variable in scanf() a syntax error or a runtime error?

…衆ロ難τιáo~ 提交于 2019-12-02 00:10:21
I was taught that a syntax error comes from a single mistake and doesn't execute the program. However, a runtime error still starts the program but crashes in the middle. If I accidentally didn't put & in front of a variable in a call to scanf() , would that considered to be a syntax error or a runtime error? For example int main(void) { int a; printf("input a integer number >>"); scanf("%d\n", a); printf("the input number is %d\n", a); return 0; } In the scanf statement, I don't have & in front of a so that would crash, but it still executes the first printf statement, so it would show some

How to generate or modify a PHP class at runtime?

霸气de小男生 提交于 2019-12-01 23:37:13
The schmittjoh/cg-library seems what I need, but there is no documentation at all. This library provides some tools that you commonly need for generating PHP code. One of it's strength lies in the enhancement of existing classes with behaviors. Given A class: class A {} I'd like to modify, at runtime of course and with some cache mechanism, class A , making it implementing a given interface: interface I { public function mustImplement(); } ... with a "default" implementation for method mustImplement() in A class. hakre Note: OP needs PHP 5.3 (it was not tagged that way before), this question

Java: Add Class to Jar archive at runtime

♀尐吖头ヾ 提交于 2019-12-01 23:35:35
问题 I want to add some compiled classes (.class files) to directories(packages) in current Jar file at runtime How can I do that? Thanks 回答1: This cannot be done - To update a Jar file you need to create a new one and overwrite the old one with the new one. Below is a sample on how you would do this: import java.io.*; import java.util.*; import java.util.zip.*; import java.util.jar.*; public class JarUpdate { /** * main() */ public static void main(String[] args) throws IOException { // Get the