首页 \ 问答 \ 防止外部编辑Application Manifest?(Prevent external editing of an Application Manifest?)

防止外部编辑Application Manifest?(Prevent external editing of an Application Manifest?)

我有一个Delphi应用程序,其中包含一个清单文件,该文件对外部程序集有一些依赖性。 反正是否有人阻止某人更新/更改该清单指向不同的程序集,从而可能改变我的应用程序的工作方式? 使用MT.exe,更新嵌入式清单非常容易。


I have a Delphi application which contains a manifest file with a few dependencies on external assemblies. Is there anyway to prevent someone from updating/changing that manifest to point to different assemblies, thereby perhaps changing the way my app works? Using MT.exe it's pretty easy to update an embedded manifest.


原文:https://stackoverflow.com/questions/5197059
更新时间:2023-07-02 18:07

最满意答案

函数eval返回一个Int ,但是在evExpr您试图将该Int推入一个Maybe Integer (基于evExpr的类型签名)。 Int不是Integer ,所以你得到一个错误。 您可以将eval更改为返回Integer ,将evExpr更改为返回Maybe Int ,或将Int转换为fromIntegralInteger

第二个错误发生是因为runParser有一个类型签名:

runParser :: GenParser tok st a -> st -> SourceName -> [tok] -> Either ParseError a

但是你用一个Parser Expr和一个String来调用它,并且忽略了SourceNamest参数。

我猜你的解析器没有任何用户状态,所以你可以使用:

parse :: Stream s Identity t => Parsec s () a -> SourceName -> s -> Either ParseError a

这不需要用户状态(因为它具有type () ),但仍需要为源传递名称。 就像是:

run :: String -> Either ParseError Expr
run = parse expr "<string>"

你将遇到的下一个问题是,如果解析器遇到解析错误,那么run无法返回Expr 。 解析器返回一个Either ParserError Expr ,你必须在evExpr处理Either ParserError Expr 。 实际上,在evExpr中检查空的列表/ String是没有evExpr ,因为解析器会处理它(并生成一个错误)。 你最好将evExpr更改为返回一个Either ParseError Int ,并且仅对解析器结果的eval进行fmap

evExpr :: String -> Either ParseError Int
evExpr str = eval <$> run str

The function eval returns an Int, but in evExpr you are trying to shove that Int into a Maybe Integer (based upon the type signature of evExpr). An Int is not an Integer, so you get an error. You can either change eval to return an Integer, change evExpr to return a Maybe Int, or convert the Int into an Integer with fromIntegral.

The second error is occurring because runParser has a type signature:

runParser :: GenParser tok st a -> st -> SourceName -> [tok] -> Either ParseError a

But you are calling it with a Parser Expr and a String, and left out the SourceName and st parameters.

I'm guessing that your parser doesn't have any user state, so you could use:

parse :: Stream s Identity t => Parsec s () a -> SourceName -> s -> Either ParseError a

Which doesn't require the user state (since it has type ()), but still requires you to pass a name for the source. Something like:

run :: String -> Either ParseError Expr
run = parse expr "<string>"

The next problem you're going to run into is that run can't return an Expr if the parser encounters a parse error. The parser returns an Either ParserError Expr, which you'll have to deal with in evExpr. In fact, there's no point in checking for an empty list/String in evExpr, since the parser will handle it (and generate an error). You're better off changing evExpr to return an Either ParseError Int, and just fmap the eval over the parser result.

evExpr :: String -> Either ParseError Int
evExpr str = eval <$> run str

相关问答

更多
  • 函数eval返回一个Int ,但是在evExpr您试图将该Int推入一个Maybe Integer (基于evExpr的类型签名)。 Int不是Integer ,所以你得到一个错误。 您可以将eval更改为返回Integer ,将evExpr更改为返回Maybe Int ,或将Int转换为fromIntegral的Integer 。 第二个错误发生是因为runParser有一个类型签名: runParser :: GenParser tok st a -> st -> SourceName -> [tok] ...
  • cin.get()只检索输入的一个字符。 为什么不用 int input1, input2; cout << "Enter the first int: \n"; cin >> input1; cout << "Enter the second int: \n"; cin >> input2; 以这种方式使用std::cin (使用operator>> )也可以处理用户输入的任何多余换行符或空格字符。 cin.get() only retrieves one character of input. Why ...
  • 这不会奏效。 form_for用于为扩展ActiveRecord的模型构建表单。 改用form_tag('/calculate') 。 你需要在config / routes.rb中定义'match'calculate'=>'your_controller_name#calculate'。 此外,您需要查看您的计算动作 - calculate.html.erb (您可以以不同的方式调用它,但您必须指定render 'view_name' 。 或者,如果您要使用相同的视图文件,请使用render :actio ...
  • 你走在正确的道路上; 让我们看看我建议的代码的一些更改。 你的add1函数非常接近,但是你有两个小问题 - 第一个是你提供的模式匹配:为了在语法上正确,你需要把整个匹配放在圆括号内。 第二个是第二个缺点(冒号)。 cons的类型a -> [a] -> [a] ,所以它可以很好地与(x+y)作为第一个参数。 但是,由于xs已经有[Int]类型,因此不需要提供: [] 。 add1 (x:y:xs) = (x+y) : xs 接下来,因为你完全处理Int和Int的列表,所以在这种情况下使用某种类型a是没有意义 ...
  • 将逻辑与接口分开通常是一种很好的做法。 例如,如果您决定创建另一个ViewController并从原始ViewController转换到它,并且您需要计算数据(例如,如果您想绘制图形),您只需将计算器脑通过第二个ViewController。 你可以在这里阅读更多关于Cocoa框架中使用的设计模式(同样的原则适用于Cocoa Touch): Cocoa Design Patterns 。 这是一个Apple教程,它提供了一个非常思考但简单的MVC模式应用程序示例: 您的第二个iOS应用程序 您可以在Web上 ...
  • 你应该记住,Rails不仅仅是关于MVC。 您可以创建自定义类,并在模型或控制器中使用它们。 在这种情况下,你可以在app / lib中创建一个Calculator类,并在你的控制器中使用它。 例如: # app/lib/calculator.rb class Calculator def self.sum(a, b) a.to_i + b.to_i end def self.subtr(a, b) a.to_i - b.to_i end end 。 # app/cont ...
  • 在这里退出一些错误,我将通过它们然后显示一个工作脚本的示例。 首先,您似乎对函数的工作方式做了一些假设。 调用函数不需要() addition() 你也试图在你的函数中使用全局位置参数,因为它们有自己的功能,所以对函数的调用应该传递你想要的 addition $2 $3 考虑到这一点,功能的内部也必须改变 echo "The result of adding " + $1 + " and " + $2 + " is:" 正如您所看到的,我们现在使用$ 1和$ 2,因为我们使用函数的第一个和第二个参数, ...
  • 这是正确的方法,也是唯一的方法。 为了创建计算器并进行计算,您需要创建一个java文件。 由于您需要浮动式计算器,因此您有两种选择: 创建一个Activity并为其指定一个浮动主题。 在res / values / styles.xml文件中添加以下样式(如果没有,请创建它。) 然后将样式应用于您的活动,例如: ... 你的 ...
  • 使用您的抽象ArithmeticExpression,这是Subtract类应该是什么样子。 Java类以大写字母开头。 public class Subtract extends ArithmeticExpression { double result; public Subtract(double x, double y) { this.binary1 = x; this.binary2 = y; } @Override pu ...
  • 这是一个天真的方法: data Station = Station Train [Train] data Train = Train Station Station [Station] 您永远不必创建未初始化的对象。 例如,这里有几个示例值: grandCentral = Station regional [national] bestWestern = Station regional [national] regional = Train grandCentral bestWestern [] na ...

相关文章

更多

最新问答

更多
  • 您如何使用git diff文件,并将其应用于同一存储库的副本的本地分支?(How do you take a git diff file, and apply it to a local branch that is a copy of the same repository?)
  • 将长浮点值剪切为2个小数点并复制到字符数组(Cut Long Float Value to 2 decimal points and copy to Character Array)
  • OctoberCMS侧边栏不呈现(OctoberCMS Sidebar not rendering)
  • 页面加载后对象是否有资格进行垃圾回收?(Are objects eligible for garbage collection after the page loads?)
  • codeigniter中的语言不能按预期工作(language in codeigniter doesn' t work as expected)
  • 在计算机拍照在哪里进入
  • 使用cin.get()从c ++中的输入流中丢弃不需要的字符(Using cin.get() to discard unwanted characters from the input stream in c++)
  • No for循环将在for循环中运行。(No for loop will run inside for loop. Testing for primes)
  • 单页应用程序:页面重新加载(Single Page Application: page reload)
  • 在循环中选择具有相似模式的列名称(Selecting Column Name With Similar Pattern in a Loop)
  • System.StackOverflow错误(System.StackOverflow error)
  • KnockoutJS未在嵌套模板上应用beforeRemove和afterAdd(KnockoutJS not applying beforeRemove and afterAdd on nested templates)
  • 散列包括方法和/或嵌套属性(Hash include methods and/or nested attributes)
  • android - 如何避免使用Samsung RFS文件系统延迟/冻结?(android - how to avoid lag/freezes with Samsung RFS filesystem?)
  • TensorFlow:基于索引列表创建新张量(TensorFlow: Create a new tensor based on list of indices)
  • 企业安全培训的各项内容
  • 错误:RPC失败;(error: RPC failed; curl transfer closed with outstanding read data remaining)
  • C#类名中允许哪些字符?(What characters are allowed in C# class name?)
  • NumPy:将int64值存储在np.array中并使用dtype float64并将其转换回整数是否安全?(NumPy: Is it safe to store an int64 value in an np.array with dtype float64 and later convert it back to integer?)
  • 注销后如何隐藏导航portlet?(How to hide navigation portlet after logout?)
  • 将多个行和可变行移动到列(moving multiple and variable rows to columns)
  • 提交表单时忽略基础href,而不使用Javascript(ignore base href when submitting form, without using Javascript)
  • 对setOnInfoWindowClickListener的意图(Intent on setOnInfoWindowClickListener)
  • Angular $资源不会改变方法(Angular $resource doesn't change method)
  • 在Angular 5中不是一个函数(is not a function in Angular 5)
  • 如何配置Composite C1以将.m和桌面作为同一站点提供服务(How to configure Composite C1 to serve .m and desktop as the same site)
  • 不适用:悬停在悬停时:在元素之前[复制](Don't apply :hover when hovering on :before element [duplicate])
  • 常见的python rpc和cli接口(Common python rpc and cli interface)
  • Mysql DB单个字段匹配多个其他字段(Mysql DB single field matching to multiple other fields)
  • 产品页面上的Magento Up出售对齐问题(Magento Up sell alignment issue on the products page)