auto eth0 iface eth0 inet static address 192.168.1.200 netmask 255.255.255.0 network 192.168.1.0 broadcast 192.168.1.255 gateway 192.168.1.12. ネットワークをrestartする
sudo /etc/init.d/networking restart
auto eth0 iface eth0 inet static address 192.168.1.200 netmask 255.255.255.0 network 192.168.1.0 broadcast 192.168.1.255 gateway 192.168.1.12. ネットワークをrestartする
sudo /etc/init.d/networking restart
Upload Form: <br />
<g:uploadForm action="upload">
<input type="file" name="myFile" />
<input type="submit" />
</g:uploadForm>
def upload() {
def f = request.getFile('myFile')
if (f.empty) {
flash.message = 'file cannot be empty'
render(view: 'uploadForm')
return
}
f.transferTo(new File('/some/local/dir/myfile.txt'))
response.sendError(200, 'Done')
}
// log4j configuration
log4j = {
// Example of changing the log pattern for the default console
// appender:
//
//appenders {
// console name:'stdout', layout:pattern(conversionPattern: '%c{2} %m%n')
//}
error 'org.codehaus.groovy.grails.web.servlet', // controllers
'org.codehaus.groovy.grails.web.pages' // GSP,
'org.codehaus.groovy.grails.web.sitemesh', // layouts
'org.codehaus.groovy.grails.web.mapping.filter', // URL mapping
'org.codehaus.groovy.grails.web.mapping', // URL mapping
'org.codehaus.groovy.grails.commons', // core / classloading
'org.codehaus.groovy.grails.plugins', // plugins
'org.codehaus.groovy.grails.orm.hibernate', // hibernate integration
'org.springframework',
'org.hibernate',
'net.sf.ehcache.hibernate'
}
[class jp.co.wave.dsam.Test]クラスのプロパティ[name]の空白は許可されません。これだとユーザーに全然優しくないので、分かりやすいメッセージに変更する方法を照会します。
| 項目 | 内容 |
|---|---|
| OS | Mac OS X 10.06 |
| Grails | 2.0.4 |
If a constraint is violated Grails will by convention look for a message code of the form: [Class Name].[Property Name].[Constraint Code] In the case of the blank constraint this would be user.login.blank so you would need a message such as the following in your grails-app/i18n/messages.properties file: user.login.blank=Your login name must be specified! The class name is looked for both with and without a package, with the packaged version taking precedence. So for example, com.mycompany.myapp.User.login.blank will be used before user.login.blank. This allows for cases where your domain class message codes clash with a plugin's. For a reference on what codes are for which constraints refer to the reference guide for each constraint.Googleで翻訳してみますと、
制約が違反している場合は、Grailsは慣例により、フォームのメッセージコードを探します。 [Class Name].[Property Name].[Constraint Code] このようなあなたのgrails-app/i18n/messages.propertiesファイルに次のようなメッセージが必要になりますので、空白の制約の場合、これはuser.login.blank次のようになります。 user.login.blank=Your login name must be specified! クラス名が優先してパッケージ化されたバージョンでは、とと、パッケージなしの両方で検索されます。したがって、たとえば、com.mycompany.myapp.User.login.blankはuser.login.blank前に使用されます。これは、ドメインクラスのメッセージコードは、プラグインのと衝突例が可能になります。 制約は、それぞれの制約のためにリファレンスガイドを参照しているコードが何であるかに参考のため。これを自分なりに読み解きますと、
validationでエラーが発生すると、 grails-app/i18n/messages.propertiesから、 [Class Name].[Property Name].[Constraint Code] という形式のメッセージコードを探します。 独自に定義することにより、プラグインで表示するメッセージとと異なるメッセージを出力することができます。試しにやってみると、追加したメッセージが出力されることを確認しました。
| 項目 | 内容 |
|---|---|
| OS | Mac OS X Lion |
| 項目 | 内容 |
|---|---|
| OS | Mac OS X Lion |
| POI | 3.8 |
import org.apache.poi.hssf.usermodel.HSSFWorkbook
import org.apache.poi.ss.usermodel.Workbook
class ChangeSheetName {
publicstaticvoid main(String[] args) {
File file = new File('test.xls')
file.withInputStream {
Workbook wb = new HSSFWorkbook(it)
// 0番目のシートの名前を変更する
wb.setSheetName(0, 'シート名を変更した')
// 複製した結果を元ファイルに書き込む
file.withOutputStream {
wb.write(it)
}
}
}
}