我正在研究CouchDB,它在关系数据库上有许多吸引人的功能,包括:
我知道这不是一个成熟的产品,所以应谨慎采用,但我想知道它是否真的是一个可行的替代RDBMS(尽管介绍页面说不然 - http://couchdb.apache.org/docs /intro.html).
我来自Enterprise Java背景,涉及相当重量级的软件堆栈,并且最近发现了 Stripes框架 ; 我最初的印象是,这似乎可以很好地减少在Java中构建Web应用程序的不愉快部分.
有没有人使用Stripes进行已经上线的项目?你能分享一下你从项目中获得的经验吗?另外,您是否考虑过任何其他技术和(如果是)为什么选择Stripes?
我正在寻找我的应用程序的模型层的编程/设计模式,并且我想知道哪一个最适合您正在进行涉及跨多个表的连接的检索的情况.
例如,假设您有以下表/关系:客户 - > 1..n帐户 - > 0..n功能
功能可以是支票簿,或免费旅行保险等优质产品.
然后我想做getCustomersForFeature()来检索所有拥有免费旅行保险账户的客户.
使用ActiveRecord或数据访问对象似乎不适合,因为这些通常关注每个表的一个类; 同样适用于Data Mapper.我意识到我可以将其分解为每个表的操作,例如getAccountsForFeature()和getCustomersForAccount(),但我想在一次点击中进行检索.
如果我们要"弯曲"每个表的一类模式并使用数据访问对象模式,比如说,getCustomersForFeature()方法是否会继续使用CustomerDAO或FeatureDAO?但这对我来说并不合适,因为你会在知道其他表的情况下污染你的DAO.
建议请.
我有一些代码使用多方法,理想情况下会重载函数(在这种情况下,多功能),以便我可以传递更高阶的函数来帮助测试,例如.
这是一个例子:
(ns multi)
(defn my-print [m] (println "The colour is" (:colour m)))
(defmulti which-colour-mm (fn [m f] (:colour m)))
(defmethod which-colour-mm :blue [m f] (f m))
(defmethod which-colour-mm :red [m f] (f m))
(defmethod which-colour-mm :default [m f] (println "Default: Neither Blue nor Red"))
(defn which-colour
([m] (which-colour-mm m my-print))
([m f] (which-colour-mm m f)))
(which-colour {:colour :blue :object :ball})
(which-colour {:colour :yellow :object :ball})
(which-colour {:colour :blue :animal :parrot} (fn [m] (println "The " (:animal m) "is" (:colour …Run Code Online (Sandbox Code Playgroud) 这是我见过的最近一篇文章的后续文章,其中表明PHP性能很差:
"PHP.是.总是.来.BOTTLENECK.我的服务器农场,让我告诉你他们!PHP整体表现 "
其次是:
"PHP的表现非常糟糕.我基于OpenX(在Linux上)和WordPress(在win64上)的经验."
我们可以得到一些客观的社区意见,以确定PHP性能是好还是坏......
我正在寻求改进我的PHP编码,并想知道其他程序员使用什么特定于PHP的技术来提高生产力或解决PHP限制.
一些例子:
处理命名空间的类命名约定:Part1_Part2_ClassName映射到文件Part1/Part2/ClassName.php
if ( count($arrayName) ) // handles $arrayName being unset or empty
变量函数名称,例如 $func = 'foo'; $func($bar); // calls foo($bar);
我正在编写一个HTML解析器,它使用TagSoup将格式良好的结构传递给XMLSlurper.
这是通用代码:
def htmlText = """
<html>
<body>
<div id="divId" class="divclass">
<h2>Heading 2</h2>
<ol>
<li><h3><a class="box" href="#href1">href1 link text</a> <span>extra stuff</span></h3><address>Here is the address<span>Telephone number: <strong>telephone</strong></span></address></li>
<li><h3><a class="box" href="#href2">href2 link text</a> <span>extra stuff</span></h3><address>Here is another address<span>Another telephone: <strong>0845 1111111</strong></span></address></li>
</ol>
</div>
</body>
</html>
"""
def html = new XmlSlurper(new org.ccil.cowan.tagsoup.Parser()).parseText( htmlText );
html.'**'.grep { it.@class == 'divclass' }.ol.li.each { linkItem ->
def link = linkItem.h3.a.@href
def address = linkItem.address.text()
println "$link: $address\n"
}
Run Code Online (Sandbox Code Playgroud)
我希望每个人都允许我依次选择每个'li',这样我就可以检索相应的href和地址细节.相反,我得到这个输出:
#href1#href2: Here is the addressTelephone number: …Run Code Online (Sandbox Code Playgroud) 前几天我和某人聊天,他建议Rails和PHP是最适合Web应用程序的平台,并避免使用Java.我的背景主要是Java,我知道有些人认为它太冗长和"重量级",但偶尔也会使用(例如通过LinkedIn).
所以我想知道是否有人成功使用Java来创建最新的Web应用程序,无论是使用语言本身(例如使用Stripes/Spring + Hibernate),还是使用dymamic语言的运行时(例如JRuby,Groovy) ,Jython)?如果是这样,请分享有效的方法和不同的方式.
一些背景 (稍后补充):Tim O'Reilly创造了措辞"Web 2.0",这是他的定义:http://www.oreillynet.com/lpt/a/6228
我认为这是"发布周期的结束"和"轻量级编程模型",涉及快速迭代和简化部署,其中Java可能不太适合.思考?
我正在研究Fred Daoud的Stripes一书,并尝试将Hello World应用程序转换为使用友好URL,因为我不喜欢基于后缀的映射,例如http:// localhost:8080/getting_started/Hello.action.
这是之前...
的index.jsp:
<jsp:forward page="/Hello.action"/>
Run Code Online (Sandbox Code Playgroud)
web.xml中:
<servlet-mapping>
<servlet-name>DispatcherServlet</servlet-name>
<url-pattern>*.action</url-pattern>
</servlet-mapping>
Run Code Online (Sandbox Code Playgroud)
我的HelloActionBean上没有UrlBinding.我有书的例子.
我想知道这些书的例子是否适合早期版本的Stripes,因为我已经下载了1.5.1,我的web.xml定义了StripesFilter和StripesDispatcher,而我看到了其他地方使用过的DynamicMappingFilter,例如Fred的这篇文章在TheServerSide上.
无论如何,我做了以下更改:
的index.jsp:
<jsp:forward page="/hello"/>
Run Code Online (Sandbox Code Playgroud)
web.xml中:
<servlet-mapping>
<servlet-name>DispatcherServlet</servlet-name>
<url-pattern>/*</url-pattern>
</servlet-mapping>
Run Code Online (Sandbox Code Playgroud)
HelloActionBean.java:
**@UrlBinding("/hello")**
public class HelloActionBean implements ActionBean
{
Run Code Online (Sandbox Code Playgroud)
但是,当我尝试通过http:// localhost:8080/getting_started加载应用程序时,我看到:
net.sourceforge.stripes.exception.ActionBeanNotFoundException: Could not locate an ActionBean that is bound to the URL [/]. Commons reasons for this include mis-matched URLs and forgetting to implement ActionBean in your class. Registered ActionBeans are: {/hello=class stripesbook.action.HelloActionBean, /controller/DefaultView.action=class net.sourceforge.stripes.controller.DefaultViewActionBean, /hello/=class stripesbook.action.HelloActionBean, /controller/DefaultView.action/=class net.sourceforge.stripes.controller.DefaultViewActionBean}
at …Run Code Online (Sandbox Code Playgroud) 我有一个示例Grails应用程序(来自Grails in Action),它是在不同的PC上在1.1.1版本之前创建的.
我现在正在加载Grails 1.2.0并希望重新访问该应用程序.但是,当我尝试运行它时,我收到此消息:
应用程序需要grails版本[1.1.1],但GRAILS_HOME是版本[1.2.0] - 如果此Grails版本比您的应用程序所期望的版本新,则使用正确的Grails版本或运行'grails upgrade'.
在阅读了一下后,我清除了我的主目录中的.grails下的1.2.0文件夹(从以前的尝试中探索问题),运行"grails clean"和"grails upgrade"(在提示时回答"y").
但是,我始终在\ grails\qotd\src\java和\ grails\qotd\grails-app {controllers,services,conf}中的类之间发生"无效的重复类定义"冲突.
我需要执行任何其他手动步骤吗?
java ×3
php ×2
stripes ×2
amazon ×1
clojure ×1
conventions ×1
couchdb ×1
database ×1
grails ×1
groovy ×1
html ×1
join ×1
multimethod ×1
parsing ×1
performance ×1
rdbms ×1
xmlslurper ×1