我有一个我正在创建的Rails应用程序(博客).很基本的东西.在我的内容区域中,我有一个文章区域的帖子内容.我需要在文本区域中包含一些html(链接,格式化等).
<%= f.text_area :content %>
Run Code Online (Sandbox Code Playgroud)
是否有另一个标签,我可以使用而不是text_area,这将允许我这样做?
我刚刚开始使用Jetty(Jetty 6 w/Java 6).使用Jetty 6的示例文件,我放置了我的xml配置文件.在与我的java文件相同的目录中.但是当我运行项目时,我得到了这个错误.
Exception in thread "main" java.lang.NullPointerException at net.test.FileServerXml.main(FileServerXml.java:13
Run Code Online (Sandbox Code Playgroud)
这是示例代码:
`package net.test;
import org.mortbay.jetty.Server;
import org.mortbay.resource.Resource;
import org.mortbay.xml.XmlConfiguration;
public class FileServerXml
{
public static void main(String[] args) throws Exception
{
Resource fileserver_xml = Resource.newSystemResource("fileserver.xml");
XmlConfiguration configuration = new XmlConfiguration(fileserver_xml.getInputStream());
Server server = (Server)configuration.configure();
server.start();
server.join();
}
}
Run Code Online (Sandbox Code Playgroud)
构建文件系统的正确方法是什么,以便找到我的xml文件?
我已经阅读了这个答案stackoverflow的答案,它让我在那里中途.这是我需要做的.
执行以下命令:
"c:\myexe.exe <c:\Users\Me\myanswerfile.txt"
Run Code Online (Sandbox Code Playgroud)
如果我从我的powershell脚本中直接运行它
&'c:\myexe.exe <c:\Users\Me\myanswerfile.txt'
Run Code Online (Sandbox Code Playgroud)
我收到此错误:
The term 'C:\myexe.exe <c:\Users\Me\myanswerfile.txt' is not recognized as the name of
a cmdlet, function, script file, or operable program. Check the spelling of the name,or
if a path was included, verif that the path is correct and try again.
Run Code Online (Sandbox Code Playgroud)
现在我尝试了几种变体,包括将原始命令放在一个名为$ cmd的变量中,然后传递
如果我将'<'附加到$ cmd变量,则命令失败并出现与第一个类似的错误.
我很难过.有什么建议?
我在这里做了一个概念验证的事情,并且遇到了比我想象的更多的麻烦.这是我想要做的以及我目前是如何做的.
我发送我的Sinatra应用程序一个json文件,其中包含下面的简单消息.
[
{
title: "A greeting!",
message: "Hello from the Chairman of the Board"
}
]
Run Code Online (Sandbox Code Playgroud)
从那里我有一个帖子,我用它来获取参数并将它们写入sqlite数据库
post '/note' do
data = JSON.parse(params) #<---EDIT - added, now gives error.
@note = Note.new :title => params[:title],
:message => params[:message],
:timestamp => (params[:timestamp] || Time.now)
@note.save
end
Run Code Online (Sandbox Code Playgroud)
当我发送消息时,时间戳和id被保存到数据库,但标题和消息是零.
我错过了什么?
谢谢
编辑:
现在,当我运行我的应用程序并将其发送给json文件时,我收到此错误:
C:/Users/Norm/ruby/Ruby192/lib/ruby/1.9.1/webrick/server.rb:183:在'block in start_thread'中TypeError:无法将Hash转换为String
编辑2:取得了一些成功.
我在文件调用test.json中有上面的json,这是json的发布方式.为了发布我使用HTTPClient的文件:
require 'httpclient'
HTTPClient.post 'http://localhost:4567/note', [ :file => File.new('.\test.json') ]
Run Code Online (Sandbox Code Playgroud)
在考虑了一些之后,我认为发布文件是问题所以我尝试以不同的方式发送它.下面的示例一旦我将我的帖子/注释句柄更改为:
data = JSON.parse(request.body.read)
Run Code Online (Sandbox Code Playgroud)
我的新send.rb
require 'net/http'
require 'rubygems'
require 'json'
@host = 'localhost'
@port …Run Code Online (Sandbox Code Playgroud) 我从使用ASCII字符254作为分隔符的数据库中提取数据.我很难过如何搜索为254返回的字符串然后根据它创建字典?
我的python类
import sys
sys.path.append('C:\\IBM\\UniDK\\uojsdk\\lib\\asjava.jar')
import os.path
from asjava.uniclientlibs import UniDynArray, UniDataSet
from asjava.uniobjects import UniSession, UniFile
from asjava.uniobjects import UniSubroutineException
from asjava.uniobjects.UniObjectsTokens import AT_FM
class u2py :
def __init__ (self):
self.conn = UniSession()
def get_db(self):
""" establish a connection to Unidata """
username = 'dbuser'
password = 'SuperSecretPassword'
return self.conn.connect("host", username, password, "ACCOUNT")
def close_db(self):
""" drop connection to Unidata """
if self.conn.isActive():
self.conn.disconnect()
def open_file(self,file_name,rec):
""" open a U2 file read a record and return it """
uvfile …Run Code Online (Sandbox Code Playgroud) datamapper ×1
eclipse ×1
erb ×1
formatting ×1
html ×1
java ×1
jetty ×1
json ×1
jython ×1
powershell ×1
python ×1
ruby ×1
sinatra ×1
uniobjects ×1