我正在运行Rails 3并尝试从我们的日志中过滤敏感信息,这些日志是作为post参数传递的JSON blob.例如,用户创建可能会使用user作为JSON对象的字符串值调用post param .JSON对象中的一个键是password,我们想要从日志中过滤掉它.我发现这样做的最好方法是在filter_params中添加一个块,如下所示:
keys_to_filter = ['password', 'password_confirmation']
config.filter_parameters << lambda do |k,v|
if v.is_a? String
keys_to_filter.each do |key|
# Match "key":"<filter_out>", or "key":"<filter_out>"}, allowing for whitespace
v.sub!(/("\s*#{key}\s*")\s*:\s*"[^,\}]*"\s*([,\}])/, "\\1:\"[FILTERED]\"\\2")
end
end
end
Run Code Online (Sandbox Code Playgroud)
这会向filter_params添加一个块,这会导致另一个问题中描述的错误:Rails:ParameterFilter :: compiled_filter尝试重复符号
将块传递给filter_parameters似乎是不安全的,所以我想知道是否有另一种方法可以解决这个问题.
我们正在将一个struts应用程序迁移到Spring MVC并利用@Controller注释将页面定向到各种方法调用.
我在确定一个好的重用策略时遇到了麻烦.
我们在许多页面中基本上都做同样的事情:
prepareView(..., ...); //Various params -- could likely be standardized
if (!allowedToView()) {
mav.setViewName(injectedErrorPage);
}
performBusinessLogic(..., ...); //Various params -- not seeing how to standardize
persistEntities();
finalizeView(..., ...); // Various params -- could likely be standardized
Run Code Online (Sandbox Code Playgroud)
有哪些策略用于创建最终方法,允许开发人员"忘记"这些流程?我考虑过制作一个抽象类,但由于每种方法的不同,我真的没有办法"标准化".
例如,我们有以下内容:
@RequestMapping("params="assign", method=RequestMethod.Post)
public ModelAndView assign(@SessionAttribute(value="sessionAttr") Pojo pojo,
@ModelAttribute("command") CommandPojo commandPojo,
BindingResult result) {
//Follows pattern above
}
@RequestMapping()
public ModelAndView filterResults(@SessionAttribute(value="sessionAttr") Pojo pojo,
@RequestAttribute("requestAttr") String requestAttr,
@ModelAttribute("command") CommandPojo2 commandPojo2,
BindingResult result) {
//Follows pattern above
}
Run Code Online (Sandbox Code Playgroud)
拥有最终方法需要将其分解为两个POJO(然后将调用描述性函数).我直接关注的是如何处理最终方法中的不同参数?我认为没有办法处理这种情况.
如果我们仍然可以使用受保护函数的"最终"方法,我们可以在需要时覆盖它.
你们如何管理MVC 3项目中的所有CSS样式?即使我为Visual Studio 2010安装了SP1,我发现css样式管理器仍无法识别布局视图文件中的样式表链接.
我猜Expression Web也没有任何支持.有没有什么可以用来帮助自己并且更容易管理所有混乱而不是手动执行?
然而,有没有人尝试过在安装SP1后ReSharper是否正常工作?
不知道我是否应该立即安装Service Pack 1,或者等待ReSharper的更新或JetBrains的任何官方声明.因为对我来说,没有ReSharper的VisualStudio已经感觉像是用记事本编码.:)
所以我分批渲染我的场景,尝试最小化状态变化.由于我的着色器通常需要多个纹理,因此我将其中一些纹理单元同时绑定到不同的纹理单元.其中一些纹理用于多个批次,因此甚至可以保持绑定.
现在我的问题是,在批处理中重新绑定我需要的所有纹理是否很好,即使它们中的一些可能已经绑定了?或者我应该检查哪些是绑定的,只绑定新的?glBindTexture有多贵?我正在使用着色器,将未使用的纹理绑定到着色器不会对其进行采样的纹理单元是不是很糟糕,还是应该解除它们的绑定?
我主要问"如何快速",而不是"如何".
编辑:如果我提供代码会有帮助吗?
我正在尝试在Xcode 4中创建一个IPA,就像提出这个问题的人一样:
所以 - 我的档案成功完成了 - 据说.它将项目的.xcarchive文件转储到其目标文件夹中.但是这些档案不会显示在"管理器"窗口中.所以我不能像上面提到的那样分享它们来创建IPA.
归档过程中没有错误 - 它们似乎已签名正常.那么为什么档案馆的档案面板中没有出现档案?是否有一些我缺少的步骤......或者我需要修改的模糊设置?
我很确定我偶然发现了一个链接,它显示了如何在没有 eclipse的情况下创建一个hello world应用程序,但我再也找不到该链接了.它当然不一定是一个hello world应用程序,但如果有人可以指向某个地方解释创建没有eclipse的应用程序所需的步骤,那将会很好.
我知道我的问题是一个普遍的问题,但是我在这里检查了很多问题,检查了Spring文档,但我真的不知道我在做什么错。我的问题:我有一个使用JPA的Spring WebFlow项目(实现:OpenJPA + MySQL数据库)。我使用Spring ORM将EntityManager(通过@PersistenceContext注释)注入到我的简单RegisterDAO中。我已经配置了GlassFishs(正在使用的)连接池以使用MySQL,并且一切正常-我可以使用我的数据库,但是当我保留某些东西时-没有任何反应(数据未保留到数据库)。我知道问题出在我使用的事务上下文中。我阅读了Spring Transaction Management的文档,并按照本文档中的配置步骤进行操作。这是我的applicationContext.xml:
<?xml version="1.0" encoding="windows-1250"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:p="http://www.springframework.org/schema/p"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:jee="http://www.springframework.org/schema/jee"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.0.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-3.0.xsd
http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-2.0.xsd">
<jee:jndi-lookup id="entityManagerFactory" jndi-name="myPersistenceUnit"/>
<bean class="org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor"/>
<bean id="registerDaoImpl" class="umk.dumont.db.dao.RegisterDAO" />
<bean id="registerModel" class="umk.dumont.models.RegisterFormModel">
<property name="registerDAO" ref="registerDaoImpl" />
</bean>
<tx:advice id="txAdvice">
<tx:attributes>
<tx:method name="*" />
</tx:attributes>
</tx:advice>
<aop:config>
<aop:pointcut id="registerModelOperation" expression="execution(* umk.dumont.models.RegisterFormModel.*(..))"/>
<aop:advisor advice-ref="txAdvice" pointcut-ref="registerModelOperation"/>
</aop:config>
<bean id="transactionManager" class="org.springframework.transaction.jta.JtaTransactionManager" />
</beans>
Run Code Online (Sandbox Code Playgroud)
如您所见,我正在将RegisterDAO注入我的RegisterFormModel中,其中包含我的业务逻辑,用于验证注册表单数据并最终将用户添加到数据库中。验证工作正常,当我尝试添加新用户时出现问题。这是代码:
package umk.dumont.models;
...
public class RegisterFormModel implements Serializable {
private String login;
private …Run Code Online (Sandbox Code Playgroud) 我觉得必须有一个更好的方法来填充选定的....
<p>
<label for="industry" class="medium">Industry</label>
<select name="industry" >
<option value="" selected="<?php if($_POST['industry'] =="") { echo "selected";} ?>">-- Select Industry --</option>
<option value="Retail" selected="<?php if($_POST['industry'] =="Retail") { echo "selected";} ?>">Retail</option>
<option value="Restaurant" selected="<?php if($_POST['industry'] =="Restaurant") { echo "selected";} ?>">Restaurant</option>
<option value="Salon" selected="<?php if($_POST['industry'] =="Salon") { echo "selected";} ?>">Salon</option>
<option value="Pizza Delivery" selected="<?php if($_POST['industry'] =="Pizza Delivery") { echo "selected";} ?>">Pizza Delivery</option>
<option value="Grocery" selected="<?php if($_POST['industry'] =="Grocery") { echo "selected";} ?>">Grocery</option>
<option value="Quick Service" selected="<?php if($_POST['industry'] =="Quick Service") { echo "selected";} ?>">Quick Service</option> …Run Code Online (Sandbox Code Playgroud) 有没有免费的Oracle 10g express GUI客户端?我正在寻找一个与phpMyAdmin具有类似功能的应用程序.
oracle ubuntu user-interface database-administration oracle-xe