如果您今天要开始一个全新的Java项目,并满足以下要求:
规模大(20k +用户)
你想要使用相当成熟的东西(不会发生剧烈的变化)并且在3年内不会成为死技术
你想要一些非常高效的东西(没有服务器在开发中重新启动,保存代码及其自动编译和部署),生产力和上市时间是关键.
前端有一定数量的AJAX
没有脚本语言(JRuby,Groovy,PHP等),它必须是Java
必须支持i18n
您将使用什么堆栈?为什么?(当我说堆栈时,我的意思是,所有的东西都要坚果,所以应用服务器,mvc框架,bean框架,ORM框架,javascript框架等......)
我有以下场景:
我需要在一个非常大的集合中找出唯一的id列表.
例如,我有6000个ID数组(关注者列表),每个数据的大小范围在1到25000之间(他们的关注者列表).
我希望在所有这些ID数组中找到唯一的id列表(追随者的独特关注者).一旦完成,我需要减去另外一个列表(另一个人跟随者列表)的ID并获得最终计数.
最后一组独特的ID增长到大约60,000,000条记录.在ruby中将数组添加到大数组时,它开始变得非常慢,只有几百万.添加到设置首先需要0.1秒,然后增加到超过4秒,达到200万(没有我需要去的地方).
我在java中编写了一个测试程序,它在不到一分钟的时间内完成了整个过程.
也许我在红宝石中效率低下,或者有另一种方式.由于我的主要代码是专有的,我编写了一个简单的测试程序来模拟问题:
big_array = []
loop_counter = 0
start_time = Time.now
# final target size of the big array
while big_array.length < 60000000
loop_counter+=1
# target size of one persons follower list
random_size_of_followers = rand(5000)
follower_list = []
follower_counter = 0
while follower_counter < random_size_of_followers
follower_counter+=1
# make ids very large so we get good spread and only some amt of dupes
follower_id = rand(240000000) + 100000
follower_list << follower_id
end
# combine the big …Run Code Online (Sandbox Code Playgroud) 我的应用程序打开了一个 customtabs 浏览器,当浏览器遇到某个 url 时,我想弹出来打开我的应用程序。
我发现这篇文章有效 - Android - 为我的应用程序创建一个架构,该架构将使用名为“myapp”的协议从网页链接打开
我更喜欢使用 http/https 协议来触发我的应用程序,但由于某种原因它似乎不起作用。
具体来说,这是有效的:
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="myapp" />
</intent-filter>
Run Code Online (Sandbox Code Playgroud)
当浏览器重定向到“myapp://10.2.2.0:3001/cats”时,我的应用程序重新打开,是的!
问题是当我尝试这个(或我尝试过的其他 100 件事中的任何一件)
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="https" android:host="10.0.2.2" />
<data android:scheme="http" android:host="10.0.2.2" />
<data android:pathPrefix="/cats" />
</intent-filter>
Run Code Online (Sandbox Code Playgroud)
当我的应用程序重定向到“ http://10.2.2.0:3001/cats ”时它不起作用,作为一个负面影响,它还会问我在打开 customTabs 时我想做什么(使用谷歌浏览器,使用不同的app),无论我选择什么,意图过滤器都不会被触发。
使用 http/https 意图过滤器是否有限制?我究竟做错了什么?
我有一个shell脚本,我想在格林威治标准时间30分钟前得到日期和时间.
我的工作时间非常长,但部分时间似乎不起作用:
TZ = GMT + 1日期+%Y-%m-%d""%H:%M:%S 2010-01-08 17:43:57
TZ = GMT + 2日期+%Y-%m-%d""%H:%M:%S 2010-01-08 16:44:07
TZ = GMT + .5日期+%Y-%m-%d""%H:%M:%S 2010-01-08 18:44:38
尝试了0.5 1.5的许多组合,没有部分小时似乎工作,这很奇怪,因为有一些时区不是一小时的完全偏移.
有什么建议?
不能使用perl或ruby需要定期shell或mysql调用.
对此有类似的问题,但它们似乎都是由身体中的javascript标签引起的,在我的情况下我的是在头脑中.我也无法将我的js移动到页面更改块之外(我认为至少我不能)
我遵循rails约定,根据资源在每个文件中包含所有j,并将它们包含在application.js中.
我的js位于头部的布局文件中:
<!DOCTYPE html>
<html>
<head>
<%= javascript_include_tag 'application', 'data-turbolinks-track' => true %>
Run Code Online (Sandbox Code Playgroud)
我的文件都遵循rails文档中的建议来使用页面更改事件:http://guides.rubyonrails.org/working_with_javascript_in_rails.html#turbolinks
这是一个示例js文件(report.js - 我使用咖啡脚本)
load_reports = ->
table = $('#reports').DataTable()
company_input_field = $('#rc-cn-st-input')
company_input_field.on 'keyup change', ->
table.column(2).search(@value).draw()
return
$(document).on('page:change', load_reports)
Run Code Online (Sandbox Code Playgroud)
这一切都很好,直到我使用浏览器后退按钮.一旦我这样做,我每次点击都会触发2次事件.我如何解决这个问题以及遵循的惯例是什么?
在其他情况下,我将我的js移动到页面更改块之外并执行:
$(document).on 'click', 'td.details-control', ->
# do something
Run Code Online (Sandbox Code Playgroud)
但是在上面的情况下这似乎不实用,我引用的jquery数据表只在一个页面上,只需要在我在该页面上时进行设置.
我确实看过.off()函数,但在这种情况下无法弄清楚如何使用它,我尝试过的所有东西似乎要么删除活动的监听器,要么失败.
我知道这是一个坏主意,但我有很多遗留代码,我想要完成一些历史批处理作业.我不想更改系统日期,因为其他东西在同一系统上运行.有没有什么办法可以改变Date.today仅在给定进程的生命周期内返回的值.这里的想法是回放并运行一些旧的批处理脚本,这些脚本用于处理Date.today.
谢谢乔尔
我不使用git,但在升级到ruby 1.9.3和rails 3.017并使用cap来部署后,我得到了这些错误:
fatal: Not a git repository (or any of the parent directories): .git
Run Code Online (Sandbox Code Playgroud)
它们似乎没有破坏任何东西,但它们很烦人.我不使用git,我怎么让它们消失?
更多信息(这是我看到的)
$ cap pirmtlddemo deploy:long
fatal: Not a git repository (or any of the parent directories): .git
fatal: Not a git repository (or any of the parent directories): .git
fatal: Not a git repository (or any of the parent directories): .git
fatal: Not a git repository (or any of the parent directories): .git
fatal: Not a git repository (or any of the parent directories): …Run Code Online (Sandbox Code Playgroud) 我有一个jquery数据表行:
table = $('#reports').DataTable()
row = table.row(rowIndex)
Run Code Online (Sandbox Code Playgroud)
我如何从中获取html类?(它是条纹的,我想知道它是奇数还是偶数.
我试过了:
row.hasClass('odd')
row.className
row.attr('class')
Run Code Online (Sandbox Code Playgroud)
有任何想法吗?
我见过将函数从父 lit-element 传递给像这里这样的子元素的示例 - https://medium.com/@westbrook/litelement-to-do-app-1e08a31707a4
但是我希望我的元素的用户不要被迫创建一个包装元素来使用我的元素。
例如,我的元素是一个计算某些值的对话框。
我希望我可以做这样的事情(使用我的元素的 html):
<script>
function latLongResult(lat,long)
{
console.log("resulting lat long called");
}
</script>
<lat-long-chooser id="latLongDialog" resultingLatLong=${latLongResult(lat,long)}></lat-long-chooser>
Run Code Online (Sandbox Code Playgroud)
然后在我的元素中:
export class LatLongChooser extends LitElement {
static get properties() {
return {
latDecimalDegrees: Number,
longDecimalDegrees: Number,
resultingLatLong: {
type: Function,
}
};
}
saveConvertedValues() {
console.log("save other values called");
this.resultingLatLong(this.latDecimalDegrees,this.longDecimalDegrees)
}
Run Code Online (Sandbox Code Playgroud)
当我尝试这个时,我收到 JavaScript 错误。
我想弄清楚如何在 centos9 流上安装 python2。我收到以下错误。有什么建议么?
sudo dnf install python2
Last metadata expiration check: 0:04:48 ago on Thu 24 Feb 2022 01:43:10 PM EST.
No match for argument: python2
Error: Unable to find a match: python2
Run Code Online (Sandbox Code Playgroud) jquery ×2
ruby ×2
android ×1
capistrano ×1
centos ×1
date ×1
datetime ×1
frameworks ×1
git ×1
intentfilter ×1
java ×1
javascript ×1
jruby ×1
lit-element ×1
performance ×1
polymer ×1
python-2.x ×1
scripting ×1
shell ×1
stack ×1
turbolinks ×1
unix ×1