有人对李强不屑,也有人对李强膜拜,物质都是具有矛盾性的。但是依然有这么多人
都前赴后继的去听他的课,并且他取得了这么大的成功,那就一定有他的优越性和正确性。
那么就让我们取其精华,为我们所用。
大道理 好文章 我是从理的人,不会写。就谈谈自己对这次培训下来的一些感想。
1.企业必须要有文化 ,要有自己的价值观。就算一个企业有再多的物质基础,和再多
的钱,没有一种精神的思想来领导员工,领导团队,那么他的落后是迟早的事。共产党
之所以从一无大有的农民军,打败装备先进,军力充足的国民党。就是在于他的思想:
为人民服务,为人民打仗。使得所有的人团结一致。并且拧成一根绳。如果一个企业没有
自己的核心价值观和宗旨,那么你的团队,一定会人员涣散。
2.如何培养企业文化。 企业文化是一种从上而下的思想传输。上面的领导如果没有这个
去带头灌输自己,那么一层又一层,到底下根本就没有执行到。第二个就是企业文化的培养
是一个“百年大计”。是一而再,再而三的强调和灌输。是企业生产生活的一部分。这个环节
虽然没有直接的利润输出,但是在实际的生产中早就使利润翻倍,效益提高了。要重视,而且
是非常重视。再牛逼的技术你也可以买到,但是禁锢在员工头脑里的东西你不一定能买到。
3.如何执行企业文化。从领导的5分钟艺术,到对客户的直接体现,到员工的衣着打败,言谈
举止,都是自然的企业文化的提现。要监督,要提醒,但更重要的是自觉。如果前2步基础打
的好,我相信执行应该是一种自然间的流露和提现。
以上就是我对企业文化的愚见。
[环境]早上骑着自行车的时候,经常看着那些汽车。经常会在想这样一个问题,同样是24小时,为什么他获得的收益却要比我的大这么
多。抛开一些非公平因素,如富二代,拆迁暴富,还是有很多的人是通过双手创造财富的,那么我和他们的差距在哪里。我创造
的价值和他们创造的价值差距为什么这么大。我们必须承认,我们的社会局部是非常不公平的,但是总体却是公平的。只有客观的认识
环境,才能摆正自己的位置,找到你自己的汽车。
[想法]一个人一定要有自己的想法,没有想法如同行尸走肉,做一天和尚撞一天钟。我有个同学他很有想法,让我钦佩。09年在groupon
在国外刚兴起的时候,他也想借鉴这个模仿,那时候找到我问我做这个网站难不难。我跟他说不难,他就注册了一个团购域名暑假里和一些
同学一起干了起来。后来由于种种原因没有成功。前几个月,他和另外三个人再次创业,合开了个工作室做手机应用。也是很热门的一个
方向。着实让我震惊了一把,我都已经工作了2年多了什么想法都没有,他还在上学(读研),却已经开始了创业生涯。虽然现在没有成功,
但是我相信是迟早的事情。我们每个人都扪心自问下:你是否还有自己的理想?那目标呢?实在没有,给点想法也行。
[实干]有了想的,当然要去做。有些人老是埋怨自己入错行,没有机遇,运气不好,家里没背景。不需要抱怨,抱怨一点用都没有,只
需要认清事实。既然没有这些客观条件,那么就让自己双手去创造。脚踏实地的去做,上帝迟早回来眷顾你的。去做了才有可能获得成功,
即使失败也是坦然面对,“我自横刀向天笑,留取肝胆两昆仑”。如果只是想,今天想创业,明天想发财,那都是空想。Just wast time.很
多大企业或企业当初创业的时候 都是微不足道的一个想法,但是如果没人去做,那么他根本就不会存在。
[坚持]其实我也有很多的想法,我也尝试了去做。做过垃圾站,写过企业软件,开源程序,但都是没有成功。原因很简单,就是不够坚持。任何一
件事情,只要认准了那就坚持着去做。终究会有所收获的。很多人做做垃圾站都月入上w,创造财富的事迹到处都是,唯独没有你的一份,那么
我想肯定是你不够坚持。
[一颗永不服输的心]以前我在学校里,虽然我不是非常聪明的那种,但我一定是绝不服输的那种。别人能考到的,我也一定可以,我会
花更多的时间,更多的认真去拼。现在社会里,诚然没有学校里的那种公平环境,但是绝不能甘于人后。别人有的,现在我没有,但是以后
我一定会有!成功的道路上失败在所难免,But Never Give Up!
我需要两个线程访问同一个List。
一个线程不停的往List中add数据。
一个线程往外get数据,get一条,remove一条。
ArrayList不是线程安全的 所以 synchronized 必须有 这一点是关键,其他的都是浮云。还有 两个线程sleep一会更好 否则 这个跟死循环一样了 机器受不了啊!。
public static List list = new ArrayList();
public static void main(String[] args) {
Test tt = new Test();
myThreadClass1 thread1 = tt.new myThreadClass1();
myThreadClass2 thread2 = tt.new myThreadClass2();
Thread t1 = new Thread(thread1);
Thread t2 = new Thread(thread2);
t1.start();
t2.start();
}
private synchronized Object getList(int index) {
return list.get(index);
}
private synchronized List getLists() {
return list;
}
private synchronized void setList(Object obj) {
Test.list.add(obj);
}
private synchronized void removeList(int index) {
Test.list.remove(index);
}
class myThreadClass1 implements Runnable {
public void run() {
int i = 0;
while (1==1) {
i++;
setList("第一个------>" + i);
System.out.println("第一个------>" + i);
}
}
}
class myThreadClass2 implements Runnable {
public void run() {
while(1==1){
if(list.size() > 0){
for(int i = 0; i < getLists().size() ; i++){
System.out.println("移除———————>"+getList(i));
removeList(i);
}
}else{
try {
Thread.sleep(100);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
}
}
需要对list进行同步,保证只有一个线程在操作list。
class myThreadClass1 implements Runnable {
public void run() {
while(1 == 1){
synchronized (Test.list) {
Test.list.add("123");
}
Thread.yield(); // 别让他老是占着CPU啊
}
}
}
在向外取的时候,不允许别人向里加,所以需要同步list。
class myThreadClass2 implements Runnable {
public void run() {
while (true) {
synchronized (Test.list) {
if (!Test.list.isEmpty()) {
String item = Test.list.get(0);
System.out.println(item);
Test.list.remove(0);
}
}
Thread.yield(); // 别让他老是占着CPU啊
}
}
原文链接http://zhidao.baidu.com/question/233617957.html
国外知名网站stackoverflow上有一个问题调查: 哪本书是对程序员最有影响、每个程序员都该阅读的书?,这个调查已历时两年,目前为止吸引了153,432人访问,读者共推荐出了478本书(还在增加),其中最火的一本书《Code Complete》(代码大全)被顶了1306次。如果你是个程序员,你一定有兴趣看看这些书里你都看过几本,如果你一本没看过的话,我也不好说什么,也许你是个天才,但我相信大多数人都知道,你在学校里根本学不到什么真正的工作中需要的知识,我们毕业后能帮助我们在公司中胜任工作的老师就是这些优秀的书籍,一本好书可以改变一个人的一生。
下面是这个调查中排名靠前的书的一个简单的清单:
1. 第一名:1306票《Code Complete (2nd Ed) by Steve McConnell》,中文版《代码大全(第二版)》,两届Software Jolt Award震撼大奖得主!
cover
2. 第二名:1161票《The Pragmatic Programmer》,中文版《程序员修炼之道》
The Pragmatic Programmer
3. 第三名:689票《Structure and Interpretation of Computer Programs》,中文版《计算机程序的构造和解释》
Structure and Interpretation of Computer Programs – 2nd Edition (MIT Electrical Engineering and Computer Science)
4. 第四名:557票《The C Programming Language》,中文版《C程序设计语言》
The C Programming Language Book
5. 第五名:472票《Refactoring: Improving the Design of Existing Code》,中文版《重构:改善既有代码的设计》
Refactoring: Improving the Design of Existing Code
6. 第六名:472票《Introduction to algorithms》,中文版《算法导论》
Introduction to algorithms cover image
7. 第七名:430票《The Mythical Man-Month》,中文版《人月神话》
The Mythical Man-Month: Essays on Software Engineering, Anniversary Edition (2nd Edition)
8. 第八名:426票《Design Patterns》,中文版《设计模式》
9. 第九名:386票《The Art of Computer Programming(First Volume Hardcover)》,中文版《计算机程序设计艺术第(第一卷)》
http://www.aqee.net/wordpress/wp-content/uploads/2011/03/75dd9_programming_41T1XCAEE1L.jpg
10. 第10名:353票《Compilers: Principles, Techniques, and Tools 》,中文版《编译原理》
Compilers: Principles, Techniques, and Tools (2nd Edition)
11. 第11名:329票《Head-First Design Patterns》,中文版《Head First 设计模式》
当然了,这里的排名并不具有什么权威性,但绝对可以说都是好书,这11本外还有很多书虽然票数不是那么多,但大家估计都耳熟能详,比如《Effective C++》(中文版《Effective C++:改善程序与设计的55个具体做法》),《Clean Code》(中文版《代码整洁之道》),《Effective Java》(中文版《Effective Java中文版(第2版)》等。
记得有位先哲曾说过:一种编程语言的重要性并不在于语言本身,而是在于这种语言来体现出来的编程思维模式。所以说,并不是你用到的书才去读,读书是一种习惯。
英文原文: What is the single most influential book every programmer should read?
威瑞信–英文名为Verisign,这家注册局提供注册的域名后缀有.com/.net/.cc/.edu/.cc/.jobs/.name。不同的域名注册局提供的域名的后缀不一样。之前已经说了成为国际顶级域名注册商的流程,当你成功申请到国际顶级域名注册商资格的时候,下一步就是需要写域名注册的接口程序了,这个接口程序要跟你公司的业务系统联系在一起,比如当你的客户交了钱之后,可以自助申请注册域名,然后制定你自己的域名价格。
因为verisign是不保存域名注册者的详细信息的,所以注册商要自己提供一个whois查询的接口,这个接口可以根据传入的域名,返回这个域名的注册详细信息,包括注册所有者,技术联系人,财务联系人等等。。
此外中文域名也在这个接口里面,比如 新浪.com,这个就属于IDN的域名了,也在这个域名注册接口中。
申请成为国际域名注册商的流程是这样的。
1.得到ICANN的认证,然后ICANN会给你一个ssl的证书,你拿着这个证书可以到任何一家注册局去申请注册域名的接口(不过要想拿到ICANN的授权证书不容易的,要求挺多,大体上的要求就是公司的注册资金,公司的规模,以及公司每个月的域名注册量能达到多少。等等要求)
2.拿着ICANN的证书去域名注册局申请注册权,申请下来之后你就是域名注册商。他们会给你一个账户信息,起初会给你两个账号和密码,还有一个OT&E(这里解释一下OT&E的意思,就是你自己写域名注册接口的时候,测试的环境,那个环境跟真实的域名注册是一样的,所以只要在OT&E上测试通过了,你转成正式的注册接口之后肯定会成功的)的地址。然后具体的SSL通信过程,证书本地的安装,以及TLD的发送结构,全得由自己开发,默认情况下注册局都会提供一个接口程序的SDK开发包,用这个开发包写注册接口的时候要轻松很多,不用了解底层的SSL的通信协议。
3.拿着注册局给的账户信息在本地开发测试。等程序开发基本完毕之后,联系注册局开始参加 OT&E,就跟考试一样。注册局会给你一个时间段,这个时间段是你和注册局商量着定的,(因为注册局大多都在国外,一般选择的时间要注意时区,我们中国是东八区,在于注册局发送邮件交流的时候要注册时间格式,不然老外看到的时间跟你发送的时候不一样。最终测试的时间也就不一样),比如商量 好下午1点到4点测试,那么在段时间里,你要完成OT&E的实战操作,比如让你新建一个域名,删除一个域名,再转移一个域名(因为给你的账户是两个,所以就可以用这两个账户来回转了),如果在给定时间给没做完或是操作中出现问题的,得需要重新商量时间测试。。直到你测试完全通过了。。
4,等程序测试通过之后,一般暂时不会给你正式账户信息,会让你再做一个财务上的确认。。往注册局账户打上指定的金额之后,确认你那账户里有钱了之后,注册局会给你正式的账户信息,还有正式的域名注册API地址
5.至此申请过程基本完成,你可以登陆相应注册局查看你域名注册情况,以及账户余额
(注册局的收费一般是这样的,每个月的域名达到一定的数量之后会返款到你账户里,不过返的不是太多)
原文链接:http://www.ehelper.com.cn/blog/post/domain-api-process_1821.html
另外恭喜爱名网获得Icann认证,http://www.22.cn/news/message/2011-03-05-636.html,如果该注册商申请下来后,相信爱名网会在国内各大平台的国际域名业务中优势更加明显和突出。
我们在应对网站的恶意请求时候,一个解决方法就是把有问题的请求IP封杀掉。
如果想快速处理这种问题,就需要编写一段代码,达到一定门槛,自动封杀。再复杂点就是不是永久封杀,还可以自动在一定时间后解封。
封杀的逻辑代码看后面提供的。
需要说明的是:IIS7时,情况发生了不同。
下面的代码,在处理封杀IP时候,不论IIS6还是IIS7 都可以把需要封杀的IP加入封杀列表。但是需要注意的是我们代码写的是全部替换原先的数据。但是在IIS7下,执行的效果是原先的不替换,新加一批封杀 IP。当然IIS7下,如果新加的IP原来就有了,则会报如下异常:
System.Runtime.InteropServices.COMException was caught
Message=”当文件已存在时,无法创建该文件。 (异常来自 HRESULT:0x800700B7)”
Source=”System.DirectoryServices”
ErrorCode=-2147024713
StackTrace:
在 System.DirectoryServices.DirectoryEntry.CommitChanges()
在 IIS_Security_ConsoleApplication.Program.IPDeny() 位置 D:\MyCodes\IIS_Security_ConsoleApplication \IIS_Security_ConsoleApplication\Program.cs:行号 109
InnerException:
这就是说,IIS7, 我们可以通过编程接口增加封杀IP名单,但是没发通过编程接口剔出封杀IP。
参考代码:
这里提供了两套参考代码,其实原理都是一样的。
在IIS 6 下,都没有任何问题, IIS 7 下都会有没发删除原先已有数据的问题。
代码一:
using System.DirectoryServices;
using System.Reflection;
using System;
class Program
{
static void IPDeny()
{
try
{
string serverName = "localhost";
// retrieve the directory entry for the root of the IIS server
System.DirectoryServices.DirectoryEntry IIS = new System.DirectoryServices.DirectoryEntry(
string.Format("IIS://{0}/w3svc/1/root", serverName));
// retrieve the list of currently denied IPs
Console.WriteLine("Retrieving the list of currently denied IPs.");
// get the IPSecurity property
Type typ = IIS.Properties["IPSecurity"][0].GetType();
object IPSecurity = IIS.Properties["IPSecurity"][0];
// retrieve the IPDeny list from the IPSecurity object
Array origIPDenyList = (Array)typ.InvokeMember("IPDeny", BindingFlags.DeclaredOnly | BindingFlags.Public
| BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.GetProperty, null, IPSecurity, null);
// 罗列已经被拒绝的地址
foreach (string s in origIPDenyList)
Console.WriteLine("Before: " + s);
// check GrantByDefault. This has to be set to true,
// or what we are doing will not work.
bool bGrantByDefault = (bool)typ.InvokeMember("GrantByDefault", BindingFlags.DeclaredOnly | BindingFlags.Public
| BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.GetProperty, null, IPSecurity, null);
Console.WriteLine("GrantByDefault = " + bGrantByDefault);
if (!bGrantByDefault)
{
// 必须设置 默认允许访问
typ.InvokeMember("GrantByDefault", BindingFlags.DeclaredOnly | BindingFlags.Public | BindingFlags.NonPublic
| BindingFlags.Instance | BindingFlags.SetProperty, null, IPSecurity, new object[] { true });
}
// 更新被拒绝的IP列表
// 注意这里是完全替换
// 如果你想保留原先的拒绝列表,需要原先的拒绝列表也在这个数组中
Console.WriteLine("Updating the list of denied IPs.");
object[] newIPDenyList = new object[4];
newIPDenyList[0] = "192.168.1.21, 255.255.255.255";
newIPDenyList[1] = "192.168.1.22, 255.255.255.255";
newIPDenyList[2] = "192.168.1.23, 255.255.255.255";
newIPDenyList[3] = "192.168.1.24, 255.255.255.255";
Console.WriteLine("Calling SetProperty");
// add the updated list back to the IPSecurity object
typ.InvokeMember("IPDeny", BindingFlags.DeclaredOnly | BindingFlags.Public | BindingFlags.NonPublic
| BindingFlags.Instance | BindingFlags.SetProperty, null, IPSecurity, new object[] { newIPDenyList });
IIS.Properties["IPSecurity"][0] = IPSecurity;
Console.WriteLine("Commiting the changes.");
// commit the changes
IIS.CommitChanges();
IIS.RefreshCache();
// 检查更新后的数据
Console.WriteLine("Checking to see if the update took.");
IPSecurity = IIS.Properties["IPSecurity"][0];
Array y = (Array)typ.InvokeMember("IPDeny",
BindingFlags.DeclaredOnly | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance
| BindingFlags.GetProperty, null, IPSecurity, null);
foreach (string s in y)
Console.WriteLine("After: " + s);
}
catch (Exception e)
{
Console.WriteLine("Error: " + e.ToString());
}
}
}
代码二:
using System.DirectoryServices;
using System.Reflection;
using System;
static void SetIPSecurityProperty(string metabasePath, string member, string item)
{
// metabasePath is of the form "IIS://<servername>/<path>"
// for example "IIS://localhost/SMTPSVC/1"
// member is of the form "IPGrant|IPDeny|DomainGrant|DomainDeny"
// item is of the form "<ipaddress|domain>", for example, 157.56.236.15 or domain.microsoft.com
Console.WriteLine("\nEnumerating the IPSecurity property at {0}:", metabasePath);
try
{
if (("IPGrant" != member) && ("IPDeny" != member) && ("DomainGrant" != member) && ("DomainDeny" != member))
{
Console.WriteLine(" Failed in SetIPSecurityProperty; second param must be one of IPGrant|IPDeny|DomainGrant|DomainDeny");
}
else
{
DirectoryEntry path = new DirectoryEntry(metabasePath);
path.RefreshCache();
object ipsecObj = path.Invoke("Get", new string[] { "IPSecurity" });
Type t = ipsecObj.GetType();
Array data = (Array)t.InvokeMember(member, BindingFlags.GetProperty, null, ipsecObj, null);
Console.WriteLine(" Old {0} =", member);
bool exists = false;
foreach (object dataItem in data)
{
Console.WriteLine(" {0}", dataItem.ToString());
if (dataItem.ToString().StartsWith(item))
{
exists = true;
}
}
if (exists)
{
Console.WriteLine(" {0} already exists in {1}", item, member);
}
else
{
object[] newData = new object[data.Length + 1];
data.CopyTo(newData, 0);
newData.SetValue(item, data.Length);
t.InvokeMember(member, BindingFlags.SetProperty, null, ipsecObj, new object[] { newData });
path.Invoke("Put", new object[] { "IPSecurity", ipsecObj });
path.CommitChanges();
path.RefreshCache();
ipsecObj = path.Invoke("Get", new string[] { "IPSecurity" });
data = (Array)t.InvokeMember(member, BindingFlags.GetProperty, null, ipsecObj, null);
Console.WriteLine(" New {0} =", member);
foreach (object dataItem in data)
Console.WriteLine(" {0}", dataItem.ToString());
Console.WriteLine(" Done.");
}
}
}
catch (Exception ex)
{
if ("HRESULT 0x80005006" == ex.Message)
Console.WriteLine(" Property IPSecurity does not exist at {0}", metabasePath);
else
Console.WriteLine("Failed in SetIPSecurityProperty with the following exception: \n{0}", ex.Message);
}
}
static void Main(string[] args)
{
// 获取目前服务器上有哪些站点
DirectoryEntry root = new DirectoryEntry("IIS://localhost/W3SVC");
foreach (DirectoryEntry dir in root.Children)
{
if (dir.SchemaClassName == "IIsWebServer")
{
string ww = dir.Properties["ServerComment"].Value.ToString();
Console.Write("IIS://localhost/W3SVC/{0}/ROOT/ {1}\r\n", dir.Name, ww);
}
}
// IPDeny();
SetIPSecurityProperty("IIS://localhost/w3svc/1/root", "IPDeny", "192.168.5.79");
Console.ReadLine();
}
原文链接 http://www.supesoft.com/ArticleDisp.asp?ID=4598&Cmd=Print