有没有办法在ASPX页面(实际上是一个ASP.NET MVC视图 - 但它是相同的东西,HTML内容)做好评论,而没有将所有这些评论发送到客户端浏览器?
我喜欢好评,但我不想向访问者发送所有这些评论.有什么方法可以防止这种情况(不同的评论标签或解决方法?)
谢谢!
我在Apache License 2.0下有一个开源项目.通常,我只会在每个代码文件的顶部包含许可条款和条件注释.
我从某人的博客或网站上复制的代码怎么样?是否提供足够的链接指向该网站?即使代码是由其他人编写的,我仍然在那里留下许可条款和条件?
这样做的正确方法是什么?
我正在做一个Java EE应用程序,而且我已经得出结论,我需要为我的对象提供缓存.
我目前的要求并不比某种键值存储复杂得多,可能是可以处理树的东西.编写一个包含一个或多个贴图的简单自定义静态/单例类很有诱惑力.但是,由于有几个实现或多或少都像这样(Memcached浮现在脑海中),我开始想知道使用Memcached必须有一些附加值,而不仅仅是我自己的实现.
所以,我想问一下这个问题:当我可以自己制作静态数据时,为什么要拿起现成的缓存呢?反之亦然; 当我可以拿起现成的缓存时,为什么要写一个静态类呢?
是的,所以MS引入了C#3.0的扩展方法.基本上,它允许您向现有类添加新方法,而无需从中继承或更改其实现.我的脑海里立刻响起了警钟.
1)您开始为库或标准库类实现自己的扩展方法.现在它不再标准化了.
2)在OOP中,您可以通过继承或组合定义新类型.实际上扩展方法是什么呢?同样,在使用扩展方法时,没有定义明确的关系.
3)扩展方法是否可以在项目之间移植?如果存在两种方法的扩展方法怎么办?
扩展方法也是一大堆蠕虫值得避免的吗?我可以看到它有优点,因为你输入较少,但不知何故它看起来会导致不好的练习.
意见?
我知道我只是在OCD上花了几毫秒的性能时间,但我只是想知道为什么以下对我来说是真的.这似乎违背了我的逻辑.
我目前有一个div,它在悬停时淡化了里面的图像:
$('div.someclass').hover(function() {
$(this).children('img').fadeOut(function(){
// do something
});
}, function() {
// do something
});
Run Code Online (Sandbox Code Playgroud)
经过一些测试后,(通过选择器循环1000次,取9次测试的平均值)我使用了3种不同的选择器并得出结论:速度按以下顺序排列:
$(this).children('img') 运行速度最快-avg约400ms;$('img', this) - 平均约900毫秒; 和$(this).find('img') 运行最慢 - 平均约1000毫秒这违背了两个函数调用慢于一的逻辑.另外,我已经在内部阅读过,jQuery将第二种情况转换为第三种情况,那么第三种情况会更慢吗?
有什么想法吗?
我试图支持从ASP.NET MVC旋转JPEG图像(以90度为增量).我试图使用System.Drawing(GDI +),但是我遇到了问题.
我尝试使用Image.RotateFlip哪种能够旋转图像,但会导致质量下降.即使编码器质量为100,旋转图像上仍然存在可见的伪像,这些伪像不在原始图像上,也不会在我使用其他程序(Gimp等)旋转时出现.
using (Image image = Image.FromFile("C:\\source.jpg")) {
ImageFormat sourceFormat = image.RawFormat;
image.RotateFlip(RotateFlipType.Rotate90FlipNone);
EncoderParameters encoderParams = null;
try {
if (sourceFormat == ImageFormat.Jpeg) {
encoderParams = new EncoderParameters(1);
encoderParams.Param[0] = new EncoderParameter(Encoder.Quality, 100L);
}
image.Save("C:\\target.jpg", GetEncoder(sourceFormat), encoderParams);
} finally {
if (encoderParams != null)
encoderParams.Dispose();
}
}
Run Code Online (Sandbox Code Playgroud)
我发现了一篇关于转换JPEG而不会丢失信息的文章.使用Encoder.Transformation似乎是.NET中的一个选项 - 但是我不能让它导致我的任何JPEG测试图像完全旋转,无论尺寸是16的倍数.
using (Image image = Image.FromFile("C:\\source.jpg")) {
ImageFormat sourceFormat = image.RawFormat;
EncoderParameters encoderParams = null;
try {
if (sourceFormat == ImageFormat.Jpeg) …Run Code Online (Sandbox Code Playgroud) 我有一个web-app(2.5 servlet规范),一个spring dispatcherservlet处理任何正在/ error/*上的内容和一个错误页面,配置为将其路由到/ error /这样的东西:
<servlet>
<servlet-name>errorServlet</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>errorServlet</servlet-name>
<url-pattern>/erorr/*</url-pattern>
</servlet-mapping>
<error-page>
<exception-type>java.lang.Throwable</exception-type>
<location>/erorr/</location>
</error-page>
Run Code Online (Sandbox Code Playgroud)
和errorServlet-servelt.xml
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd">
<context:annotation-config/>
<context:component-scan base-package="some.base.package"/>
<bean id="simpleUrlController" class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">
<property name="mappings">
<props>
<prop key="/*">errorController</prop>
</props>
</property>
</bean>
<bean id="errorController" class="ErrorController">
<property name="formView" value="formView"/>
<property name="commandClass" value="Error"/>
<property name="commandName" value="errorNAMe"/>
</bean>
<bean id="viewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="prefix" value="/WEB-INF/jsp/"/>
<property name="suffix" value=".jsp"/>
</bean>
</beans>
Run Code Online (Sandbox Code Playgroud)
我需要帮助的地方:
我想用Instruments运行我的iphone应用程序以检查内存使用情况,但我也希望能够随时查看我的控制台输出.目前没有办法做到这一点吗?您只能在XCode本身启动仪器或控制台.
我有代码XmlSerializer用于序列化/反序列化数据结构的持久性.我在StackOverflow上的几个地方读过和听过的XmlSerializer是以下一个或多个:
我的问题是双重的; 以上是否属实,若有,有哪些替代方案?就我的目的而言,XML工作得非常好,我希望保持这种不变,但其他一切都可以改变.
编辑:如果你想建议XML的其他东西,我会接受它,但它确实需要人类可读.
请使用以下标准建议用于创建类图的工具:
另外,请仅建议您实际使用的工具.
更新:请不要包含那些无法创建类图的UML图工具.
.net ×1
asp.net ×1
asp.net-mvc ×1
c# ×1
c#-3.0 ×1
caching ×1
children ×1
class ×1
diagram ×1
iphone ×1
java ×1
jpeg ×1
jquery ×1
open-source ×1
performance ×1
spring ×1
spring-mvc ×1
xml ×1