当前位置: 首页 > 编程日记 > 正文

[翻译] Ruby Golf

原文地址:http://rubysource.com/ruby-golf/

Ruby golf is the art of writing code that uses as few characters as possible. The idea originates in the world of Perl (where it is, unsurprisingly, known as Perl Golf). As a language, Perl is well suited to this as it has more than its fair share of bizarre constructs and syntactic sugar. Ruby also contains some large dollops of syntactic sugar which makes it suited to the odd round of golf.

Ruby golf 是一种使用尽量少的字符来编写代码的技术。这个想法最初产生于Perl社区(不出意料的成为Perl Golf)。由于Perl拥有一系列奇异的语法结构和特征,所以很适合应用这种技术。Ruby同样包含大量的奇异语法特征,所以也非常适合这种成为Golf的技术。

The obsession with trying to minimise the number of bytes used in a program harks back to a bygone age when memory was at a premium and every byte counted. It doesn’t really have any practical use in today’s world, but this does not mean that it is not still used. Code minimisation can be found in competitions such as the 1k JavaScript competitions and Perl Apocalypse. There are also a number of sites dedicated to the art of Code Golf.

试着减少程序中使用的字节数的想法可以追溯到那个内存昂贵到以每个字节来计费的时代。当下,这种想法并没有多少实际意义,但是很多时候它仍被使用。代码最小化可以在一些比如称作1k JavaScript competitions和Perl Apocalypse的比赛中找到。也有很多网站试着对Code Golf这种技术有所贡献。

There is often a competitve element associated with Code Golf: Hackers try to outdo each other as they strive to find the ‘perfect’ solution. One that achieves the aim of the code but could not possibly be done in fewer characters. I find this to be analagous to mathemticians who search for ‘elegant proofs’ and am reminded of Einstein’s quote “Everything should be made as simple as possible, but not simpler”.

跟Code Golf相关的一个竞争元素是:黑客们总是试图通过找到'完美'解决方案而超越他人。一个人可以完成代码的功能却可能无法用更少的字母实现。我发现这类似一个寻找“最优解”的数学家被爱因斯坦的名言提醒:"任何事情都应该尽可能简单,而不仅仅是简单。"

Unfortunately, the code that is produced is often very difficult to understand as it usually relies on various hacks and shortcuts. In fact, a complimentary game is to try and figure out what the code produced actually does! There is often a thin line between being clever and too clever…

不幸的是,由于过分依赖各种编程技巧,编写出来的代码经常难以理解。实际上,一个免费的游戏是试着找出这段代码真正做的事情。总有一条细线横亘在变的聪明和变得过于聪明之间...

Code Golf has a bit of a marmite reputation – people either love it or hate it, so to try and maintain some balance, I’ve listed a few of the advantages and disadvantes of trying your hand at a round or two:

Code Golf有截然不同的两种名称:喜欢它或者厌恶它。所以为了试着去保持某种平衡,我列举了一些Code Gold的优点和缺点:

Advantages

  • You get to learn some lesser known parts of the language and some neat tricks.
  • You get a nice smug feeling inside when you manage to chip a few more characters off the best solution.
  • Sometimes the more succinct way of writing the code actually looks cleaner.
  • You can learn techniques that could be of use in other situtations.
  • The process itself encourages ingenuity.
  • It’s fun!
优点:
1. 你会学到这门语言的一些很少人知道的部分和一些优雅的技巧
2. 当你试着减少最佳解决方案的代码你会得到快感
3. 有时候更简洁的代码看上去的确更干净
4. 你可以学到能够在其他环境中使用的技术
5. 这个过程鼓励你发挥聪明才智
6. 有乐趣!

Disadvantages

  • The code usually looks horrible
  • The code can often be difficult to read or understand, which is a shame because one of the best aspects of Ruby is how readable it is.
  • The code would be a maintenance nightmare – even by yourself never mind others.
缺点:
1. 代码很有可能看起来畏惧
2. 代码经常比较难于理解或者阅读,这真是强调可读性的Ruby代码的一个耻辱啊
3. 代码真是维护者的噩梦——即便是你自己来维护

Pro Tips

If you fancy having a go at some golf, then here are a few tips that can be used to cut your Ruby code down to size and reduce your golfing handicap:

专业提示:

如果你喜欢尝试一下Golf,那么这里有一些小贴士可以用来帮助你减少你的Ruby代码并且减少你在这个过程中遇到的困难。

Mass Assignment

This is an easy one that most people will know, but assigning all your variables at once will help to cut down on code bloat.

1a,b = 1,2

多变量赋值
这是一种大部分人都知道的简单方法,但是一次性给你的所有变量赋值可以帮助你避免你的代码膨胀

Create Arrays Using the Shortcut Notation %w

You can create arrays of strings by using the following notation:

1a = %w(a b c) => ["a","b","c"]

使用缩写记号%w来创建数组

你可以通过这个记号来创建字符串数组

Use the Ternary Operator for Logic

1a>10?"too big":"fine"

对一些逻辑判断使用使用三元操作符

Use Chained Ternary Operators for More Complex Logic

view source
print?
1a<0?"no negatives":(a>10?"too big":"fine")

对一些更复杂的逻辑判断使用链式的三元操作符

Use Scientific Notation for Numbers

If you need big numbers, then 1e6 is shorter than 1000000.

使用科学计数法来标识数字

如果你需要很大的数字,那么1e6比1000000要短。

Use Dash-Rocket Syntax for Procs

If you’re using Ruby 1.9, use the dash-rocket (->) syntax for procs

1sayhello = -> {p "hello"}
2sayhello = -> name {p "hello #{name}"}

使用dash-rocket(->)创建proc

如果你使用的是Ruby 1.9,在创建proc结构时使用dash-rocket(->)符号

1 Character Strings

For 1 digit strings, use ?x = "x" (again, this only works in Ruby 1.9 though)

单字母字符串

对于单字母字符串,可以使用?x 来标识"x"(同样,这个仅适用于Ruby 1.9)

Learn Regular Expressions

Regular expressions can express some complicated expressions in a few characters.

学习正则表达式

正则表达式可以用很少的字符数来替代一些复杂的表达式

Use the Modulo Operator to Test if a Number is a Factor

12%3==0, because 12 is a multiple of 3
13%3!=0, because 13 is not a multiple of 3

**EDIT**

This has been improved further by Cyrus in the comments. You can actually just test if the answer is less than one rather than equal to zero:

112%3<1 => true

使用模操作符去测试一个数字是否是因子

12%3==0,因为12是3的倍数

13%3!=0,因为13不是3的倍数

这个操作已经得到改进。你可以测试这个答案是否小于1去代替是否等于0

12%3<1 => true

Use Map to Iterate

Iterators are usually better than for loops and map is the best iterator as it has the least characters. It can be used instead of each because you don’t have to change each element in the array, it still loops through it.

1%w(a b c).map{|x| puts x}

使用Map去迭代

迭代器通常要比循环好,并且因为map所用的字母最少所以map是最好的迭代器。它可以被用来取代each因为你不需要改变数组中每个元素的值,它仍然会循环一遍。

Use Symbol To Proc

This saves a lot of time (and possibly looks neater).

1%w(a b c).map{ |e| e.upcase }

becomes

1%w(a b c).map(&:upcase)
2=> ["A""B""C"]

What actually happens is that & calls the to_proc method for the symbol that follows (in this case the upcase method is called on each element of the array.

在Proc中使用名字

这种方法可以节省很多时间(而且可能看上去更整洁)

%w(a b c).map{ |e| e.upcase}

可以写成

%w(a b c).map(&:upcase)

实际上&会使用紧接后面的名字来调用to_proc方法(在这个例子中upcase方法对数组中的每个元素调用)

Easy Joins
%w(a b c)*"-" is the same as %w(a b c).join"-"
=> “a-b-c”

更方便的链接

%w(a b c)*"-" 等同于%w(a b c).join"-"

=> "a-b-c"

Reuse Loops

A good way to avoid using 2 loops for different object types is to bung all the objects into a single array and use just one iterator, but then perform different tasks depending on the object type.

1["a","b",2,4].map{|e|(e.to_s==e)?(e.upcase):(e*2)}
2=> ["A""B"48]

重用循环

一个避免对不同对象类型使用两个循环的好方法是将所有对象都塞到单独的数组中,然后使用唯一的循环,但是根据对象的类型调用不同的任务。

["a","b",2,4].map{|e|(e.to_s==e)?(e.upcase):(e*2)}

=> ["A","B",4, 8]

Testing Types

If you want to test if an object is a string then e.to_s==e is shorter than e.is_a? String.

测试类型

如果你想要测试一个对象是否是字符串,e.to_s==e 要比 e.is_a? String 要短。

Do you have any other tips to bring one’s handicap down? Leave your tips in the comments.

你还有其他的建议解决问题吗?在评论中留下你的建议吧。

Almost Sinatra

Konstantin Hasse (Sinatra Jedi Grand Master) performed an extreme form of Ruby golf when he condensed Sinatra (not exactly bloated at 1646 lines of code) into a measly 8 lines of code. It didn’t quite have the same functionality, but came pretty darn close. He used some great tricks when doing this, the last couple of tips in the list above are from the Almost Sinatra code.

Almost Sinatra

Konastantin Hasse(Sinatra的绝地一代宗师)诠释了一种Ruby golf的极致形式:他将Sinatra(估计大约有1646行代码)浓缩到了极少的8行代码。确切的讲它并没有完全复制原有功能,但是却相当的接近。在这个过程中,他使用了一些非常棒的技巧,上面列的一些贴士就是来源于Almost Sinatra的代码。

An Example Hole

As a example, I tried writing a method that would find the sum of all multiples of a given number up to a given value. For example sum(5,24) would calculate the sum of all the multiples of 5 up to 24 (ie 5 + 10 + 15 + 20).

This is what I came up with in the end:

1def sum(n,t)
2  n*(1..t/n).to_a.inject(&:+)
3end

I utilised the symbol to proc notation to use the inject method to sum the integers. How many integers to sum was found by doing integer division and relying on the fact that remainders are ignored.

This contains 27 characters (not including the method definition). Can anybody beat it? Leave your answer in the comments if you can.

一个例子

举个例子,我试着写一个方法,这个方法会找到一个特定数到一个给定值的所有倍数之和。比如,sum(5,24)会计算所有24以内5的倍数之和。

这是我最后的方案:

def sum(n,t)

n*(1..t/n).to_a.inject(&:+)

end

我利用了proc中的名字的标记法并使用了inject的方法来计算所有整数的值。至于有多少整数相加则通过整数除法并忽略余数的方法来保证。

这个方法一共包含了27个字母(不包含方法定义)。有人可以打败它嘛?如果你能的话请再评论区留下你的答案。

Competition

Now it’s time to find out who is the Tiger Woods of the Ruby World. Below are five ‘holes’ that make up the RubySource Golf Course. Try your hand at any or all of them and post your solutions in the comments.

竞赛

现在是时候去找出Ruby世界里的Tiger Woods了。下面有五个holes组成了Ruby代码Golf课程。请尝试其中的一些或全部并将你的解决方案列在评论中。

Hole 1: Fizz Buzz

Given a number the function returns “Fizz” if it is a multiple of 3, “Buzz” if it is a multiple of 5 and “FizzBuzz” if it is a multiple of 15. If the number is not a multiple of 3 or 5 then the number is returned as a string.

Example:

1fizzbuzz(3) => "Fizz"
2fizzbuzz(10) => "Buzz"
3fizzbuzz(45) => "FizzBuzz"
4fizzbuzz(31) => "31"

Hold1:

给出一个数,如果这个数是3的倍数,就返回"Fizz",如果是5的倍数就返回"Buzz",如果是15的倍数就返回"FizzBuzz"。如果这个数既不是3的倍数也不睡5的倍数,那么这个数就会作为字符串返回。

例子:

fizzbuzz(3) => "Fizz"

fizzbuzz(10) => "Buzz"

fizzbuzz(45" => "FizzBuzz"

fizzbuzz(31) => "31"

Hole 2: Caesar Cipher

Implement a Caesar Shift Cipher

Example:

1caeser("hello",3) => "khoor"

You should also be able to produce negative shifts.

Hole2:

实现一个凯撒移位密码

例子:

caeser("hello",3) => "khoor"

你应该同样实现逆向转换。

Hole 3: Rock,Paper,Scissors Game

Write a simple method that ‘plays’ this game, where the player enters their ‘move’ as an argument to the method. If the player enters an invalid option then the result should be ‘lose’. The computer should choose its move at random. The output gives the computer’s ‘move’ and the result as a comma-separated string.

Example:

1play("Rock") => "Rock,Draw"
2play("Paper") => "Rock,Win"
3play("Scissors") => "Rock,Lose"
4play("Soap") => "Paper,Lose"

Hold3:

写一个简单的方法来“玩”游戏,游戏里玩家输入他们的“动作”作为参数给这个方法。如果这个玩家输入一个不合法的选项,那么这个结果会是“失败”。计算机会随机选择它的动作。方法的输出会给出计算机的“动作”,这个输出是用逗号分隔的。

Hole 4: String Counter

Write a method that when given a string and substring, returns the number of times the substring occurs in that string (ignoring case).

Example:

1count("Banana","a") => 3
2count("RubySource provides advice, tutorials, commentary, and insight into the Ruby and Rails ecosystem","ruby") => 2

Hold4:

写一个方法,当给出一个字符串和一个子串,返回这个子串在这个字符串中出现的次数(忽略字母大小写)。

例子:

count("Banana","a") => 3

count("RubySource provides advice, tutorials, commentary, and insight into the Ruby and Rails ecosystem","ruby") => 2

Hole 5: Swingers Function

Write a function that replaces ‘putting your keys in a tin’. The argument to the function is an array of arrays that contain two objects. The function returns a new array where the pairs of objects have been mixed up. An object should not end up with it’s original ‘partner’.

Example:

1swingers([["Homer","Marge"],["Micky","Minnie"],["Fred","Wilma"],["Peter","Lois"],["George","Judy"]])
2=> [["Homer","Wilma"],["Micky","Lois"],["Fred","Judy"],["Peter","Marge"],["George","Minnie"]]

To enter, write your method in the comments below. The person whose entry contains the lowest number of characters will win each hole. There’s a Sitepoint book up for grabs for the winner of each hole. You can use Ruby 1.8 or 1.9. The deadline is 31st December 2011. Only the characters inside the method definition will be counted, so my example hole above would count as 27 characters. Feel free to post a Gist to your code.

Hole5:

写一个方法来取代‘putting your keys in a tin’。这个方法的参数是一个包含两个对象的数组的数组。这个方法返回一个新的数组,其中成对的对象都已经被混合了。一个对象不能以它原来的“搭档”结尾。

例子:

swingers([["Homer","Marge"],["Micky,"Minnie"],["Fred","Wilma"],["Peter","Lois"],["George","Judy"]])

=>

[["Homer","Wilma"],["Micky","Lois"],["Fred","Judy"],["Peter","Marge"],["George","Minnie"]]

(待续。)

相关文章:

AI删库,程序员背锅?

作者 | 一一出品 | AI科技大本营又一代码清库的惨案发生了&#xff0c;不过这次要背锅是 AI。近日&#xff0c;美国最大点评网站 Yelp 的工程师训练的神经网络闯祸了。他们训练了一个用来消除 bug 的神经网络&#xff0c;万万没想到&#xff0c;该网络删除一切&#xff0c;从根…

OpenStack Keystone架构一:Keystone基础

一 什么是keystone keystone是OpenStack的身份服务&#xff0c;暂且可以理解为一个与权限有关的组件。 二 为何要有keystone Keystone项目的主要目的是为访问openstack的各个组件&#xff08;nova&#xff0c;cinder,glance...&#xff09;提供一个统一的验证方式,具体的&#…

用gdb调试mpi程序的一些心得

Linux下MPI (Message Passage Interface) 的程序不太好调试&#xff0c;在windows下vs2005以上的IDE有集成的简便MPI调试工具&#xff0c;没有用过&#xff0c;有兴趣的可以试验一下。下面总结了一些最近在用MPI和c语言写程序时的调试经验&#xff08;Ubuntu环境&#xff0c;c语…

开源如何占领软件世界?

作者 | Mike Volpimavolpi译者 | 风车云马编辑 | 一一出品 | AI科技大本营5 年前&#xff0c;投资商对开源这种商业模式的可行性持有怀疑态度。他们普遍认为&#xff0c;红帽&#xff08;redhat&#xff09;公司犹如雪花飘零——在软件世界里开源公司不可能占据举足轻重的地位。…

软件工程概论——课堂测试1

设计思想&#xff1a;1.用1个页面&#xff0c;实现课程录入&#xff0c;提交后直接返回课程界面。2.应用html表单属性进行数据的提交。3.用servlet进行写入数据库和验证输入。 源代码&#xff1a; <% page language"java" import"java.util.*" contentT…

过程即奖励(The Journey is the Reward)

今天读完了《乔布斯传》。翻着这本书最后的影集&#xff0c;乔布斯传奇一生的一幕幕仿佛在眼前展开。从第一张照片中特里独行、桀骜不驯的年轻人&#xff0c;到最后一张照片中阳光下慈祥微笑的老者&#xff0c;看到的仿佛不是乔布斯的照片&#xff0c;而是自己的一位人生挚友。…

BREW 计费模式概览

计费模式也就是收入模型是商业模式的基础。BDS分发系统中不但提供了与运营商计费系统的接口&#xff0c;而且直接提供了BREW 计费服务。 BREW分发系统与运营商计费系统的集成&#xff0c;一般就是与运营商的综合营帐系统的集成&#xff0c;需要融合于网元层&#xff0c;资源层&…

程序员崩溃了,年终奖怎么说黄就黄

作者 | 胡巍巍转载自程序人生&#xff08;ID:coder_life&#xff09;往年王者荣耀年终奖200个月100万&#xff08;虽然辟谣是假的&#xff09;、华为年终奖24个月100万&#xff0c;都让我等平民羡煞不已。还有在BAT发生的&#xff08;朋友圈&#xff09;真人真事↓这是年终奖的…

改变IT世界的11大Apache开源技术

据国外媒体报道&#xff0c;转眼之间&#xff0c;Apache软件基金会已经成立10年之久了&#xff0c;11月份&#xff0c;Apache基金会的成员将会为其举行一次大型的庆祝。虽然Apache软件基金会是一个开源的组织&#xff0c;但是Apache却创造了对现代互联网来说很重要的技术。下面…

nginx常用技术

作者:NetSeek http://www.linuxtone.org (IT运维专家网|集群架构|性能调优)欢迎转载,转载时请务必以超链接形式标明文章原始出处和作者信息及本声明.首发时间: 2008-11-25 更新时间:2009-1-14目 录一、 Nginx 基础知识二、 Nginx 安装及调试三、 Ngi…

2011到过的地方

火车上读《南方周末》&#xff0c;看到记者把自己2011去过的地方在地图上标记&#xff0c;带着标记的世界地图&#xff0c;显得特别而好看&#xff0c;于是很想自己也做一份。找了一些网站&#xff0c;做的图片&#xff0c;差强人意吧。2011到过的地方&#xff1a;这个图不算漂…

2亿简历遭泄漏,到底谁的锅?

作者 | 仲培艺转载自CSDN&#xff08;ID&#xff1a;CSDNnews&#xff09;前面刚有 AWS 开战 MongoDB&#xff0c;双方“隔空互呛”&#xff0c;这厢又曝出 2 亿简历信息泄露——MongoDB 的这场开年似乎“充实”得过分了些。长期以来&#xff0c;作为“最受欢迎的 NoSQL 数据库…

Could not apply the stored configuration for monitors 解决办法

Could not apply the stored configuration for monitors 解决办法&#xff1a; $ sudo rm -rf ~/.config/monitors.xml 重启电脑即可 本文转自linux博客51CTO博客&#xff0c;原文链接http://blog.51cto.com/yangzhiming/1225802如需转载请自行联系原作者 yangzhimingg

20行Python代码给微信头像戴帽子

作者 | Leauky&#xff0c;北理工硕士在读&#xff0c;非CS专业的Python爱好者。朋友圈里微信官方要求戴圣诞帽的活动曾经火爆一时&#xff0c;有些会玩的小伙伴都悄咪咪地用美图秀秀一类的 app 给自己头像 p 一顶&#xff0c;然后可高兴地表示“哎呀好神奇hhhh”&#xff0c;呆…

2012关于钱的Tips

对于目前的我来说&#xff0c;死工资是唯一的财富积累手段&#xff0c;而且工资本身还不足够满足所有的物质和精神需求。以此为前提&#xff0c;对钱的来龙去脉有一个了解、把控是极其有必要的。 2011钱的规划基本为零&#xff0c;一年下来惊恐的发现&#xff0c;似乎自己没攒多…

在 Azure 中管理 Windows 虚拟机的可用性

了解如何设置和管理多个虚拟机&#xff0c;以确保 Azure 中 Windows 应用程序的高可用性。 也可以管理 Linux 虚拟机的可用性。 Note Azure 具有用于创建和处理资源的两个不同的部署模型&#xff1a;Resource Manager 和经典。 这篇文章介绍了如何使用这两种模型&#xff0c;但…

[日记]一个人去散步

森林里面的寂静会让每一个人都有所进步。 ——罗伯特M波西格 《禅与摩托车维修艺术》 北陵公园下午5点之后免收门票&#xff0c;我就在这个时间去那里散步。 说起来&#xff0c;我家离北陵西门走路才10几分钟的路程&#xff0c;可是我…

2019年人工智能行业又进入冬天了吗?

【AI科技大本营导语】过去几年&#xff0c;以深度学习为代表的人工智能技术取得了前所未有的高速发展&#xff0c;公司高薪聘请相关领域研究人员&#xff0c;组建人工智能研究团队&#xff0c;相信人工智能带来的巨大商业价值。然而&#xff0c;从近一年的发展态势来讲&#xf…

Vue.js slots: 为什么你需要它们?

也许你已经看过了Vue.js slots的文档。我对这个功能从“为什么你可能需要它”到“没有它我怎么可能工作”的态度转变非常快。虽然文档已经解释了它的概念&#xff0c;但是这里有一个关于slots怎么改进应用程序代码库的真实例子。在我看来&#xff0c;slots是vue最有用和最有趣的…

apache httpd server安装的一个问题

问题&#xff11;&#xff1a; 启动bin/apachectl start的时候&#xff1a; 发现报错&#xff1a;httpd: bad user name daemon 解决方法&#xff1a; groupadd daemon useradd -g daemon daemon 若没有配置合适PATH常量&#xff0c;则可以找 /usr/sbin/groupadd&#xff0c…

telnet 如何退出

ctrl]&#xff0c;然后再输入q就可以退出了。转载于:https://www.cnblogs.com/rethink/archive/2009/10/29/1591898.html

TensorFlow 2.0新特性解读,Keras API成核心

来源 | Google TensorFlow 团队2018 年 11 月&#xff0c;TensorFlow 迎来了它的 3 岁生日&#xff0c;我们回顾了几年来它增加的功能&#xff0c;进而对另一个重要里程碑 TensorFlow 2.0 感到兴奋 &#xff01;TensorFlow 2.0 将专注于 简单性 和 易用性&#xff0c;具有以下更…

列选主元guass消去法

200701020110 07计算机 王再#include <iostream.h>#include <iomanip.h>#include <stdlib.h>void main(){ int flag1;input(); //输入方程 while(flag){ print_menu(); //打印主菜单}void print_menu(){ system("cls");cout<…

Mac 下 IDEA 启动慢的问题

转自&#xff1a; http://blog.csdn.net/KingBoyWorld/article/details/73440717 从控制台来看&#xff0c;每次都会连接本地地址(127.0.0.1)&#xff0c;问题可能就出在这里。 修改本地/etc/hosts文件&#xff0c;添加以下内容: 127.0.0.1 localhost <hostname&g…

研发投入超876亿的华为,将如何进击云+AI?

人工智能作为下一轮科技革命的关键元素&#xff0c;正在进入越来越多的行业&#xff0c;用 AI 的技术和理念去解决现在和未来的问题&#xff0c;将是企业构建竞争力的关键。在去年 10 月召开的华为全联接大会上&#xff0c;华为轮值董事长徐直军详细阐述了华为的 AI 战略&#…

Bash脚本: 根据关键字做替换

根据某个文件的关键字做替换 #!/bin/bashkvawk -F "" { if(NF2) print $1""$2 } ./zuanshi_servic_test.propertiesfor kv in ${kv[]};dokecho $kv | awk -F "" {print $1}vecho $kv | awk -F "" {print $2} | awk -F "\r" …

Git学习系列之一些常用的Git命令收录更新ing

不多说&#xff0c;直接上干货&#xff01; 前言 对于Git工具&#xff0c;有必要整理和总结一些常用实用的命令。 http://p.primeton.com/articles/53cce3a3e138236138000026 https://www.zhihu.com/question/22932048 http://blog.csdn.net/w410589502/article/details/536063…

普通域账号客户端计算无关机选项

组策略-》计算机配置-》安全设置-》本地策略-》用户权限分配-》关闭系统把DOMIAN USERS 组加进去我是在Default Domain Policy 里面加的转载于:https://blog.51cto.com/zhangjunjie/219613

罗永浩“咬定”微信不放松

作者 | 胡巍巍来源 | CSDN&#xff08;CSDNnews&#xff09;昨天&#xff0c;1月15日&#xff0c;听起来是很普通的一天。但是&#xff0c;历史上的这一天——公元8年1月15日&#xff0c;是王莽建立新朝、西汉结束的日子。2011年后的这一天&#xff0c;有一个八岁的国民社交软件…

Windows Ruby使用Mysql环境配置

windows下Ruby使用mysql时候报错&#xff1a; Incorrect MySQL client library version! This gem was compile d for 6.0.0 but the client library is 5.1.45 经过查找找到了解决方案&#xff1a; 1. 下载mysql-connector-c-noinstall-6.0.2-win32.zip http://dev.mysql.c…