灯角

文章 0 评论 0 浏览 23

灯角 2024-10-27 06:22:44

恕我直言,一个更大的问题是可用性。验证码总是会降低转化率,而且通常会显着降低。如果你的目标是使用 JS 作为阻止机器人的手段,我可​​以告诉你,它为我显着减少了 90% 以上的机器人流量。

只需合并一个由 JS 填充的隐藏字段即可。如果没有填写,他们要么是一个机器人,要么是那些关闭了 JS 的白痴之一,无论如何你都不想迎合他们。

还包含一个在 DOM 中可见的隐藏字段。使用“position:absolute; left:9999px; top:-9999px”等 CSS 让它飞离屏幕。不要使用“显示:无;”如果填写此字段,则它们是机器人。

我用它减少了 90% 以上的垃圾邮件,所以你应该使用它而不是验证码类型,除非你是一家大企业。如果您是一家大企业,那么您唯一真正的解决方案是后端服务器端解决方案。祝你好运,在 StackOverflow 上找到它。他们关闭您的评论的速度会比人们回答它的速度更快。 (而且它的 Google 排名会比其他任何东西都高)

A bigger issue is usability IMHO. Captcha is always going to decrease conversion rates, and often significantly. If your goal is to use JS as a means of deterring bots, I can tell you that it has significantly reduced bot traffic for me by more than 90%.

Just incorporate a hidden field that gets populated by JS. If it isn't filled in, they're either a bot, or one of those idiots with JS turned off, who you don't really want to cater to anyway.

Also incorporate a hidden field that is visible in the DOM. Make it fly off the screen with CSS like "position:absolute; left:9999px; top: -9999px". Don't use "display:none;" If this field is filled in, they're a bot.

I cut down our spam more than 90% with this, so you should use it over Captcha types, unless you're a big business. If you're a big business, your only real solution is a back-end server side solution. Good luck finding that on StackOverflow. They'll close your comment quicker than people can answer it. (and it will have better Google rank than anything out there)

有多少个机器人“启用”了 JS?

灯角 2024-10-27 05:20:18

我正在专门为启用了 R 的 RStudio Server 维护 AMI。详细信息请参见 http://www.louisaslett.com/RStudio_AMI/

希望有所帮助。

I'm maintaining AMIs specifically for RStudio Server which have R on. Details are at http://www.louisaslett.com/RStudio_AMI/

Hope that helps.

预安装 R 的公共 Amazon EC2 AMI

灯角 2024-10-27 01:31:42

您不需要任何 API 来播放系统声音,只需编写如下代码:

// Plays the sound associated with the Asterisk system event.
System.Media.SystemSounds.Asterisk.Play();

SystemSounds 类包含以下预定义的系统声音:

  • Asterisk
  • Beep
  • Exclamation
  • Hand
  • Question

所有其他声音都要求您从注册表中读取所需的声音并使用如下代码播放它:

SoundPlayer simpleSound = new SoundPlayer(@"c:\Path\To\Your\Wave\File.wav");

You do not require any API to play system sounds just write code like this:

// Plays the sound associated with the Asterisk system event.
System.Media.SystemSounds.Asterisk.Play();

The SystemSounds class contains the following predefined system sounds:

  • Asterisk
  • Beep
  • Exclamation
  • Hand
  • Question

All other sounds require you read the desired sound from the registry and play it with code like this:

SoundPlayer simpleSound = new SoundPlayer(@"c:\Path\To\Your\Wave\File.wav");

从 Windows 选择声音并播放它们

灯角 2024-10-26 21:37:37

所有“业务逻辑”都应该放在模型中,而不是控制器中。最近用户和帖子的查询应该在 UserPost 模型中。然后,如果您有站点范围的视图元素,请将其移至部分视图元素并将该部分视图添加到 application.html.erb 中。

# User.rb
model User
  def recent
    # logic and query here
  end
end

 

# Post.rb
(see above)

 

# application_controller.rb
before_filter :get_recent_posts
before_filter :get_recent_users
...
private
def get_recent_posts
  @recent_posts = Post.recent
end

def get_recent_users
  @recent_users = User.recent
end

 

# application.html.erb
...
<%= yield %>
...

<%= render :partial => 'layouts/footer', :locals => { :recent_users => @recent_users, :recent_posts => @recent_posts } %>

 

# layouts/_footer.html.erb
<% recent_users.each do |user| %>
  <%= link_to user.name, user %>
<% end %>

# same for posts

需要注意的一些重要事项:

  1. 不要访问部分中的实例变量(@foo)...将其传递到本地哈希中并将其作为变量访问。这通常是不好的做法

  2. 你也可以使用模块

  3. 查看缓存,因为你可能不想在每次页面加载时两次访问数据库。您可以在页脚上使用片段缓存,并每 15 分钟过期一次(可能是最好的选择)。

All "business logic" should be put in the Model, not the controller. The query for recent Users and Posts should be in the User and Post model. Then, if you have a site-wide view element, move it into a partial and add that partial into the application.html.erb.

# User.rb
model User
  def recent
    # logic and query here
  end
end

 

# Post.rb
(see above)

 

# application_controller.rb
before_filter :get_recent_posts
before_filter :get_recent_users
...
private
def get_recent_posts
  @recent_posts = Post.recent
end

def get_recent_users
  @recent_users = User.recent
end

 

# application.html.erb
...
<%= yield %>
...

<%= render :partial => 'layouts/footer', :locals => { :recent_users => @recent_users, :recent_posts => @recent_posts } %>

 

# layouts/_footer.html.erb
<% recent_users.each do |user| %>
  <%= link_to user.name, user %>
<% end %>

# same for posts

A few important things to note:

  1. don't access the instance variables (the @foo) in the partial... pass it into the locals hash and access it as a variable instead. It's just generally bad practice

  2. you could also use a module

  3. look into caching because you probably don't want to hit your database TWICE on every page load. You could use fragment caching on the footer and expire it every 15 minutes (probably the best option).

Rails 3 应用程序中站点范围的页脚逻辑属于哪里?

灯角 2024-10-26 19:39:17

i) setInterval 将每秒运行 moveElement 函数。如果是setTimeout,则只会在1秒后运行一次。

ii) 看起来这就是它的作用。

iii) 在这种情况下,x 没有在函数 moveElement 中的任何位置声明,因此它会尝试查找在顶部执行的全局变量。所以是的,它将把新值存储在函数外部的 x 中。

i) the setInterval will run the moveElement function every second. if it were setTimeout it would only run it once after 1 second.

ii) seems like thats what it does.

iii) in this case x is not declared anywhere in the function moveElement so then it tries to find a global variable which it does at the top. So yes it will store the new value in the x outside of the function.

JavaScript 设置间隔

灯角 2024-10-26 18:36:58

在 Cygwin 中,您可以尝试 gem list --all -d | grep --before-context=1 --after-context=4 平台。

In Cygwin you could try gem list --all -d | grep --before-context=1 --after-context=4 Platform.

如何获取已安装且具有本机扩展的 gem 列表?

灯角 2024-10-26 17:35:08

您的应用程序开始崩溃之前所做的最后更改是什么?这就是导致你的问题的原因。如果您在运行应用程序来测试它们之前立即进行了很多更改,那么现在您知道这是一个非常糟糕的想法(tm)...:-(

What's the very last change you made before your app started crashing? That's the one that caused your problem. If you made a lot of changes at once before running your app to test them, now you know what that's a Very Bad Idea (tm)... :-(

应用程序打开时崩溃

灯角 2024-10-26 15:00:51

几周前我遇到了这样的问题,这是由于 ADT 向 Eclipse 提供了一些有关 Android 源代码在类路径中的位置的无效信息。我通过下载 Android 源代码并自己附加它们来修复它。该错误在这里:

http://code.google.com/p/ android/issues/detail?id=7850

以及有关如何附加源的博客文章位于:

http://android.opensourceror.org/2010/01/18/android-source/

I had a problem like this a few weeks ago and it was due to ADT giving Eclipse some invalid information about where the Android sources are for the classpath. I fixed it by downloading the Android sources and attaching them myself. The bug is here:

http://code.google.com/p/android/issues/detail?id=7850

and a blog post on how to attach the sources is here:

http://android.opensourceror.org/2010/01/18/android-source/

Eclipse ContentAssist 突然非常非常慢

灯角 2024-10-26 13:14:06
 // Make your Main UIWorker Thread to execute this statement
 Handler mHandler = new Handler(); 

在您的代码需要关闭对话框的地方执行类似的操作。

 // this will dismiss the dialog after 2 Sec. set as per you 
 mHandler.postDelayed(new Runnable() {
    @Override
    public void run() {     
        dialog.dismiss();
    }
 },2000L); 

希望这有帮助:)

 // Make your Main UIWorker Thread to execute this statement
 Handler mHandler = new Handler(); 

Do something like this where ever your code need to dismiss the dialog.

 // this will dismiss the dialog after 2 Sec. set as per you 
 mHandler.postDelayed(new Runnable() {
    @Override
    public void run() {     
        dialog.dismiss();
    }
 },2000L); 

Hope This Help :)

Android 在设置时间后隐藏对话框,就像自定义时间间隔 toast

灯角 2024-10-26 13:08:01

为了加快速度,您可以做的一件事就是删除您手动创建的索引 - 主键约束已经在该列上自动创建了唯一索引,如下所示(我正在测试on 8.3):

postgres=> CREATE TABLE "user"
postgres-> (
postgres(>   id serial NOT NULL,
postgres(>   username character varying(40),
postgres(>   email character varying(70),
postgres(>   website character varying(100),
postgres(>   created integer,
postgres(>   CONSTRAINT user_pkey PRIMARY KEY (id)
postgres(> )
postgres-> WITH ( OIDS=FALSE );
NOTICE:  CREATE TABLE will create implicit sequence "user_id_seq" for serial column "user.id"
NOTICE:  CREATE TABLE / PRIMARY KEY will create implicit index "user_pkey" for table "user"
CREATE TABLE
postgres=> CREATE INDEX id ON "user" USING btree (id);
CREATE INDEX
postgres=> \d user
                                  Table "stack.user"
  Column  |          Type          |                     Modifiers
----------+------------------------+---------------------------------------------------
 id       | integer                | not null default nextval('user_id_seq'::regclass)
 username | character varying(40)  |
 email    | character varying(70)  |
 website  | character varying(100) |
 created  | integer                |
Indexes:
    "user_pkey" PRIMARY KEY, btree (id)
    "id" btree (id)

另外,请考虑将 wal_sync_method 更改为使用 O_DIRECT 的选项 - 这不是 Linux 上的默认设置

Well one thing you could do to speed things up is drop the index you are creating manually - the primary key constraint already auto-creates a unique index on that column as you can see below (I'm testing on 8.3):

postgres=> CREATE TABLE "user"
postgres-> (
postgres(>   id serial NOT NULL,
postgres(>   username character varying(40),
postgres(>   email character varying(70),
postgres(>   website character varying(100),
postgres(>   created integer,
postgres(>   CONSTRAINT user_pkey PRIMARY KEY (id)
postgres(> )
postgres-> WITH ( OIDS=FALSE );
NOTICE:  CREATE TABLE will create implicit sequence "user_id_seq" for serial column "user.id"
NOTICE:  CREATE TABLE / PRIMARY KEY will create implicit index "user_pkey" for table "user"
CREATE TABLE
postgres=> CREATE INDEX id ON "user" USING btree (id);
CREATE INDEX
postgres=> \d user
                                  Table "stack.user"
  Column  |          Type          |                     Modifiers
----------+------------------------+---------------------------------------------------
 id       | integer                | not null default nextval('user_id_seq'::regclass)
 username | character varying(40)  |
 email    | character varying(70)  |
 website  | character varying(100) |
 created  | integer                |
Indexes:
    "user_pkey" PRIMARY KEY, btree (id)
    "id" btree (id)

Also, consider changing wal_sync_method to an option that uses O_DIRECT - this is not the default on Linux

提高 PostgreSQL 写入速度是否会以可能丢失数据为代价?

灯角 2024-10-26 12:33:31

像这样改变你的 if 条件

if(document.form1.field1.value==document.form1.field2.value)

Change your if condition like this

if(document.form1.field1.value==document.form1.field2.value)

检查两个表单字段

灯角 2024-10-26 10:18:39

你的表缺少 html id 吗? jQuery 选择器 $('#orderingTable') 正在寻找 id="orderingTable" 的内容

Is your table missing an html id? The jQuery selector $('#orderingTable') is looking for something with id="orderingTable"

通过 AJAX 添加的表单字段无法加载到 $_POST 数组中

灯角 2024-10-26 09:05:31

您需要在计划使用此过滤器的每个模板中添加 {% load the_name_of_that_module %} 块。

You need to add {% load the_name_of_that_module %} block in every template you plan to use this filter.

如何在 Google App Engine 模板系统中注册自定义过滤器?

灯角 2024-10-26 07:56:55

@adamonduty 的解决方案很棒。我之前使用的另一个解决方案,只需在模型上创建一个方法:

def name
  file.path.split("/").last
end

@adamonduty's solution is great. Another solution I used before, just create a method on the model:

def name
  file.path.split("/").last
end

在视图中显示 Carrierwave 文件名

灯角 2024-10-26 04:05:03

就我而言,这是一本关于正则表达式主题的书。它可能无法让您完全弄清楚如何编写 C++ 库,但对理论的解释非常出色,并且包含许多上下文中正则表达式实际应用的示例。

http://oreilly.com/catalog/9780596528126?green =9514625548&cmp=af-mybuy-9780596528126.IP

As far as I'm concerned, this is THE book on the subject of regular expressions. It may not get you all the way to figuring out how to code up a C++ library, but the explanation of the theory is excellent and it includes a lot of examples for the practical application of regular expressions in many contexts.

http://oreilly.com/catalog/9780596528126?green=9514625548&cmp=af-mybuy-9780596528126.IP

C++ 中的正则表达式

更多

推荐作者

daid

文章 0 评论 0

我心依旧

文章 0 评论 0

晒暮凉

文章 0 评论 0

微信用户

文章 0 评论 0

DS

文章 0 评论 0

〆凄凉。

文章 0 评论 0

    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文