博客园 - Allen Leeuuid:6cbd1ba2-f883-4c34-aed1-30dde64a3a3e;id=6855512020-01-04T02:36:24ZAllen Leehttps://www.cnblogs.com/allenlooplee/feed.cnblogs.comhttps://www.cnblogs.com/allenlooplee/p/9222173.html用R处理一组数据的三种方式 - Allen LeeUSArrests是R附带的一个数据集,现在我们需要创建一个factor向量urbancat,如果UrbanPop列的某个值在中位数之上,就把urbancat对应位置的值设为1,否则设为0。 这种数据处理任务实在太简单了,一个for循环就能搞定。首先,我们计算一下UrbanPop的中位数: 然后,用2018-06-24T15:25:00Z2018-06-24T15:25:00ZAllen Leehttps://www.cnblogs.com/allenlooplee/【摘要】USArrests是R附带的一个数据集,现在我们需要创建一个factor向量urbancat,如果UrbanPop列的某个值在中位数之上,就把urbancat对应位置的值设为1,否则设为0。 这种数据处理任务实在太简单了,一个for循环就能搞定。首先,我们计算一下UrbanPop的中位数: 然后,用 <a href="https://www.cnblogs.com/allenlooplee/p/9222173.html" target="_blank">阅读全文</a>https://www.cnblogs.com/allenlooplee/archive/2013/01/17/2863866.html遇见C++ AMP:GPU的线程模型和内存模型 - Allen Lee本文讲述了GPU如何组织和执行GPU线程、不同类型的内存有哪些特点和如何使用可编程缓存,并通过具体例子讲解如何利用这些知识进一步提高C++ AMP代码的性能。2013-01-17T01:58:00Z2013-01-17T01:58:00ZAllen Leehttps://www.cnblogs.com/allenlooplee/【摘要】本文讲述了GPU如何组织和执行GPU线程、不同类型的内存有哪些特点和如何使用可编程缓存,并通过具体例子讲解如何利用这些知识进一步提高C++ AMP代码的性能。 <a href="https://www.cnblogs.com/allenlooplee/archive/2013/01/17/2863866.html" target="_blank">阅读全文</a>https://www.cnblogs.com/allenlooplee/archive/2012/08/15/2640644.html遇见C++ AMP:在GPU上做并行计算 - Allen Lee本文介绍如何使用Visual C++ 2012新增的C++ AMP实现GPU并行计算,并通过代码示例讲解C++ AMP的基本用法和步骤,以及相关的类和函数的工作原理。2012-08-15T10:43:00Z2012-08-15T10:43:00ZAllen Leehttps://www.cnblogs.com/allenlooplee/【摘要】本文介绍如何使用Visual C++ 2012新增的C++ AMP实现GPU并行计算,并通过代码示例讲解C++ AMP的基本用法和步骤,以及相关的类和函数的工作原理。 <a href="https://www.cnblogs.com/allenlooplee/archive/2012/08/15/2640644.html" target="_blank">阅读全文</a>https://www.cnblogs.com/allenlooplee/archive/2012/07/25/2608820.html遇见C++ PPL:C++ 的并行和异步 - Allen Lee本文通过代码示例介绍如何使用PPL提供的函数实现并行操作和MapReduce操作,以及借助combinable对象避免Reduce过程中不必要的同步,并示范如何通过新的task对象实现异步操作。2012-07-25T10:53:00Z2012-07-25T10:53:00ZAllen Leehttps://www.cnblogs.com/allenlooplee/【摘要】本文通过代码示例介绍如何使用PPL提供的函数实现并行操作和MapReduce操作,以及借助combinable对象避免Reduce过程中不必要的同步,并示范如何通过新的task对象实现异步操作。 <a href="https://www.cnblogs.com/allenlooplee/archive/2012/07/25/2608820.html" target="_blank">阅读全文</a>https://www.cnblogs.com/allenlooplee/archive/2012/07/03/2574119.html遇见C++ Lambda - Allen Lee遇见C++ Lambda Written by Allen Lee If you die when there's no one watching, and your ratings drop and you're forgotten. – Marilyn Manson, Lamb Of God 生成随机数字 假设我们有一个vector<int>容器,想用100以内的随机数初始化它,其中一个办法是通过generate函数生成,如代码1所示。generate函数接受三个参数,前两个参数指定容器的起止位置,后一个参数指定生成逻辑,这个逻辑正是通过Lambda来表达的。代2012-07-03T00:50:00Z2012-07-03T00:50:00ZAllen Leehttps://www.cnblogs.com/allenlooplee/【摘要】遇见C++ Lambda Written by Allen Lee If you die when there's no one watching, and your ratings drop and you're forgotten. – Marilyn Manson, Lamb Of God 生成随机数字 假设我们有一个vector<int>容器,想用100以内的随机数初始化它,其中一个办法是通过generate函数生成,如代码1所示。generate函数接受三个参数,前两个参数指定容器的起止位置,后一个参数指定生成逻辑,这个逻辑正是通过Lambda来表达的。代 <a href="https://www.cnblogs.com/allenlooplee/archive/2012/07/03/2574119.html" target="_blank">阅读全文</a>https://www.cnblogs.com/allenlooplee/archive/2011/12/10/2283356.htmlWP7有约(八):在ListPicker控件的选择页面上播放铃声 - Allen LeeWP7有约(八):在ListPicker控件的选择页面上播放铃声 Written by Allen Lee 上节课我们在ListPicker控件的选择页面上实现了播放图标的效果,随后sjcxyf同学又发现了新的问题:我在项目里面添加了一个MP3文件,然后我在页面加了一个MediaElement控件,我在Image_Tap事件里面添加了播放音乐的代码,但是表现出来的结果是当选择页面弹出来之后点击播放图标不能播放音乐,我试图尝试在选择模板里面加入MediaElement控件来实现,但是最后结果还是一样。 在Silverlight for Windows Phone里,MediaElemen...2011-12-10T08:00:00Z2011-12-10T08:00:00ZAllen Leehttps://www.cnblogs.com/allenlooplee/【摘要】WP7有约(八):在ListPicker控件的选择页面上播放铃声 Written by Allen Lee 上节课我们在ListPicker控件的选择页面上实现了播放图标的效果,随后sjcxyf同学又发现了新的问题:我在项目里面添加了一个MP3文件,然后我在页面加了一个MediaElement控件,我在Image_Tap事件里面添加了播放音乐的代码,但是表现出来的结果是当选择页面弹出来之后点击播放图标不能播放音乐,我试图尝试在选择模板里面加入MediaElement控件来实现,但是最后结果还是一样。 在Silverlight for Windows Phone里,MediaElemen... <a href="https://www.cnblogs.com/allenlooplee/archive/2011/12/10/2283356.html" target="_blank">阅读全文</a>https://www.cnblogs.com/allenlooplee/archive/2011/12/07/2280008.htmlWP7有约(七):实现铃声设置的播放图标的效果 - Allen LeeWP7有约(七):实现铃声设置的播放图标的效果 Written by Allen Lee sjcxyf同学通过站内消息提到这样一个问题:我现在想做一个功能就是当ListPicker弹出全屏幕的时候每一项前面是一个播放图片,后面是音乐名称,然后我点击前面的播放的时候播放当前的音乐,不让他选择这一项的值并返回 要选择后面的字之后才返回 就是像Phone 7真机里面设置铃声那种效果怎么做? 我们来看一个山寨版的铃声设置,如图1所示,无论用户单击铃声名字还是它左边那个播放图标,都会关闭ListPicker页面。sjcxyf同学想要的效果是单击播放图标将会播放对应的铃声,而单击铃声名字才是确认选...2011-12-07T15:10:00Z2011-12-07T15:10:00ZAllen Leehttps://www.cnblogs.com/allenlooplee/【摘要】WP7有约(七):实现铃声设置的播放图标的效果 Written by Allen Lee sjcxyf同学通过站内消息提到这样一个问题:我现在想做一个功能就是当ListPicker弹出全屏幕的时候每一项前面是一个播放图片,后面是音乐名称,然后我点击前面的播放的时候播放当前的音乐,不让他选择这一项的值并返回 要选择后面的字之后才返回 就是像Phone 7真机里面设置铃声那种效果怎么做? 我们来看一个山寨版的铃声设置,如图1所示,无论用户单击铃声名字还是它左边那个播放图标,都会关闭ListPicker页面。sjcxyf同学想要的效果是单击播放图标将会播放对应的铃声,而单击铃声名字才是确认选... <a href="https://www.cnblogs.com/allenlooplee/archive/2011/12/07/2280008.html" target="_blank">阅读全文</a>https://www.cnblogs.com/allenlooplee/archive/2011/11/28/2265729.htmlWP7有约(六):AppBarUtils使用指南 - Allen LeeAppBarUtils提供了一组Expression Blend行为,可以实现Application Bar上的按钮和菜单项的绑定,在这篇文章里,我们将会具体看看如何使用这个工具包实现相关的功能。2011-11-28T00:41:00Z2011-11-28T00:41:00ZAllen Leehttps://www.cnblogs.com/allenlooplee/【摘要】AppBarUtils提供了一组Expression Blend行为,可以实现Application Bar上的按钮和菜单项的绑定,在这篇文章里,我们将会具体看看如何使用这个工具包实现相关的功能。 <a href="https://www.cnblogs.com/allenlooplee/archive/2011/11/28/2265729.html" target="_blank">阅读全文</a>https://www.cnblogs.com/allenlooplee/archive/2011/05/27/2059582.htmlWP7有约:一个应用的破蛋过程 - Allen Lee2011年年度独家巨献,超过半年的写作成果,将近300页的中文教程,全程记录一个WP7应用的开发过程,全新排版,图文并茂,免费下载,不容错失!2011-05-27T02:22:00Z2011-05-27T02:22:00ZAllen Leehttps://www.cnblogs.com/allenlooplee/【摘要】2011年年度独家巨献,超过半年的写作成果,将近300页的中文教程,全程记录一个WP7应用的开发过程,全新排版,图文并茂,免费下载,不容错失! <a href="https://www.cnblogs.com/allenlooplee/archive/2011/05/27/2059582.html" target="_blank">阅读全文</a>https://www.cnblogs.com/allenlooplee/archive/2011/05/09/2040785.htmlWP7有约(五):回到主页 - Allen LeeWP7有约(五):回到主页Written by Allen LeeIn this farewell, there is no blood, there is no alibi, cause I've drawn regret from the truth of a thousand lies.– Linkin Park, What I've done最重要的问题 还记得当初我们开发这个应用的目的吗...2011-05-09T00:18:00Z2011-05-09T00:18:00ZAllen Leehttps://www.cnblogs.com/allenlooplee/【摘要】WP7有约(五):回到主页Written by Allen LeeIn this farewell, there is no blood, there is no alibi, cause I've drawn regret from the truth of a thousand lies.– Linkin Park, What I've done最重要的问题 还记得当初我们开发这个应用的目的吗... <a href="https://www.cnblogs.com/allenlooplee/archive/2011/05/09/2040785.html" target="_blank">阅读全文</a>https://www.cnblogs.com/allenlooplee/archive/2011/03/24/1993368.htmlWP7有约(四):课程全景 - Allen LeeWP7有约(四):课程全景Written by Allen LeeDo I trust some and get fooled by phoniness, or do I trust nobody and live in loneliness?– Linkin Park, By Myself化零为整 前面三节课我们分别实现了课程表、作业本和笔记本三个主要功能,然而,它们的内容分散在三个不同的页面...2011-03-24T00:15:00Z2011-03-24T00:15:00ZAllen Leehttps://www.cnblogs.com/allenlooplee/【摘要】WP7有约(四):课程全景Written by Allen LeeDo I trust some and get fooled by phoniness, or do I trust nobody and live in loneliness?– Linkin Park, By Myself化零为整 前面三节课我们分别实现了课程表、作业本和笔记本三个主要功能,然而,它们的内容分散在三个不同的页面... <a href="https://www.cnblogs.com/allenlooplee/archive/2011/03/24/1993368.html" target="_blank">阅读全文</a>https://www.cnblogs.com/allenlooplee/archive/2011/01/11/1933165.htmlWP7有约(三):课堂重点 - Allen LeeWP7有约(三):课堂重点Written by Allen LeeCrawling in my skin, these wounds they will not heal. Fear is how I fall, confusing what is real.– Linkin Park, Crawling记笔记 俗话说:好记性不如烂笔头。当然,这并不是说我们的脑子不好使,也不是叫我们不要用脑子记...2011-01-11T11:32:00Z2011-01-11T11:32:00ZAllen Leehttps://www.cnblogs.com/allenlooplee/【摘要】WP7有约(三):课堂重点Written by Allen LeeCrawling in my skin, these wounds they will not heal. Fear is how I fall, confusing what is real.– Linkin Park, Crawling记笔记 俗话说:好记性不如烂笔头。当然,这并不是说我们的脑子不好使,也不是叫我们不要用脑子记... <a href="https://www.cnblogs.com/allenlooplee/archive/2011/01/11/1933165.html" target="_blank">阅读全文</a>https://www.cnblogs.com/allenlooplee/archive/2010/12/14/1905184.htmlWP7有约(二):课后作业 - Allen LeeWP7有约(二):课后作业Written by Allen LeeI'm tired of being what you want me to be, feeling so faithless, lost under the surface.– Linkin Park, Numb作业本 上节课布置的作业有做吗?没人吭声啊,看来大家都忘了哦,没事,我们这次弄个作业本出来,大家就有地方记作业了。...2010-12-14T00:19:00Z2010-12-14T00:19:00ZAllen Leehttps://www.cnblogs.com/allenlooplee/【摘要】WP7有约(二):课后作业Written by Allen LeeI'm tired of being what you want me to be, feeling so faithless, lost under the surface.– Linkin Park, Numb作业本 上节课布置的作业有做吗?没人吭声啊,看来大家都忘了哦,没事,我们这次弄个作业本出来,大家就有地方记作业了。... <a href="https://www.cnblogs.com/allenlooplee/archive/2010/12/14/1905184.html" target="_blank">阅读全文</a>https://www.cnblogs.com/allenlooplee/archive/2010/11/17/1879489.htmlWP7有约(一):课程安排 - Allen LeeWP7有约(一):课程安排Written by Allen LeeAll I want to do is trade this life for something new holding on to what I haven't got.– Linkin Park, Waiting For The End你好,老七! WP7终于发布了,到目前为止,有关它的新闻和介绍我相信你已经看过不少了,所以...2010-11-17T00:22:00Z2010-11-17T00:22:00ZAllen Leehttps://www.cnblogs.com/allenlooplee/【摘要】WP7有约(一):课程安排Written by Allen LeeAll I want to do is trade this life for something new holding on to what I haven't got.– Linkin Park, Waiting For The End你好,老七! WP7终于发布了,到目前为止,有关它的新闻和介绍我相信你已经看过不少了,所以... <a href="https://www.cnblogs.com/allenlooplee/archive/2010/11/17/1879489.html" target="_blank">阅读全文</a>https://www.cnblogs.com/allenlooplee/archive/2010/01/27/1657164.htmlRuby 101:行为驱动 - Allen LeeRuby 101:行为驱动 Written by Allen Lee 写下你的期望 在上一篇文章里,我们创建了一个简易的插件系统,还为它写了一个YAML导出器,这次,我们将会尝试写个SQLite导出器,并探讨开发过程中的遇到的问题。 首先,我们的插件系统会自动装载插件,这意味着,当应用程序启动好后,插件就应该准备就绪了,这既是我们期望的效果,也是将来测试的时候需要覆盖到的内容,其重要性犹如航标...2010-01-27T00:25:00Z2010-01-27T00:25:00ZAllen Leehttps://www.cnblogs.com/allenlooplee/【摘要】Ruby 101:行为驱动 Written by Allen Lee 写下你的期望 在上一篇文章里,我们创建了一个简易的插件系统,还为它写了一个YAML导出器,这次,我们将会尝试写个SQLite导出器,并探讨开发过程中的遇到的问题。 首先,我们的插件系统会自动装载插件,这意味着,当应用程序启动好后,插件就应该准备就绪了,这既是我们期望的效果,也是将来测试的时候需要覆盖到的内容,其重要性犹如航标... <a href="https://www.cnblogs.com/allenlooplee/archive/2010/01/27/1657164.html" target="_blank">阅读全文</a>https://www.cnblogs.com/allenlooplee/archive/2009/12/14/1623384.htmlRuby 101:动态编程 - Allen LeeRuby 101:动态编程 Written by Allen Lee 当method_missing的魔法失效时…… 在上一篇文章里,我们通过重写Hash类的method_missing方法把Hash对象模拟成匿名对象,但是,这种做法有时会产生一些莫名其妙的问题,举个例子吧,假如我把process方法(完整实现参见上一篇文章的代码31)的options参数从这样: 代码...2009-12-14T00:26:00Z2009-12-14T00:26:00ZAllen Leehttps://www.cnblogs.com/allenlooplee/【摘要】Ruby 101:动态编程 Written by Allen Lee 当method_missing的魔法失效时…… 在上一篇文章里,我们通过重写Hash类的method_missing方法把Hash对象模拟成匿名对象,但是,这种做法有时会产生一些莫名其妙的问题,举个例子吧,假如我把process方法(完整实现参见上一篇文章的代码31)的options参数从这样: 代码... <a href="https://www.cnblogs.com/allenlooplee/archive/2009/12/14/1623384.html" target="_blank">阅读全文</a>https://www.cnblogs.com/allenlooplee/archive/2009/11/30/1613429.htmlRuby 101:方法对象 - Allen LeeRuby 101:方法对象 Written by Allen Lee 从方法调用说起 在上一篇文章里,我们看到调用对象的方法实质上是向对象发送消息,下面,我们再来看一个有趣的应用。在Ruby里,字典可以通过 {key => value} 来创建,如果你使用的版本是1.9或以上,当key的类型是Symbol时,创建字典的语法可以进一步简化为 {key: value} (注意,冒号要紧贴在ke...2009-11-30T00:19:00Z2009-11-30T00:19:00ZAllen Leehttps://www.cnblogs.com/allenlooplee/【摘要】Ruby 101:方法对象 Written by Allen Lee 从方法调用说起 在上一篇文章里,我们看到调用对象的方法实质上是向对象发送消息,下面,我们再来看一个有趣的应用。在Ruby里,字典可以通过 {key => value} 来创建,如果你使用的版本是1.9或以上,当key的类型是Symbol时,创建字典的语法可以进一步简化为 {key: value} (注意,冒号要紧贴在ke... <a href="https://www.cnblogs.com/allenlooplee/archive/2009/11/30/1613429.html" target="_blank">阅读全文</a>https://www.cnblogs.com/allenlooplee/archive/2009/11/03/1595461.htmlRuby 101:对象和方法 - Allen LeeRuby 101:对象和方法 Written by Allen Lee 从静态方法说起 在上一篇文章末尾,我们提到了受保护的静态方法……受保护的静态方法??Ruby的protected不是用来向相同类型的不同实例开放受限方法的访问的吗(忘记protected的用法了?不要紧,回去上一篇文章复习一下吧。),如果把它用于静态方法,那么我该向参数传入什么? 在回答这些问题之前...2009-11-03T12:01:00Z2009-11-03T12:01:00ZAllen Leehttps://www.cnblogs.com/allenlooplee/【摘要】Ruby 101:对象和方法 Written by Allen Lee 从静态方法说起 在上一篇文章末尾,我们提到了受保护的静态方法……受保护的静态方法??Ruby的protected不是用来向相同类型的不同实例开放受限方法的访问的吗(忘记protected的用法了?不要紧,回去上一篇文章复习一下吧。),如果把它用于静态方法,那么我该向参数传入什么? 在回答这些问题之前... <a href="https://www.cnblogs.com/allenlooplee/archive/2009/11/03/1595461.html" target="_blank">阅读全文</a>https://www.cnblogs.com/allenlooplee/archive/2009/10/15/1583616.htmlRuby 101:重用、隐藏和多态 - Allen LeeRuby 101:重用、隐藏和多态 Written by Allen Lee 什么?你不想安装Ruby? 在我决定把Ruby装到我的机子里之前,我想先试一下;在我试用Ruby之前,我得先把它装到我的机子里;在我决定……哎哟,死锁了…… 没问题,今天我带上"钥匙"了!现在,请用你喜欢的浏览器打开这个网址:http://tryruby.sophrin...2009-10-15T00:13:00Z2009-10-15T00:13:00ZAllen Leehttps://www.cnblogs.com/allenlooplee/【摘要】Ruby 101:重用、隐藏和多态 Written by Allen Lee 什么?你不想安装Ruby? 在我决定把Ruby装到我的机子里之前,我想先试一下;在我试用Ruby之前,我得先把它装到我的机子里;在我决定……哎哟,死锁了…… 没问题,今天我带上"钥匙"了!现在,请用你喜欢的浏览器打开这个网址:http://tryruby.sophrin... <a href="https://www.cnblogs.com/allenlooplee/archive/2009/10/15/1583616.html" target="_blank">阅读全文</a>https://www.cnblogs.com/allenlooplee/archive/2009/09/25/1573725.htmlRuby 101:类和对象 - Allen LeeRuby 101:类和对象 Written by Allen Lee 今天开始Ruby ~ 虽然仅仅阅读文章也能了解Ruby的语法,但这样就会少很多乐趣,如果你有兴趣学习Ruby,我建议你还是动手试试,与纯粹阅读相比,亲身体验将会有另一番不同的感受。 工欲善其事,必先利其器,想要体验Ruby,就得花点时间配置它的运行环境了。目前可以选择的有Ruby、IronRuby和JRuby,你可以根据自己的...2009-09-25T00:26:00Z2009-09-25T00:26:00ZAllen Leehttps://www.cnblogs.com/allenlooplee/【摘要】Ruby 101:类和对象 Written by Allen Lee 今天开始Ruby ~ 虽然仅仅阅读文章也能了解Ruby的语法,但这样就会少很多乐趣,如果你有兴趣学习Ruby,我建议你还是动手试试,与纯粹阅读相比,亲身体验将会有另一番不同的感受。 工欲善其事,必先利其器,想要体验Ruby,就得花点时间配置它的运行环境了。目前可以选择的有Ruby、IronRuby和JRuby,你可以根据自己的... <a href="https://www.cnblogs.com/allenlooplee/archive/2009/09/25/1573725.html" target="_blank">阅读全文</a>