嗨伙计们我想尝试做类似的事情
SELECT * from accounttable, peopletable, companytable
WHERE if accounttable.account_type = company
JOIN companytable
WHERE companytable.id = accounttable.company_id
ELSE IF accounttable.account_type = = person
JOIN peopletable
WHERE peopletable.id = accounttable.person_id
Run Code Online (Sandbox Code Playgroud)
对不起它有点sqlenglish但我真的不知道如何写出来!
我正在使用以下样式解析电子邮件
message = Mail.new(body) #where body is the RAW source from the email server
message.subject #=> the subject of the message as a string
message.from #=> shows who the email is from
Run Code Online (Sandbox Code Playgroud)
如果存在,我如何获得'reply-to'字段的值?宝石可以这样做吗?
我在stackoverflow上找到了一个非常优雅的'humanize'转换器,它没有使用任何循环.
有可能用javascript做同样的事情吗?(例如1024字节=> 1 kb)?
听起来很简单,我已经做了很多搜索
如果你想知道:Java版本
我如何在rails中获取URL及其数据?
我尝试过使用open-uri:
@r = open("http://google.com/").read
Run Code Online (Sandbox Code Playgroud)
这适用于我,ruby但不适用于rails.
如果您可以建议更好的方法来获取网址(如果有的话)让我知道!
我尝试使用解析
Date.parse("28-May-10").to_s
Run Code Online (Sandbox Code Playgroud)
退货0010-5-28(这是2000年!)
我怎样才能让ruby正确地解释两位数的年份.
谷歌有很多字符串到目前为止转换技巧,但大多数处理数字月份而不是"五月".
是否有可能在红宝石中这样做?
variablename = true
if variablename
puts "yes!"
end
Run Code Online (Sandbox Code Playgroud)
而不是这个
variablename = true
if variablename == true
puts "yes!"
end
Run Code Online (Sandbox Code Playgroud)
编辑:还考虑:
variablename = 0 #which caused my problem
Run Code Online (Sandbox Code Playgroud)
我无法让它发挥作用.如果可能的话,这样的风格是什么?我现在正在学习ruby,它可以在PHP中使用,但我不确定如何在ruby中正确执行
我试图基本上尝试删除.字符串中的内容.extension
所以我正在使用
'.extension'[1..10] #gives extension
Run Code Online (Sandbox Code Playgroud)
当然,这将适用于10个字符,我将如何使它适用于任何长度.我不知道要搜索什么,因为我不知道这个数组样式[x..y]是什么.
我有以下代码:
name= "a";
value="b"
$.post("ajax.php", {name:value})....
Run Code Online (Sandbox Code Playgroud)
但是ajax.php会收到name=b而不是a=b.
我怎么能接受后者呢?
我已经制作了我的应用程序,现在我想打包它,所以我转到我的应用程序目录在终端包含
/app
/app.js
/app.json
/resources
/index.html
/touch
Run Code Online (Sandbox Code Playgroud)
我跑了sencha app build package,我遇到了
[ERR] Please ensure this command was executed from a valid application directory
[ERR] Unable to locate 'app.dir' config property from sencha.cfg
Run Code Online (Sandbox Code Playgroud)
我究竟做错了什么?我在应用程序目录中,它包含触摸文件夹中的sdk.
我的堆积面积图如下所示:

我使用的数据具有相同数量的值,就像在示例中一样.我使用的数据是:http://pastebin.com/D07hja76
我使用的代码也几乎与选择器类似:
var colors = d3.scale.category20();
keyColor = function(d, i) {return colors(d.key)};
nv.addGraph(function() {
chart = nv.models.stackedAreaChart()
.useInteractiveGuideline(true)
.x(function(d) { return d.t })
.y(function(d) { return d.v })
.color(keyColor)
.transitionDuration(300)
chart.xAxis
.tickFormat(function(d) { return d3.time.format('%x')(new Date(d)) });
chart.yAxis
.tickFormat(d3.format(',.0f'));
d3.select('#browserBreakdown')
.datum(browserchartdata)
.transition().duration(500)
.call(chart)
.each('start', function() {
setTimeout(function() {
d3.selectAll('#browserBreakdown *').each(function() {
if(this.__transition__)
this.__transition__.duration = 1;
})
}, 0)
})
nv.utils.windowResize(chart.update);
return chart;
});
Run Code Online (Sandbox Code Playgroud)
如何让图表看起来正确?
ruby ×5
javascript ×2
arrays ×1
charts ×1
d3.js ×1
date ×1
email ×1
if-statement ×1
literals ×1
mail-gem ×1
mysql ×1
nvd3.js ×1
select ×1
sencha-cmd ×1
strptime ×1