易栈网-膘叔

浏览模式: 标准 | 列表 | 图文
HTML中尺寸对比

HTML中尺寸对比

做网页的时候,总是会用到一些尺寸,那么这些尺寸的规格又各是什么呢?这里有个表格可以做个简单的对比,可以让你在看到这些尺寸的时候能够知道如何进行换算成自己所熟悉的尺寸单位:

Points

Pixels

Ems

Percent

6pt

8px

0.5em

50%

7pt

9px

0.55em

55%

7.5pt

10px

0.625em

62.5%

8pt

11px

0.7em

70%

9pt

12px

0.75em

75%

10pt

13px

0.8em

80%

10.5pt

14px

0.875em

87.5%

11pt

15px

0.95em

95%

12pt

16px

1em

100%

13pt

17px

1.05em

105%

13.5pt

18px

1.125em

112.5%

14pt

19px

1.2em

120%

14.5pt

20px

1.25em

125%

15pt

21px

1.3em

130%

16pt

22px

1.4em

140%

17pt

23px

1.45em

145%

18pt

24px

1.5em

150%

20pt

26px

1.6em

160%

22pt

29px

1.8em

180%

24pt

32px

2em

200%

26pt

35px

2.2em

220%

27pt

36px

2.25em

225%

28pt

37px

2.3em

230%

29pt

38px

2.35em

235%

30pt

40px

2.45em

245%

32pt

42px

2.55em

255%

34pt

45px

2.75em

275%

36pt

48px

3em

300%


其实本来已经发表了,但不知怎么的,文章消失了。郁闷,只好重发一遍,其实也是给自己做个参考了。

转:为什么我们程序员难晋升

转:为什么我们程序员难晋升

来自cnbeta,有点意思,想起了以前的一些小事情
原文来自:http://cnbeta.com/articles/151368.htm,作者梁斌,文末有链接

今天看到微博上@hellodba发的一个帖子:“内部晋升越来越困难,但是外部来的大P越来越多,所以很多人都选择跳槽”,之后我从三个方面简要的进行 了回答:“外面来的总是有包装的,内部的都是肉身PK,此一输;外面来的总是小股人马,内部的一批批的,升谁都伤感情,此二输;外面来的通常都是大佬推荐 的,没有特别重大机会,人不会来,内部的就不解释了,成果都被大佬吸收,难有机会,此三输”。之后讨论不断,我也余兴未了,继续写来。

这个世界上有一类人特别苦逼,苦逼到什么程度呢?他们省吃俭用攒钱买房,结果房价越来越贵;公司外部竞争激烈,他们工作异常繁忙,披星戴月,日复一日;技 术更新行业罕见,他们要随时调整心情,随时学习知识;他们长期和机器为伍,大多比较呆傻,比较单纯;还有很多不一一例举,这一类人就是程序员。

而就是这么一类程序员过着这么苦逼的生活,在公司内部却难以获得公平的晋升机会,外来的和尚总是在不断打破平衡,甚至是刚毕业的新和尚拿得都比老和尚多,这是全行业都罕见的奇观,IT人有幸经历了。

  • 某创业公司,某个程序员要离职,老板甚至不问问他直接领导的意见,就同意了,没有挽留,之后大骂不忠诚,这个人拿3k,拿了2年,他走了以后,老板用5k雇了个新面孔,但就是不愿意给这个老人晋升,不愿意给加到哪怕是4k。
  • 某上市公司,游戏部门突然从外部空降了一个领导,原因是原大佬被挖走以后,剩下的人升谁都有意见,难以服众,不从外部请人来镇不住局面,这个人一来,大家是团结了,团结起来和这个人斗,但最后还是和解了。
  • 某国际大公司,某人伪造简历,包装的如花似玉,获得高职,工作主要有下属完成,他只需要汇众汇报即可,越混路越宽,直到某天事发,依然是高官。
  • 某IT企业,某清华同学离职时语重心长的对我说,XX(可以理解为网游,搜索,电商任意一种)是00-02年毕业的这些人清华人的机会, 我们就是比某人强十倍也没有机会,也得从下面做起,搜索的天时不属于我,此人去了某金融分析软件公司,目前是高管,同期留在某IT企业的其他同学依然过着 苦逼的生活。

举了这么多例子,我想说得是为什么不给你晋升这个问题,或者晋升很难,为什么?

1)大佬的问题

你晋升困难,最大的主观原因在你自己,最大的客观原因在你的直接上司。付责任人的说,目前很多企业的领导是不合格的,他们大多80后,没有为他人着想的思 想基础,一味的考虑自己,不顾下属,曾经我对某人说,你说你是合格的领导,你说出你下属每个员工租房在哪里,每月多少房租,我就同意你是合格的领导,结果他羞愧不言。你晋升不了,很大程度上是你的领导没有帮你,连你每月房租多少都不知道,你指望他帮助你提高技术水平,帮助你晋升?

2)大佬的大佬的问题

你大佬的大佬,level很高,他需要引入新鲜血液,他知道这个队伍缺什么,这个是他思考的问题,他需要找牛的人来补这个缺口,于是一个光鲜照人的牛人进 来了(虽然两年后也会泯为众人)给队伍带来了新鲜的血液,但你的大佬升不上去,你大佬边上的位置被这个人占了,你的位置在哪?

3)公司的问题

各大企业给员工的再教育和培训都是不尽相同的,但大多口号是一致的,在工作中锻炼成长,这句话是最扯淡的,国外很多大公司是有很完善的培训和再教育计划 的,会给员工一个充电的机会,并且给其一个完善的培训后,以便于让他在新升职的岗位上能够很好的胜任。在国内大公司都在找牛人,就是不愿意自己培养,原因 是什么,不解释,你懂得。

4)你的兄弟

很多时候让你升不了职恰恰是因为和你一起战斗的兄弟,他们工作也很不错,你升职了,他们怎么办?这也是一个平衡的问题,你很努力,为什么你没有带动你的兄 弟一起努力,你上去了,需要你这帮兄弟的支持,他们会支持你吗?曾有一个说了一句话,我觉得很值得回味,“当大家都认为你该升职了,就是你升职的时候了”,细细品味,很有道理。

5)你自己的问题

最后你升不了职是你自己的问题,每天工作很忙,没时间充电,每天工作压力很大,来不及学习,每天这个那个,一年下来碌碌无为。你提高了自己的效率了嘛?你 周围有朋友再帮你吗?你知道你要学什么嘛?你知道什么样的工作才能超出领导的期望?,你超出领导期望后却没有升职和领导沟通过吗?我曾在某企业,我周围的 几乎所有人加薪升职都是和领导沟通后才获得的。指望主动给你加薪升职,不如指望自己的沟通。

6)还是你自己的问题

你选择的这个行业是不是对的,公司是不是对的,就好像我说的这个清华的同学这个例子。如果你能耐大可以选大公司,PK到一票牛人上去,如果你能耐不大,去成熟大公司,还心理期盼高薪升职就不现实了,不如去一个有前途的中小公司,开创自己的事业。

从企业角度出发,如何创建一个合理公平的晋升机制呢?

1)第一流大佬才会招第一流的人,第二流大佬只会招第三流的人,因此公司一把手必须是第一流的,价值观才能靠谱,制度才靠谱,没熟读历史,不理解中国文化的,建议不要做公司一把手。

2)晋升的制度必须公平,面向每一个人,每一个层次,这往往很难做到,做前端的和做后台的不好比,但做前端的可以和做前端的比。必须要有公开公平的比拼,已获得升职机会。例如某公司做一个高维矩阵分解的难题,大家机会均等,性能最快,效果最好,胜出者升职,带领团队。

3)鼓励公司职员交流,传播和帮助他人的文化,一个人如果乐于助人,帮助他人提高技术水平,这个人升职升上来,大家都会顶,反之,你保守,不帮助他人,水平再牛,升职上来也没人支持。

4)可以给职员一些挑战的机会,提供更多的资源,比如某公司的闪电计划,超越了谷歌搜索效果,就是一个很好的例子,要敢于给一些勇于挑战的职员更多的资源,在严酷的战斗中考验,并提供充分弹药。

5)给予内训机会,邀请业界牛人讲座,送职员去美帝考察开会乃至工作等等。培训机会是发达国家企业的一种非常好的激励措施,一个岗位5个人培训,最好的上岗,这是一个很公平的机会,培训机构足够独立。

方法有很多,只要这第一流的大佬,心中有着这帮打生打死的兄弟,办法总是有的,不要总是考虑自己的业绩,考虑自己的乌纱帽,做到这一点很难很难,但制度不是只有这位大佬可以制定,任何职员都应该积极投身到制度建立的过程中,要敢于提出自己的观点,毕竟公司是大家的公司。

我就写这么多,我是一个十年一线程序员的身份写这篇博客的,我努力做到客观,但我相信我更多代表的是劳方立场。

作者/梁斌

买了几本书

这两天买了三本书,作为公司的资料。
head first设计模式,这本书相对是从浅入深,还不错
代码大全2精华本,这本就相对较简单了。。
编程珠玑,虽然做WEB开发看这个书好象有点浪费,但其实不然,还是可以看看的。

其他同事买了点算法、数据结构类的书,到时候也可以抢来看看。
我自己是买了head first的另外两本书,一本是项目管理的,一本是ios开发,感觉好象都是浅显易懂。

最近用脑图用多了一点,画画啥的都方便很多了,看来以后出规划可以直接用脑图出了

nbscala-2.8.x

nbscala-2.8.x

说实话,这个插件等了很久了。自从NB升级到7.0了,原来的scala插件就再也不能用了,即使用了以前的插件,也无法在新版的NB下运行。
直到前一阵子才发现,原来,终于有人更新了这个插件。。
怕多介绍了之后会影响别人的想法,我也不能过分主观的说太多这个插件的优点,就平常的介绍一下下吧。官网地址是:http://plugins.netbeans.org/plugin/36598/nbscala-2-8-x

官方的介绍就一句话:Scala plugin for NetBeans 7.0, works with Scala 2.8.x
附了一张小图片:
88552d87aa2694e2d177afc9ac57319a

想用的人可以开始用了。

郁闷啊,我的PR值

郁闷啊,我的PR值

真TMD纠结,为了这么备案,我现在真是吐血了。
原来的PR5都6、7年了,原来的备案都也6、7年,现在可好,备案突然消失,PR也降了1。
在这个神奇的国度,还有什么不能理解的,想想我也麻木了。

主要还是国外的VPS等不太方便,事实上我的站也几乎都保持着稳定,所以要再等等,如果顺利的话,还是准备迁移了。否则再这么折腾个几次,我是受不了了。

求理解。

扩展yii的验证类

扩展yii的验证类

在项目中遇到文件上传的问题,这时候需要用到CFileValidator,但是官方的验证中少了一点点的处理,比如,对于图片,我只想上传尺寸正好是300x500的图片。怎么办?
所以我做了一点小小的扩展,于是我在rules里面加了这么两条:

array('picname', 'application.validators.Myfile', 'on'=>'insert','types'=>'jpg,png','wrongType'=>'只允许上传jpg或者PNG','maxSize' => 1024*300,'tooLarge' => '图片最大只支持300K','imageSize'=>'768x1024','wrongImageSize'=>'对不起,图片尺寸只支持768*1024'),
array('picname', 'application.validators.Myfile', 'on'=>'update','types'=>'jpg,png','wrongType'=>'只允许上传jpg或者PNG','maxSize' => 1024*300,'tooLarge' => '图片最大只支持300K','imageSize'=>'768x1024','wrongImageSize'=>'对不起,图片尺寸只支持768*1024','allowEmpty'=>true,),

数组的第二个字段就是一个全路径,告诉rules,对于picname用的是application.validators.Myfile类。这个类其实很简单,只是简单的扩展了官方的CFileValidator类,大致如下:

class Myfile extends CFileValidator{
public $imageSize;
public $wrongImageSize;

/**
* @param CModel $object the object being validated
* @param string $attribute the attribute being validated
* @param CUploadedFile $file uploaded file passed to check against a set of rules
* @return void
*/
protected function validateFile($object, $attribute, $file){
parent::validateFile($object,$attribute,$file);
if($this->imageSize!=''&&strpos($this->imageSize,"x")!==false){
list($width,$height) = @getimagesize($file->getTempName());
$imageSize = sprintf("%sx%s",$width,$height);
if($imageSize != $this->imageSize){
$message=$this->wrongImageSize!==null?$this->wrongImageSize : Yii::t('yii','The file "{file}" cannot be uploaded. Only files with these size are allowed: {imagesize}.');
$this->addError($object,$attribute,$message,array('{file}'=>$file->getName(), '{extensions}'=>$this->imageSize));
}
}
}
}

我这种只是简单的判断是否与指定尺寸相符,如果需要检测小于指定范围的图片,那就需要多一点的判断了,也不会太难啦。主要是一个思路(感谢烂桔提供思路)

xml2array 和 array2xml

xml2array 和 array2xml

这是一个简单的方法,其实是两种方法的其中一种:xml2array 和 array2xml 中的一种啦。
但因为array2xml的时候,没有办法做到更好的把attributes做到更好,因此,就折腾了一些简单的处理方法:
array2xml是hightman的方法的简版。我自己改了一些:

function array2xml($var, $type = 'root', $tag = '') {
$ret = '';
if (!is_int($type)) {
if ($tag)
return array2xml(array($tag => $var), 0, $type); else {
$tag .= $type;
$type = 0;
}
}
$level = $type;
$indent = str_repeat("\t", $level);
if (!is_array($var)) {
$ret .= $indent . '<' . $tag;
$var = strval($var);
if ($var == '') {
$ret .= ' />';
} else if (!preg_match('/[^0-9a-zA-Z@\._:\/-]/', $var)) {
$ret .= '>' . $var . '</' . $tag . '>';
} else {
$ret .= "><![CDATA[{$var}]]></{$tag}>";
}
// if (strpos($var, "\n") === false){
// $ret .= '><![CDATA[' . $var . ']]></' . $tag . '>';
// } else
$ret .= "\n";
} else if (!(is_array($var) && count($var) && (array_keys($var) !== range(0, sizeof($var) - 1))) && !emptyempty($var)) {
foreach ($var as $tmp)
$ret .= array2xml($tmp, $level, $tag);
} else {
$ret .= $indent . '<' . $tag;
if ($level == 0)
$ret .= '';
if (isset($var['@attributes'])) {
foreach ($var['@attributes'] as $k => $v) {
if (!is_array($v)) {
$ret .= sprintf(' %s="%s"', $k, $v);
}
}
unset($var['@attributes']);
}
$ret .= ">\n";
foreach ($var as $key => $val) {
$ret .= array2xml($val, $level + 1, $key);
}
$ret .= "{$indent}</{$tag}>\n";
}
return $ret;

在其中强加了attributes。比较恶心的方法啦。。
然后xml2array,其实以前写过,但写的不太好,所以我这次抄的是ibm的网站上的xml2json中的代码:

define ("DEBUG", false);
// Maximum Recursion Depth that we can allow.
define ("MAX_RECURSION_DEPTH_ALLOWED", 25);
// An empty string
define ("EMPTY_STR", "");
// SimpleXMLElement object property name for attributes
define ("SIMPLE_XML_ELEMENT_OBJECT_PROPERTY_FOR_ATTRIBUTES", "@attributes");
// SimpleXMLElement object name.
define ("SIMPLE_XML_ELEMENT_PHP_CLASS", "SimpleXMLElement");
/**
* @static
* @param $simpleXmlElementObject
* @param int $recursionDepth
* @return array|null|string
*/
public static function xml2array($simpleXmlElementObject, $getAttributes = false , &$recursionDepth = 0 ) {
// Keep an eye on how deeply we are involved in recursion.
if ($recursionDepth > MAX_RECURSION_DEPTH_ALLOWED) {
// Fatal error. Exit now.
return (null);
}
if ($recursionDepth == 0) {
if (get_class($simpleXmlElementObject) != SIMPLE_XML_ELEMENT_PHP_CLASS) {
// If the external caller doesn't call this function initially
// with a SimpleXMLElement object, return now.
return (null);
} else {
// Store the original SimpleXmlElementObject sent by the caller.
// We will need it at the very end when we return from here for good.
$callerProvidedSimpleXmlElementObject = $simpleXmlElementObject;
}
} // End of if ($recursionDepth == 0) {
if (get_class($simpleXmlElementObject) == SIMPLE_XML_ELEMENT_PHP_CLASS) {
// Get a copy of the simpleXmlElementObject
$copyOfsimpleXmlElementObject = $simpleXmlElementObject;
// Get the object variables in the SimpleXmlElement object for us to iterate.
$simpleXmlElementObject = get_object_vars($simpleXmlElementObject);
}
// It needs to be an array of object variables.
if (is_array($simpleXmlElementObject)) {
// Initialize the result array.
$resultArray = array();
// Is the input array size 0? Then, we reached the rare CDATA text if any.
if (count($simpleXmlElementObject) <= 0) {
// Let us return the lonely CDATA. It could even be
// an empty element or just filled with whitespaces.
return (trim(strval($copyOfsimpleXmlElementObject)));
}
// Let us walk through the child elements now.
foreach ($simpleXmlElementObject as $key => $value) {
// When this block of code is commented, XML attributes will be
// added to the result array.
// Uncomment the following block of code if XML attributes are
// NOT required to be returned as part of the result array.
/*
if((is_string($key)) && ($key == SIMPLE_XML_ELEMENT_OBJECT_PROPERTY_FOR_ATTRIBUTES)) {
continue;
}
*/
// Let us recursively process the current element we just visited.
// Increase the recursion depth by one.
$recursionDepth++;
if($key == '@attributes' && $getAttributes == true){
foreach(self::xml2array($value,$getAttributes, $recursionDepth) as $k=>$v){
$resultArray[$k]=$v;
}
}else{
$resultArray[$key] = self::xml2array($value,$getAttributes, $recursionDepth);
}
// Decrease the recursion depth by one.
$recursionDepth--;
} // End of foreach($simpleXmlElementObject as $key=>$value) {
if ($recursionDepth == 0) {
// That is it. We are heading to the exit now.
// Set the XML root element name as the root [top-level] key of
// the associative array that we are going to return to the caller of this
// recursive function.
$tempArray = $resultArray;
$resultArray = array();
$resultArray[$callerProvidedSimpleXmlElementObject->getName()] = $tempArray;
}
return ($resultArray);
} else {
// We are now looking at either the XML attribute text or
// the text between the XML tags.
return (trim(strval($simpleXmlElementObject)));
} // End of else
}

改过其中的几行代码,否则会报错,改了哪几行我忘了。。官网地址是:http://www.ibm.com/developerworks/xml/library/x-xml2jsonphp/

这里还有一个:http://www.zenme.org/?action=show&id=270,可以参考一下

ec2 micro型 上国外网站

amazon的VPS是大家都知道的。其实micro是最近11爷告诉我的。说是有信用卡的话,可以免费用micro一年(关于这一块我不多介绍了,网上多的是教程)
申请了一个micro之后,听人介绍说,用它来做网站会很耗资源,于是想到的就是,可以用来做ssh tunnel,用来翻翻墙啦。
果然,我用xshell在菜单的tunneling中选择了dynmac后,自动把商品设为1080,然后就能翻墙了。
开始上上facebook了。但其实我很纠结的是,我几乎没有好友在上面,推特我的兴趣也不大,可能只是用来看看一些平时看不到的技术性文章吧。

如果你有信用卡,你也可以尝试使用一年免费的ssh上网哦。

笔记1

笔记1

这段时间在和IOS开发的同事们互相配合,本来是有笔记都会记录下来的。然而那段时间网站备案出点问题。然后就没有记录下来。于是现在开始就要把当时遇到的一些问题开始记录了。
比如这个。原本程序写的时候没有考虑推送,但是在进行了一阵后,发现还是需要推送才行,但当时创建的版本是是类似xxx.xxx.*,如果用推送的话就不能xxx.xxx.*,而是要用具体的版本(因为不是我写的啦,所以说不太清楚),后来找到了官方的介绍:
http://developer.apple.com/library/ios/#qa/qa1680/_index.html

可以从这里看:

Updating from a wildcard App ID to an explicit App ID

Q: My application is currently signed with a Provisioning Profile that uses a wildcard App ID. How do I enable my App ID to support In App Purchase or Apple Push Notification service?

A: My application is currently signed with a Provisioning Profile that uses a wildcard App ID. How do I enable my App ID to support In App Purchase or Apple Push Notification service?

In App Purchase and Apple Push Notification service require that your application is signed with a Provisioning Profile, which uses an explicit App ID such as com.mycompany.myappname. So, if you have shipped an application signed with a Provisioning Profile that uses a wildcard App ID such as com.mycompany.*, you may wonder how to enable that App ID to handle these features. The answer is to keep your project's Bundle ID the same and create a new App ID in the iPhone Portal that matches the Bundle ID you are currently using in your project. Follow the steps below to enable an App ID that supports In App Purchase or Apple Push Notification service:

  1. Identify your application's current Bundle ID

    You can find your Bundle ID by looking in your project's Info.plist file, however it is best to check what iTunes Connect says it is. Log in to iTunes Connect, navigate to the Manage Your Applications module present in the home page, then select the App Details link for the application you are updating, and copy the bundle identifier displayed in the ensuing page.

  2. Create a new App ID

    Your Team Agent or Team Admin should log in to the iPhone Portal and navigate to its App ID section to create a new App ID. In the App ID section, click on the New App ID button to navigate to the Create App ID form, which contains a Description field, a Bundle Identifier field, a Bundle Seed ID pop-up menu, and a Submit button as shown in Figure 1. Fill out the Description field with a meaningful name such as Explicit App ID for MyAppName for your App ID, select Generate New from the Bundle Seed ID pop-up menu, and paste the previously copied bundle identifier into the Bundle Identifier field. Click Submit to save the new App ID.

Figure 1 Create App ID form

992445fddaede615cdf653b588a8d04e

  1. Enable the newly created App ID for In App Purchase or Apple Push Notification service

    Find your App ID in the App ID section of the Program Portal, click the Configure link next to it, and follow the instructions to enable your App ID for either In App Purchase or Apple Push Notification service.

  2. Update or create, download, and install a Provisioning Profile that uses your App ID enabled for In App Purchase or Apple Push Notifications

    Edit an existing Provisioning Profile or create a new one, and then associate it with your newly created App ID. Download and install this Provisioning Profile on your machine and select it in the Code Signing Identity section of your Target's Build pane in Xcode. Update the version number of your binary, build it, test it, and upload it to iTunes Connect for review.

看最后的两点就知道怎么操作了啦。。这些资料还是需要找英文的,MD,中文里就找不到类似的资料 。。。真TMD狗屎

终于通了。NND

终于通了。NND

历经多时,终于又通了。
6年的备案啊。。哭泣中

顺便,首页的模版被我误删除了。靠。