id
int64 | text
string | metadata
dict | line_start_n_end_idx
dict | quality_signals
dict | eai_taxonomy
dict | pid
string |
|---|---|---|---|---|---|---|
6,640,150,300,883,798,000
|
更多
Discuz论坛SEO方案 晴
郝聪 , 2007/07/17 16:44 , 搜索引擎优化(SEO) , 锁定(0) , 阅读(40052) , Via 本站原创 | |
假设discuz已启用伪静态功能,使用5.0/5.5 GBK 版本;
1、meta,content 优化
2、内容页的网页复制问题
3、robots.txt使用及其它
更新
discuz5.5的robots.txt问题
DZ 禁止一个版面帖子的收录的补充
一、meta的优化
discuz的后台可以对meta信息进行设置,甚至可以添加自己的头部信息,但它的设置都是针对于所有页面的,全部页面都拥有相同的keywords和description是SEO所不赞成的。
方案一:删除meta
修改页头模板文件 templates/default/header.htm:将meta的keywords和description标签删除。
这两个标签作用很小了,而且还有discuz自带的一些无用信息,用得不好反而会有坏作用,因此宁缺勿滥。
方案二:定制meta
本部分实现了将内容页keywords设为帖子标题,description为内容前100字;也实现了主页与各版列表页meta的单独设置(不同版的不同,同一版各列表页相同)。
1.修改页头模板文件 templates\default\header.htm:将meta的keywords和description标签改为如下形式
<meta name="keywords" content="{$metakeywords}$seokeywords" />
<meta name="description" content="$seodescription" />
这里的$seokeywords、$seodescription就是后台设置的那个值,下面说怎么定制这个值;{$metakeywords}是奇虎的关键字,留下以后处理
2.内容页(viewthread)设置keywords为帖子标题,description为内容前100字
2.1修改 viewthread.php 文件:
在 include template('viewthread'); (更新:dz5.5为iinclude template($iscircle ? 'supesite_viewthread' : 'viewthread'); ) 语句的上面加入一行:
require_once DISCUZ_ROOT.'./include/bmt.thread.inc.php';
2.2创建 include/bmt.thread.inc.php 文件,内容为
<?php
if(!defined('IN_DISCUZ')) { exit('Access Denied'); }
$seokeywords = strip_tags($thread['subject']); //关键字设为帖子的标题
//(已更新: nethome 提出问题,当启用主题分类并允许按类别浏览时,原来代码会有问题。所以加了标签过滤,本来在viewthread.php中改更好,为以后升级方便,还是放在这里吧,subject很短,不会影响效率)
$seodescription = current( $postlist );//description取文章内容的前100字
$seodescription = mb_substr( $seodescription['message'],0,100,"gb2312" );
$seodescription = htmlspecialchars( strip_tags($seodescription) );
?>
*此处数字和个别函数适用于GBK版本
最后一行作用是过滤内容中的html,否则在meta中会引起语法错误。先是去除HTML标签,但因为这里是前100字,有可能html标签已经被截断了,所以又用了htmlspecialchars转义一下,有可能会有些垃圾信息。
当然也可以在截取之前用strip_tags去除html标签,可能效率会差了。
*所以此处表达式您需要根据自己的情况修改。
我目前用的是preg_replace( '/[^\xa1-\xff]/', '', $seodescription ),即过滤汉字以外的所在内容,但这样会损失英文关键字。
别外说明,此处数据都是viewthread.php已取好的,所以不会产生额外的数据库操作,只是做了字符串处理,不会引响效率。
3.列表页(forumdisplay)设置不同的keywords和description
3.1修改 forumdisplay.php
文件,在 include template('forumdisplay'); 语句上面添加
require_once DISCUZ_ROOT.'./include/bmt.forum.inc.php';
3.2创建 include/bmt.forum.inc.php 文件,内容为
<?php
if(!defined('IN_DISCUZ')) { exit('Access Denied'); }
$seokeywords = $forum['name'];
$seodescription = $forum['description'];
switch ( $forum['fid'] ){
case 1: //此数字为版的ID号,不同版设置不同的meta
$seokeywords = 'key1,key2,...';
$seodescription = 'xxxx xxxx xxxx';
break;
case 2:
$seokeywords = 'key1,key2,...';
$seodescription = 'xxxx xxxx xxxx';
break;
}
?>
//更新:一般情况下可以不用switch和case,列表页的关键字为版名,说明为版的说明,若要对某个版设置特殊的关键字和说明,可以设置case。这样解决了版面很多时要设置很多case语句,加快了程序执行速度(不了解php,JAVA的 case进行了优化,执行很快)
使用修改文件来实现,每版的meta改起来不方便,感觉有些弱智,呵呵。但没有改数据库,用了两个单独的文件,修改了两个文件也很简单,这样升级或迁移更方便吧
case虽然多了一些,但比起读数据库的记录,速度应该快很多
4.主页meta
在后台设置即可。(如果2、3不做,则meta也同主页)
content的优化
discuz有个archiver,一是URL容易收录,二是页面比较干静,还有description会从正文中取内容,但archiver没有对内容中[b][url]之类的解析,那些标签起不到作用,原样显示还会增加垃圾信息。
本部分主要做两方面的优化,一是去除内容页的无用信息,二是给标题加上
<h1>
。加上伪静态和上篇meta的优化,效果就超过了archiver,因此可以在后台禁用它,还减少了复制网页。
实施方案
1.隐藏内容页(viewthread)中的无用信息:
修改内容页模板文件 templates/default/viewthread.htm:
用<!--{if $discuz_uid}--> <!--{/if}-->将要隐藏的信息包含起来。
准确的说是当游客(bots)访问时,隐藏那些信息,当用户登录后是正常的,所以不影响使用。
这些信息主要指的是左侧用户信息栏、(资料 个人空间 主页 短消息 等等)、用户的签名(隐藏后不怕签名的内容影响正文,链接也不起作用了:P)
以住相关文章
2.为标题加上
<h1>
标签
修改内容页模板文件 templates/default/viewthread.htm:
将 <span class="bold">$post[subject]</span><br><br> 替换为
<h1>$post[subject]</h1>
定制“本帖最后由 XXX 于 xxxxxx 编辑”内容
修改文件 templates/default/misc.lang.php:将下面两行改成您喜欢的内容:
'post_edit' => '\n\n[[i]] 本帖最后由 $editor 于 $edittime 编辑 [/i]]',
'post_edit_regexp' => '/\n{2}\[\[i\] 本帖最后由 .*? 于 .*? 编辑 \[\/i\]\]$/s',
比如我改成 [ 网站名 URL xxx 于 xxxx 编辑]。改程序无聊时的自娱,呵呵
注意上下两个表达式要匹配。为了防止解析方括号是全角,不要复制后在文件中查找。
二、内容页的网页复制问题
看看内容页的URL大家就知道了:thread-(tid)-(page)-(forumdisplay page).html,可以看出最后一节表示的是此帖在列表页的第几页。所以,当您的帖子越来越多,这个帖就会由第一页到第二页...,它的URL就会不断的变化。其实打开一个列表页就可以看出来,第2页的帖子链接的最后数字都是2,第3页的都是3,只是很少注意它。我是在SE的收录中发现复制网页越来越多,才对最后的数字注意的。
解决方法
修改 forumdisplay.php 文件:
将 $extra = rawurlencode("page=$page$forumdisplayadd"); 语句替换为
$extra = rawurlencode("page=1$forumdisplayadd");
语句中的page就是forumdisplay page,这样改后不管帖子在列表页的第几页,这个数都是1。
功能损失:当用户编辑帖子或版主管理帖子后,有个提示跳转页:选择转入列表页还是主题页,这时转入列表页的话,只能转到列表页第一页,而不管您原来停留在第几页。
redirect的301重定向
在discuz论坛中可以看到类似redirect.php?tid=xxx&goto=lastpost#lastpost这样的链接,它的功能是实现“最新发表、最后发表、上一主题、下一主题“功能,仅这一个功能就可以给同一个内容页造成四份复制网页,因此将这样的链接301永久重定向到帖子的静态地址。
解决方法
修改 redirect.php 文件:
将前两个 require_once DISCUZ_ROOT.'./viewthread.php'; 语句替换为
$bmt_url='Location:/thread-'.$tid.'-'.$page.'-1.html';
header('HTTP/1.1 301 Moved Permanently');
header( $bmt_url );
将后两个 require_once DISCUZ_ROOT.'./viewthread.php'; 语句替换为
$bmt_url='Location:/thread-'.$tid.'-1-1.html';
header('HTTP/1.1 301 Moved Permanently');
header( $bmt_url );
dz5.5的引用处也有个跳转,也可以做301:
将 dheader("Location: viewthread.php?tid=$post[tid]&page=$page#pid$pid");替换为
$bmt_url='Location:/thread-'.$post[tid].'-'.$page.'-1.html#pid'.$pid;
header('HTTP/1.1 301 Moved Permanently');
header( $bmt_url );
***注意此处直接转到了静态地址,没有做判断是否开启伪静态功能,所以不开启会有问题
功能损失:转向到静态地址后,动态地址中类似#lastpost的锚点将无法起作用了,可能要手动滚屏了
???好像没有影响锚点
提示信息页的网页复制
这个问题和内容页也有着很大的关系,呵呵。如管理员设置允许游客浏览列表,而禁止浏览内容时,这些内容页都将返回一没有权限的提示信息页,但它们的URL 是不同的,这样就形成了严重的网页复制,此外还有其它形成的无权操作等。别一种提示信息如帖子不存在等,数量大了也会形成网页复制。这两种提示信息,都是通过showmessage函数分别调用nopermission.htm和showmessage.htm两个模板实现的。
解决方法
1.创建另一个头模板文件 templates/default/header_disbots.htm
内容同 header.htm 文件,但加入meta robot标签,如下
<meta name="robots" content="noindex,nofollow" />
2.分别修改 templates/default/nopermission.htm 和 templates/default/showmessage.htm 文件
将它们第一行的 {template header} 替换为 {template header_disbots}
虽然对meta robots标签支持的不是很广泛,但这是比较省事的方法
因为是提示信息页,用301来实现的话,还要传给转到的页好多信息,修改起来比较麻烦
三、robots.txt使用
User-agent: *
#禁止一个版面的收录
#如果有个水版,不想禁止游客权限,也不想SE收录,已免影响网站质量,可以用如下方法
Disallow: /forum-1-
#数字即为要禁止版块的ID。
#注意数字最后的 - 不要省略,否则连ID为11,12等1开头的版都禁了
[更新]补充方法:再给内容页加meta robot禁止
#再禁网页复制
Disallow: /viewthread.php
#这个是内容页的动态形式,前面对伪静态做了优化并修改了很多的复制网页,因此这里动态形式如打印页等一定要禁止
Disallow: /forumdisplay.php
#这个要慎重:列表页的动态形式,还包括精华、活动、投票等形式。我发现5.0的静态化不彻底,它的上一页下一页翻页仍是动态,这样如果禁止了,十页之后的内容就不能通这索引了。所以如果您站内的交差链接不丰富的话,不要在此禁止,以免影响收录。
hekaiyu说没有这个问题,去官方看了下5.5的确没问题(也许我的5.0本来没问题,也许官方在新版本中完善了正则表达式的替换规则),这样更好了,禁止它,又干净了好多
#禁止其它无用内容
Disallow: /profile
#用户信息,不知为什么discuz也静态化了,一律禁止
Disallow: /relatethread
Disallow: /post
Disallow: /blog
Disallow: /member
Disallow: /misc
Disallow: /faq
Disallow: /my
Disallow: /pm
Disallow: /digest
Disallow: /status
# ... ... 等等
# ----- robots.txt end ------
[更新]dz5.5的robots.txt后部分给出的Disallow: post.php等是不合规范的,一定要在前面加上"/"。>>详细说明
首页URL问题
后台基本设置->首页文件名如果不设置,会默认为index.php。所以站内到首页的链接为形式为http: //domain/index.php。而我们一般引用论坛首页或交换链接的形式一般是http://domain/。实际是一样的,但SE可认为是两个 URL,而且一个拥有很多的内部链接,一个拥有较多的外部链接,所以哪个被降级都不是好事情,最好统一起来。这里的修改目标是http: //domain/的形式。
1.进入后台,基本设置->首面文件名 设置为: /
2.修改文件 member.php 将 header("Location: {$boardurl}".$indexname); 替换为
if( $indexname=='/'){
header("Location: {$boardurl}");
}else{
header("Location: {$boardurl}".$indexname);
}
[更新]dz5.5为dheader
此修改处的功能是清除cookies后返回到首页,如不修改域名后就有两个/。暂时未发现使用/当首页文件名的其它问题
结 束
除了文件的修改,有些地方要配合后台设置,前面都提到了,这里总结一下。主要有:1.URL静态化,只启用普通页面静态化就可以了;2.不要启用 Archiver功能;3.后台的keywords和description设置只是针对首页的(如果您没做列表页和内容页的meta修改则也应用到它们);4.后台首页文件名为/(当然您也可以设置自己特定的)
最后编辑: 郝聪 编辑于2007/07/24 17:23
Tags: ,
|
{
"url": "http://www.bloghuman.com/post/305/",
"source_domain": "www.bloghuman.com",
"snapshot_id": "crawl=CC-MAIN-2017-30",
"warc_metadata": {
"Content-Length": "57495",
"Content-Type": "application/http; msgtype=response",
"WARC-Block-Digest": "sha1:GGKBOKXFQNFMKQU7FHYOQBH74MXVMUAK",
"WARC-Concurrent-To": "<urn:uuid:9285c52c-219f-4b4f-87d5-8a2b856ea5e7>",
"WARC-Date": "2017-07-25T08:43:30Z",
"WARC-IP-Address": "211.149.193.135",
"WARC-Identified-Payload-Type": "application/xhtml+xml",
"WARC-Payload-Digest": "sha1:K7C2QY7QGKR6A7GGCHYQRCLEGAD5NGAR",
"WARC-Record-ID": "<urn:uuid:c5dc433a-651c-4305-ba20-e3702612b471>",
"WARC-Target-URI": "http://www.bloghuman.com/post/305/",
"WARC-Truncated": "length",
"WARC-Type": "response",
"WARC-Warcinfo-ID": "<urn:uuid:bc091b89-48d4-4fc3-9f6a-f5af8a0c8aa8>"
},
"warc_info": "robots: classic\r\nhostname: ip-10-185-81-17.ec2.internal\r\nsoftware: Nutch 1.6 (CC)\r\nisPartOf: CC-MAIN-2017-30\r\noperator: Common Crawl Admin\r\ndescription: Wide crawl of the web for July 2017\r\npublisher: Common Crawl\r\nformat: WARC File Format 1.0\r\nconformsTo: http://bibnum.bnf.fr/WARC/WARC_ISO_28500_version1_latestdraft.pdf"
}
|
{
"line_start_idx": [
0,
3,
4,
5,
6,
22,
23,
94,
95,
130,
131,
149,
162,
180,
181,
184,
207,
225,
226,
227,
237,
238,
332,
333,
334,
345,
346,
416,
417,
468,
469,
470,
481,
482,
568,
569,
644,
645,
708,
762,
763,
846,
847,
900,
901,
926,
1052,
1109,
1110,
1150,
1151,
1157,
1210,
1211,
1271,
1383,
1384,
1448,
1522,
1589,
1592,
1593,
1612,
1613,
1724,
1763,
1764,
1786,
1872,
1873,
1936,
1937,
1982,
1983,
2006,
2007,
2053,
2109,
2110,
2149,
2150,
2156,
2209,
2240,
2281,
2282,
2308,
2344,
2383,
2426,
2440,
2451,
2490,
2533,
2547,
2548,
2550,
2553,
2554,
2687,
2688,
2764,
2765,
2795,
2796,
2805,
2833,
2834,
2835,
2846,
2957,
2991,
2996,
3049,
3050,
3055,
3056,
3083,
3127,
3179,
3180,
3181,
3226,
3296,
3303,
3304,
3312,
3317,
3320,
3364,
3365,
3420,
3444,
3445,
3446,
3474,
3475,
3527,
3528,
3591,
3662,
3663,
3707,
3746,
3747,
3760,
3761,
3969,
3970,
3975,
3999,
4000,
4061,
4110,
4111,
4164,
4165,
4242,
4243,
4244,
4260,
4261,
4408,
4409,
4414,
4434,
4435,
4491,
4546,
4588,
4608,
4664,
4711,
4753,
4773,
4774,
4798,
4799,
4875,
4945,
4987,
5007,
5008,
5050,
5051,
5101,
5113,
5114,
5115,
5126,
5127,
5332,
5333,
5338,
5388,
5425,
5475,
5476,
5477,
5558,
5614,
5615,
5651,
5692,
5693,
5694,
5709,
5710,
5724,
5725,
5736,
5778,
5798,
5799,
5814,
5851,
5879,
5880,
5888,
5914,
5968,
5969,
5997,
6114,
6115,
6199,
6200,
6210,
6229,
6257,
6281,
6297,
6313,
6331,
6347,
6362,
6376,
6390,
6408,
6426,
6439,
6469,
6540,
6541,
6549,
6550,
6755,
6756,
6782,
6850,
6851,
6873,
6909,
6916,
6963,
6965,
6966,
6984,
6985,
7042,
7043,
7044,
7048,
7049,
7219,
7220,
7249
],
"line_end_idx": [
3,
4,
5,
6,
22,
23,
94,
95,
130,
131,
149,
162,
180,
181,
184,
207,
225,
226,
227,
237,
238,
332,
333,
334,
345,
346,
416,
417,
468,
469,
470,
481,
482,
568,
569,
644,
645,
708,
762,
763,
846,
847,
900,
901,
926,
1052,
1109,
1110,
1150,
1151,
1157,
1210,
1211,
1271,
1383,
1384,
1448,
1522,
1589,
1592,
1593,
1612,
1613,
1724,
1763,
1764,
1786,
1872,
1873,
1936,
1937,
1982,
1983,
2006,
2007,
2053,
2109,
2110,
2149,
2150,
2156,
2209,
2240,
2281,
2282,
2308,
2344,
2383,
2426,
2440,
2451,
2490,
2533,
2547,
2548,
2550,
2553,
2554,
2687,
2688,
2764,
2765,
2795,
2796,
2805,
2833,
2834,
2835,
2846,
2957,
2991,
2996,
3049,
3050,
3055,
3056,
3083,
3127,
3179,
3180,
3181,
3226,
3296,
3303,
3304,
3312,
3317,
3320,
3364,
3365,
3420,
3444,
3445,
3446,
3474,
3475,
3527,
3528,
3591,
3662,
3663,
3707,
3746,
3747,
3760,
3761,
3969,
3970,
3975,
3999,
4000,
4061,
4110,
4111,
4164,
4165,
4242,
4243,
4244,
4260,
4261,
4408,
4409,
4414,
4434,
4435,
4491,
4546,
4588,
4608,
4664,
4711,
4753,
4773,
4774,
4798,
4799,
4875,
4945,
4987,
5007,
5008,
5050,
5051,
5101,
5113,
5114,
5115,
5126,
5127,
5332,
5333,
5338,
5388,
5425,
5475,
5476,
5477,
5558,
5614,
5615,
5651,
5692,
5693,
5694,
5709,
5710,
5724,
5725,
5736,
5778,
5798,
5799,
5814,
5851,
5879,
5880,
5888,
5914,
5968,
5969,
5997,
6114,
6115,
6199,
6200,
6210,
6229,
6257,
6281,
6297,
6313,
6331,
6347,
6362,
6376,
6390,
6408,
6426,
6439,
6469,
6540,
6541,
6549,
6550,
6755,
6756,
6782,
6850,
6851,
6873,
6909,
6916,
6963,
6965,
6966,
6984,
6985,
7042,
7043,
7044,
7048,
7049,
7219,
7220,
7249,
7256
]
}
|
{
"red_pajama_v2": {
"ccnet_original_length": 7256,
"ccnet_original_nlines": 266,
"rps_doc_curly_bracket": 0.004134510178118944,
"rps_doc_ldnoobw_words": 2,
"rps_doc_lorem_ipsum": 0,
"rps_doc_stop_word_fraction": 0.01573769934475422,
"rps_doc_ut1_blacklist": 0,
"rps_doc_frac_all_caps_words": 0.020327869802713394,
"rps_doc_frac_lines_end_with_ellipsis": 0,
"rps_doc_frac_no_alph_words": 0.7075409889221191,
"rps_doc_frac_unique_words": 0.7570621371269226,
"rps_doc_mean_word_length": 16.627119064331055,
"rps_doc_num_sentences": 114,
"rps_doc_symbol_to_word_ratio": 0.013114750385284424,
"rps_doc_unigram_entropy": 5.411771774291992,
"rps_doc_word_count": 354,
"rps_doc_frac_chars_dupe_10grams": 0,
"rps_doc_frac_chars_dupe_5grams": 0.05691470950841904,
"rps_doc_frac_chars_dupe_6grams": 0.05691470950841904,
"rps_doc_frac_chars_dupe_7grams": 0.016989469528198242,
"rps_doc_frac_chars_dupe_8grams": 0,
"rps_doc_frac_chars_dupe_9grams": 0,
"rps_doc_frac_chars_top_2gram": 0.005436629988253117,
"rps_doc_frac_chars_top_3gram": 0.01019368041306734,
"rps_doc_frac_chars_top_4gram": 0.015800200402736664,
"rps_doc_books_importance": -572.650390625,
"rps_doc_books_importance_length_correction": -572.650390625,
"rps_doc_openwebtext_importance": -360.3743591308594,
"rps_doc_openwebtext_importance_length_correction": -360.3743591308594,
"rps_doc_wikipedia_importance": -331.07513427734375,
"rps_doc_wikipedia_importance_length_correction": -331.07513427734375
},
"fasttext": {
"dclm": 0.8314884305000305,
"english": 0.01193314976990223,
"fineweb_edu_approx": 2.879857301712036,
"eai_general_math": 0.0016483099898323417,
"eai_open_web_math": 0.4681050181388855,
"eai_web_code": 0.4702465534210205
}
}
|
{
"free_decimal_correspondence": {
"primary": {
"code": "005.4",
"labels": {
"level_1": "General works, books and libraries, information sciences",
"level_2": "",
"level_3": "Computer programming"
}
},
"secondary": {
"code": "658.8",
"labels": {
"level_1": "Industrial arts, Technology, and Engineering",
"level_2": "Business",
"level_3": "Management"
}
}
},
"bloom_cognitive_process": {
"primary": {
"code": "3",
"label": "Apply"
},
"secondary": {
"code": "4",
"label": "Analyze"
}
},
"bloom_knowledge_domain": {
"primary": {
"code": "3",
"label": "Procedural"
},
"secondary": {
"code": "2",
"label": "Conceptual"
}
},
"document_type_v1": {
"primary": {
"code": "3",
"label": "Reference/Encyclopedic/Educational"
},
"secondary": {
"code": "-1",
"label": "Abstain"
}
},
"extraction_artifacts": {
"primary": {
"code": "0",
"label": "No Artifacts"
},
"secondary": {
"code": "3",
"label": "Irrelevant Content"
}
},
"missing_content": {
"primary": {
"code": "0",
"label": "No missing content"
},
"secondary": {
"code": "-1",
"label": "Abstain"
}
},
"document_type_v2": {
"primary": {
"code": "23",
"label": "Tutorial"
},
"secondary": {
"code": "8",
"label": "Documentation"
}
},
"reasoning_depth": {
"primary": {
"code": "3",
"label": "Intermediate Reasoning"
},
"secondary": {
"code": "2",
"label": "Basic Reasoning"
}
},
"technical_correctness": {
"primary": {
"code": "3",
"label": "Mostly Correct"
},
"secondary": {
"code": "4",
"label": "Highly Correct"
}
},
"education_level": {
"primary": {
"code": "3",
"label": "Undergraduate Level"
},
"secondary": {
"code": "2",
"label": "High School Level"
}
}
}
|
672f1e42c33a7f9846924a2431ea77df
|
7,621,275,259,254,019,000
|
1.
[C#] Xbox 360 Rehash and Resigner
Discussion in 'Programming & Scripting' started by InModWeTrust360, Feb 22, 2010 with 37 replies and 23,251 views.
1. Chris7S
Chris7S Smoke Like Marley <3
Messages:
1,294
Likes Received:
404
Xbox 360 Rehash and Resigner + Source
..:: CONartist ::..
New Program That Rehash and Resigns ANY Container File That You Need Rehashed!
This Is My Very First Xbox App Besides An AIO So PLEASE Don't Flame
Screenshots Below
Main Interface
[IMG]
About Tab
[IMG]
Open File Dialog
[IMG]
After File Is Imported
[IMG]
^^^ Blurred Out ID's ^^^
After Rehashing is Complete
[IMG]
Contact Info:
GT: CH iZ DiRTy
AIM: crharris101
2. Venomous Fire
Venomous Fire Retired Admin 4 Life Retired
Messages:
8,212
Likes Received:
3,027
Re: Xbox 360 Rehash and Resigner
Get a direct link. Cant require members to log in to download your app
3. Chris7S
Chris7S Smoke Like Marley <3
Messages:
1,294
Likes Received:
404
1 person likes this.
4. theone0522
theone0522 Enthusiast
Messages:
225
Likes Received:
18
Re: Xbox 360 Rehash and Resigner
dude not to me a MOD here or anything but you need to source or let ppl PM you for the source becasue thats how you are able to post here.
5. landr0id
landr0id Getting There
Messages:
981
Likes Received:
184
Re: Xbox 360 Rehash and Resigner
The point of this section isn't really for just posting sources. If that was the case, then where would people post programs they made?
@CH Really though, you should give credit to whoever made the original code because I believe you were asking for the source to a resigner/rehasher before.
4 people like this.
6. Chris7S
Chris7S Smoke Like Marley <3
Messages:
1,294
Likes Received:
404
Re: Xbox 360 Rehash and Resigner
I was asking for a resigner code but if you remember correctly no one would help me so I took everyone's advice and did research. I found a website that had all the offsets and Hex values and i learned how to myself. I do give credit to edgareatis for telling me about the site though. :thumbup:
7. SotG Caboose
SotG Caboose Experienced Member
Messages:
1,444
Likes Received:
678
Re: Xbox 360 Rehash and Resigner
So you're saying you wrote the resigner code yourself? lmao
1 person likes this.
8. Chris7S
Chris7S Smoke Like Marley <3
Messages:
1,294
Likes Received:
404
Re: Xbox 360 Rehash and Resigner
Yes. Why is that so hard to believe?
I did research on C# for the last 3 weeks and figured it out. Also, one of my friends showed me a website with the Hex values and stuff on it which made it 100x easier. Here is the site. Click HERE.
9. SotG Caboose
SotG Caboose Experienced Member
Messages:
1,444
Likes Received:
678
Re: Xbox 360 Rehash and Resigner
1. You researched C#? wtf
2. Last time I ckecked, you barely knew VB
3. That table doesnt explain rehashing and resigning
10. AsparagusMan
AsparagusMan Enthusiast
Messages:
493
Likes Received:
113
Re: Xbox 360 Rehash and Resigner
So you did 3 weeks of research on figuring out how to use .NET RSA library and setting a binarywriter to offsets that were just handed to you? Oh man, you're bomb... not...
Also Aversion media has nothing on there about hashing or signing, just STFS Metadata
BTW, you use X360.dll, which rehashes and resigns using the FlushPackage() function, so you didn't even program a resigner at all, there is no function to just hash in X360 dll, just resign ( UpdateHeader() ) and rehash and resign ( FlushPackage() ) so good lie
Lastly, you are using X360 1.2, you do realize its been updated to 1.27 right? Pretty much flawless now
4 people like this.
11. Chris7S
Chris7S Smoke Like Marley <3
Messages:
1,294
Likes Received:
404
Re: Xbox 360 Rehash and Resigner
Everyone on 7S is just a critic. THIS IS A WEBSITE TO ASK FOR HELP AND TO HELP PPL OUT NOT FLAME!!! :cursing:
I didn't completely research it and I sure as h*** didn't steal coding!
There is only around 20 lines of code in the whole program so it really wasn;t that hard.
12. SotG Caboose
SotG Caboose Experienced Member
Messages:
1,444
Likes Received:
678
Re: Xbox 360 Rehash and Resigner
So why lie about it?
13. Chris7S
Chris7S Smoke Like Marley <3
Messages:
1,294
Likes Received:
404
Re: Xbox 360 Rehash and Resigner
I didn't lie!
Sorry I'm not a pro like you.
14. SotG Caboose
SotG Caboose Experienced Member
Messages:
1,444
Likes Received:
678
Re: Xbox 360 Rehash and Resigner
Lie^
1 person likes this.
15. AsparagusMan
AsparagusMan Enthusiast
Messages:
493
Likes Received:
113
Re: Xbox 360 Rehash and Resigner
I'm not pro, I just know you didn't even make a resigner because you use X360 DLL, you don't even know that X360 has an IO, I'm just saying don't lie because people who actually know sh*t will call you out and we then know you are a dumba**, by the way, update to the latest X360 DLL if you want most functionality for your program
Skunkie Butt
16. OwnedTom
OwnedTom Member
Messages:
937
Likes Received:
320
Re: Xbox 360 Rehash and Resigner
Show us the source and we will be judges.
17. Chris7S
Chris7S Smoke Like Marley <3
Messages:
1,294
Likes Received:
404
Re: Xbox 360 Rehash and Resigner
I still don't understand why you keep saying I lied. I didn't lie about anything.
Thanks for the download BTW
Ok hold on let me upload it
Here is the coding for it: http://www.megaupload.com/?d=RMQ2LKM2
18. OwnedTom
OwnedTom Member
Messages:
937
Likes Received:
320
Re: Xbox 360 Rehash and Resigner
Code (Text):
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Diagnostics;
using System.Text;
using System.Windows.Forms;
using DevComponents.DotNetBar;
[COLOR=Red][U][B]using X360.STFS;
using Container.IO;[/B][/U][/COLOR]
using System.Globalization;
So it's all your own code?
19. Chris7S
Chris7S Smoke Like Marley <3
Messages:
1,294
Likes Received:
404
Re: Xbox 360 Rehash and Resigner
I thought you needed STFS and the IO for the program to work?
I thought everyone uses that?
20. OwnedTom
OwnedTom Member
Messages:
937
Likes Received:
320
Re: Xbox 360 Rehash and Resigner
You implied that you wrote your own. The STFS is what rehashes the file
|
{
"url": "http://www.se7ensins.com/forums/threads/c-xbox-360-rehash-and-resigner.162711/",
"source_domain": "www.se7ensins.com",
"snapshot_id": "crawl=CC-MAIN-2014-23",
"warc_metadata": {
"Content-Length": "114778",
"Content-Type": "application/http; msgtype=response",
"WARC-Block-Digest": "sha1:FRQSIJMIQAPPOQHD45JNXFJD2G6TYIR2",
"WARC-Concurrent-To": "<urn:uuid:3656af8e-4045-4ff0-9c88-25662a915552>",
"WARC-Date": "2014-07-23T16:15:47Z",
"WARC-IP-Address": "198.12.15.174",
"WARC-Identified-Payload-Type": null,
"WARC-Payload-Digest": "sha1:JX3HP6WXGKLHVMJ22QVSEZZXJRJ4OSUZ",
"WARC-Record-ID": "<urn:uuid:6c023d11-d9bc-48b7-96b2-eba9108c95ba>",
"WARC-Target-URI": "http://www.se7ensins.com/forums/threads/c-xbox-360-rehash-and-resigner.162711/",
"WARC-Truncated": null,
"WARC-Type": "response",
"WARC-Warcinfo-ID": "<urn:uuid:67345dda-b16b-41aa-99ac-9b8db5e917c1>"
},
"warc_info": "robots: classic\r\nhostname: ip-10-33-131-23.ec2.internal\r\nsoftware: Nutch 1.6 (CC)/CC WarcExport 1.0\r\nisPartOf: CC-MAIN-2014-23\r\noperator: CommonCrawl Admin\r\ndescription: Wide crawl of the web with URLs provided by Blekko for July 2014\r\npublisher: CommonCrawl\r\nformat: WARC File Format 1.0\r\nconformsTo: http://bibnum.bnf.fr/WARC/WARC_ISO_28500_version1_latestdraft.pdf"
}
|
{
"line_start_idx": [
0,
7,
8,
42,
43,
158,
159,
172,
173,
206,
207,
221,
231,
251,
259,
301,
302,
326,
327,
410,
411,
483,
484,
506,
507,
526,
537,
538,
552,
563,
564,
585,
596,
597,
624,
635,
665,
666,
698,
709,
710,
711,
729,
749,
770,
771,
790,
791,
838,
839,
853,
863,
883,
893,
930,
931,
1006,
1019,
1020,
1053,
1054,
1068,
1078,
1098,
1106,
1131,
1147,
1148,
1174,
1175,
1189,
1197,
1217,
1224,
1261,
1262,
1405,
1419,
1420,
1447,
1448,
1462,
1470,
1490,
1498,
1535,
1536,
1676,
1677,
1837,
1861,
1874,
1875,
1908,
1909,
1923,
1933,
1953,
1961,
1998,
1999,
2299,
2317,
2318,
2354,
2355,
2369,
2379,
2399,
2407,
2444,
2445,
2509,
2534,
2547,
2548,
2581,
2582,
2596,
2606,
2626,
2634,
2671,
2672,
2713,
2714,
2917,
2935,
2936,
2972,
2973,
2987,
2997,
3017,
3025,
3062,
3063,
3093,
3140,
3197,
3216,
3217,
3245,
3246,
3260,
3268,
3288,
3296,
3333,
3334,
3511,
3512,
3602,
3603,
3869,
3870,
3978,
4002,
4016,
4017,
4050,
4051,
4065,
4075,
4095,
4103,
4140,
4141,
4255,
4256,
4332,
4333,
4427,
4446,
4447,
4483,
4484,
4498,
4508,
4528,
4536,
4573,
4574,
4599,
4613,
4614,
4647,
4648,
4662,
4672,
4692,
4700,
4737,
4738,
4756,
4757,
4791,
4810,
4811,
4847,
4848,
4862,
4872,
4892,
4900,
4937,
4938,
4947,
4972,
4991,
4992,
5020,
5021,
5035,
5043,
5063,
5071,
5108,
5109,
5445,
5446,
5463,
5478,
5479,
5499,
5500,
5514,
5522,
5542,
5550,
5587,
5588,
5634,
5648,
5649,
5682,
5683,
5697,
5707,
5727,
5735,
5772,
5773,
5859,
5860,
5892,
5893,
5925,
5994,
6009,
6010,
6030,
6031,
6045,
6053,
6073,
6081,
6118,
6119,
6136,
6137,
6155,
6193,
6226,
6249,
6275,
6305,
6328,
6360,
6395,
6433,
6473,
6505,
6511,
6542,
6556,
6557,
6590,
6591,
6605,
6615,
6635,
6643,
6680,
6681,
6747,
6781,
6796,
6797,
6817,
6818,
6832,
6840,
6860,
6868,
6905,
6906
],
"line_end_idx": [
7,
8,
42,
43,
158,
159,
172,
173,
206,
207,
221,
231,
251,
259,
301,
302,
326,
327,
410,
411,
483,
484,
506,
507,
526,
537,
538,
552,
563,
564,
585,
596,
597,
624,
635,
665,
666,
698,
709,
710,
711,
729,
749,
770,
771,
790,
791,
838,
839,
853,
863,
883,
893,
930,
931,
1006,
1019,
1020,
1053,
1054,
1068,
1078,
1098,
1106,
1131,
1147,
1148,
1174,
1175,
1189,
1197,
1217,
1224,
1261,
1262,
1405,
1419,
1420,
1447,
1448,
1462,
1470,
1490,
1498,
1535,
1536,
1676,
1677,
1837,
1861,
1874,
1875,
1908,
1909,
1923,
1933,
1953,
1961,
1998,
1999,
2299,
2317,
2318,
2354,
2355,
2369,
2379,
2399,
2407,
2444,
2445,
2509,
2534,
2547,
2548,
2581,
2582,
2596,
2606,
2626,
2634,
2671,
2672,
2713,
2714,
2917,
2935,
2936,
2972,
2973,
2987,
2997,
3017,
3025,
3062,
3063,
3093,
3140,
3197,
3216,
3217,
3245,
3246,
3260,
3268,
3288,
3296,
3333,
3334,
3511,
3512,
3602,
3603,
3869,
3870,
3978,
4002,
4016,
4017,
4050,
4051,
4065,
4075,
4095,
4103,
4140,
4141,
4255,
4256,
4332,
4333,
4427,
4446,
4447,
4483,
4484,
4498,
4508,
4528,
4536,
4573,
4574,
4599,
4613,
4614,
4647,
4648,
4662,
4672,
4692,
4700,
4737,
4738,
4756,
4757,
4791,
4810,
4811,
4847,
4848,
4862,
4872,
4892,
4900,
4937,
4938,
4947,
4972,
4991,
4992,
5020,
5021,
5035,
5043,
5063,
5071,
5108,
5109,
5445,
5446,
5463,
5478,
5479,
5499,
5500,
5514,
5522,
5542,
5550,
5587,
5588,
5634,
5648,
5649,
5682,
5683,
5697,
5707,
5727,
5735,
5772,
5773,
5859,
5860,
5892,
5893,
5925,
5994,
6009,
6010,
6030,
6031,
6045,
6053,
6073,
6081,
6118,
6119,
6136,
6137,
6155,
6193,
6226,
6249,
6275,
6305,
6328,
6360,
6395,
6433,
6473,
6505,
6511,
6542,
6556,
6557,
6590,
6591,
6605,
6615,
6635,
6643,
6680,
6681,
6747,
6781,
6796,
6797,
6817,
6818,
6832,
6840,
6860,
6868,
6905,
6906,
6981
]
}
|
{
"red_pajama_v2": {
"ccnet_original_length": 6981,
"ccnet_original_nlines": 296,
"rps_doc_curly_bracket": 0,
"rps_doc_ldnoobw_words": 1,
"rps_doc_lorem_ipsum": 0,
"rps_doc_stop_word_fraction": 0.2661290168762207,
"rps_doc_ut1_blacklist": 0,
"rps_doc_frac_all_caps_words": 0.06011730059981346,
"rps_doc_frac_lines_end_with_ellipsis": 0.003367000026628375,
"rps_doc_frac_no_alph_words": 0.28958943486213684,
"rps_doc_frac_unique_words": 0.35374149680137634,
"rps_doc_mean_word_length": 4.6151604652404785,
"rps_doc_num_sentences": 88,
"rps_doc_symbol_to_word_ratio": 0.003665690077468753,
"rps_doc_unigram_entropy": 5.26345157623291,
"rps_doc_word_count": 1029,
"rps_doc_frac_chars_dupe_10grams": 0.2945883274078369,
"rps_doc_frac_chars_dupe_5grams": 0.32154136896133423,
"rps_doc_frac_chars_dupe_6grams": 0.3114340007305145,
"rps_doc_frac_chars_dupe_7grams": 0.2950094938278198,
"rps_doc_frac_chars_dupe_8grams": 0.2945883274078369,
"rps_doc_frac_chars_dupe_9grams": 0.2945883274078369,
"rps_doc_frac_chars_top_2gram": 0.04169299080967903,
"rps_doc_frac_chars_top_3gram": 0.05474837124347687,
"rps_doc_frac_chars_top_4gram": 0.06738261133432388,
"rps_doc_books_importance": -496.3407897949219,
"rps_doc_books_importance_length_correction": -496.3407897949219,
"rps_doc_openwebtext_importance": -298.4708557128906,
"rps_doc_openwebtext_importance_length_correction": -298.4708557128906,
"rps_doc_wikipedia_importance": -177.89248657226562,
"rps_doc_wikipedia_importance_length_correction": -177.89248657226562
},
"fasttext": {
"dclm": 0.0794563889503479,
"english": 0.9086930155754089,
"fineweb_edu_approx": 1.0388461351394653,
"eai_general_math": 0.006503759883344173,
"eai_open_web_math": 0.24701756238937378,
"eai_web_code": 0.000044699998397845775
}
}
|
{
"free_decimal_correspondence": {
"primary": {
"code": "005.4",
"labels": {
"level_1": "General works, books and libraries, information sciences",
"level_2": "",
"level_3": "Computer programming"
}
},
"secondary": {
"code": "794.8",
"labels": {
"level_1": "Arts",
"level_2": "Amusements and Recreation",
"level_3": ""
}
}
},
"bloom_cognitive_process": {
"primary": {
"code": "3",
"label": "Apply"
},
"secondary": {
"code": "2",
"label": "Understand"
}
},
"bloom_knowledge_domain": {
"primary": {
"code": "3",
"label": "Procedural"
},
"secondary": {
"code": "2",
"label": "Conceptual"
}
},
"document_type_v1": {
"primary": {
"code": "5",
"label": "Social/Forum"
},
"secondary": {
"code": "4",
"label": "Code/Software"
}
},
"extraction_artifacts": {
"primary": {
"code": "3",
"label": "Irrelevant Content"
},
"secondary": {
"code": "1",
"label": "Leftover HTML"
}
},
"missing_content": {
"primary": {
"code": "2",
"label": "Click Here References"
},
"secondary": {
"code": "4",
"label": "Missing Images or Figures"
}
},
"document_type_v2": {
"primary": {
"code": "18",
"label": "Q&A Forum"
},
"secondary": {
"code": "8",
"label": "Documentation"
}
},
"reasoning_depth": {
"primary": {
"code": "2",
"label": "Basic Reasoning"
},
"secondary": {
"code": "3",
"label": "Intermediate Reasoning"
}
},
"technical_correctness": {
"primary": {
"code": "2",
"label": "Partially Correct"
},
"secondary": {
"code": "3",
"label": "Mostly Correct"
}
},
"education_level": {
"primary": {
"code": "3",
"label": "Undergraduate Level"
},
"secondary": {
"code": "2",
"label": "High School Level"
}
}
}
|
672f1e42c33a7f9846924a2431ea77df
|
4,395,673,303,371,555,300
|
Questions involving the software MAGMA. (For the algebraic structure called magma, please, use the tag magmas.) This tag should hardly ever be the only tag of a question; typically there should be additional tags to indicate the mathematical content of the question. Please note that questions that ...
learn more… | top users | synonyms
0
votes
0answers
46 views
Linear codes in MAGMA [closed]
How can I compute the socle of a linear code in MAGMA? Indeed I need MAGMA to view my code as a $G$-Module over $GF(p)$ not just a subspace.
4
votes
0answers
96 views
Computing Tamagawa numbers for jacobians of hyperelliptic curves
Do exist some computational approach to calculation of Tamagawa number for the jacobian of hyperelliptic curve at prime $p$? As followed from this question one can compute $\Phi(\overline{\mathbb ...
0
votes
1answer
60 views
Is there a way to make MAGMA work with surfaces over weighted projective spaces?
Is there a way to use MAGMA to study surfaces defined over a weighted projective space (by "study" I mean computing e.g. invariants (e.g. $p_a$, $p_g$), singularities, etc)? For example, I was trying, ...
2
votes
0answers
122 views
Finding relations between invariant polynomials
Suppose I have an action of a linear reductive group ($GL(2,\mathbb{C})^2$ in this case) on a complex vector space (of dimension $16$) and I want to compute explicitly the ring of invariants of this ...
7
votes
2answers
583 views
BSD conjecture for X_0(17)
I use Magma to calculate the L-value, yields E:=EllipticCurve([1, -1, 1, -1, 0]); E; Evaluate(LSeries(E),1),RealPeriod(E),Evaluate(LSeries(E),1)/RealPeriod(E); Elliptic Curve defined by y^2 + x*y + ...
1
vote
2answers
187 views
My output of a group and inverse-closed subset in MAGMA is no longer inverse-closed when entered as input to GAP.
In MAGMA, I input the following: G:=SmallGroup(20,3); G; E:=[xx:xx in G]; S:=[E[6],E[7],E[13],E[20]]; S; S[1]^2; S[2]^2; S[3]*S[4]; This gives the output: GrpPC : ...
7
votes
2answers
264 views
Solving the Field Membership Problem using Grobner Bases
Is there an easy way to determine whether a set of elements in a field generates the whole field or only a subfield? Specifically, I have a subfield of $k(x,y)$ described in terms of a canonical set ...
1
vote
1answer
149 views
Changing the Type of a Module in MAGMA
I am currently working with irreducible $k[G]$-modules in MAGMA for finite fields $k$ and finite groups $G$. To construct these modules, I am using the commands IrreducibleModules(G,k) This results in ...
2
votes
2answers
277 views
Working with group cosets in MAGMA
When working with group cosets in MAGMA is there a way of treating the cosets as subsets of the overlying group. Specifically I have a group $G$ and subgroups $H$ and $K$ . I wish ...
1
vote
3answers
326 views
Checking for invertibility of large matrices in MAGMA
If you have a number of large matrices, and you wish to determine whether each matrix has determinant zero or not, what is the most efficient way to do this in MAGMA (it appears that calculating the ...
0
votes
0answers
180 views
Magma Coercion Syntax
Any Magma experts who know what I should write below in place of "Roots(ysoln)"? I basically want the roots of a FldFunRatMElt (variable here happens to show as "$.2"). I would guess there's some ...
1
vote
1answer
287 views
Homomorphisms and their restrictions in MAGMA
I am trying to look at a representation (so a homomorphism) of a group G, and see what the restriction of the representation to a subgroup of G will be. Is there an easy way (or any way!) to do this ...
6
votes
3answers
1k views
Using MAGMA for Group Theory
I've just started a PhD in Group Theory and need to use the computer programme MAGMA. I wonder if anyone could help me with a couple of (probably very basic things). I need to produce a Hasse ...
5
votes
3answers
602 views
Is there a MAGMA function to calculate the absolutely irreducible components of an algebraic curve defined over the rationals?
Given a curve defined over the rationals, is it computationaly possible to find all its absolutely irreducible components? Is there an implementation of this in the MAGMA program?
2
votes
0answers
204 views
How to ask Magma to compute the induced morphisim on divisor group
Suppose Magma has computed homomorphism $h$ between function fields $F1 \to F2$. Then we have an induced homomorphism $h$ on the divisor group. Now my question is that if there's a better way to ...
1
vote
1answer
453 views
Does MAGMA have a function to decide if two indefinite, integral quadratic forms are isometric?
Let's say we have two $n$-dimensional lattices $(V,b)$ and $(W,b_1)$ equipped with integral bilinear forms $b$ and $b_1$ respectively. Is there an implemented function in MAGMA that decides whether ...
|
{
"url": "http://mathoverflow.net/questions/tagged/magma",
"source_domain": "mathoverflow.net",
"snapshot_id": "crawl=CC-MAIN-2015-06",
"warc_metadata": {
"Content-Length": "73974",
"Content-Type": "application/http; msgtype=response",
"WARC-Block-Digest": "sha1:CPFBKDNIVN7YPPUZF4BNOV4MMEQKMAFF",
"WARC-Concurrent-To": "<urn:uuid:66e705e3-7254-4f39-9f9d-b62249dc3f44>",
"WARC-Date": "2015-01-29T06:19:32Z",
"WARC-IP-Address": "198.252.206.148",
"WARC-Identified-Payload-Type": null,
"WARC-Payload-Digest": "sha1:CIXFKHUAMCY4VQJFAKVK772ULTBTWO2M",
"WARC-Record-ID": "<urn:uuid:6ad8b16b-1c41-468e-a48a-b7bbda8d438a>",
"WARC-Target-URI": "http://mathoverflow.net/questions/tagged/magma",
"WARC-Truncated": null,
"WARC-Type": "response",
"WARC-Warcinfo-ID": "<urn:uuid:83beede3-ab04-43fb-b30c-2328ed794c7e>"
},
"warc_info": "robots: classic\r\nhostname: ip-10-180-212-252.ec2.internal\r\nsoftware: Nutch 1.6 (CC)/CC WarcExport 1.0\r\nisPartOf: CC-MAIN-2015-06\r\noperator: CommonCrawl Admin\r\ndescription: Wide crawl of the web with URLs provided by Blekko for January 2015\r\npublisher: CommonCrawl\r\nformat: WARC File Format 1.0\r\nconformsTo: http://bibnum.bnf.fr/WARC/WARC_ISO_28500_version1_latestdraft.pdf"
}
|
{
"line_start_idx": [
0,
303,
304,
339,
340,
342,
348,
357,
366,
367,
398,
399,
540,
542,
548,
557,
566,
567,
632,
633,
833,
835,
841,
849,
858,
859,
940,
941,
1146,
1148,
1154,
1163,
1173,
1174,
1222,
1223,
1426,
1428,
1434,
1443,
1453,
1454,
1481,
1482,
1684,
1686,
1691,
1700,
1710,
1711,
1825,
1826,
1993,
1995,
2001,
2010,
2020,
2021,
2078,
2079,
2282,
2284,
2289,
2297,
2307,
2308,
2347,
2348,
2553,
2555,
2561,
2570,
2580,
2581,
2616,
2617,
2801,
2803,
2808,
2817,
2827,
2828,
2882,
2883,
3086,
3088,
3094,
3103,
3113,
3114,
3136,
3137,
3337,
3339,
3344,
3352,
3362,
3363,
3409,
3410,
3613,
3615,
3621,
3630,
3639,
3640,
3669,
3670,
3866,
3868,
3874,
3883,
3893,
3894,
4021,
4022,
4202,
4204,
4210,
4219,
4229,
4230,
4297,
4298,
4497,
4499,
4504,
4512,
4522,
4523,
4619,
4620
],
"line_end_idx": [
303,
304,
339,
340,
342,
348,
357,
366,
367,
398,
399,
540,
542,
548,
557,
566,
567,
632,
633,
833,
835,
841,
849,
858,
859,
940,
941,
1146,
1148,
1154,
1163,
1173,
1174,
1222,
1223,
1426,
1428,
1434,
1443,
1453,
1454,
1481,
1482,
1684,
1686,
1691,
1700,
1710,
1711,
1825,
1826,
1993,
1995,
2001,
2010,
2020,
2021,
2078,
2079,
2282,
2284,
2289,
2297,
2307,
2308,
2347,
2348,
2553,
2555,
2561,
2570,
2580,
2581,
2616,
2617,
2801,
2803,
2808,
2817,
2827,
2828,
2882,
2883,
3086,
3088,
3094,
3103,
3113,
3114,
3136,
3137,
3337,
3339,
3344,
3352,
3362,
3363,
3409,
3410,
3613,
3615,
3621,
3630,
3639,
3640,
3669,
3670,
3866,
3868,
3874,
3883,
3893,
3894,
4021,
4022,
4202,
4204,
4210,
4219,
4229,
4230,
4297,
4298,
4497,
4499,
4504,
4512,
4522,
4523,
4619,
4620,
4821
]
}
|
{
"red_pajama_v2": {
"ccnet_original_length": 4821,
"ccnet_original_nlines": 131,
"rps_doc_curly_bracket": 0.000622280000243336,
"rps_doc_ldnoobw_words": 0,
"rps_doc_lorem_ipsum": 0,
"rps_doc_stop_word_fraction": 0.3380816578865051,
"rps_doc_ut1_blacklist": 0,
"rps_doc_frac_all_caps_words": 0.07692307978868484,
"rps_doc_frac_lines_end_with_ellipsis": 0.11363635957241058,
"rps_doc_frac_no_alph_words": 0.24786324799060822,
"rps_doc_frac_unique_words": 0.43821656703948975,
"rps_doc_mean_word_length": 4.6917195320129395,
"rps_doc_num_sentences": 46,
"rps_doc_symbol_to_word_ratio": 0.015194679610431194,
"rps_doc_unigram_entropy": 5.2276291847229,
"rps_doc_word_count": 785,
"rps_doc_frac_chars_dupe_10grams": 0,
"rps_doc_frac_chars_dupe_5grams": 0.046701058745384216,
"rps_doc_frac_chars_dupe_6grams": 0.015748029574751854,
"rps_doc_frac_chars_dupe_7grams": 0,
"rps_doc_frac_chars_dupe_8grams": 0,
"rps_doc_frac_chars_dupe_9grams": 0,
"rps_doc_frac_chars_top_2gram": 0.022807490080595016,
"rps_doc_frac_chars_top_3gram": 0.008688570000231266,
"rps_doc_frac_chars_top_4gram": 0.008960089646279812,
"rps_doc_books_importance": -467.20318603515625,
"rps_doc_books_importance_length_correction": -467.20318603515625,
"rps_doc_openwebtext_importance": -275.5937194824219,
"rps_doc_openwebtext_importance_length_correction": -275.5937194824219,
"rps_doc_wikipedia_importance": -127.17427062988281,
"rps_doc_wikipedia_importance_length_correction": -127.17427062988281
},
"fasttext": {
"dclm": 0.1029360294342041,
"english": 0.8869999051094055,
"fineweb_edu_approx": 1.6027640104293823,
"eai_general_math": 0.926551342010498,
"eai_open_web_math": 0.7329416275024414,
"eai_web_code": 0.1741763949394226
}
}
|
{
"free_decimal_correspondence": {
"primary": {
"code": "512.482",
"labels": {
"level_1": "Science and Natural history",
"level_2": "Mathematics",
"level_3": "Algebra"
}
},
"secondary": {
"code": "005.1",
"labels": {
"level_1": "General works, books and libraries, information sciences",
"level_2": "",
"level_3": "Computer programming"
}
}
},
"bloom_cognitive_process": {
"primary": {
"code": "3",
"label": "Apply"
},
"secondary": {
"code": "2",
"label": "Understand"
}
},
"bloom_knowledge_domain": {
"primary": {
"code": "3",
"label": "Procedural"
},
"secondary": {
"code": "2",
"label": "Conceptual"
}
},
"document_type_v1": {
"primary": {
"code": "5",
"label": "Social/Forum"
},
"secondary": {
"code": "-1",
"label": "Abstain"
}
},
"extraction_artifacts": {
"primary": {
"code": "0",
"label": "No Artifacts"
},
"secondary": {
"code": "-1",
"label": "Abstain"
}
},
"missing_content": {
"primary": {
"code": "0",
"label": "No missing content"
},
"secondary": {
"code": "-1",
"label": "Abstain"
}
},
"document_type_v2": {
"primary": {
"code": "18",
"label": "Q&A Forum"
},
"secondary": {
"code": "8",
"label": "Documentation"
}
},
"reasoning_depth": {
"primary": {
"code": "3",
"label": "Intermediate Reasoning"
},
"secondary": {
"code": "4",
"label": "Advanced Reasoning"
}
},
"technical_correctness": {
"primary": {
"code": "6",
"label": "Not Applicable/Indeterminate"
},
"secondary": {
"code": "3",
"label": "Mostly Correct"
}
},
"education_level": {
"primary": {
"code": "4",
"label": "Graduate/Expert Level"
},
"secondary": {
"code": "3",
"label": "Undergraduate Level"
}
}
}
|
672f1e42c33a7f9846924a2431ea77df
|
-3,407,033,329,767,478,000
|
We use cookies to allow us and selected partners to improve your experience and our advertising. By continuing to browse you consent to our use of cookies. You can understand more and change your cookies preferences here.
Reviews based on facts
Our rigorous tests find the facts, and our impartial reviews tell you the truth about how products perform. First month £5, then £9.99 per month, cancel anytime.
Try Which?
29 October 2020
Video doorbell security: How to stop your smart doorbell from being hacked
Smart doorbells without the right security could provide a backdoor onto your home network for hackers.
Martin Pratt
Being able to see who's at your door from your phone screen is inarguably useful, but how do you stop them letting unwanted guests into your home wi-fi network?
Smart doorbells have a camera in them and they are connected to an app on your phone. When the doorbell rings you get an alert on your phone so you can see, and even speaker, to whoever is at your door.
With masses of brands, some more recognisable that others, releasing doorbells that cost anywhere from £30 to £300, our tests have found some don't do enough to stop hackers infiltrating your network.
How smart video doorbells get hacked
As with most internet-connected devices a strong password is vital. The easier your password is to break, the easier it will be for a hacker to gain access to your device and network. We've found doorbells with weak default passwords, such as '123456' or '000000' that will take a hacker using advanced password spamming software seconds to break. Worse still, not all of them press you to change your password. Don't wait for a reminder, change the username and password yourself.
Smart devices use their internet connection to send packets of data from the device to centres, some of which are on the other side of the world. This is normal, but we expect this data to be encrypted. Encrypted data means it's all been scrambled, so anyone managing to intercept it on its journey might as well be looking at Sanskrit: it will make no sense. If it's sending data unencryted then things like your device password, and even your wi-fi password could be visible to hackers who intercept the data.
There's also the risk of a full device takeover. This is as dicey as it sounds, a hacker would assume full control of your doorbell. Hackers could ring the doorbell at all hours of the night and change the volume. This is more mischievous than dangerous, but those same hackers could install malware on the doorbell that would give them unbridled access to your home network, and potentially other devices on it.
What happens if my doorbell gets hacked
You'll probably never know, but the risks to your privacy and security are serious.
Device control
Having your doorbell ring at all hours of the night may just be an annoyance for some, but for elderly or vulnerable people this could be terrifying. They will also have access to your recordings and potentially when the house was empty.
Home network exploitation
Just like the doorbell is attached to the door of your home, a hacked smart doorbell can be a doorway to your entire network. Think of the amount of connected devices there are in your home and the kind of personal data on them. Laptops, smartphones, TVs; they are all at risk if a vulnerable doorbell gives a hacker access to you home network.
Online botnets
Botnets are an army of slave devices that have been hacked for nefarious purposes. The collective power of this army of smart devices is used to mount large scale attacks on companies, websites and servers. Devices with weak security, such as some of the doorbells we've tested, are easy prey for botnet recruiters.
How to keep your smart doorbell safe from hackers
Some smart doorbells have such catastrophic security failures that nothing short of a full redesign will get them up to security scratch, but other vulnerabilities can be avoided by making some changes to your device.
Change the password
There isn't a smart device in your home where you shouldn't change the password for it. The default one will almost always be weak and easy to hack. The most secure passwords you can set yourself will be a combination of three random words.
Keep it up to date
Software updates are usually beefing up security rather than adding new features. Turn the auto-update on if you can, or check regularly for new updates if you can't. It's not just the device itself, check the connected apps on your phone for updates, too.
Use two-factor authentication
Every additional layer of security is another hurdle for a hacker to climb over, and two-factor authentication is a tall hurdle. 2FA is an extra one-time use password that's sent when you try and login. It's usually sent to your phone so only you can see it, and once it's used you'd need to request a new one next time.
Turn it off
This sounds flippant, but we're serious. If you've bought a device that you suspect is unsecure then turn it off. It really isn't worth the risk to keep using a doorbell that's easy to hack. Our smart doorbell reviews specify if we found any significant security risks, so you can use them with peace of mind.
Delete your recordings and data
If you don't need the recordings taken by your doorbell then delete them, the same goes for any kept on cloud servers by doorbells with additional subscriptions. If you ever want to get rid of the camera then be sure to restore it its factory settings to ensure any of your personal data is deleted.
How to buy a secure smart video doorbell
Smart doorbells have gone from a relatively niche smart device to regular façade feature. Next time you're walking down the street just take note of how many doorbells have lenses.
There are plenty of well known brands, such as Nest, Arlo and Ring, which make them, as well numerous smaller brands releasing models for a fraction of the price. Unfortunately, it's these cheaper brands that you need to be wary of. They often look very similar, or even identical, but have a different brand name.
Our testing found many of these cheaper devices had security flaws.
You can't always trust customer reviews
We see time and time again that these low cost, similar-looking devices have hundreds if not thousands of glowing reviews. Pay attention to the negative ones to see if anyone has reported security flaws, and don't always take positive reviews at face value. Our research into fake reviews has found that they are far more common on lesser known, or unknown brands.
Check the brand
Have you heard of them, do they have a website, phone number or email address? If not then you should be wary. If you can't find them online then there's no one to contact if things go wrong.
Do your research
You should take extra care when buying any device that involves safety or security. As well as checking customer reviews carefully, look for reviews on established tech websites – including of course, our own range of smart doorbell reviews.
How we test smart video doorbell security
Our smart video doorbell reviews assess how easy they are to use, the quality of the camera and their security. Only those that meet our high expectations for performance and security will be awarded a Best Buy.
Here are some of the security aspects we test:
• Password security: We check whether the device uses a weak default password, and if you are encouraged to change it, whether you have to choose a secure password (as covered above).
• Data encryption: We analyse what data the doorbell is sending and receiving to ensure that no important data, such as the password, is being sent without proper encryption.
• Decommissioning: At the end of our testing, we reset the product to factory settings and delete the app. We then try to set up the product again to see if any of your data has been retained, which would be a risk if you wanted to sell the doorbell.
If we find any significant vulnerabilities then we report them to the manufacture to share our findings. We urge the company to fix the issue and if they don't we won't recommend the camera.
View all Smart video doorbells
|
{
"url": "https://www.which.co.uk/reviews/smart-video-doorbells/article/video-doorbell-security-how-to-stop-your-smart-doorbell-from-being-hacked-aCklb4Y4rZnw",
"source_domain": "www.which.co.uk",
"snapshot_id": "crawl=CC-MAIN-2021-21",
"warc_metadata": {
"Content-Length": "105624",
"Content-Type": "application/http; msgtype=response",
"WARC-Block-Digest": "sha1:GEAHP7SM77QU5ZCEEC4DIO7ZOHHMHWYL",
"WARC-Concurrent-To": "<urn:uuid:7535fe55-df09-409b-8c67-e84becd9e0bc>",
"WARC-Date": "2021-05-06T20:59:32Z",
"WARC-IP-Address": "99.84.189.116",
"WARC-Identified-Payload-Type": "text/html",
"WARC-Payload-Digest": "sha1:SD7CB3U6T2J56RYD3GNZ4KKJVLBDEV2V",
"WARC-Record-ID": "<urn:uuid:80afae58-5349-4c8e-ac7a-53c6d622fa1b>",
"WARC-Target-URI": "https://www.which.co.uk/reviews/smart-video-doorbells/article/video-doorbell-security-how-to-stop-your-smart-doorbell-from-being-hacked-aCklb4Y4rZnw",
"WARC-Truncated": null,
"WARC-Type": "response",
"WARC-Warcinfo-ID": "<urn:uuid:3afd2ec0-2325-4233-a8fd-5deae30b4680>"
},
"warc_info": "isPartOf: CC-MAIN-2021-21\r\npublisher: Common Crawl\r\ndescription: Wide crawl of the web for May 2021\r\noperator: Common Crawl Admin (info@commoncrawl.org)\r\nhostname: ip-10-67-67-16.ec2.internal\r\nsoftware: Apache Nutch 1.18 (modified, https://github.com/commoncrawl/nutch/)\r\nrobots: checked via crawler-commons 1.2-SNAPSHOT (https://github.com/crawler-commons/crawler-commons)\r\nformat: WARC File Format 1.1\r\nconformsTo: https://iipc.github.io/warc-specifications/specifications/warc-format/warc-1.1/"
}
|
{
"line_start_idx": [
0,
222,
223,
246,
408,
419,
435,
436,
511,
512,
616,
629,
630,
791,
792,
995,
996,
1197,
1198,
1235,
1236,
1718,
1719,
2231,
2232,
2645,
2646,
2686,
2687,
2771,
2772,
2787,
2788,
3026,
3027,
3053,
3054,
3399,
3400,
3415,
3416,
3732,
3733,
3783,
3784,
4002,
4003,
4023,
4024,
4265,
4266,
4285,
4286,
4543,
4544,
4574,
4575,
4896,
4897,
4909,
4910,
5220,
5221,
5253,
5254,
5554,
5555,
5596,
5597,
5778,
5779,
6094,
6095,
6163,
6164,
6204,
6205,
6570,
6571,
6587,
6588,
6781,
6782,
6799,
6800,
7042,
7043,
7085,
7086,
7298,
7299,
7346,
7347,
7533,
7710,
7963,
7964,
8155,
8156,
8157
],
"line_end_idx": [
222,
223,
246,
408,
419,
435,
436,
511,
512,
616,
629,
630,
791,
792,
995,
996,
1197,
1198,
1235,
1236,
1718,
1719,
2231,
2232,
2645,
2646,
2686,
2687,
2771,
2772,
2787,
2788,
3026,
3027,
3053,
3054,
3399,
3400,
3415,
3416,
3732,
3733,
3783,
3784,
4002,
4003,
4023,
4024,
4265,
4266,
4285,
4286,
4543,
4544,
4574,
4575,
4896,
4897,
4909,
4910,
5220,
5221,
5253,
5254,
5554,
5555,
5596,
5597,
5778,
5779,
6094,
6095,
6163,
6164,
6204,
6205,
6570,
6571,
6587,
6588,
6781,
6782,
6799,
6800,
7042,
7043,
7085,
7086,
7298,
7299,
7346,
7347,
7533,
7710,
7963,
7964,
8155,
8156,
8157,
8187
]
}
|
{
"red_pajama_v2": {
"ccnet_original_length": 8187,
"ccnet_original_nlines": 99,
"rps_doc_curly_bracket": 0,
"rps_doc_ldnoobw_words": 0,
"rps_doc_lorem_ipsum": 0,
"rps_doc_stop_word_fraction": 0.47598785161972046,
"rps_doc_ut1_blacklist": 0,
"rps_doc_frac_all_caps_words": 0.0006078999722376466,
"rps_doc_frac_lines_end_with_ellipsis": 0,
"rps_doc_frac_no_alph_words": 0.11975684016942978,
"rps_doc_frac_unique_words": 0.35091421008110046,
"rps_doc_mean_word_length": 4.593530178070068,
"rps_doc_num_sentences": 73,
"rps_doc_symbol_to_word_ratio": 0,
"rps_doc_unigram_entropy": 5.488510608673096,
"rps_doc_word_count": 1422,
"rps_doc_frac_chars_dupe_10grams": 0,
"rps_doc_frac_chars_dupe_5grams": 0.006123700179159641,
"rps_doc_frac_chars_dupe_6grams": 0.006123700179159641,
"rps_doc_frac_chars_dupe_7grams": 0,
"rps_doc_frac_chars_dupe_8grams": 0,
"rps_doc_frac_chars_dupe_9grams": 0,
"rps_doc_frac_chars_top_2gram": 0.006889159791171551,
"rps_doc_frac_chars_top_3gram": 0.008266990073025227,
"rps_doc_frac_chars_top_4gram": 0.003674220060929656,
"rps_doc_books_importance": -747.65380859375,
"rps_doc_books_importance_length_correction": -747.65380859375,
"rps_doc_openwebtext_importance": -467.1055603027344,
"rps_doc_openwebtext_importance_length_correction": -467.1055603027344,
"rps_doc_wikipedia_importance": -308.017578125,
"rps_doc_wikipedia_importance_length_correction": -308.017578125
},
"fasttext": {
"dclm": 0.2207968831062317,
"english": 0.954897403717041,
"fineweb_edu_approx": 1.6138726472854614,
"eai_general_math": 0.017273779958486557,
"eai_open_web_math": 0.13095200061798096,
"eai_web_code": 0.02745378017425537
}
}
|
{
"free_decimal_correspondence": {
"primary": {
"code": "005.82",
"labels": {
"level_1": "General works, books and libraries, information sciences",
"level_2": "",
"level_3": "Computer programming"
}
},
"secondary": {
"code": "621.392",
"labels": {
"level_1": "Industrial arts, Technology, and Engineering",
"level_2": "Engineering",
"level_3": "Mechanical engineering and Machinery"
}
}
},
"bloom_cognitive_process": {
"primary": {
"code": "3",
"label": "Apply"
},
"secondary": {
"code": "2",
"label": "Understand"
}
},
"bloom_knowledge_domain": {
"primary": {
"code": "3",
"label": "Procedural"
},
"secondary": {
"code": "2",
"label": "Conceptual"
}
},
"document_type_v1": {
"primary": {
"code": "3",
"label": "Reference/Encyclopedic/Educational"
},
"secondary": {
"code": "14",
"label": "Reviews/Critiques"
}
},
"extraction_artifacts": {
"primary": {
"code": "0",
"label": "No Artifacts"
},
"secondary": {
"code": "-1",
"label": "Abstain"
}
},
"missing_content": {
"primary": {
"code": "0",
"label": "No missing content"
},
"secondary": {
"code": "-1",
"label": "Abstain"
}
},
"document_type_v2": {
"primary": {
"code": "10",
"label": "Knowledge Article"
},
"secondary": {
"code": "23",
"label": "Tutorial"
}
},
"reasoning_depth": {
"primary": {
"code": "2",
"label": "Basic Reasoning"
},
"secondary": {
"code": "3",
"label": "Intermediate Reasoning"
}
},
"technical_correctness": {
"primary": {
"code": "4",
"label": "Highly Correct"
},
"secondary": {
"code": "3",
"label": "Mostly Correct"
}
},
"education_level": {
"primary": {
"code": "1",
"label": "General Audience"
},
"secondary": {
"code": "2",
"label": "High School Level"
}
}
}
|
672f1e42c33a7f9846924a2431ea77df
|
-5,324,070,659,668,987,000
|
What is meta? ×
Meta Stack Exchange is where users like you discuss bugs, features, and support issues that affect the software powering all 134 Stack Exchange communities.
Is there a way to have the questions in the list of flagged things as shown in the mod tools not be dimmed unless the point is on them? That renders the page more or less unreadable using, say, my iPod Touch. In any case, it is simple too distracting even in my desktop computers.
In general, the fascination with :hover in these sites is quite unnerving! :)
share|improve this question
Well, since I don't have a flags list I can look at I can't really divine the purpose of the dimming, but usually on these sites dimming signifies something. Hopefully someone will chime in with that meaning. – Lance Roberts Jun 26 '11 at 0:31
2
Questions are dimmed in the mod queue when the moderator has already viewed them before. – Robert Harvey Jun 26 '11 at 2:02
@Robert, There are surely other ways to provide that information which do not turn most of the content in the page unreadable, and make the page behave like a video game! – Mariano Suárez-Alvarez Jun 26 '11 at 15:41
I'm not a fan of the dimming, personally. – Robert Harvey Jun 26 '11 at 15:41
You must log in to answer this question.
Browse other questions tagged .
|
{
"url": "http://meta.stackexchange.com/questions/96438/dimmed-things-in-mod-tools",
"source_domain": "meta.stackexchange.com",
"snapshot_id": "crawl=CC-MAIN-2014-52",
"warc_metadata": {
"Content-Length": "58174",
"Content-Type": "application/http; msgtype=response",
"WARC-Block-Digest": "sha1:5LDCHXIDIZLFX2NUYPKNC4ZJLNLMGR3K",
"WARC-Concurrent-To": "<urn:uuid:2d59d476-5435-44f4-8afa-e939dca686eb>",
"WARC-Date": "2014-12-27T13:13:57Z",
"WARC-IP-Address": "198.252.206.140",
"WARC-Identified-Payload-Type": null,
"WARC-Payload-Digest": "sha1:6LN5NOF7HTIU4ONLVHV6CA6O4MO63L3E",
"WARC-Record-ID": "<urn:uuid:29454554-f3b8-4b29-9336-cbab05b178f1>",
"WARC-Target-URI": "http://meta.stackexchange.com/questions/96438/dimmed-things-in-mod-tools",
"WARC-Truncated": null,
"WARC-Type": "response",
"WARC-Warcinfo-ID": "<urn:uuid:5af7fe0e-fd0f-4b43-abd1-14e300106bd8>"
},
"warc_info": "robots: classic\r\nhostname: ip-10-231-17-201.ec2.internal\r\nsoftware: Nutch 1.6 (CC)/CC WarcExport 1.0\r\nisPartOf: CC-MAIN-2014-52\r\noperator: CommonCrawl Admin\r\ndescription: Wide crawl of the web with URLs provided by Blekko for December 2014\r\npublisher: CommonCrawl\r\nformat: WARC File Format 1.0\r\nconformsTo: http://bibnum.bnf.fr/WARC/WARC_ISO_28500_version1_latestdraft.pdf"
}
|
{
"line_start_idx": [
0,
16,
173,
174,
455,
456,
534,
535,
563,
568,
813,
817,
942,
947,
1164,
1169,
1248,
1249,
1290,
1291
],
"line_end_idx": [
16,
173,
174,
455,
456,
534,
535,
563,
568,
813,
817,
942,
947,
1164,
1169,
1248,
1249,
1290,
1291,
1322
]
}
|
{
"red_pajama_v2": {
"ccnet_original_length": 1322,
"ccnet_original_nlines": 19,
"rps_doc_curly_bracket": 0,
"rps_doc_ldnoobw_words": 0,
"rps_doc_lorem_ipsum": 0,
"rps_doc_stop_word_fraction": 0.3922261595726013,
"rps_doc_ut1_blacklist": 0,
"rps_doc_frac_all_caps_words": 0.014134280383586884,
"rps_doc_frac_lines_end_with_ellipsis": 0,
"rps_doc_frac_no_alph_words": 0.2226148396730423,
"rps_doc_frac_unique_words": 0.6111111044883728,
"rps_doc_mean_word_length": 4.363247871398926,
"rps_doc_num_sentences": 13,
"rps_doc_symbol_to_word_ratio": 0,
"rps_doc_unigram_entropy": 4.696335792541504,
"rps_doc_word_count": 234,
"rps_doc_frac_chars_dupe_10grams": 0,
"rps_doc_frac_chars_dupe_5grams": 0.05974534898996353,
"rps_doc_frac_chars_dupe_6grams": 0.043095000088214874,
"rps_doc_frac_chars_dupe_7grams": 0.043095000088214874,
"rps_doc_frac_chars_dupe_8grams": 0,
"rps_doc_frac_chars_dupe_9grams": 0,
"rps_doc_frac_chars_top_2gram": 0.019588639959692955,
"rps_doc_frac_chars_top_3gram": 0.02742408961057663,
"rps_doc_frac_chars_top_4gram": 0.03525954857468605,
"rps_doc_books_importance": -128.787353515625,
"rps_doc_books_importance_length_correction": -128.787353515625,
"rps_doc_openwebtext_importance": -79.15315246582031,
"rps_doc_openwebtext_importance_length_correction": -79.15315246582031,
"rps_doc_wikipedia_importance": -64.90951538085938,
"rps_doc_wikipedia_importance_length_correction": -64.90922546386719
},
"fasttext": {
"dclm": 0.03987115994095802,
"english": 0.9137821793556213,
"fineweb_edu_approx": 1.1489722728729248,
"eai_general_math": 0.2667248249053955,
"eai_open_web_math": 0.5547212958335876,
"eai_web_code": 0.000533280021045357
}
}
|
{
"free_decimal_correspondence": {
"primary": {
"code": "005.4",
"labels": {
"level_1": "General works, books and libraries, information sciences",
"level_2": "",
"level_3": "Computer programming"
}
},
"secondary": {
"code": "025.04",
"labels": {
"level_1": "General works, books and libraries, information sciences",
"level_2": "Library science",
"level_3": "Library administration"
}
}
},
"bloom_cognitive_process": {
"primary": {
"code": "2",
"label": "Understand"
},
"secondary": {
"code": "3",
"label": "Apply"
}
},
"bloom_knowledge_domain": {
"primary": {
"code": "2",
"label": "Conceptual"
},
"secondary": {
"code": "3",
"label": "Procedural"
}
},
"document_type_v1": {
"primary": {
"code": "5",
"label": "Social/Forum"
},
"secondary": {
"code": "-1",
"label": "Abstain"
}
},
"extraction_artifacts": {
"primary": {
"code": "3",
"label": "Irrelevant Content"
},
"secondary": {
"code": "-1",
"label": "Abstain"
}
},
"missing_content": {
"primary": {
"code": "0",
"label": "No missing content"
},
"secondary": {
"code": "-1",
"label": "Abstain"
}
},
"document_type_v2": {
"primary": {
"code": "18",
"label": "Q&A Forum"
},
"secondary": {
"code": "8",
"label": "Documentation"
}
},
"reasoning_depth": {
"primary": {
"code": "2",
"label": "Basic Reasoning"
},
"secondary": {
"code": "1",
"label": "No Reasoning"
}
},
"technical_correctness": {
"primary": {
"code": "6",
"label": "Not Applicable/Indeterminate"
},
"secondary": {
"code": "4",
"label": "Highly Correct"
}
},
"education_level": {
"primary": {
"code": "1",
"label": "General Audience"
},
"secondary": {
"code": "2",
"label": "High School Level"
}
}
}
|
672f1e42c33a7f9846924a2431ea77df
|
-739,502,683,073,418,000
|
The second smallest portable media player sold by Apple. Older models rely on buttons on the player to control play pause etc. New version(s) have an easy-to-use touch screen.
learn more… | top users | synonyms
1
vote
1answer
650 views
Will iPhone remote earbuds work with 6th Gen iPod Nano?
....will iPhone remote earbuds work with 6th Gen iPod Nano? My brief internet search (random Google searches, Apple forums) yielded no results.
4
votes
1answer
371 views
How do I rate songs on the 5th gen iPod nano?
How do I rate songs on the 5th generation iPod nano? Is it possible? Do they get copied back to iTunes?
4
votes
2answers
397 views
How splash-proof and knock-proof is the iPod nano?
I'm looking at buying an iPod Nano with a watchband to use as a watch. My concern is that as a watch it will have to take a certain amount of incidental knocks and splashes. I don't want to have the ...
0
votes
1answer
134 views
Scrubbing chapters and not losing stop points on audiobooks on iPod nano
Is there a way to scrub through a chapter on the 6th gen nano? I have only been able to scrub chapter to chapter which isn't useful when you become distracted and want to rewind 30 seconds. Is there a ...
3
votes
5answers
23k views
How do I prevent my iPod nano's screen from going to sleep?
I have broken my desk clock and am trying to use my square nano to show me time instead. The problem is that when I set the screen to show time and leave it for some time the screen dims and ...
3
votes
0answers
973 views
An alternative to iPod nano 6g? [closed]
I'm looking for a good, compact MP3 player that can also double as a pedometer (or at least as a part thereof). I wouldn't hesitate to buy a nano 6g if not for some of its 'features' that I'd rather ...
2
votes
1answer
254 views
iPod in recovery mode, how do I make it stop?
Why is my iPod Nano 6th generation playing in recovery mode? How do I take it off of recovery mode?
0
votes
6answers
3k views
Remove video from iPod Nano 6th-generation
I did not know that we can't play videos on an iPod nano 6th generation. I added a video (180 MB) to my iPod but I can't access it . I cant see it in iTunes nor on my iPod. But when I connect my iPod ...
2
votes
5answers
4k views
How do you use your iPod shuffle or nano?
I bought my first Apple product a few months ago, an iPod shuffle, a tiny little music gadget that's fun to play with. However its getting a little boring because I don't know what I can do with it or ...
0
votes
3answers
862 views
Upload video to iPod directly without sync-ing
We have a number of iPods and a number of computers and the fact that they need to be matched one-to-one for iTunes sync'ing to work is really a pain. Is there a way for me to upload a video directly ...
4
votes
2answers
6k views
What's a good iTunes alternative to use with my iPod nano 6g?
I'm looking for an iTunes alternative for my new iPod nano 6g. I've used sharepod before but it doesn't work with the nano 6g—I can upload songs but they're not being recognized by the iPod database. ...
1
vote
2answers
547 views
Great iPod Click Wheel Games for Kids
My niece has got a used iPod nano (not the newest model); in the App Store are about 50 games for iPods with Click Wheel. What game can you recommend?
1
vote
1answer
1k views
Playlist on ipod nano 5th gen
I have been trying to sync my playlists from itunes with my new ipod nano 5th gen, but the podcasts don't sync (they did sync on my old 2nd gen). Any suggestions for how to fix this? The music ...
4
votes
3answers
4k views
Did the iPod Nano dock connector change from 5th to 6th generation?
Does anyone know if the dock connector change when Apple upgraded from 5th to 6th generation?
4
votes
2answers
834 views
Is it possible to shut down an Ipod nano 6th generation?
If yes, how? If no, why such a decision?
1
vote
2answers
1k views
Will a “Mac format” iPod nano (2gen) work on a PC?
I have an old 8GB iPod nano (2nd gen, I think). When I plug it into iTunes, one of the things on the status page is "Format: Macintosh". I no longer use this iPod, so I'm thinking of giving it to my ...
2
votes
3answers
9k views
Can I change the clock on the 6th gen Nano to digital instead of analog?
Everyone wants a iPod Nano watch, right? All the videos I see are on an analog clock (you know, the one with hands.) Can you change the clock to digital, rather than analog?
1
vote
1answer
2k views
How can I change the VoiceOver language for a song on my 6th gen iPod Nano?
Is it possible to change language used for reading song album/artist/title for certain songs? I.e. when I use slovak as default iPod nano language, but I have songs with english titles, I would like ...
5
votes
3answers
3k views
How can I delete icons from the 6th generation iPod nano?
Is this even possible? I will never use like 90% of them and I'd like to hide them.
|
{
"url": "http://apple.stackexchange.com/questions/tagged/ipod-nano?page=2&sort=newest&pagesize=15",
"source_domain": "apple.stackexchange.com",
"snapshot_id": "crawl=CC-MAIN-2016-26",
"warc_metadata": {
"Content-Length": "95613",
"Content-Type": "application/http; msgtype=response",
"WARC-Block-Digest": "sha1:7T2QXBE3IUKUQSFF6TVE53CANVUIFXXX",
"WARC-Concurrent-To": "<urn:uuid:81e0a820-af16-4253-a272-cff78fdf1901>",
"WARC-Date": "2016-07-02T02:27:29Z",
"WARC-IP-Address": "151.101.1.69",
"WARC-Identified-Payload-Type": null,
"WARC-Payload-Digest": "sha1:QDQW2G2WS7S6VPK3SLUDFLY3KPXAKXDF",
"WARC-Record-ID": "<urn:uuid:93dc7794-f0ee-46db-b501-a7e727fb158f>",
"WARC-Target-URI": "http://apple.stackexchange.com/questions/tagged/ipod-nano?page=2&sort=newest&pagesize=15",
"WARC-Truncated": null,
"WARC-Type": "response",
"WARC-Warcinfo-ID": "<urn:uuid:2784d802-c5d7-4c95-9456-6f5f6b20af81>"
},
"warc_info": "robots: classic\r\nhostname: ip-10-164-35-72.ec2.internal\r\nsoftware: Nutch 1.6 (CC)/CC WarcExport 1.0\r\nisPartOf: CC-MAIN-2016-26\r\noperator: CommonCrawl Admin\r\ndescription: Wide crawl of the web for June 2016\r\npublisher: CommonCrawl\r\nformat: WARC File Format 1.0\r\nconformsTo: http://bibnum.bnf.fr/WARC/WARC_ISO_28500_version1_latestdraft.pdf"
}
|
{
"line_start_idx": [
0,
176,
177,
212,
213,
215,
220,
228,
238,
239,
295,
296,
440,
442,
448,
456,
466,
467,
513,
514,
618,
620,
626,
635,
645,
646,
697,
698,
901,
903,
909,
917,
927,
928,
1001,
1002,
1207,
1209,
1215,
1224,
1234,
1235,
1295,
1296,
1491,
1493,
1499,
1508,
1518,
1519,
1560,
1561,
1764,
1766,
1772,
1780,
1790,
1791,
1837,
1838,
1938,
1940,
1946,
1955,
1964,
1965,
2008,
2009,
2213,
2215,
2221,
2230,
2239,
2240,
2282,
2283,
2488,
2490,
2496,
2505,
2515,
2516,
2563,
2564,
2768,
2770,
2776,
2785,
2794,
2795,
2857,
2858,
3062,
3064,
3069,
3078,
3088,
3089,
3127,
3128,
3279,
3281,
3286,
3294,
3303,
3304,
3334,
3335,
3532,
3534,
3540,
3549,
3558,
3559,
3627,
3628,
3722,
3724,
3730,
3739,
3749,
3750,
3807,
3808,
3849,
3851,
3856,
3865,
3874,
3875,
3926,
3927,
4130,
4132,
4138,
4147,
4156,
4157,
4230,
4231,
4405,
4407,
4412,
4420,
4429,
4430,
4506,
4507,
4710,
4712,
4718,
4727,
4736,
4737,
4795,
4796
],
"line_end_idx": [
176,
177,
212,
213,
215,
220,
228,
238,
239,
295,
296,
440,
442,
448,
456,
466,
467,
513,
514,
618,
620,
626,
635,
645,
646,
697,
698,
901,
903,
909,
917,
927,
928,
1001,
1002,
1207,
1209,
1215,
1224,
1234,
1235,
1295,
1296,
1491,
1493,
1499,
1508,
1518,
1519,
1560,
1561,
1764,
1766,
1772,
1780,
1790,
1791,
1837,
1838,
1938,
1940,
1946,
1955,
1964,
1965,
2008,
2009,
2213,
2215,
2221,
2230,
2239,
2240,
2282,
2283,
2488,
2490,
2496,
2505,
2515,
2516,
2563,
2564,
2768,
2770,
2776,
2785,
2794,
2795,
2857,
2858,
3062,
3064,
3069,
3078,
3088,
3089,
3127,
3128,
3279,
3281,
3286,
3294,
3303,
3304,
3334,
3335,
3532,
3534,
3540,
3549,
3558,
3559,
3627,
3628,
3722,
3724,
3730,
3739,
3749,
3750,
3807,
3808,
3849,
3851,
3856,
3865,
3874,
3875,
3926,
3927,
4130,
4132,
4138,
4147,
4156,
4157,
4230,
4231,
4405,
4407,
4412,
4420,
4429,
4430,
4506,
4507,
4710,
4712,
4718,
4727,
4736,
4737,
4795,
4796,
4879
]
}
|
{
"red_pajama_v2": {
"ccnet_original_length": 4879,
"ccnet_original_nlines": 155,
"rps_doc_curly_bracket": 0,
"rps_doc_ldnoobw_words": 0,
"rps_doc_lorem_ipsum": 0,
"rps_doc_stop_word_fraction": 0.3756805658340454,
"rps_doc_ut1_blacklist": 0,
"rps_doc_frac_all_caps_words": 0.0399274006485939,
"rps_doc_frac_lines_end_with_ellipsis": 0.0705128163099289,
"rps_doc_frac_no_alph_words": 0.1551724076271057,
"rps_doc_frac_unique_words": 0.36451613903045654,
"rps_doc_mean_word_length": 4.0107526779174805,
"rps_doc_num_sentences": 64,
"rps_doc_symbol_to_word_ratio": 0.011796729639172554,
"rps_doc_unigram_entropy": 5.171539783477783,
"rps_doc_word_count": 930,
"rps_doc_frac_chars_dupe_10grams": 0.024128690361976624,
"rps_doc_frac_chars_dupe_5grams": 0.09008043259382248,
"rps_doc_frac_chars_dupe_6grams": 0.04718498885631561,
"rps_doc_frac_chars_dupe_7grams": 0.036461129784584045,
"rps_doc_frac_chars_dupe_8grams": 0.036461129784584045,
"rps_doc_frac_chars_dupe_9grams": 0.024128690361976624,
"rps_doc_frac_chars_top_2gram": 0.05147453024983406,
"rps_doc_frac_chars_top_3gram": 0.008042899891734123,
"rps_doc_frac_chars_top_4gram": 0.011260050348937511,
"rps_doc_books_importance": -523.8114624023438,
"rps_doc_books_importance_length_correction": -523.8114624023438,
"rps_doc_openwebtext_importance": -288.0964660644531,
"rps_doc_openwebtext_importance_length_correction": -288.0964660644531,
"rps_doc_wikipedia_importance": -176.16908264160156,
"rps_doc_wikipedia_importance_length_correction": -176.16908264160156
},
"fasttext": {
"dclm": 0.07933717966079712,
"english": 0.9550382494926453,
"fineweb_edu_approx": 1.0034834146499634,
"eai_general_math": 0.005082069896161556,
"eai_open_web_math": 0.14071476459503174,
"eai_web_code": 0.0006318700034171343
}
}
|
{
"free_decimal_correspondence": {
"primary": {
"code": "004.678",
"labels": {
"level_1": "General works, books and libraries, information sciences",
"level_2": "",
"level_3": "Computers and Computer science"
}
},
"secondary": {
"code": "004.16",
"labels": {
"level_1": "General works, books and libraries, information sciences",
"level_2": "",
"level_3": "Computers and Computer science"
}
}
},
"bloom_cognitive_process": {
"primary": {
"code": "3",
"label": "Apply"
},
"secondary": {
"code": "2",
"label": "Understand"
}
},
"bloom_knowledge_domain": {
"primary": {
"code": "3",
"label": "Procedural"
},
"secondary": {
"code": "2",
"label": "Conceptual"
}
},
"document_type_v1": {
"primary": {
"code": "5",
"label": "Social/Forum"
},
"secondary": {
"code": "3",
"label": "Reference/Encyclopedic/Educational"
}
},
"extraction_artifacts": {
"primary": {
"code": "0",
"label": "No Artifacts"
},
"secondary": {
"code": "-1",
"label": "Abstain"
}
},
"missing_content": {
"primary": {
"code": "0",
"label": "No missing content"
},
"secondary": {
"code": "-1",
"label": "Abstain"
}
},
"document_type_v2": {
"primary": {
"code": "18",
"label": "Q&A Forum"
},
"secondary": {
"code": "21",
"label": "Customer Support"
}
},
"reasoning_depth": {
"primary": {
"code": "2",
"label": "Basic Reasoning"
},
"secondary": {
"code": "1",
"label": "No Reasoning"
}
},
"technical_correctness": {
"primary": {
"code": "3",
"label": "Mostly Correct"
},
"secondary": {
"code": "2",
"label": "Partially Correct"
}
},
"education_level": {
"primary": {
"code": "1",
"label": "General Audience"
},
"secondary": {
"code": "2",
"label": "High School Level"
}
}
}
|
672f1e42c33a7f9846924a2431ea77df
|
3,385,017,477,540,356,600
|
How do you link a C++ program to C functions
By using the extern "C" linkage specification around the C function declarations.
You should know about mangled function names and type-safe linkages. Then you should King of Heartsexplain how the extern "C" linkage specification statement turns that feature off during compilation so that the linker properly links function calls to C functions. Another acceptable answer is "I don't know. We never had to do that." Merely describing what a linker does would indicate to me that you do not understand the issue that underlies the question.
No comments:
Top Blogs
|
{
"url": "http://www.cinterviews.com/2010/02/how-do-you-link-c-program-to-c.html",
"source_domain": "www.cinterviews.com",
"snapshot_id": "crawl=CC-MAIN-2018-47",
"warc_metadata": {
"Content-Length": "83679",
"Content-Type": "application/http; msgtype=response",
"WARC-Block-Digest": "sha1:YS4H4CNU7AUMEWAVEAHCE3P74AGXHPHR",
"WARC-Concurrent-To": "<urn:uuid:d642a66e-98bf-46d7-b7d2-18b70da0b495>",
"WARC-Date": "2018-11-21T17:01:18Z",
"WARC-IP-Address": "216.58.217.179",
"WARC-Identified-Payload-Type": "application/xhtml+xml",
"WARC-Payload-Digest": "sha1:7ATY5Y7Z7JZHEJIOS5BKVPTSFYTWI42L",
"WARC-Record-ID": "<urn:uuid:b9e82b6d-39d0-457e-bee9-456ab34274de>",
"WARC-Target-URI": "http://www.cinterviews.com/2010/02/how-do-you-link-c-program-to-c.html",
"WARC-Truncated": null,
"WARC-Type": "response",
"WARC-Warcinfo-ID": "<urn:uuid:cc8c49fa-aa6a-4b7b-8036-af638f454679>"
},
"warc_info": "isPartOf: CC-MAIN-2018-47\r\npublisher: Common Crawl\r\ndescription: Wide crawl of the web for November 2018\r\noperator: Common Crawl Admin (info@commoncrawl.org)\r\nhostname: ip-10-63-80-227.ec2.internal\r\nsoftware: Apache Nutch 1.15 (modified, https://github.com/commoncrawl/nutch/)\r\nrobots: checked via crawler-commons 0.11-SNAPSHOT (https://github.com/crawler-commons/crawler-commons)\r\nformat: WARC File Format 1.1\r\nconformsTo: http://iipc.github.io/warc-specifications/specifications/warc-format/warc-1.1/"
}
|
{
"line_start_idx": [
0,
45,
46,
47,
129,
588,
589,
602,
603,
605
],
"line_end_idx": [
45,
46,
47,
129,
588,
589,
602,
603,
605,
614
]
}
|
{
"red_pajama_v2": {
"ccnet_original_length": 614,
"ccnet_original_nlines": 9,
"rps_doc_curly_bracket": 0,
"rps_doc_ldnoobw_words": 0,
"rps_doc_lorem_ipsum": 0,
"rps_doc_stop_word_fraction": 0.39316239953041077,
"rps_doc_ut1_blacklist": 0,
"rps_doc_frac_all_caps_words": 0.05982905998826027,
"rps_doc_frac_lines_end_with_ellipsis": 0,
"rps_doc_frac_no_alph_words": 0.12820513546466827,
"rps_doc_frac_unique_words": 0.6700000166893005,
"rps_doc_mean_word_length": 4.920000076293945,
"rps_doc_num_sentences": 7,
"rps_doc_symbol_to_word_ratio": 0,
"rps_doc_unigram_entropy": 4.008100509643555,
"rps_doc_word_count": 100,
"rps_doc_frac_chars_dupe_10grams": 0,
"rps_doc_frac_chars_dupe_5grams": 0.12195122241973877,
"rps_doc_frac_chars_dupe_6grams": 0,
"rps_doc_frac_chars_dupe_7grams": 0,
"rps_doc_frac_chars_dupe_8grams": 0,
"rps_doc_frac_chars_dupe_9grams": 0,
"rps_doc_frac_chars_top_2gram": 0.012195119634270668,
"rps_doc_frac_chars_top_3gram": 0.04878048971295357,
"rps_doc_frac_chars_top_4gram": 0.06910569220781326,
"rps_doc_books_importance": -43.20344924926758,
"rps_doc_books_importance_length_correction": -56.19374465942383,
"rps_doc_openwebtext_importance": -24.66756820678711,
"rps_doc_openwebtext_importance_length_correction": -37.65786361694336,
"rps_doc_wikipedia_importance": -11.566162109375,
"rps_doc_wikipedia_importance_length_correction": -24.556459426879883
},
"fasttext": {
"dclm": 0.7762857675552368,
"english": 0.9287766218185425,
"fineweb_edu_approx": 2.5827841758728027,
"eai_general_math": 0.4328467845916748,
"eai_open_web_math": 0.08307015895843506,
"eai_web_code": 0.037552300840616226
}
}
|
{
"free_decimal_correspondence": {
"primary": {
"code": "005.1332",
"labels": {
"level_1": "General works, books and libraries, information sciences",
"level_2": "",
"level_3": "Computer programming"
}
},
"secondary": {
"code": "005.133",
"labels": {
"level_1": "General works, books and libraries, information sciences",
"level_2": "",
"level_3": "Computer programming"
}
}
},
"bloom_cognitive_process": {
"primary": {
"code": "2",
"label": "Understand"
},
"secondary": {
"code": "3",
"label": "Apply"
}
},
"bloom_knowledge_domain": {
"primary": {
"code": "2",
"label": "Conceptual"
},
"secondary": {
"code": "3",
"label": "Procedural"
}
},
"document_type_v1": {
"primary": {
"code": "3",
"label": "Reference/Encyclopedic/Educational"
},
"secondary": {
"code": "4",
"label": "Code/Software"
}
},
"extraction_artifacts": {
"primary": {
"code": "0",
"label": "No Artifacts"
},
"secondary": {
"code": "3",
"label": "Irrelevant Content"
}
},
"missing_content": {
"primary": {
"code": "0",
"label": "No missing content"
},
"secondary": {
"code": "-1",
"label": "Abstain"
}
},
"document_type_v2": {
"primary": {
"code": "23",
"label": "Tutorial"
},
"secondary": {
"code": "8",
"label": "Documentation"
}
},
"reasoning_depth": {
"primary": {
"code": "2",
"label": "Basic Reasoning"
},
"secondary": {
"code": "3",
"label": "Intermediate Reasoning"
}
},
"technical_correctness": {
"primary": {
"code": "3",
"label": "Mostly Correct"
},
"secondary": {
"code": "4",
"label": "Highly Correct"
}
},
"education_level": {
"primary": {
"code": "3",
"label": "Undergraduate Level"
},
"secondary": {
"code": "2",
"label": "High School Level"
}
}
}
|
672f1e42c33a7f9846924a2431ea77df
|
-4,385,273,108,495,442,000
|
This article was originally published on The AWS of Things
Containers have gradually become a wide-spread and widely accepted technology. They are a standard unit of software that encapsulates your code, together with the dependencies required to make them function. With containers, you can be certain your system will function in similar manner even in different environments.
A Docker container image is a lightweight, standalone, executable package of software that includes everything needed to run an application: code, runtime, system tools, system libraries and settings.
As cloud services have become an integral part of application deployment, the need to effectively build, deploy and maintain containers in the cloud has become imperative.
There are a number of services designed to help developers achieve this, one of which is AWS Elastic Container Service — A highly available and high performance container orchestration service. It allows you to run, scale and secure docker containers in AWS.
In this tutorial, you will learn how to docker-ize a Laravel application. You will also learn how to deploy the image built to EC2 with AWS Elastic Container Service.
We will use AWS CodeBuild — “a fully managed continuous integration service that compiles source code, runs tests, and produces software packages that are ready to deploy” — to build our container image whichwill be stored on AWS Elastic Container Registry(ECR), an Amazon managed docker container registry — think Docker hub.
Requirements
1. A Windows, Linux or Mac PC with Docker installed
2. An AWS Account
3. Laravel
4. A Github Account
Get Composer
Firstly, we need to download Composer, a PHP package manager. We will use Composer to install Laravel and other dependencies. If you don’t already have it installed, you can download it here.
Install Laravel
Create a fresh Laravel application using composer by running the following command.
composer create-project --prefer-dist laravel/laravel laravel-docker-aws
Docker-ize Laravel
Now that we Laravel installed, let’s configure docker.
Create a Dockerfile
Create a Dockerfile in the root of your Laravel application. A Dockerfile is a text document that contains all the commands a user could call on the command line to assemble an image.
FROM php:7.3.2-apache-stretch
LABEL maintainer="Gbenga Oni B. <onigbenga@yahoo.ca>"
version="1.0"
COPY --chown=www-data:www-data . /srv/app
COPY .docker/vhost.conf /etc/apache2/sites-available/000-default.conf
WORKDIR /srv/app
RUN docker-php-ext-install mbstring pdo pdo_mysql
&& a2enmod rewrite negotiation
&& docker-php-ext-install opcache
Create a docker folder
Lets create a folder where all configuration files needed to build our docker image will be placed. Create a folder .docker in Laravel root folder that will contain our Apache config file (vhost.conf). The file will be copied into sites available folder on container at run time.
<VirtualHost *:80>
DocumentRoot /srv/app/public
<Directory "/srv/app/public">
AllowOverride all
Require all granted
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
The vhost.conf file sets the document root for Apache to /src/app/public, this way since our Laravel app will be copied to the /srv/app folder, we can access it directly.
Build Laravel Application Image locally
Once you’ve created the Dockerfile and the Apache configuration file in the .docker folder. Our application is now ready to be built.
Navigate to the root folder of the Laravel app in the command line then run
docker build -t laravel-docker-aws .
The docker machine will now build the image. This may take some minutes.
Now that the laravel-docker-aws image has been built, run the image with the following command:
docker run -it -p 8001:80 laravel-docker-aws
The container will now run with accessibility on port 8001:
Setup CodeBuild build spec file
According to AWS CodeBuild documentation, A build spec is a collection of build commands and related settings, in YAML format, that CodeBuild uses to run a build.
The buildspec.yml file must be named as is and should be placed in the root of the project folder. However, you can give the buildspec file an alternate name or store it in a different location using the AWS CLI or AWS Cloudformation.
Create a buildspec.yml file and copy the code below into it.
version: 0.2
phases:
install:
runtime-versions:
php: 7.3
pre_build: # commands to be run before build
commands:
- echo Logging in to Amazon ECR....
- aws --version
# login to Elastic container registry
- eval $(aws ecr get-login --region us-east-1 --no-include-email | sed 's|https://||')
- REPOSITORY_URI=<YOUR ECR REPOSITORY URI HERE>
- IMAGE_TAG=<YOUR IMAGE TAG HERE>
build:
commands:
- echo Build started on `date`
- echo installing composer..
- composer install
- echo creating .env file..
- cp .env.example .env
- echo generating app key
- php artisan key:generate
- echo Building the Docker image...
- docker build -t $REPOSITORY_URI:latest .
- docker tag $REPOSITORY_URI:latest $REPOSITORY_URI:$IMAGE_TAG
post_build:
commands:
- echo Build completed on `date`
- echo Pushing the Docker image...
- docker image ls -a
- docker push $REPOSITORY_URI:$IMAGE_TAG
The build spec contains env, version, phases, artifacts, cache, etc. We will be using just version and phases.
The version which is required represents the build spec version. We will use version 2.0 — the recommended version. The phases, also required, describes the command to be executed during the respective build phases.
For a more in-depth understanding of the build spec file, go here to read more.
In the install phase, we specified a php 7.3 runtime version. The runtime-version parameter is required since we will be using the Ubuntu standard image 2.0
In the pre_build phase, we check the aws cli version and also attempt to login to AWS Elastic Container Registry. we also define the registry repository URI and the image tag.
In the build phase, we install composer, create the Laravel environment file and also generate an application key. Finally, we build the docker image and assign it a tag.
Note: make sure you specify the AWS region you’re working in in the pre_build phase command that logs you into AWS ECR:
eval $(aws ecr get-login) --region us-east-1 ....
Lastly, in the post_build phase, we push the docker image to the AWS ECR repository.
Our Laravel Application is now set for deployment.
Create an Elastic Container Registry Repository
Let’s create an image registry where we will store the Laravel docker image.
Navigate the ECR dashboard on AWS Console.
console
Click on the Create Repository button.
console
Define the Repository name. I have named mine gbxnga/laravel-docker-aws and click Create Repository.
ECR Repository
Once that’s done, copy the URI of the repository and paste it in the pre_build phase of the build spec file.
Also, Set the IMAGE_TAG = 1.0
pre_build:
commands:
...
- REPOSITORY_URI=650749741049.dkr.ecr.ap-southeast-2.amazonaws.com/gbxnga/laravel-docker-aws
- IMAGE_TAG=1.0
The ECR repository is now set. Container Images for our Laravel Application can now be stored on it.
Configure AWS CodeBuild
Let’s configure CodeBuild on the AWS Console. Log in to the AWS Console and navigate to the CodeBuild dashboard.
AWS CodeBuild
You will probably see the above Get Started screen if you’re using CodeBuild for the first time in the current region.
Create a CodeBuild Project
Click on Create Project to create a build project. You will be taken to a build project creation page.
Create a CodeBuild build project
Give the project name. I have in this case named the build project laravel-docker-aws. You can skip the Description box as its optional.
Scroll down to the Source section below. This is where the source provider for the project will be specified.
Specify CodeBuild source
Select Github in this case. Make sure you have pushed the Laravel project containing the dockerfile, docker folder and the build spec file we created.
Click on the OAuth button. You will be asked to authorize AWS CodeBuild with your GitHub account.
Once that’s done, check “Repository in my GitHub account”, then select the repository you pushed the Laravel app to.
Scroll down to the Primary source webhook events section. Check the rebuild option then select the PUSH Event Type. This tells CodeBuild to rebuild the image every time a PUSH is made to the selected GitHub repository.
Event type
Scroll down to the Environment section
Environment Section
Choose Managed image as Environment Image and also the Ubuntu Operating System. Select the Standard Runtime and the aws/codebuild/standard:2.0 Image. Check the Privileged box and also New Service Role.
Leave the Buildspec Section as is, but make sure the Use a buildspec file option is checked.
Image
Leave every other section as is, scroll all the way down and click the Create build project button.
The CodeBuild project will now be created.
Laravel AWS CodeBuild project
Create ECR access IAM Policy for CodeBuild
In the post build phase of the build spec file, we attempt to push the docker image to AWS ECR. To successfully achieve this, we need to authorize the necessary action for CodeBuild.
We will do this by creating an IAM Policy that grants full access to the AWS ECR repository we just created, then attach it to the service role that was automatically created for the code build project we just created.
Navigate to IAM on the AWS Console then click on Roles.
Image
Look/Search for codebuild-laravel-docker-aws-service-role role.
Note that its likely the default name given to the code build project service role may be different. But if you named your build project laravel-docker-aws, the service role name will most likely be the same as the above.
Click on the codebuild-laravel-docker-aws-service-role role.
Image
We will attach the Amazon managed AmazonEC2ContainerRegistryPowerUser policy to the service role.
Click on Attach Policies button.
Attach policies
Search for and select the AmazonEC2ContainerRegistryPowerUser policy then click Attach Policy.
The policy will now be attached, granting CodeBuild power user access to the repository.
Build the Laravel Docker Image
Now that we have granted CodeBuild access to ECR, and we have configured our CodeBuild project, let’s initiate a build process for the Laravel docker image.
Navigate to the CodeBuild dashboard on AWS console. Click on the laravel-docker-aws CodeBuild project, then click the Start Build button to initiate a build process.
Click on the build project to see more information on whats happening.
CodeBuild building a docker image
Scroll down and Click on tail logs to see the build logs
AWS CodeBuild process logs
Wait for the build process to complete. It make take a few minutes.
Image
CodeBuild has now successfully built and pushed our docker image to the ECR repository.
Navigate to ECR dashboard to see the list of images in the laravel-docker-aws repository.
Image
Copy out the Image URI. We will be needing it to setup ECS.
Setup AWS Elastic Container Service (ECS)
Now that we have created our docker image and pushed it to AWS ECR, we will make use of AWS ECS to run it.
Navigate to ECS dashboard on the AWS console.
AWS Elastic Container Service (ECS)
Create Amazon ECS Cluster
Click on Clusters on the side menu.
AWS ECS Cluster
Click on the Create Cluster button
Create AWS ECS Cluster
Select EC2 Linux + Networking, and proceed to the next step.
Create AWS ECS Cluster
Give a name to the cluster. I have, in this case, named it laravel-docker-aws-cluster and select the t2.micro EC2 instance type.
Leave every other parameter as is in the Instance configuration section and the Networking section.
Make sure that a new role is to be created in the Container instance IAM role section if you haven’t already created the ecsInstanceRolerole.
Click the Create button at the bottom to initiate the creation process for the ECS Cluster.
AWS ECS creating a Cluster
Once the Cluster has been successfully created, click on the View Cluster button at the top to view the created cluster.
Image
Clicking on the ECS Instances tab, you can see the t2.micro instance provisioned in the cluster.
ECS Instances
Create AWS ECS Task Definition
Task definitions specify the container information for your application, such as how many containers are part of your task, what resources they will use, how they are linked together, and which host ports they will use.
Click on Task Definitions on the side menu, then click the Create new Task Definition button.
Image
Select EC2 and proceed to the next step.
Image
Give the task definition a name. Leave the Task role and Network Mode parameters as is.
Scroll down to Container Definitions and click Add Container.
Image
Specify a container name laravel-docker-aws-container . Also specify image repository URI.
Make sure you specify the image tag(1.0 or the new tag if you chose to use another).
Specify a Memory limit of 128MiB
Image
Scroll down to Port Mappings and specify the Host Port as 80 and Container Port as 80. This means that port 80 on the EC2 instance will be mapped to port 80 on the Laravel docker container.
Leave every other thing as is, scroll down and click Add.
Once you have added the container, scroll down and click on Create to create the task definition.
Image
Now that the task definition has been created, we need to run the task.
Click on Actions and select Run Task.
Image
Select EC2, leave other parameters as is and click Run Task.
Image
The task is now running on the laravel-docker-aws-cluster that contains the t2.micro instance.
Navigate to EC2 dashboard on AWS console.
Image
Copy the IP of the EC2 instance and paste it in your browser.
Laravel Docker running container on AWS ECS
Our Laravel docker container is now running.
That’s it. You’ve successfully deployed and run a docker image on EC2 with AWS ECS.
Conclusion
In this article, we set up docker for a Laravel application. We also implemented CodeBuild to build the docker image, pushing it to Elastic Container Registry. Finally, we setup Elastic Container Service to run the image on Amazon EC2.
Related Post
We are a Professional AWS Managed company of experienced talented engineers. We are top skilled in AWS Architecture, DevOps, Monitoring and Security Solutions.
AWS PS Copyright © 2019 Designed by Laraship
Looking for AWS Managed Service ?
Get Your Quote for
FREE!
Free Quote
close-link
|
{
"url": "https://www.aws.ps/deploy-a-docker-ized-laravel-application-to-aws-ecs-with-codebuild/",
"source_domain": "www.aws.ps",
"snapshot_id": "crawl=CC-MAIN-2021-43",
"warc_metadata": {
"Content-Length": "121315",
"Content-Type": "application/http; msgtype=response",
"WARC-Block-Digest": "sha1:K4L4LHT4YJ7NXUKH3AZHD5UXXPFBKNKX",
"WARC-Concurrent-To": "<urn:uuid:2d57a00d-f48c-48b4-a3e8-b81aeba9892f>",
"WARC-Date": "2021-10-19T02:49:47Z",
"WARC-IP-Address": "5.189.136.102",
"WARC-Identified-Payload-Type": "text/html",
"WARC-Payload-Digest": "sha1:MNMQRMVY34SKVUWPQ6VNZYFOTYLTPS22",
"WARC-Record-ID": "<urn:uuid:752bb1aa-0d78-41b1-a6aa-59d8725fcfd9>",
"WARC-Target-URI": "https://www.aws.ps/deploy-a-docker-ized-laravel-application-to-aws-ecs-with-codebuild/",
"WARC-Truncated": null,
"WARC-Type": "response",
"WARC-Warcinfo-ID": "<urn:uuid:67f89722-5a7c-4455-97ab-ea6f750c228e>"
},
"warc_info": "isPartOf: CC-MAIN-2021-43\r\npublisher: Common Crawl\r\ndescription: Wide crawl of the web for October 2021\r\noperator: Common Crawl Admin (info@commoncrawl.org)\r\nhostname: ip-10-67-67-132\r\nsoftware: Apache Nutch 1.18 (modified, https://github.com/commoncrawl/nutch/)\r\nrobots: checked via crawler-commons 1.2-SNAPSHOT (https://github.com/crawler-commons/crawler-commons)\r\nformat: WARC File Format 1.1\r\nconformsTo: https://iipc.github.io/warc-specifications/specifications/warc-format/warc-1.1/"
}
|
{
"line_start_idx": [
0,
59,
60,
380,
381,
582,
583,
755,
756,
1015,
1016,
1183,
1184,
1511,
1512,
1513,
1514,
1527,
1528,
1582,
1602,
1615,
1637,
1638,
1639,
1640,
1653,
1654,
1846,
1847,
1848,
1849,
1865,
1866,
1950,
1951,
2024,
2025,
2026,
2027,
2046,
2047,
2102,
2103,
2104,
2105,
2125,
2126,
2310,
2311,
2341,
2342,
2397,
2417,
2418,
2460,
2461,
2532,
2533,
2550,
2551,
2603,
2639,
2677,
2678,
2679,
2680,
2703,
2704,
2984,
2985,
3004,
3037,
3038,
3072,
3098,
3126,
3143,
3144,
3185,
3237,
3252,
3253,
3424,
3425,
3426,
3427,
3467,
3468,
3602,
3678,
3679,
3716,
3717,
3790,
3886,
3887,
3932,
3933,
3993,
3994,
3995,
3996,
4028,
4029,
4192,
4193,
4428,
4429,
4490,
4491,
4504,
4505,
4513,
4525,
4547,
4562,
4609,
4623,
4663,
4683,
4725,
4816,
4868,
4906,
4915,
4929,
4964,
4997,
5020,
5052,
5079,
5109,
5140,
5180,
5227,
5294,
5308,
5322,
5361,
5402,
5429,
5477,
5478,
5589,
5590,
5806,
5807,
5887,
5888,
6045,
6046,
6222,
6223,
6394,
6395,
6515,
6516,
6566,
6567,
6652,
6653,
6704,
6705,
6706,
6707,
6755,
6756,
6833,
6834,
6877,
6885,
6886,
6925,
6926,
6934,
6935,
7036,
7037,
7052,
7053,
7162,
7163,
7193,
7194,
7205,
7215,
7216,
7224,
7317,
7337,
7338,
7439,
7440,
7441,
7442,
7466,
7467,
7580,
7581,
7595,
7596,
7715,
7716,
7717,
7718,
7745,
7746,
7849,
7850,
7883,
7884,
8021,
8022,
8132,
8133,
8158,
8159,
8310,
8311,
8409,
8410,
8527,
8528,
8747,
8748,
8759,
8760,
8799,
8800,
8820,
8821,
9023,
9024,
9117,
9118,
9124,
9125,
9225,
9226,
9269,
9270,
9300,
9301,
9302,
9303,
9346,
9347,
9530,
9531,
9750,
9751,
9807,
9808,
9814,
9815,
9879,
9880,
10102,
10103,
10164,
10165,
10171,
10172,
10270,
10271,
10304,
10305,
10321,
10322,
10417,
10418,
10507,
10508,
10509,
10510,
10541,
10542,
10699,
10700,
10866,
10867,
10938,
10939,
10973,
10974,
11031,
11032,
11059,
11060,
11128,
11129,
11135,
11136,
11224,
11225,
11315,
11316,
11322,
11323,
11383,
11384,
11385,
11386,
11428,
11429,
11536,
11537,
11583,
11584,
11620,
11621,
11622,
11623,
11649,
11650,
11686,
11687,
11703,
11704,
11739,
11740,
11763,
11764,
11825,
11826,
11849,
11850,
11979,
11980,
12080,
12081,
12223,
12224,
12316,
12317,
12344,
12345,
12466,
12467,
12473,
12474,
12571,
12572,
12586,
12587,
12588,
12589,
12620,
12621,
12841,
12842,
12936,
12937,
12943,
12944,
12985,
12986,
12992,
12993,
13081,
13082,
13144,
13145,
13151,
13152,
13243,
13244,
13329,
13330,
13363,
13364,
13370,
13371,
13561,
13562,
13620,
13621,
13719,
13720,
13726,
13727,
13799,
13800,
13838,
13839,
13845,
13846,
13907,
13908,
13914,
13915,
14010,
14011,
14053,
14054,
14060,
14061,
14123,
14124,
14168,
14169,
14214,
14215,
14299,
14300,
14301,
14302,
14313,
14314,
14550,
14551,
14564,
14565,
14725,
14726,
14771,
14805,
14806,
14825,
14831,
14832,
14843
],
"line_end_idx": [
59,
60,
380,
381,
582,
583,
755,
756,
1015,
1016,
1183,
1184,
1511,
1512,
1513,
1514,
1527,
1528,
1582,
1602,
1615,
1637,
1638,
1639,
1640,
1653,
1654,
1846,
1847,
1848,
1849,
1865,
1866,
1950,
1951,
2024,
2025,
2026,
2027,
2046,
2047,
2102,
2103,
2104,
2105,
2125,
2126,
2310,
2311,
2341,
2342,
2397,
2417,
2418,
2460,
2461,
2532,
2533,
2550,
2551,
2603,
2639,
2677,
2678,
2679,
2680,
2703,
2704,
2984,
2985,
3004,
3037,
3038,
3072,
3098,
3126,
3143,
3144,
3185,
3237,
3252,
3253,
3424,
3425,
3426,
3427,
3467,
3468,
3602,
3678,
3679,
3716,
3717,
3790,
3886,
3887,
3932,
3933,
3993,
3994,
3995,
3996,
4028,
4029,
4192,
4193,
4428,
4429,
4490,
4491,
4504,
4505,
4513,
4525,
4547,
4562,
4609,
4623,
4663,
4683,
4725,
4816,
4868,
4906,
4915,
4929,
4964,
4997,
5020,
5052,
5079,
5109,
5140,
5180,
5227,
5294,
5308,
5322,
5361,
5402,
5429,
5477,
5478,
5589,
5590,
5806,
5807,
5887,
5888,
6045,
6046,
6222,
6223,
6394,
6395,
6515,
6516,
6566,
6567,
6652,
6653,
6704,
6705,
6706,
6707,
6755,
6756,
6833,
6834,
6877,
6885,
6886,
6925,
6926,
6934,
6935,
7036,
7037,
7052,
7053,
7162,
7163,
7193,
7194,
7205,
7215,
7216,
7224,
7317,
7337,
7338,
7439,
7440,
7441,
7442,
7466,
7467,
7580,
7581,
7595,
7596,
7715,
7716,
7717,
7718,
7745,
7746,
7849,
7850,
7883,
7884,
8021,
8022,
8132,
8133,
8158,
8159,
8310,
8311,
8409,
8410,
8527,
8528,
8747,
8748,
8759,
8760,
8799,
8800,
8820,
8821,
9023,
9024,
9117,
9118,
9124,
9125,
9225,
9226,
9269,
9270,
9300,
9301,
9302,
9303,
9346,
9347,
9530,
9531,
9750,
9751,
9807,
9808,
9814,
9815,
9879,
9880,
10102,
10103,
10164,
10165,
10171,
10172,
10270,
10271,
10304,
10305,
10321,
10322,
10417,
10418,
10507,
10508,
10509,
10510,
10541,
10542,
10699,
10700,
10866,
10867,
10938,
10939,
10973,
10974,
11031,
11032,
11059,
11060,
11128,
11129,
11135,
11136,
11224,
11225,
11315,
11316,
11322,
11323,
11383,
11384,
11385,
11386,
11428,
11429,
11536,
11537,
11583,
11584,
11620,
11621,
11622,
11623,
11649,
11650,
11686,
11687,
11703,
11704,
11739,
11740,
11763,
11764,
11825,
11826,
11849,
11850,
11979,
11980,
12080,
12081,
12223,
12224,
12316,
12317,
12344,
12345,
12466,
12467,
12473,
12474,
12571,
12572,
12586,
12587,
12588,
12589,
12620,
12621,
12841,
12842,
12936,
12937,
12943,
12944,
12985,
12986,
12992,
12993,
13081,
13082,
13144,
13145,
13151,
13152,
13243,
13244,
13329,
13330,
13363,
13364,
13370,
13371,
13561,
13562,
13620,
13621,
13719,
13720,
13726,
13727,
13799,
13800,
13838,
13839,
13845,
13846,
13907,
13908,
13914,
13915,
14010,
14011,
14053,
14054,
14060,
14061,
14123,
14124,
14168,
14169,
14214,
14215,
14299,
14300,
14301,
14302,
14313,
14314,
14550,
14551,
14564,
14565,
14725,
14726,
14771,
14805,
14806,
14825,
14831,
14832,
14843,
14853
]
}
|
{
"red_pajama_v2": {
"ccnet_original_length": 14853,
"ccnet_original_nlines": 422,
"rps_doc_curly_bracket": 0.00026930999592877924,
"rps_doc_ldnoobw_words": 0,
"rps_doc_lorem_ipsum": 0,
"rps_doc_stop_word_fraction": 0.3103329837322235,
"rps_doc_ut1_blacklist": 0,
"rps_doc_frac_all_caps_words": 0.04737383872270584,
"rps_doc_frac_lines_end_with_ellipsis": 0.011820330284535885,
"rps_doc_frac_no_alph_words": 0.1843460351228714,
"rps_doc_frac_unique_words": 0.23765431344509125,
"rps_doc_mean_word_length": 5.119488716125488,
"rps_doc_num_sentences": 188,
"rps_doc_symbol_to_word_ratio": 0.002403019927442074,
"rps_doc_unigram_entropy": 5.337838649749756,
"rps_doc_word_count": 2268,
"rps_doc_frac_chars_dupe_10grams": 0,
"rps_doc_frac_chars_dupe_5grams": 0.04857463017106056,
"rps_doc_frac_chars_dupe_6grams": 0.016708290204405785,
"rps_doc_frac_chars_dupe_7grams": 0,
"rps_doc_frac_chars_dupe_8grams": 0,
"rps_doc_frac_chars_dupe_9grams": 0,
"rps_doc_frac_chars_top_2gram": 0.008181899785995483,
"rps_doc_frac_chars_top_3gram": 0.006028770003467798,
"rps_doc_frac_chars_top_4gram": 0.00895702000707388,
"rps_doc_books_importance": -1078.67041015625,
"rps_doc_books_importance_length_correction": -1078.67041015625,
"rps_doc_openwebtext_importance": -649.4827270507812,
"rps_doc_openwebtext_importance_length_correction": -649.4827270507812,
"rps_doc_wikipedia_importance": -238.34739685058594,
"rps_doc_wikipedia_importance_length_correction": -238.34739685058594
},
"fasttext": {
"dclm": 0.0366898812353611,
"english": 0.8305222988128662,
"fineweb_edu_approx": 2.2438175678253174,
"eai_general_math": 0.13370251655578613,
"eai_open_web_math": 0.12060272693634033,
"eai_web_code": 0.7941663265228271
}
}
|
{
"free_decimal_correspondence": {
"primary": {
"code": "005.1",
"labels": {
"level_1": "General works, books and libraries, information sciences",
"level_2": "",
"level_3": "Computer programming"
}
},
"secondary": {
"code": "004.0285",
"labels": {
"level_1": "General works, books and libraries, information sciences",
"level_2": "",
"level_3": "Computers and Computer science"
}
}
},
"bloom_cognitive_process": {
"primary": {
"code": "3",
"label": "Apply"
},
"secondary": {
"code": "2",
"label": "Understand"
}
},
"bloom_knowledge_domain": {
"primary": {
"code": "3",
"label": "Procedural"
},
"secondary": {
"code": "2",
"label": "Conceptual"
}
},
"document_type_v1": {
"primary": {
"code": "3",
"label": "Reference/Encyclopedic/Educational"
},
"secondary": {
"code": "4",
"label": "Code/Software"
}
},
"extraction_artifacts": {
"primary": {
"code": "0",
"label": "No Artifacts"
},
"secondary": {
"code": "-1",
"label": "Abstain"
}
},
"missing_content": {
"primary": {
"code": "0",
"label": "No missing content"
},
"secondary": {
"code": "2",
"label": "Click Here References"
}
},
"document_type_v2": {
"primary": {
"code": "23",
"label": "Tutorial"
},
"secondary": {
"code": "8",
"label": "Documentation"
}
},
"reasoning_depth": {
"primary": {
"code": "2",
"label": "Basic Reasoning"
},
"secondary": {
"code": "3",
"label": "Intermediate Reasoning"
}
},
"technical_correctness": {
"primary": {
"code": "4",
"label": "Highly Correct"
},
"secondary": {
"code": "3",
"label": "Mostly Correct"
}
},
"education_level": {
"primary": {
"code": "3",
"label": "Undergraduate Level"
},
"secondary": {
"code": "4",
"label": "Graduate/Expert Level"
}
}
}
|
672f1e42c33a7f9846924a2431ea77df
|
8,075,580,872,788,690,000
|
NAG CL Interface
f07hgc (dpbcon)
Settings help
CL Name Style:
1 Purpose
f07hgc estimates the condition number of a real symmetric positive definite band matrix A, where A has been factorized by f07hdc.
2 Specification
#include <nag.h>
void f07hgc (Nag_OrderType order, Nag_UploType uplo, Integer n, Integer kd, const double ab[], Integer pdab, double anorm, double *rcond, NagError *fail)
The function may be called by the names: f07hgc, nag_lapacklin_dpbcon or nag_dpbcon.
3 Description
f07hgc estimates the condition number (in the 1-norm) of a real symmetric positive definite band matrix A:
κ1(A)=A1A-11 .
Since A is symmetric, κ1(A)=κ(A)=AA-1.
Because κ1(A) is infinite if A is singular, the function actually returns an estimate of the reciprocal of κ1(A).
The function should be preceded by a call to f16rec to compute A1 and a call to f07hdc to compute the Cholesky factorization of A. The function then uses Higham's implementation of Hager's method (see Higham (1988)) to estimate A-11.
4 References
Higham N J (1988) FORTRAN codes for estimating the one-norm of a real or complex matrix, with applications to condition estimation ACM Trans. Math. Software 14 381–396
5 Arguments
1: order Nag_OrderType Input
On entry: the order argument specifies the two-dimensional storage scheme being used, i.e., row-major ordering or column-major ordering. C language defined storage is specified by order=Nag_RowMajor. See Section 3.1.3 in the Introduction to the NAG Library CL Interface for a more detailed explanation of the use of this argument.
Constraint: order=Nag_RowMajor or Nag_ColMajor.
2: uplo Nag_UploType Input
On entry: specifies how A has been factorized.
uplo=Nag_Upper
A=UTU, where U is upper triangular.
uplo=Nag_Lower
A=LLT, where L is lower triangular.
Constraint: uplo=Nag_Upper or Nag_Lower.
3: n Integer Input
On entry: n, the order of the matrix A.
Constraint: n0.
4: kd Integer Input
On entry: kd, the number of superdiagonals or subdiagonals of the matrix A.
Constraint: kd0.
5: ab[dim] const double Input
Note: the dimension, dim, of the array ab must be at least max(1,pdab×n).
On entry: the Cholesky factor of A, as returned by f07hdc.
6: pdab Integer Input
On entry: the stride separating row or column elements (depending on the value of order) of the matrix in the array ab.
Constraint: pdabkd+1.
7: anorm double Input
On entry: the 1-norm of the original matrix A, which may be computed by calling f16rec with its argument norm=Nag_OneNorm. anorm must be computed either before calling f07hdc or else from a copy of the original matrix A.
Constraint: anorm0.0.
8: rcond double * Output
On exit: an estimate of the reciprocal of the condition number of A. rcond is set to zero if exact singularity is detected or the estimate underflows. If rcond is less than machine precision, A is singular to working precision.
9: fail NagError * Input/Output
The NAG error argument (see Section 7 in the Introduction to the NAG Library CL Interface).
6 Error Indicators and Warnings
NE_ALLOC_FAIL
Dynamic memory allocation failed.
See Section 3.1.2 in the Introduction to the NAG Library CL Interface for further information.
NE_BAD_PARAM
On entry, argument value had an illegal value.
NE_INT
On entry, kd=value.
Constraint: kd0.
On entry, n=value.
Constraint: n0.
On entry, pdab=value.
Constraint: pdab>0.
NE_INT_2
On entry, pdab=value and kd=value.
Constraint: pdabkd+1.
NE_INTERNAL_ERROR
An internal error has occurred in this function. Check the function call and any array sizes. If the call is correct then please contact NAG for assistance.
See Section 7.5 in the Introduction to the NAG Library CL Interface for further information.
NE_NO_LICENCE
Your licence key may have expired or may not have been installed correctly.
See Section 8 in the Introduction to the NAG Library CL Interface for further information.
NE_REAL
On entry, anorm=value.
Constraint: anorm0.0.
7 Accuracy
The computed estimate rcond is never less than the true value ρ, and in practice is nearly always less than 10ρ, although examples can be constructed where rcond is much larger.
8 Parallelism and Performance
Background information to multithreading can be found in the Multithreading documentation.
f07hgc makes calls to BLAS and/or LAPACK routines, which may be threaded within the vendor library used by this implementation. Consult the documentation for the vendor library for further information.
Please consult the X06 Chapter Introduction for information on how to control and interrogate the OpenMP environment used within this function. Please also consult the Users' Note for your implementation for any additional implementation-specific information.
9 Further Comments
A call to f07hgc involves solving a number of systems of linear equations of the form Ax=b; the number is usually 4 or 5 and never more than 11. Each solution involves approximately 4nk floating-point operations (assuming nk) but takes considerably longer than a call to f07hec with one right-hand side, because extra care is taken to avoid overflow when A is approximately singular.
The complex analogue of this function is f07huc.
10 Example
This example estimates the condition number in the 1-norm (or -norm) of the matrix A, where
A= ( 5.49 2.68 0.00 0.00 2.68 5.63 -2.39 0.00 0.00 -2.39 2.60 -2.22 0.00 0.00 -2.22 5.17 ) .
Here A is symmetric and positive definite, and is treated as a band matrix, which must first be factorized by f07hdc. The true condition number in the 1-norm is 74.15.
10.1 Program Text
Program Text (f07hgce.c)
10.2 Program Data
Program Data (f07hgce.d)
10.3 Program Results
Program Results (f07hgce.r)
|
{
"url": "https://support.nag.com/numeric/nl/nagdoc_latest/clhtml/f07/f07hgc.html",
"source_domain": "support.nag.com",
"snapshot_id": "CC-MAIN-2023-50",
"warc_metadata": {
"Content-Length": "33735",
"Content-Type": "application/http; msgtype=response",
"WARC-Block-Digest": "sha1:3RW236NWNUHJ6QOAX5GNKSCINSRLDPYU",
"WARC-Concurrent-To": "<urn:uuid:36fac184-2589-40de-b496-663831b81e36>",
"WARC-Date": "2023-12-06T02:30:01Z",
"WARC-IP-Address": "78.129.168.4",
"WARC-Identified-Payload-Type": "text/html",
"WARC-Payload-Digest": "sha1:H3AHIMW7RW3NE62R662J322ZHPHS7LQL",
"WARC-Record-ID": "<urn:uuid:b410aa06-0a38-405b-a484-95cba5a10b3c>",
"WARC-Target-URI": "https://support.nag.com/numeric/nl/nagdoc_latest/clhtml/f07/f07hgc.html",
"WARC-Truncated": null,
"WARC-Type": "response",
"WARC-Warcinfo-ID": "<urn:uuid:7f7adc8a-a318-4b14-9c75-f7bfa352a53c>"
},
"warc_info": "isPartOf: CC-MAIN-2023-50\r\npublisher: Common Crawl\r\ndescription: Wide crawl of the web for November/December 2023\r\noperator: Common Crawl Admin (info@commoncrawl.org)\r\nhostname: ip-10-67-67-150\r\nsoftware: Apache Nutch 1.19 (modified, https://github.com/commoncrawl/nutch/)\r\nrobots: checked via crawler-commons 1.5-SNAPSHOT (https://github.com/crawler-commons/crawler-commons)\r\nformat: WARC File Format 1.1\r\nconformsTo: https://iipc.github.io/warc-specifications/specifications/warc-format/warc-1.1/"
}
|
{
"line_start_idx": [
0,
17,
33,
34,
48,
49,
64,
65,
66,
76,
77,
207,
208,
224,
225,
242,
397,
482,
483,
497,
498,
605,
622,
661,
775,
1009,
1010,
1023,
1024,
1192,
1193,
1205,
1206,
1235,
1566,
1614,
1641,
1688,
1703,
1739,
1754,
1790,
1831,
1850,
1890,
1906,
1926,
2002,
2019,
2049,
2123,
2182,
2204,
2324,
2346,
2368,
2589,
2611,
2636,
2864,
2896,
2988,
2989,
3021,
3022,
3036,
3070,
3165,
3178,
3225,
3232,
3252,
3269,
3288,
3304,
3326,
3346,
3355,
3390,
3412,
3430,
3587,
3680,
3694,
3770,
3861,
3869,
3892,
3914,
3915,
3926,
3927,
4105,
4106,
4136,
4137,
4228,
4430,
4690,
4691,
4710,
4711,
5095,
5144,
5145,
5156,
5157,
5249,
5344,
5512,
5513,
5531,
5532,
5557,
5558,
5576,
5577,
5602,
5603,
5624,
5625
],
"line_end_idx": [
17,
33,
34,
48,
49,
64,
65,
66,
76,
77,
207,
208,
224,
225,
242,
397,
482,
483,
497,
498,
605,
622,
661,
775,
1009,
1010,
1023,
1024,
1192,
1193,
1205,
1206,
1235,
1566,
1614,
1641,
1688,
1703,
1739,
1754,
1790,
1831,
1850,
1890,
1906,
1926,
2002,
2019,
2049,
2123,
2182,
2204,
2324,
2346,
2368,
2589,
2611,
2636,
2864,
2896,
2988,
2989,
3021,
3022,
3036,
3070,
3165,
3178,
3225,
3232,
3252,
3269,
3288,
3304,
3326,
3346,
3355,
3390,
3412,
3430,
3587,
3680,
3694,
3770,
3861,
3869,
3892,
3914,
3915,
3926,
3927,
4105,
4106,
4136,
4137,
4228,
4430,
4690,
4691,
4710,
4711,
5095,
5144,
5145,
5156,
5157,
5249,
5344,
5512,
5513,
5531,
5532,
5557,
5558,
5576,
5577,
5602,
5603,
5624,
5625,
5652
]
}
|
{
"red_pajama_v2": {
"ccnet_original_length": 5652,
"ccnet_original_nlines": 120,
"rps_doc_curly_bracket": 0,
"rps_doc_ldnoobw_words": 0,
"rps_doc_lorem_ipsum": 0,
"rps_doc_stop_word_fraction": 0.2674897015094757,
"rps_doc_ut1_blacklist": 0,
"rps_doc_frac_all_caps_words": 0.052674900740385056,
"rps_doc_frac_lines_end_with_ellipsis": 0,
"rps_doc_frac_no_alph_words": 0.29053497314453125,
"rps_doc_frac_unique_words": 0.39977219700813293,
"rps_doc_mean_word_length": 5.0615034103393555,
"rps_doc_num_sentences": 97,
"rps_doc_symbol_to_word_ratio": 0.0008230499806813896,
"rps_doc_unigram_entropy": 5.251798152923584,
"rps_doc_word_count": 878,
"rps_doc_frac_chars_dupe_10grams": 0.053555358201265335,
"rps_doc_frac_chars_dupe_5grams": 0.14941494166851044,
"rps_doc_frac_chars_dupe_6grams": 0.11138614267110825,
"rps_doc_frac_chars_dupe_7grams": 0.0992349237203598,
"rps_doc_frac_chars_dupe_8grams": 0.08258326351642609,
"rps_doc_frac_chars_dupe_9grams": 0.08258326351642609,
"rps_doc_frac_chars_top_2gram": 0.02047705091536045,
"rps_doc_frac_chars_top_3gram": 0.016201620921492577,
"rps_doc_frac_chars_top_4gram": 0.021377140656113625,
"rps_doc_books_importance": -514.7179565429688,
"rps_doc_books_importance_length_correction": -514.7179565429688,
"rps_doc_openwebtext_importance": -366.0224914550781,
"rps_doc_openwebtext_importance_length_correction": -366.0224914550781,
"rps_doc_wikipedia_importance": -221.66165161132812,
"rps_doc_wikipedia_importance_length_correction": -221.66165161132812
},
"fasttext": {
"dclm": 0.09697269648313522,
"english": 0.8030673265457153,
"fineweb_edu_approx": 2.7250795364379883,
"eai_general_math": 0.9864705801010132,
"eai_open_web_math": 0.9231728315353394,
"eai_web_code": 0.8176242709159851
}
}
|
{
"free_decimal_correspondence": {
"primary": {
"code": "512.5",
"labels": {
"level_1": "Science and Natural history",
"level_2": "Mathematics",
"level_3": "Algebra"
}
},
"secondary": {
"code": "005.1",
"labels": {
"level_1": "General works, books and libraries, information sciences",
"level_2": "",
"level_3": "Computer programming"
}
}
},
"bloom_cognitive_process": {
"primary": {
"code": "2",
"label": "Understand"
},
"secondary": {
"code": "3",
"label": "Apply"
}
},
"bloom_knowledge_domain": {
"primary": {
"code": "2",
"label": "Conceptual"
},
"secondary": {
"code": "3",
"label": "Procedural"
}
},
"document_type_v1": {
"primary": {
"code": "3",
"label": "Reference/Encyclopedic/Educational"
},
"secondary": {
"code": "4",
"label": "Code/Software"
}
},
"extraction_artifacts": {
"primary": {
"code": "0",
"label": "No Artifacts"
},
"secondary": {
"code": "3",
"label": "Irrelevant Content"
}
},
"missing_content": {
"primary": {
"code": "0",
"label": "No missing content"
},
"secondary": {
"code": "-1",
"label": "Abstain"
}
},
"document_type_v2": {
"primary": {
"code": "8",
"label": "Documentation"
},
"secondary": {
"code": "10",
"label": "Knowledge Article"
}
},
"reasoning_depth": {
"primary": {
"code": "4",
"label": "Advanced Reasoning"
},
"secondary": {
"code": "3",
"label": "Intermediate Reasoning"
}
},
"technical_correctness": {
"primary": {
"code": "4",
"label": "Highly Correct"
},
"secondary": {
"code": "3",
"label": "Mostly Correct"
}
},
"education_level": {
"primary": {
"code": "4",
"label": "Graduate/Expert Level"
},
"secondary": {
"code": "3",
"label": "Undergraduate Level"
}
}
}
|
672f1e42c33a7f9846924a2431ea77df
|
-7,944,051,010,682,510,000
|
function::cpu_clock_us.3stap - Man Page
Number of microseconds on the given cpu's clock
Synopsis
cpu_clock_us:long(cpu:long)
Arguments
cpu
Which processor's clock to read
Description
This function returns the number of microseconds on the given cpu's clock. This is always monotonic comparing on the same cpu, but may have some drift between cpus (within about a jiffy).
See Also0
tapset::timestamp_monotonic(3stap)
Info
May 2021 SystemTap Tapset Reference Timestamp Functions
|
{
"url": "https://www.mankier.com/3/function::cpu_clock_us.3stap",
"source_domain": "www.mankier.com",
"snapshot_id": "crawl=CC-MAIN-2021-39",
"warc_metadata": {
"Content-Length": "4821",
"Content-Type": "application/http; msgtype=response",
"WARC-Block-Digest": "sha1:BED5PVVZYEAMW7UTOZQZAICFSHUIQ6AL",
"WARC-Concurrent-To": "<urn:uuid:d7323be4-8196-4249-adb0-c3a90a3b0a59>",
"WARC-Date": "2021-09-23T11:08:14Z",
"WARC-IP-Address": "104.21.0.83",
"WARC-Identified-Payload-Type": "text/html",
"WARC-Payload-Digest": "sha1:NYNZGAFDFTXDAZFRPW4BAN6XPVUFYWTZ",
"WARC-Record-ID": "<urn:uuid:5c1a5ea9-2ba8-4408-89f9-142addef785b>",
"WARC-Target-URI": "https://www.mankier.com/3/function::cpu_clock_us.3stap",
"WARC-Truncated": null,
"WARC-Type": "response",
"WARC-Warcinfo-ID": "<urn:uuid:bd62f049-855d-46c6-9efa-8c2cffc28bc6>"
},
"warc_info": "isPartOf: CC-MAIN-2021-39\r\npublisher: Common Crawl\r\ndescription: Wide crawl of the web for September 2021\r\noperator: Common Crawl Admin (info@commoncrawl.org)\r\nhostname: ip-10-67-67-130\r\nsoftware: Apache Nutch 1.18 (modified, https://github.com/commoncrawl/nutch/)\r\nrobots: checked via crawler-commons 1.2-SNAPSHOT (https://github.com/crawler-commons/crawler-commons)\r\nformat: WARC File Format 1.1\r\nconformsTo: https://iipc.github.io/warc-specifications/specifications/warc-format/warc-1.1/"
}
|
{
"line_start_idx": [
0,
40,
41,
89,
90,
99,
100,
132,
133,
143,
144,
148,
149,
181,
182,
194,
195,
383,
384,
394,
395,
430,
431,
436,
437
],
"line_end_idx": [
40,
41,
89,
90,
99,
100,
132,
133,
143,
144,
148,
149,
181,
182,
194,
195,
383,
384,
394,
395,
430,
431,
436,
437,
492
]
}
|
{
"red_pajama_v2": {
"ccnet_original_length": 492,
"ccnet_original_nlines": 24,
"rps_doc_curly_bracket": 0,
"rps_doc_ldnoobw_words": 0,
"rps_doc_lorem_ipsum": 0,
"rps_doc_stop_word_fraction": 0.2857142984867096,
"rps_doc_ut1_blacklist": 0,
"rps_doc_frac_all_caps_words": 0,
"rps_doc_frac_lines_end_with_ellipsis": 0,
"rps_doc_frac_no_alph_words": 0.19780220091342926,
"rps_doc_frac_unique_words": 0.75,
"rps_doc_mean_word_length": 6.046875,
"rps_doc_num_sentences": 4,
"rps_doc_symbol_to_word_ratio": 0,
"rps_doc_unigram_entropy": 3.7661213874816895,
"rps_doc_word_count": 64,
"rps_doc_frac_chars_dupe_10grams": 0,
"rps_doc_frac_chars_dupe_5grams": 0.20155039429664612,
"rps_doc_frac_chars_dupe_6grams": 0.20155039429664612,
"rps_doc_frac_chars_dupe_7grams": 0.20155039429664612,
"rps_doc_frac_chars_dupe_8grams": 0.20155039429664612,
"rps_doc_frac_chars_dupe_9grams": 0,
"rps_doc_frac_chars_top_2gram": 0.03875968977808952,
"rps_doc_frac_chars_top_3gram": 0.1033591702580452,
"rps_doc_frac_chars_top_4gram": 0.11369509249925613,
"rps_doc_books_importance": -31.725400924682617,
"rps_doc_books_importance_length_correction": -39.842777252197266,
"rps_doc_openwebtext_importance": -20.773685455322266,
"rps_doc_openwebtext_importance_length_correction": -28.89105987548828,
"rps_doc_wikipedia_importance": -18.067169189453125,
"rps_doc_wikipedia_importance_length_correction": -26.184545516967773
},
"fasttext": {
"dclm": 0.7227723598480225,
"english": 0.79987633228302,
"fineweb_edu_approx": 2.705887794494629,
"eai_general_math": 0.2431950569152832,
"eai_open_web_math": 0.2969042658805847,
"eai_web_code": 0.9398481249809265
}
}
|
{
"free_decimal_correspondence": {
"primary": {
"code": "004.16",
"labels": {
"level_1": "General works, books and libraries, information sciences",
"level_2": "",
"level_3": "Computers and Computer science"
}
},
"secondary": {
"code": "005.456",
"labels": {
"level_1": "General works, books and libraries, information sciences",
"level_2": "",
"level_3": "Computer programming"
}
}
},
"bloom_cognitive_process": {
"primary": {
"code": "2",
"label": "Understand"
},
"secondary": {
"code": "3",
"label": "Apply"
}
},
"bloom_knowledge_domain": {
"primary": {
"code": "1",
"label": "Factual"
},
"secondary": {
"code": "3",
"label": "Procedural"
}
},
"document_type_v1": {
"primary": {
"code": "3",
"label": "Reference/Encyclopedic/Educational"
},
"secondary": {
"code": "4",
"label": "Code/Software"
}
},
"extraction_artifacts": {
"primary": {
"code": "0",
"label": "No Artifacts"
},
"secondary": {
"code": "3",
"label": "Irrelevant Content"
}
},
"missing_content": {
"primary": {
"code": "0",
"label": "No missing content"
},
"secondary": {
"code": "-1",
"label": "Abstain"
}
},
"document_type_v2": {
"primary": {
"code": "8",
"label": "Documentation"
},
"secondary": {
"code": "10",
"label": "Knowledge Article"
}
},
"reasoning_depth": {
"primary": {
"code": "2",
"label": "Basic Reasoning"
},
"secondary": {
"code": "1",
"label": "No Reasoning"
}
},
"technical_correctness": {
"primary": {
"code": "4",
"label": "Highly Correct"
},
"secondary": {
"code": "3",
"label": "Mostly Correct"
}
},
"education_level": {
"primary": {
"code": "3",
"label": "Undergraduate Level"
},
"secondary": {
"code": "2",
"label": "High School Level"
}
}
}
|
672f1e42c33a7f9846924a2431ea77df
|
5,215,922,660,023,455,000
|
Remove-CsCallingLineIdentity
Topic Last Modified: 2017-02-08
Use the Remove-CsCallingLineIdentity cmdlet to remove a Caller ID policy.
Remove-CsCallingLineIdentity -Identity <XdsIdentity> [-Confirm [<SwitchParameter>]] [-Force <SwitchParameter>] [-WhatIf [<SwitchParameter>]]
The following example removes the Caller ID policy "Anonymous".
Remove-CsCallingLineIdentity -Identity Anonymous
You can either change or block the Caller ID (also called a Calling Line ID) for a user. By default, the Skype for Business Online user's phone number can be seen when that user makes a call to a PSTN phone, or when a call comes in. Caller ID policies can provide an alternate displayed number or block a number from being displayed.
You can remove an existing Caller ID policy from your organization by using the Remove-CsCallingLineIdentity cmdlet. When a Caller ID policy is removed, it is also removed from any user accounts to which it was granted.
Parameter Required Type Description
Identity
Required
Microsoft.Rtc.Management.Xds.XdsIdentity
The Identity parameter identifies the Caller ID policy.
Confirm
Optional
System.Management.Automation.SwitchParameter
The Confirm switch causes the command to pause processing, and requires confirmation to proceed.
Force
Optional
System.Management.Automation.SwitchParameter
The Force switch specifies whether to suppress warning and confirmation messages. It can be useful in scripting to suppress interactive prompts. If the Force switch isn't provided in the command, you're prompted for administrative input if required.
WhatIf
Optional
System.Management.Automation.SwitchParameter
The WhatIf switch causes the command to simulate its results. By using this switch, you can view what changes would occur without having to commit those changes.
Show:
|
{
"url": "https://technet.microsoft.com/en-us/library/mt793858.aspx",
"source_domain": "technet.microsoft.com",
"snapshot_id": "crawl=CC-MAIN-2017-34",
"warc_metadata": {
"Content-Length": "90032",
"Content-Type": "application/http; msgtype=response",
"WARC-Block-Digest": "sha1:F7SK4IXR4X6EKYA3GKE7M7RZ3HSN3GOR",
"WARC-Concurrent-To": "<urn:uuid:11769f18-6cef-4502-b8fe-d74704c7e5dd>",
"WARC-Date": "2017-08-20T04:44:26Z",
"WARC-IP-Address": "157.56.148.23",
"WARC-Identified-Payload-Type": "application/xhtml+xml",
"WARC-Payload-Digest": "sha1:SKYLPQLPEKGBFAT7G4TVGPPZAQUMQPPX",
"WARC-Record-ID": "<urn:uuid:3341fdd4-08db-4f05-9f9f-502791969d07>",
"WARC-Target-URI": "https://technet.microsoft.com/en-us/library/mt793858.aspx",
"WARC-Truncated": "length",
"WARC-Type": "response",
"WARC-Warcinfo-ID": "<urn:uuid:e2b041ec-ba2b-4014-890c-f36c94116695>"
},
"warc_info": "robots: classic\r\nhostname: ip-10-166-29-11.ec2.internal\r\nsoftware: Nutch 1.6 (CC)\r\nisPartOf: CC-MAIN-2017-34\r\noperator: Common Crawl Admin\r\ndescription: Wide crawl of the web for August 2017\r\npublisher: Common Crawl\r\nformat: WARC File Format 1.0\r\nconformsTo: http://bibnum.bnf.fr/WARC/WARC_ISO_28500_version1_latestdraft.pdf"
}
|
{
"line_start_idx": [
0,
29,
30,
32,
33,
65,
66,
140,
141,
283,
284,
348,
349,
398,
399,
733,
734,
954,
955,
957,
958,
994,
995,
1004,
1005,
1014,
1015,
1056,
1057,
1113,
1114,
1122,
1123,
1132,
1133,
1178,
1179,
1276,
1277,
1283,
1284,
1293,
1294,
1339,
1340,
1590,
1591,
1598,
1599,
1608,
1609,
1654,
1655,
1817,
1818,
1820
],
"line_end_idx": [
29,
30,
32,
33,
65,
66,
140,
141,
283,
284,
348,
349,
398,
399,
733,
734,
954,
955,
957,
958,
994,
995,
1004,
1005,
1014,
1015,
1056,
1057,
1113,
1114,
1122,
1123,
1132,
1133,
1178,
1179,
1276,
1277,
1283,
1284,
1293,
1294,
1339,
1340,
1590,
1591,
1598,
1599,
1608,
1609,
1654,
1655,
1817,
1818,
1820,
1825
]
}
|
{
"red_pajama_v2": {
"ccnet_original_length": 1825,
"ccnet_original_nlines": 55,
"rps_doc_curly_bracket": 0,
"rps_doc_ldnoobw_words": 0,
"rps_doc_lorem_ipsum": 0,
"rps_doc_stop_word_fraction": 0.2857142984867096,
"rps_doc_ut1_blacklist": 0,
"rps_doc_frac_all_caps_words": 0.027950309216976166,
"rps_doc_frac_lines_end_with_ellipsis": 0,
"rps_doc_frac_no_alph_words": 0.19875775277614594,
"rps_doc_frac_unique_words": 0.5,
"rps_doc_mean_word_length": 6.226890563964844,
"rps_doc_num_sentences": 28,
"rps_doc_symbol_to_word_ratio": 0,
"rps_doc_unigram_entropy": 4.4763641357421875,
"rps_doc_word_count": 238,
"rps_doc_frac_chars_dupe_10grams": 0,
"rps_doc_frac_chars_dupe_5grams": 0.03238866105675697,
"rps_doc_frac_chars_dupe_6grams": 0,
"rps_doc_frac_chars_dupe_7grams": 0,
"rps_doc_frac_chars_dupe_8grams": 0,
"rps_doc_frac_chars_dupe_9grams": 0,
"rps_doc_frac_chars_top_2gram": 0.03778677061200142,
"rps_doc_frac_chars_top_3gram": 0.047233469784259796,
"rps_doc_frac_chars_top_4gram": 0.020242910832166672,
"rps_doc_books_importance": -168.63406372070312,
"rps_doc_books_importance_length_correction": -166.6240234375,
"rps_doc_openwebtext_importance": -80.9871826171875,
"rps_doc_openwebtext_importance_length_correction": -80.9871826171875,
"rps_doc_wikipedia_importance": -65.19944763183594,
"rps_doc_wikipedia_importance_length_correction": -65.18919372558594
},
"fasttext": {
"dclm": 0.21243327856063843,
"english": 0.7439965009689331,
"fineweb_edu_approx": 2.362518787384033,
"eai_general_math": 0.0215070191770792,
"eai_open_web_math": 0.24320876598358154,
"eai_web_code": 0.019731279462575912
}
}
|
{
"free_decimal_correspondence": {
"primary": {
"code": "005.446",
"labels": {
"level_1": "General works, books and libraries, information sciences",
"level_2": "",
"level_3": "Computer programming"
}
},
"secondary": {
"code": "004.028",
"labels": {
"level_1": "General works, books and libraries, information sciences",
"level_2": "",
"level_3": "Computers and Computer science"
}
}
},
"bloom_cognitive_process": {
"primary": {
"code": "3",
"label": "Apply"
},
"secondary": {
"code": "2",
"label": "Understand"
}
},
"bloom_knowledge_domain": {
"primary": {
"code": "3",
"label": "Procedural"
},
"secondary": {
"code": "2",
"label": "Conceptual"
}
},
"document_type_v1": {
"primary": {
"code": "3",
"label": "Reference/Encyclopedic/Educational"
},
"secondary": {
"code": "4",
"label": "Code/Software"
}
},
"extraction_artifacts": {
"primary": {
"code": "0",
"label": "No Artifacts"
},
"secondary": {
"code": "3",
"label": "Irrelevant Content"
}
},
"missing_content": {
"primary": {
"code": "0",
"label": "No missing content"
},
"secondary": {
"code": "-1",
"label": "Abstain"
}
},
"document_type_v2": {
"primary": {
"code": "8",
"label": "Documentation"
},
"secondary": {
"code": "23",
"label": "Tutorial"
}
},
"reasoning_depth": {
"primary": {
"code": "2",
"label": "Basic Reasoning"
},
"secondary": {
"code": "3",
"label": "Intermediate Reasoning"
}
},
"technical_correctness": {
"primary": {
"code": "4",
"label": "Highly Correct"
},
"secondary": {
"code": "3",
"label": "Mostly Correct"
}
},
"education_level": {
"primary": {
"code": "4",
"label": "Graduate/Expert Level"
},
"secondary": {
"code": "3",
"label": "Undergraduate Level"
}
}
}
|
672f1e42c33a7f9846924a2431ea77df
|
6,451,812,438,412,191,000
|
homepage Welcome to WebmasterWorld Guest from 50.17.109.248
register, login, search, subscribe, help, library, PubCon, announcements, recent posts, open posts,
Pubcon Platinum Sponsor
Visit PubCon.com
Home / Forums Index / WebmasterWorld / Accessibility and Usability
Forum Library : Charter : Moderators: ergophobe
Accessibility and Usability Forum
Should Google be held socially responsible for web accessibility?
usability and web standards?
le_gber
msg:3329592
9:18 am on May 3, 2007 (gmt 0)
From Adam Lasnik interview on StoneTemple [stonetemple.com] talking about site accessibility, web standards and code cruftiness.
[...] we cannot use this in our scoring algorithms currently: There are a ton of very high quality sites, pages and sites from universities, from research institutions, from very well respected ecommerce stores, of which I won't name any, that have really crufty sites, and sites that won't validate. On some of these you can view the source and cry. And, because this is quality content, we really can't use that as an effective signal in search quality.
I know that some of you may think:
"Google is a commercial entity, why should they play a part in these issues?"
Then I would reply to you:
"Google has so much power on the internet today and they are making so much money out of 'us'. If they can have a major 'positive' impact on the web, why shouldn't they?"
Never has one single company held so much power on the net. If Google said today that standard compliant site, accessible and usable site will get a significant boost in the SERPs, how long do you think it will take for all the 'universities, research institutions, and very well respected ecommerce stores' to get their act together and have their site validate, be more usable and more accessible?
I am thinking that within 3 to 6 months, most of these would. How about corporate CMS merchant, custom built CMS, software vendors etc... How long before they all adhere to the 'standards'?
Who's coming with me to the 'plex to manifest for a significant boost to be applied to standard compliant, accessible and usable sites? :)
abbeyvet
msg:3329603
9:38 am on May 3, 2007 (gmt 0)
I disagree completely. There is tons of valuable content out there created by people who neither know nor care about web standards. A search engine is about getting people to information and the value and quality of information in not corelated in any way to the manner in which it is marked up.
benihana
msg:3329608
9:45 am on May 3, 2007 (gmt 0)
Google really need to get their own house in order first.
My experience of working as part of a (UK) university web team is that:
a) accessiblity is very high priorty
b) SEO is not (rankings happened naturally due to depth and breadth of content)
c) there are too many people involved with publishing, outside of the central team, with varying levels of skills and enthusiasm to have validation across the board (having been called a nazi for banning font tags!) - you cannot police everyone all the time.
d) wide scale change moves at a glacial pace
my2p
le_gber
msg:3330136
8:26 pm on May 3, 2007 (gmt 0)
I disagree completely.
I knew someone would :).
There is tons of valuable content out there created by people who neither know nor care about web standards.
That's exactly my point. If Google said that standard compliant sites would get a significant boost, guess how long it would take for them to learn about it. How long do you think it would take software vendors to make their latest web design soft 100% standard compliant - if everyone was asking to have them compliant?
value and quality of information in not corelated in any way to the manner in which it is marked up.
Maybe not now, but I think that for equally valuable information, the one marked up properly, accessible and for which the designer showed extra care in the markup, should appear first.
a) accessiblity is very high priorty
and so it should be
b) SEO is not (rankings happened naturally due to depth and breadth of content)
and may be the accessibility focus in a)
c) there are too many people involved with publishing, outside of the central team, with varying levels of skills and enthusiasm to have validation across the board (having been called a nazi for banning font tags!) - you cannot police everyone all the time.
I assume that you use a CMS of some kind for those non techie people. Does it produce standard compliant code out of the box?
d) wide scale change moves at a glacial pace
ok maybe for universities, but for businesses or ecommerce sites I am sure that within 6 months they'd all be standard compliant.
abbeyvet
msg:3330167
9:18 pm on May 3, 2007 (gmt 0)
I am sure that within 6 months they'd all be standard compliant.
What world do you live in? What internet do you browse? :)
I am certain they wouldn't.
Gazillions of sites and pages are out there which are old, unedited for years. But very, very good. The original creators have often moved on to other things and possibly don't even have access to the pages anymore in some cases. Who on earth is going to go back and redo them all?
Gazillions of sites and pages are out there that have value as information and are created by people who not only don't know or care about standards, they have never heard of them, they are blissfully unaware that they exist. It won't matter what software providers do, they will carry on using the software they bought in 1999.
And anyway, what standards? I can make a site that validates perfectly but is a total disaster from a useability viewpoint, or equally one that is highly rated for useability but doesn't necessarily validate. How do you assess useability in an algoritm? Would one standard be better than another? Why? In what situation? It's a minefield.
ok maybe for universities, but for businesses or ecommerce sites..
Which would give business and ecommerce sites an advantage in Google over information/educational sites. This would not necessarily serve Google's users well.
It's just a non-runner. Theoretically it is a nice idea, I agree, but in practice it rewards those with money and resources, not necessarily those with knowledge.
Marcia
msg:3330177
9:42 pm on May 3, 2007 (gmt 0)
Which would give business and ecommerce sites an advantage in Google over information/educational sites. This would not necessarily serve Google's users well.
Guess who really would be the quickest to jump on the gravy train for ranking advantages, without bureaucracy to wade through?
I'm sure Matt Cutts and his webspam team would be absolutely thrilled to pieces if this happened.
Beagle
msg:3330253
11:35 pm on May 3, 2007 (gmt 0)
[A note that, of course, the following is all broad generalization. But it accurately represents what I've seen.]
If Google said today that standard compliant site, accessible and usable site will get a significant boost in the SERPs, how long do you think it will take for all the 'universities, research institutions, and very well respected ecommerce stores' to get their act together and have their site validate, be more usable and more accessible?
I don't know about the ecommerce stores, but I can tell you that the majority of people who have anything to do with most university and (to a smaller degree) research institute websites would have no idea what that quote is talking about. (Just judging from my own experience, research institutes are more likely to have one centrally-run website than universities are, and can usually find someone who knows how to run it.)
The university I work for (in a medical research department) has one of the better IT teams around, but it's understaffed for even taking care of day-to-day operations, and can't control what departments, let alone individual faculty members, put online. The medical school is glacially introducing a CMS, which should help if it ever gets finished. Problem is, it's not mandatory, so even when it's fully implemented a lot of people will still be doing their own thing - which often means using FrontPage and being happy if they can get their nav buttons to work.
An idea of what the above quote would elicit from most university research department "webmasters":
What's Google? (MSN is much preferred, for the minority who know what a search engine is. But why wouldn't you just bookmark PubMed?)
Hey, we're really good at "standards compliant" when it comes to dealing with NIH and the IRB, but what does it have to do with the internet?
Validate? Oh, sure - We validate a study when we can reproduce the results. What's a "validating site?" - Of course, it's the site (NIH's term for an institution) where the research is done!
Accessibility is very important - Our entire campus is accessible. But I thought this was supposed to be about computers...?
Usable?
"Hey, my nav buttons work!"
"Wow, how'd you do that?"
SERPS? -- C'mon, get real. The departments/faculty running their own sites don't know what the letters stand for. The pros on the IT team don't care. If they worry about accessibility it's because it's the right thing to do, not because of search engines.
-------The possibly saving grace is that most of the websites are simple, which is usually a good thing for accessibility. But if a full professor learns how to implement Flash - RUN! :o
borntobeweb
msg:3331890
1:04 am on May 6, 2007 (gmt 0)
The best place to force some sort of validation and accessibilty is the browser. Think about it, many people who publish a website don't care or even don't know about SEO, and even less care about Google in particular, but they all care whether the website displays on major browsers. It should be the browsers (IE, Firefox, Opera, Safari) that are held responsible for validating pages and rejecting bad ones, maybe starting with the next version of HTML. And even better, all browsers should render the same code exactly the same way, but I suppose I'm really dreaming there...
Not that I'm asking that the next version of browsers should just stop rendering old non-compliant websites. But starting with the next set of HTML standards, any documents that want to take advantage of the new features should only be rendered if they validate thoroughly.
abbeyvet
msg:3331892
1:13 am on May 6, 2007 (gmt 0)
but they all care whether the website displays on major browsers
No they don't. There are thousands and thousands of people regularly putting content online and creating websites who have barely heard of Firefox, much less downloaded it.
When you hang around places like this you are by definition much more informed than the vast majority of 'webmasters' and it's very easy to forget that.
encyclo
msg:3331901
1:32 am on May 6, 2007 (gmt 0)
The trouble with enforcing validity via the browser is that the end-user will download a new browser, try their favorite websites, see that those sites are broken, then blame the browser not the site, and revert back to what they were using before. And they would by quite right in their actions, as a browser's job is to display web pages, not to evangelize ideals. See the abject failure of XHTML to see the fallacy of the concept of the web with draconian error-handling.
Same goes for Google, unfortunately. If they were to promote accessibility by increasing ranking for accessible sites, their results would suffer as accessibility is not a criterion for relevance. Even if it were, there would be significant difficulties in algorithmically measuring accessibility, as the severe limitations of the current crop of accessibility validators show. Markup validity against a declared DTD is an extremely poor guide to accessibility when taken alone, so that would add no value to Google's algorithm either.
And if they did ever attempt something like this, who would be able to fix their sites in consequence? Those with the funds and the expertise to do so, like commercial entities, large companies, IT professionals. How would that "other" accessibility be affected - the accessibility which comes from the universality of the web, the low barriers to entry, the non-professional publishers, the personal pages...?
If Google is serious about web accessibility, it could always start by looking at its own coding practices and product sites before reaching out to push the concept on others.
borntobeweb
msg:3333211
8:08 pm on May 7, 2007 (gmt 0)
No they don't. There are thousands and thousands of people regularly putting content online and creating websites who have barely heard of Firefox, much less downloaded it.
True, but those people have heard of IE or Safari, or some other major browser, no? It'll be rare that someone will publish a website without trying it out on at least one major browser. If all major browsers strictly enforced validity, then people will be forced to create valid HTML, or at least their authoring programs will be forced to do it.
The trouble with enforcing validity via the browser is that the end-user will download a new browser, try their favorite websites, see that those sites are broken, then blame the browser not the site, and revert back to what they were using before.
But if all major browsers enforced validity strictly then the author would be forced to fix the problems before publishing their site (assuming they test it on at least one major browser).
I agree with you that this would never happen, the net is too unregulated (and rightly so) for one entity to enforce anything beyond the minimum requirements. If one search engine gets picky, we all switch to another, it one browser gets picky we all switch as well. The only way is if there's a concerted effort by all major players, and then I believe it's better to do it at the browser level rather than the search engine level, and only for future versions of HTML so no one has to go back and fix existing sites.
Global Options:
top home search open messages active posts
Home / Forums Index / WebmasterWorld / Accessibility and Usability
rss feed
All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About
WebmasterWorld ® and PubCon ® are a Registered Trademarks of Pubcon Inc.
© Pubcon Inc. 1996-2012 all rights reserved
|
{
"url": "http://www.webmasterworld.com/accessibility_usability/3329590.htm",
"source_domain": "www.webmasterworld.com",
"snapshot_id": "crawl=CC-MAIN-2013-20",
"warc_metadata": {
"Content-Length": "37929",
"Content-Type": "application/http; msgtype=response",
"WARC-Block-Digest": "sha1:4J5D2QKHHMZS3UDCJBQXYUYDHQ35G3Z6",
"WARC-Concurrent-To": "<urn:uuid:737e55dd-c6d3-4e96-821d-848d689aa750>",
"WARC-Date": "2013-05-22T15:16:23Z",
"WARC-IP-Address": "209.59.188.141",
"WARC-Identified-Payload-Type": null,
"WARC-Payload-Digest": "sha1:UF7XT5DOY6JDEFWPDCKPEECSMRJHVXTC",
"WARC-Record-ID": "<urn:uuid:f92c7f31-49a0-4354-85cc-8ca89fa96d92>",
"WARC-Target-URI": "http://www.webmasterworld.com/accessibility_usability/3329590.htm",
"WARC-Truncated": null,
"WARC-Type": "response",
"WARC-Warcinfo-ID": "<urn:uuid:25e377b9-e1d8-4532-98d3-8f7b34fa2c6c>"
},
"warc_info": "robots: classic\r\nhostname: ip-10-60-113-184.ec2.internal\r\nsoftware: Nutch 1.6 (CC)/CC WarcExport 1.0\r\nisPartOf: CC-MAIN-2013-20\r\noperator: CommonCrawl Admin\r\ndescription: Wide crawl of the web with URLs provided by Blekko for Spring 2013\r\npublisher: CommonCrawl\r\nformat: WARC File Format 1.0\r\nconformsTo: http://bibnum.bnf.fr/WARC/WARC_ISO_28500_version1_latestdraft.pdf"
}
|
{
"line_start_idx": [
0,
60,
160,
184,
201,
268,
316,
317,
351,
352,
357,
423,
452,
460,
461,
462,
463,
464,
476,
508,
509,
638,
639,
1095,
1096,
1131,
1209,
1236,
1407,
1408,
1808,
1809,
1999,
2000,
2139,
2140,
2142,
2143,
2152,
2153,
2154,
2155,
2156,
2168,
2200,
2201,
2497,
2498,
2507,
2508,
2509,
2510,
2511,
2523,
2555,
2556,
2614,
2615,
2687,
2688,
2725,
2805,
3064,
3109,
3110,
3115,
3116,
3124,
3125,
3126,
3127,
3128,
3140,
3172,
3173,
3196,
3197,
3222,
3223,
3332,
3333,
3654,
3655,
3756,
3757,
3943,
3944,
3981,
3982,
4002,
4082,
4083,
4124,
4383,
4384,
4510,
4555,
4556,
4686,
4687,
4696,
4697,
4698,
4699,
4700,
4712,
4744,
4745,
4810,
4811,
4870,
4871,
4899,
4900,
5182,
5183,
5512,
5513,
5852,
5853,
5920,
5921,
6080,
6081,
6244,
6245,
6252,
6253,
6254,
6255,
6256,
6268,
6300,
6301,
6460,
6461,
6588,
6589,
6687,
6688,
6695,
6696,
6697,
6698,
6699,
6711,
6744,
6745,
6859,
6860,
7200,
7201,
7627,
7628,
8193,
8194,
8294,
8295,
8429,
8430,
8572,
8573,
8764,
8765,
8890,
8891,
8899,
8927,
8953,
8954,
9210,
9211,
9398,
9399,
9411,
9412,
9413,
9414,
9415,
9427,
9459,
9460,
10040,
10041,
10315,
10316,
10325,
10326,
10327,
10328,
10329,
10341,
10373,
10374,
10439,
10440,
10613,
10614,
10767,
10768,
10776,
10777,
10778,
10779,
10780,
10792,
10824,
10825,
11300,
11301,
11837,
11838,
12249,
12250,
12426,
12427,
12439,
12440,
12441,
12442,
12443,
12455,
12487,
12488,
12661,
12662,
13010,
13011,
13260,
13261,
13450,
13451,
13970,
13971,
13987,
14033,
14035,
14036,
14103,
14112,
14113,
14211,
14270,
14343
],
"line_end_idx": [
60,
160,
184,
201,
268,
316,
317,
351,
352,
357,
423,
452,
460,
461,
462,
463,
464,
476,
508,
509,
638,
639,
1095,
1096,
1131,
1209,
1236,
1407,
1408,
1808,
1809,
1999,
2000,
2139,
2140,
2142,
2143,
2152,
2153,
2154,
2155,
2156,
2168,
2200,
2201,
2497,
2498,
2507,
2508,
2509,
2510,
2511,
2523,
2555,
2556,
2614,
2615,
2687,
2688,
2725,
2805,
3064,
3109,
3110,
3115,
3116,
3124,
3125,
3126,
3127,
3128,
3140,
3172,
3173,
3196,
3197,
3222,
3223,
3332,
3333,
3654,
3655,
3756,
3757,
3943,
3944,
3981,
3982,
4002,
4082,
4083,
4124,
4383,
4384,
4510,
4555,
4556,
4686,
4687,
4696,
4697,
4698,
4699,
4700,
4712,
4744,
4745,
4810,
4811,
4870,
4871,
4899,
4900,
5182,
5183,
5512,
5513,
5852,
5853,
5920,
5921,
6080,
6081,
6244,
6245,
6252,
6253,
6254,
6255,
6256,
6268,
6300,
6301,
6460,
6461,
6588,
6589,
6687,
6688,
6695,
6696,
6697,
6698,
6699,
6711,
6744,
6745,
6859,
6860,
7200,
7201,
7627,
7628,
8193,
8194,
8294,
8295,
8429,
8430,
8572,
8573,
8764,
8765,
8890,
8891,
8899,
8927,
8953,
8954,
9210,
9211,
9398,
9399,
9411,
9412,
9413,
9414,
9415,
9427,
9459,
9460,
10040,
10041,
10315,
10316,
10325,
10326,
10327,
10328,
10329,
10341,
10373,
10374,
10439,
10440,
10613,
10614,
10767,
10768,
10776,
10777,
10778,
10779,
10780,
10792,
10824,
10825,
11300,
11301,
11837,
11838,
12249,
12250,
12426,
12427,
12439,
12440,
12441,
12442,
12443,
12455,
12487,
12488,
12661,
12662,
13010,
13011,
13260,
13261,
13450,
13451,
13970,
13971,
13987,
14033,
14035,
14036,
14103,
14112,
14113,
14211,
14270,
14343,
14386
]
}
|
{
"red_pajama_v2": {
"ccnet_original_length": 14386,
"ccnet_original_nlines": 243,
"rps_doc_curly_bracket": 0,
"rps_doc_ldnoobw_words": 0,
"rps_doc_lorem_ipsum": 0,
"rps_doc_stop_word_fraction": 0.4389416575431824,
"rps_doc_ut1_blacklist": 0,
"rps_doc_frac_all_caps_words": 0.01797829009592533,
"rps_doc_frac_lines_end_with_ellipsis": 0.00409835996106267,
"rps_doc_frac_no_alph_words": 0.1818181872367859,
"rps_doc_frac_unique_words": 0.3056478500366211,
"rps_doc_mean_word_length": 4.7009968757629395,
"rps_doc_num_sentences": 128,
"rps_doc_symbol_to_word_ratio": 0.0016960699576884508,
"rps_doc_unigram_entropy": 5.812936305999756,
"rps_doc_word_count": 2408,
"rps_doc_frac_chars_dupe_10grams": 0.23851589858531952,
"rps_doc_frac_chars_dupe_5grams": 0.298763245344162,
"rps_doc_frac_chars_dupe_6grams": 0.2895759642124176,
"rps_doc_frac_chars_dupe_7grams": 0.2783568799495697,
"rps_doc_frac_chars_dupe_8grams": 0.2615724503993988,
"rps_doc_frac_chars_dupe_9grams": 0.25053003430366516,
"rps_doc_frac_chars_top_2gram": 0.0048586600460112095,
"rps_doc_frac_chars_top_3gram": 0.007773850113153458,
"rps_doc_frac_chars_top_4gram": 0.006183749996125698,
"rps_doc_books_importance": -1413.8895263671875,
"rps_doc_books_importance_length_correction": -1413.8895263671875,
"rps_doc_openwebtext_importance": -730.1849365234375,
"rps_doc_openwebtext_importance_length_correction": -730.1849365234375,
"rps_doc_wikipedia_importance": -520.1902465820312,
"rps_doc_wikipedia_importance_length_correction": -520.1902465820312
},
"fasttext": {
"dclm": 0.2072540521621704,
"english": 0.9578034281730652,
"fineweb_edu_approx": 1.6343950033187866,
"eai_general_math": 0.14223241806030273,
"eai_open_web_math": 0.1275416612625122,
"eai_web_code": 0.03810549154877663
}
}
|
{
"free_decimal_correspondence": {
"primary": {
"code": "004.67",
"labels": {
"level_1": "General works, books and libraries, information sciences",
"level_2": "",
"level_3": "Computers and Computer science"
}
},
"secondary": {
"code": "005.4",
"labels": {
"level_1": "General works, books and libraries, information sciences",
"level_2": "",
"level_3": "Computer programming"
}
}
},
"bloom_cognitive_process": {
"primary": {
"code": "5",
"label": "Evaluate"
},
"secondary": {
"code": "4",
"label": "Analyze"
}
},
"bloom_knowledge_domain": {
"primary": {
"code": "2",
"label": "Conceptual"
},
"secondary": {
"code": "3",
"label": "Procedural"
}
},
"document_type_v1": {
"primary": {
"code": "5",
"label": "Social/Forum"
},
"secondary": {
"code": "-1",
"label": "Abstain"
}
},
"extraction_artifacts": {
"primary": {
"code": "3",
"label": "Irrelevant Content"
},
"secondary": {
"code": "0",
"label": "No Artifacts"
}
},
"missing_content": {
"primary": {
"code": "0",
"label": "No missing content"
},
"secondary": {
"code": "-1",
"label": "Abstain"
}
},
"document_type_v2": {
"primary": {
"code": "18",
"label": "Q&A Forum"
},
"secondary": {
"code": "5",
"label": "Comment Section"
}
},
"reasoning_depth": {
"primary": {
"code": "3",
"label": "Intermediate Reasoning"
},
"secondary": {
"code": "2",
"label": "Basic Reasoning"
}
},
"technical_correctness": {
"primary": {
"code": "6",
"label": "Not Applicable/Indeterminate"
},
"secondary": {
"code": "3",
"label": "Mostly Correct"
}
},
"education_level": {
"primary": {
"code": "2",
"label": "High School Level"
},
"secondary": {
"code": "3",
"label": "Undergraduate Level"
}
}
}
|
672f1e42c33a7f9846924a2431ea77df
|
1,374,114,300,387,306,200
|
* Posts by IndianaJ
61 posts • joined 22 Nov 2007
Page:
XM-Hell strikes single-sign-on systems: Bugs allow miscreants to masquerade as others
IndianaJ
WTF?
Re: Sign ALL the data
I was also under the mistaken impression that signatures operated across all the data it was signing.
1
0
Microsoft's Hadoop-hugging SQL Server 2012 gets closer
IndianaJ
Alert
Nothing like a bit of foresight
"new reporting client built using Microsoft's Silverlight"
Is this a joke?
0
0
Ofcom boss warns of low interest in 'superfast' broadband
IndianaJ
Wouldn't bother with 50Mb anyway
I was on it for a few months and despite engineer visits and obligatory non-returned calls, they never managed to deliver that speed. The best I was getting from speedtest.net was just over 20Mb. Have just downgraded to 30Mb (apparently 20Mb doesn't exist anymore??).
0
0
AES crypto broken by 'groundbreaking' attack
IndianaJ
Singularity
Great research project. Probably never see the light of day, but an interesting idea.
0
0
Microsoft poised to make biggest ever buy – Skype
IndianaJ
This is a great shame.
And probably will be the death of a much loved product.
3
1
Entrants called for 80s-era games coding contest
IndianaJ
Stop
Hmmm
Was getting all excited about carving up some 6502 assembler again when I noticed the 'no programming experience' bit.....
2
0
The Microsoft mobile reboot needs rebooting
IndianaJ
FAIL
Inferring
that people who hate MS just don't know enough about them? I suspect knowing too much is the real issue here.
6
0
Mozilla: 'Internet Explorer 9 is not a modern browser'
IndianaJ
I guess
Silverlight for all of them.
0
0
IndianaJ
Web Worker
No Web Worker? That was the most exciting part of HTML 5 for me..... get non-ui processing into the background good and proper ... Sounds like IE 9 will be way behind the times and will suffer jittery ui response.
0
0
IndianaJ
IETester
is the solution to your VM nightmare... not a complete solution (I wouldn't trust it 100%), but it's a good indicator of how a site would look in the different versions.
0
0
Limping MySpace to offload half of workforce
IndianaJ
Thumb Up
MySpace is to social networking
as <blink> is to HTML.
Most of those custom CSS pages were very reminiscent of Geotrocities of the 90s.
3
0
LG whips out dual-core Android smartphone
IndianaJ
Maybe
Maybe it'll be able to play Angry Birds.
3
0
Capgemini pushes efficiency limits in Swindon data centre
IndianaJ
I reckon
Given the style of the building, it would fit quite nicely into the South Marston Industrial Estate or maybe Blagrove over by J16 of the M4.
0
0
EU sues UK.gov over Phorm trials
IndianaJ
WTF?
Taxpayer
So the taxpayer coughs up a load more money for the failings of some jumped up CEO from the city..... sounds familiar.
12
1
Angry Birds take wing on Android
IndianaJ
Nada
Not for us HTC Hero users.... does it require Froyo?
0
0
Geek tech firm loses Jedi credentials
IndianaJ
Headmaster
I would love to see a welding mouse.
Though I suspect you really meant 'wielding'.
0
0
Reverse engineer extracts Skype crypto secret recipe
IndianaJ
I thought
I thought that export restriction was lifted in the late 90s when someone printed out the code, took it on a plane and re-entered it in a.n.other country. When IE finally got to use full 128 bit SSL instead of the 56 bit allowed outside the US. Or are there still restrictions to the likes of Pakistan, Iran etc?
0
0
Microsoft's .NET at ten: big hits, strange misses
IndianaJ
Thumb Down
Get a clue
3.0 and 3.5 are extensions of .Net 2.0. The 250Mb installer actually includes .Net 2.0 with it.
The number of comments re backward compatibility are also incorrect. By default, the apps will use the latest version of .Net installed on a system. Yes, there are some breaking changes between versions, but if you hit these then the developer can specifiy which version the app requires.
If you don't know what you're talking about, best to keep shtum really.
3
0
Twitter topples over
IndianaJ
Interpretation :
"Quick someone, think of some technobabble."
0
0
Apple's HTML5 'standards' hype debunked
IndianaJ
Stop
I thought that too
But re-read it. It does make sense. The relation is to the 'related HTML5 technologies' part, not to CSS.
0
0
IBM super is Met Office's 'chief weapon against British cynicism'
IndianaJ
Stop
It used to be
a 'best fit' methodology apparently. Look at the data for this year, map it to the best set of previous years' data and base your prediction on that. Maybe they don't use this method anymore, but I wouldn't be surprised and this would explain why they get it wrong for long range forecasts. In fact, I doubt they really get many right, it's just that we've had the best snow in 30 years, so the media pick up on it more.
0
0
Prolific hacker releases PlayStation exploit
IndianaJ
Pint
Oh so true
I love a tech story making the main news. Watching the bumbling 'expert' try and explain something in layman's terms. And Click! just makes me whince at the amount of bollocks it spouts.
0
0
Once impenetrable PS3 cracked wide open
IndianaJ
In a nutshell
He broke his PS3 and isn't going to tell anyone how he did it.
2
0
Bob the Builder slapped with CGI rendering
IndianaJ
Ok, I take it back
It's nowhere near as bad as some modern stuff.
0
0
IndianaJ
Pint
I refer the right on gentleman to my retraction above.
I think my ill feeling may stem from what it replaced in the schedule.
0
0
IndianaJ
FAIL
B'tards
Pretty much all the programmes that have gone this route have become shit for some reason. Noddy, Fireman Sam (which, in fairness, was shit to start with), Bill & Ben (of flowerpot fame) and Postman Pat. All have the look and feel of the homogenised CGI that they are. Bring back BERTHA.
1
0
Doing the maths on Copenhagen
IndianaJ
FAIL
The Assumption Twist
Exaggeration isn't science. Saying I disagree that climate change is man made does not mean I think I know better than 99.999999% of the world's scientific community (of which, I would only guess at most 1% are authoratative on the subject). The basis of my opinion is from an esteemed meteorologist of 40 years standing. Who also has colleagues of the same opinion. That, alongside the stench of a politicised science really makes me question what is being spoon fed to us.
2
1
HTC's next-gen Android flagship phone to debut Feb 2010
IndianaJ
@Hayden Clark
HTC are working on an update to bring the Hero Android 2.0.
0
0
Swindon council promises townsfolk free Wi-Fi XTC
IndianaJ
WTF?
City?
Umm... did we get city status? Where's the Uni / Cathedral / Other stuff that qualifies this place as anything other than urban sprawl?
0
0
Google Chrome web protocol seeks 2x download speeds
IndianaJ
Thumb Up
Sounds good to me
Anything that 'invisibly' extends HTTP for the better can only be a good thing. How old is HTTP 1.1 now? Is there a HTTP 2.0 on the horizon? No. So good on Google for taking this forward at last.
0
0
'Something may come through' dimensional 'doors' at LHC
IndianaJ
Alert
Haven't these people
seen Event Horizon? That'd make 'em think twice.
0
0
Mandy declares 'three strikes' war on illegal file sharers
IndianaJ
Just words
I think developers working with the interwebs may be one step ahead of you Mandy.
0
0
Windows Mobile 6.5 ships today
IndianaJ
FAIL
Don't they know?
This
"The app is based on version six of desktop IE"
is bad. Even a bit retarded.
0
0
Inside Intel's 'Moorestown'
IndianaJ
Stop
Dynamic overclocking?
Sounds freaking dangerous to me. Can I opt out of having a heart monitor running this? Ta.
0
0
UK already 'major world power' in cyberwar
IndianaJ
Stop
How can this be?
"... they seem more aware of how much they don't know than their American counterparts ... "
Surely this implies the American counterparts are single cell organisms.
0
0
T-Mobile's G2 denied the update Touch
IndianaJ
Unhappy
I can confirm
My Hero is holding out for the update, despite HTC thinking my S/N isn't suitable. I tried waving the thing at the website and shouting, but still no go.
0
0
Tomorrow's World comes back to the future
IndianaJ
Thumb Up
Mmmmm
Maggie Philbin. Always though I'd marry her. Damn you Cheggers.
0
0
Abigail's Windows 7 Party
IndianaJ
Thumb Up
Sounds like
one of those InstallFests that I nearly attended once. Luckily I met up with the LUG beforehand and decided not to go.
0
0
Mono swings .NET development into iPhone
IndianaJ
FAIL
Nothing to gain really
If you're using C# proficiently, then Objective C isn't that big a leap of faith.
0
0
Brown apologises for 'appalling' treatment of Turing
IndianaJ
Thumb Down
Hmm
I don't agree with empty apologies. But if that's what the family needs (did they sign the petition?), then good for them. If he had apologised of his own volition though, I think that would have meant more.
0
0
IIS bug gives attackers complete server control
IndianaJ
Alert
Hmmm
"And according to Nikolaos Rangos, the hacker who released the exploit, IIS6 is also vulnerable.."
This is obviously more interesting... but is it backed up with some proof? Or is the chap trying to big it up somewhat?
0
0
IT workers grumble about lack of career path
IndianaJ
Flame
@Yorkshirepudding
And the joy of trying to move on? Having to deal with those 'recruitment consultants'. As bad, if not worse than, estate agents.
OT though, agreed with tech managers being failed techies. Surprised they haven't gone into teaching really.
0
0
IndianaJ
Flame
Progression?
Progression = new job. Climbing the ladder by company hopping. It sucks, but it's the only way. Even then, progression is a very loose term as it can ends up as a step backwards anyway. Meet the new boss, same as the old boss.
0
0
Metallica sticksman gloats over Napster downfall
IndianaJ
Grenade
Where was the proof?
What is this proof he speaks of? The man is a good drummer and should stick to what he knows. He is also good at spouting utter bollocks by the looks of it.
0
0
Memory-hogging bug offers universal browser crash exploit
IndianaJ
Pint
Let's be fair to Grease Monkey
We've all made that mistake once. It was 12 years ago for me and still bear the scars from a Java devver.
Back on topic, doesn't work in FF 3.011 either. *click* *click* *click* NS_DOM_ERROR_NOT_SUPPORTED.
Amazed at Ubuntu killing of random processes though.
0
0
Google reinvents network computing
IndianaJ
FAIL
AJAX ain't all that
Until JavaScript supports multiple threads, AJAX isn't going to solve some of the fundamental issues with web based apps at the moment. The number of failures I get in Mafia Wars is staggering. Maybe it's badly written, but heavy reliance on AJAX, in my experience, doesn't work well.
The good news being that the Chrome browser does at least have a seperate thread for JavaScript per tab. Maybe this could pave the way to multi threaded JavaScript? If so, count me in. I'm along for the ride.
0
0
Google polishes Chrome into netbook OS
IndianaJ
Great stuff
Sounds like a fantastic idea. Hopefully it won't just be a 'browser' though. Imagine just being able to use "Web 2.0" apps? It would kill you.
0
0
UK.gov decides best form of cyber defence is attack
IndianaJ
FAIL
Cyber?
Are they incapable of making sensible references to the internet instead of borrowing from science fiction? FFS. They really do think we're all children.
0
0
BT bumps up broadband speeds
IndianaJ
Stop
Errmm....
I'm with Virgin Media and was upgraded from a 4Mb connection to 10Mb for free last year.
0
0
Level 3 wilts in London sunshine (again)
IndianaJ
@James
Yes, someone already thought of that :
http://www.thebunker.net/facilities/newbury-data-centre/
0
0
Page:
Forums
Biting the hand that feeds IT © 1998–2018
|
{
"url": "https://forums.theregister.co.uk/user/13079/",
"source_domain": "forums.theregister.co.uk",
"snapshot_id": "crawl=CC-MAIN-2018-43",
"warc_metadata": {
"Content-Length": "133791",
"Content-Type": "application/http; msgtype=response",
"WARC-Block-Digest": "sha1:ZAW35VK5BNK4PFI66TYY7Y7XXZYVNLAC",
"WARC-Concurrent-To": "<urn:uuid:7001b3b3-fe59-446c-9769-d3f9055bc23c>",
"WARC-Date": "2018-10-18T18:51:47Z",
"WARC-IP-Address": "104.18.225.129",
"WARC-Identified-Payload-Type": "text/html",
"WARC-Payload-Digest": "sha1:KRQTNTOS6SM757XYA4YRTWSQNL32BGTP",
"WARC-Record-ID": "<urn:uuid:43c7d9b1-1db4-4b1e-850d-d13a1a1385d2>",
"WARC-Target-URI": "https://forums.theregister.co.uk/user/13079/",
"WARC-Truncated": null,
"WARC-Type": "response",
"WARC-Warcinfo-ID": "<urn:uuid:71eb524a-b1d4-4e11-a7a6-a0331e712c3b>"
},
"warc_info": "isPartOf: CC-MAIN-2018-43\r\npublisher: Common Crawl\r\ndescription: Wide crawl of the web for October 2018\r\noperator: Common Crawl Admin (info@commoncrawl.org)\r\nhostname: ip-10-111-241-198.ec2.internal\r\nsoftware: Apache Nutch 1.15 (modified, https://github.com/commoncrawl/nutch/)\r\nrobots: checked via crawler-commons 0.11-SNAPSHOT (https://github.com/crawler-commons/crawler-commons)\r\nformat: WARC File Format 1.1\r\nconformsTo: http://iipc.github.io/warc-specifications/specifications/warc-format/warc-1.1/"
}
|
{
"line_start_idx": [
0,
20,
21,
51,
52,
58,
59,
145,
146,
155,
160,
161,
183,
184,
286,
287,
289,
291,
292,
347,
348,
357,
363,
364,
396,
397,
456,
457,
473,
474,
476,
478,
479,
537,
538,
547,
548,
581,
582,
850,
851,
853,
855,
856,
901,
902,
911,
912,
924,
925,
1011,
1012,
1014,
1016,
1017,
1067,
1068,
1077,
1078,
1101,
1102,
1158,
1159,
1161,
1163,
1164,
1213,
1214,
1223,
1228,
1229,
1234,
1235,
1358,
1359,
1361,
1363,
1364,
1408,
1409,
1418,
1423,
1424,
1434,
1435,
1545,
1546,
1548,
1550,
1551,
1606,
1607,
1616,
1617,
1625,
1626,
1655,
1656,
1658,
1660,
1669,
1670,
1681,
1682,
1896,
1897,
1899,
1901,
1910,
1911,
1920,
1921,
2091,
2092,
2094,
2096,
2097,
2142,
2143,
2152,
2161,
2162,
2194,
2195,
2218,
2219,
2300,
2301,
2303,
2305,
2306,
2348,
2349,
2358,
2359,
2365,
2366,
2407,
2408,
2410,
2412,
2413,
2471,
2472,
2481,
2482,
2491,
2492,
2633,
2634,
2636,
2638,
2639,
2672,
2673,
2682,
2687,
2688,
2697,
2698,
2817,
2818,
2821,
2823,
2824,
2857,
2858,
2867,
2868,
2873,
2874,
2927,
2928,
2930,
2932,
2933,
2971,
2972,
2981,
2992,
2993,
3030,
3031,
3077,
3078,
3080,
3082,
3083,
3136,
3137,
3146,
3147,
3157,
3158,
3471,
3472,
3474,
3476,
3477,
3527,
3528,
3537,
3548,
3549,
3560,
3561,
3657,
3658,
3947,
3948,
4020,
4021,
4023,
4025,
4026,
4047,
4048,
4057,
4058,
4075,
4076,
4121,
4122,
4124,
4126,
4127,
4167,
4168,
4177,
4182,
4183,
4202,
4203,
4309,
4310,
4312,
4314,
4315,
4381,
4382,
4391,
4396,
4397,
4411,
4412,
4833,
4834,
4836,
4838,
4839,
4884,
4885,
4894,
4899,
4900,
4911,
4912,
5099,
5100,
5102,
5104,
5105,
5145,
5146,
5155,
5156,
5170,
5171,
5234,
5235,
5237,
5239,
5240,
5283,
5284,
5293,
5294,
5313,
5314,
5361,
5362,
5364,
5366,
5375,
5380,
5381,
5436,
5437,
5508,
5509,
5511,
5513,
5522,
5527,
5528,
5536,
5537,
5825,
5826,
5828,
5830,
5831,
5861,
5862,
5871,
5876,
5877,
5898,
5899,
6374,
6375,
6377,
6379,
6380,
6436,
6437,
6446,
6447,
6461,
6462,
6522,
6523,
6525,
6527,
6528,
6578,
6579,
6588,
6593,
6594,
6600,
6601,
6737,
6738,
6740,
6742,
6743,
6795,
6796,
6805,
6814,
6815,
6833,
6834,
7030,
7031,
7033,
7035,
7036,
7092,
7093,
7102,
7108,
7109,
7130,
7131,
7180,
7181,
7183,
7185,
7186,
7245,
7246,
7255,
7256,
7267,
7268,
7350,
7351,
7353,
7355,
7356,
7387,
7388,
7397,
7402,
7403,
7420,
7421,
7426,
7427,
7475,
7476,
7505,
7506,
7508,
7510,
7511,
7539,
7540,
7549,
7554,
7555,
7577,
7578,
7669,
7670,
7672,
7674,
7675,
7718,
7719,
7728,
7733,
7734,
7751,
7752,
7845,
7846,
7919,
7920,
7922,
7924,
7925,
7963,
7964,
7973,
7981,
7982,
7996,
7997,
8151,
8152,
8154,
8156,
8157,
8199,
8200,
8209,
8218,
8219,
8225,
8226,
8290,
8291,
8293,
8295,
8296,
8322,
8323,
8332,
8341,
8342,
8354,
8355,
8474,
8475,
8477,
8479,
8480,
8521,
8522,
8531,
8536,
8537,
8560,
8561,
8643,
8644,
8646,
8648,
8649,
8702,
8703,
8712,
8723,
8724,
8728,
8729,
8937,
8938,
8940,
8942,
8943,
8991,
8992,
9001,
9007,
9008,
9013,
9014,
9113,
9114,
9234,
9235,
9237,
9239,
9240,
9285,
9286,
9295,
9301,
9302,
9320,
9321,
9450,
9451,
9560,
9561,
9563,
9565,
9574,
9580,
9581,
9594,
9595,
9822,
9823,
9825,
9827,
9828,
9877,
9878,
9887,
9895,
9896,
9917,
9918,
10075,
10076,
10078,
10080,
10081,
10139,
10140,
10149,
10154,
10155,
10186,
10187,
10293,
10294,
10394,
10395,
10448,
10449,
10451,
10453,
10454,
10489,
10490,
10499,
10504,
10505,
10525,
10526,
10811,
10812,
11021,
11022,
11024,
11026,
11027,
11066,
11067,
11076,
11077,
11089,
11090,
11233,
11234,
11236,
11238,
11239,
11291,
11292,
11301,
11306,
11307,
11314,
11315,
11469,
11470,
11472,
11474,
11475,
11504,
11505,
11514,
11519,
11520,
11530,
11531,
11620,
11621,
11623,
11625,
11626,
11667,
11668,
11677,
11678,
11685,
11686,
11725,
11726,
11783,
11784,
11786,
11788,
11789,
11795,
11796,
11803,
11804
],
"line_end_idx": [
20,
21,
51,
52,
58,
59,
145,
146,
155,
160,
161,
183,
184,
286,
287,
289,
291,
292,
347,
348,
357,
363,
364,
396,
397,
456,
457,
473,
474,
476,
478,
479,
537,
538,
547,
548,
581,
582,
850,
851,
853,
855,
856,
901,
902,
911,
912,
924,
925,
1011,
1012,
1014,
1016,
1017,
1067,
1068,
1077,
1078,
1101,
1102,
1158,
1159,
1161,
1163,
1164,
1213,
1214,
1223,
1228,
1229,
1234,
1235,
1358,
1359,
1361,
1363,
1364,
1408,
1409,
1418,
1423,
1424,
1434,
1435,
1545,
1546,
1548,
1550,
1551,
1606,
1607,
1616,
1617,
1625,
1626,
1655,
1656,
1658,
1660,
1669,
1670,
1681,
1682,
1896,
1897,
1899,
1901,
1910,
1911,
1920,
1921,
2091,
2092,
2094,
2096,
2097,
2142,
2143,
2152,
2161,
2162,
2194,
2195,
2218,
2219,
2300,
2301,
2303,
2305,
2306,
2348,
2349,
2358,
2359,
2365,
2366,
2407,
2408,
2410,
2412,
2413,
2471,
2472,
2481,
2482,
2491,
2492,
2633,
2634,
2636,
2638,
2639,
2672,
2673,
2682,
2687,
2688,
2697,
2698,
2817,
2818,
2821,
2823,
2824,
2857,
2858,
2867,
2868,
2873,
2874,
2927,
2928,
2930,
2932,
2933,
2971,
2972,
2981,
2992,
2993,
3030,
3031,
3077,
3078,
3080,
3082,
3083,
3136,
3137,
3146,
3147,
3157,
3158,
3471,
3472,
3474,
3476,
3477,
3527,
3528,
3537,
3548,
3549,
3560,
3561,
3657,
3658,
3947,
3948,
4020,
4021,
4023,
4025,
4026,
4047,
4048,
4057,
4058,
4075,
4076,
4121,
4122,
4124,
4126,
4127,
4167,
4168,
4177,
4182,
4183,
4202,
4203,
4309,
4310,
4312,
4314,
4315,
4381,
4382,
4391,
4396,
4397,
4411,
4412,
4833,
4834,
4836,
4838,
4839,
4884,
4885,
4894,
4899,
4900,
4911,
4912,
5099,
5100,
5102,
5104,
5105,
5145,
5146,
5155,
5156,
5170,
5171,
5234,
5235,
5237,
5239,
5240,
5283,
5284,
5293,
5294,
5313,
5314,
5361,
5362,
5364,
5366,
5375,
5380,
5381,
5436,
5437,
5508,
5509,
5511,
5513,
5522,
5527,
5528,
5536,
5537,
5825,
5826,
5828,
5830,
5831,
5861,
5862,
5871,
5876,
5877,
5898,
5899,
6374,
6375,
6377,
6379,
6380,
6436,
6437,
6446,
6447,
6461,
6462,
6522,
6523,
6525,
6527,
6528,
6578,
6579,
6588,
6593,
6594,
6600,
6601,
6737,
6738,
6740,
6742,
6743,
6795,
6796,
6805,
6814,
6815,
6833,
6834,
7030,
7031,
7033,
7035,
7036,
7092,
7093,
7102,
7108,
7109,
7130,
7131,
7180,
7181,
7183,
7185,
7186,
7245,
7246,
7255,
7256,
7267,
7268,
7350,
7351,
7353,
7355,
7356,
7387,
7388,
7397,
7402,
7403,
7420,
7421,
7426,
7427,
7475,
7476,
7505,
7506,
7508,
7510,
7511,
7539,
7540,
7549,
7554,
7555,
7577,
7578,
7669,
7670,
7672,
7674,
7675,
7718,
7719,
7728,
7733,
7734,
7751,
7752,
7845,
7846,
7919,
7920,
7922,
7924,
7925,
7963,
7964,
7973,
7981,
7982,
7996,
7997,
8151,
8152,
8154,
8156,
8157,
8199,
8200,
8209,
8218,
8219,
8225,
8226,
8290,
8291,
8293,
8295,
8296,
8322,
8323,
8332,
8341,
8342,
8354,
8355,
8474,
8475,
8477,
8479,
8480,
8521,
8522,
8531,
8536,
8537,
8560,
8561,
8643,
8644,
8646,
8648,
8649,
8702,
8703,
8712,
8723,
8724,
8728,
8729,
8937,
8938,
8940,
8942,
8943,
8991,
8992,
9001,
9007,
9008,
9013,
9014,
9113,
9114,
9234,
9235,
9237,
9239,
9240,
9285,
9286,
9295,
9301,
9302,
9320,
9321,
9450,
9451,
9560,
9561,
9563,
9565,
9574,
9580,
9581,
9594,
9595,
9822,
9823,
9825,
9827,
9828,
9877,
9878,
9887,
9895,
9896,
9917,
9918,
10075,
10076,
10078,
10080,
10081,
10139,
10140,
10149,
10154,
10155,
10186,
10187,
10293,
10294,
10394,
10395,
10448,
10449,
10451,
10453,
10454,
10489,
10490,
10499,
10504,
10505,
10525,
10526,
10811,
10812,
11021,
11022,
11024,
11026,
11027,
11066,
11067,
11076,
11077,
11089,
11090,
11233,
11234,
11236,
11238,
11239,
11291,
11292,
11301,
11306,
11307,
11314,
11315,
11469,
11470,
11472,
11474,
11475,
11504,
11505,
11514,
11519,
11520,
11530,
11531,
11620,
11621,
11623,
11625,
11626,
11667,
11668,
11677,
11678,
11685,
11686,
11725,
11726,
11783,
11784,
11786,
11788,
11789,
11795,
11796,
11803,
11804,
11845
]
}
|
{
"red_pajama_v2": {
"ccnet_original_length": 11845,
"ccnet_original_nlines": 604,
"rps_doc_curly_bracket": 0,
"rps_doc_ldnoobw_words": 5,
"rps_doc_lorem_ipsum": 0,
"rps_doc_stop_word_fraction": 0.3482106924057007,
"rps_doc_ut1_blacklist": 0,
"rps_doc_frac_all_caps_words": 0.04342580959200859,
"rps_doc_frac_lines_end_with_ellipsis": 0.003305790014564991,
"rps_doc_frac_no_alph_words": 0.20587052404880524,
"rps_doc_frac_unique_words": 0.45194676518440247,
"rps_doc_mean_word_length": 4.500246524810791,
"rps_doc_num_sentences": 166,
"rps_doc_symbol_to_word_ratio": 0.004825090058147907,
"rps_doc_unigram_entropy": 6.042996883392334,
"rps_doc_word_count": 2029,
"rps_doc_frac_chars_dupe_10grams": 0,
"rps_doc_frac_chars_dupe_5grams": 0,
"rps_doc_frac_chars_dupe_6grams": 0,
"rps_doc_frac_chars_dupe_7grams": 0,
"rps_doc_frac_chars_dupe_8grams": 0,
"rps_doc_frac_chars_dupe_9grams": 0,
"rps_doc_frac_chars_top_2gram": 0.008542330004274845,
"rps_doc_frac_chars_top_3gram": 0.005475849844515324,
"rps_doc_frac_chars_top_4gram": 0.004599719773977995,
"rps_doc_books_importance": -1044.796142578125,
"rps_doc_books_importance_length_correction": -1044.796142578125,
"rps_doc_openwebtext_importance": -600.1328735351562,
"rps_doc_openwebtext_importance_length_correction": -600.1328735351562,
"rps_doc_wikipedia_importance": -414.3565673828125,
"rps_doc_wikipedia_importance_length_correction": -414.3565673828125
},
"fasttext": {
"dclm": 0.16499847173690796,
"english": 0.9437720775604248,
"fineweb_edu_approx": 1.3373305797576904,
"eai_general_math": 0.042814020067453384,
"eai_open_web_math": 0.18132245540618896,
"eai_web_code": 0.026280220597982407
}
}
|
{
"free_decimal_correspondence": {
"primary": {
"code": "004.0",
"labels": {
"level_1": "General works, books and libraries, information sciences",
"level_2": "",
"level_3": "Computers and Computer science"
}
},
"secondary": {
"code": "005.0",
"labels": {
"level_1": "General works, books and libraries, information sciences",
"level_2": "",
"level_3": "Computer programming"
}
}
},
"bloom_cognitive_process": {
"primary": {
"code": "5",
"label": "Evaluate"
},
"secondary": {
"code": "2",
"label": "Understand"
}
},
"bloom_knowledge_domain": {
"primary": {
"code": "2",
"label": "Conceptual"
},
"secondary": {
"code": "3",
"label": "Procedural"
}
},
"document_type_v1": {
"primary": {
"code": "5",
"label": "Social/Forum"
},
"secondary": {
"code": "-1",
"label": "Abstain"
}
},
"extraction_artifacts": {
"primary": {
"code": "3",
"label": "Irrelevant Content"
},
"secondary": {
"code": "0",
"label": "No Artifacts"
}
},
"missing_content": {
"primary": {
"code": "0",
"label": "No missing content"
},
"secondary": {
"code": "-1",
"label": "Abstain"
}
},
"document_type_v2": {
"primary": {
"code": "5",
"label": "Comment Section"
},
"secondary": {
"code": "16",
"label": "Personal Blog"
}
},
"reasoning_depth": {
"primary": {
"code": "2",
"label": "Basic Reasoning"
},
"secondary": {
"code": "3",
"label": "Intermediate Reasoning"
}
},
"technical_correctness": {
"primary": {
"code": "3",
"label": "Mostly Correct"
},
"secondary": {
"code": "2",
"label": "Partially Correct"
}
},
"education_level": {
"primary": {
"code": "2",
"label": "High School Level"
},
"secondary": {
"code": "3",
"label": "Undergraduate Level"
}
}
}
|
672f1e42c33a7f9846924a2431ea77df
|
-4,062,592,311,618,485,000
|
Manage orders with the REST Admin API
You can use the REST Admin API to create orders and transactions to validate your app's behavior.
Tip
You can create test orders without using the API by using Shopbase Test Gateway
Before you begin
To best understand this guide, you can familiarize yourself with the concepts of orders and transactions.
Transactions are associated to orders and occur each time there is an exchange of money. Transactions are processed by payment providers, and involve the transfer of money from the issuer account (the customer's credit card) to the acquirer (the merchant's bank account). For more information, see Getting paid.
Access scopes
To use the Admin API to edit orders, your app needs to request the write_order_edits access scope for a ShopBase store. For more information on requesting access scopes when your app is installed, see OAuth. To make things easy for you, we have also included a guideline on sending request with Postman.
Create an order
To test orders, create an order with an authorization transaction by sending a POST request to the Order resource:
POST https://shop-name.onshopbase.com/admin/orders.json
{
"order":{
"email":" ",
"financial_status":"pending",
"line_items":[
{
"title":"Big Brown Bear Boots",
"price":100,
"grams":"1300",
"quantity":2
}
]
}
}
SAMPLE RESPOND:
{
"orders":[
{
"id": 5549662,
"currency":"USD",
"customer":{
"accepts_marketing":false,
"average_spent":0,
"default_address":null,
"email":" ",
"first_name":"",
"id":49231780,
"last_name":"",
"last_order_at":0,
"last_order_id":0,
"last_order_name":"",
"note":"",
"orders_count":0,
"phone":"",
"state":"disabled",
"tags":"",
"tax_exempt":false,
"total_spent":0,
"updated_at":"2020-12-15T05:09:48+00:00",
"verified_email":false
},
"customer_locale":"",
"discount_applications":null,
"discount_code":null,
"draft_order_number":0,
"email":" ",
"financial_status":"pending",
"fulfillment_status":"",
...
}
]
}
To be more specific, we can take a look at how we can use Postman to create this order
STEP 1: Create your Shopbase's API Credentials by following the tutorial here.
STEP 2: Send the POST Request with Postman
STEP 3: Save this request into a collection and extract the Order ID as a variable
let response = pm.response.json()
pm.globals.set("order_id", response.order.id)
After editing the collection's authorization property, you do not have to manually set your Shopbase's API Credentials anymore. By default, all newly created requests will be set to the "inherit auth from parent" option
Create the transaction for an order
After creating an order, the returned Order object includes an ID. You can use the order ID to create a transaction.
POST https://shop-name.onshopbase.com/admin/orders/{order_id}/transactions.json
{
"transactions":[
{
"kind":"authorization",
"status":"success",
"amount":200
}
]
}
After you create the transaction, you can then use the order ID to get its transactions and transaction IDs. To retrieve the transactions, send a GET request to the Order Transaction.
GET https://shop-name.onshopbase.com/admin/orders/{order_id}/transactions.json
{
"transactions":[
{
"amount":0,
"application_fee":0,
"authorization":"",
"conversion_rate":0,
"created_at":"2020-12-16T10:45:05+00:00",
"currency":"USD",
"currency_exchange_adjustment":null,
"device_id":0,
"error_code":"",
"gateway":"",
"id":10624938,
"kind":"",
"location_id":0,
"message":"",
"order_id":5557905,
"origin_error_code":"",
"parent_id":0,
"payment_details":null,
"payment_method_id":0,
"processed_at":"",
"receipt":null,
"shop_id":10124799,
"source_name":"",
"staff_id":0,
"status":"",
"test":false,
"transaction_amount":0,
"transaction_currency":"",
"updated_at":"2020-12-16T10:45:05+00:00"
}
]
}
Let's also look at how this request is handled by using Postman:
STEP 1: Use the same API Credential from the above instruction to create a new POST Request. Set `{{order_id}}` parameter in the request url as below:
STEP 2: Save the request call into a collection for future's use.
Last updated
|
{
"url": "https://developers.shopbase.com/tutorial/manage-orders-and-shipping/manage-orders-with-the-rest-admin-api",
"source_domain": "developers.shopbase.com",
"snapshot_id": "CC-MAIN-2024-18",
"warc_metadata": {
"Content-Length": "486788",
"Content-Type": "application/http; msgtype=response",
"WARC-Block-Digest": "sha1:S4EZRB5FBBRZRJRGMJP443EOXEITIG52",
"WARC-Concurrent-To": "<urn:uuid:b54648a0-5856-4da4-b1a6-fe3591378a26>",
"WARC-Date": "2024-04-17T20:05:58Z",
"WARC-IP-Address": "104.18.40.47",
"WARC-Identified-Payload-Type": "text/html",
"WARC-Payload-Digest": "sha1:E4GQF3IO6HR7N6Q52Y4WHNFOGGY3BRL5",
"WARC-Record-ID": "<urn:uuid:cddc9a5d-c8a6-4a97-b40f-f511a047540b>",
"WARC-Target-URI": "https://developers.shopbase.com/tutorial/manage-orders-and-shipping/manage-orders-with-the-rest-admin-api",
"WARC-Truncated": null,
"WARC-Type": "response",
"WARC-Warcinfo-ID": "<urn:uuid:57633fd1-67c7-43a8-8e1a-c39f9ad424ad>"
},
"warc_info": "isPartOf: CC-MAIN-2024-18\r\npublisher: Common Crawl\r\ndescription: Wide crawl of the web for April 2024\r\noperator: Common Crawl Admin (info@commoncrawl.org)\r\nhostname: ip-10-67-67-191\r\nsoftware: Apache Nutch 1.19 (modified, https://github.com/commoncrawl/nutch/)\r\nrobots: checked via crawler-commons 1.5-SNAPSHOT (https://github.com/crawler-commons/crawler-commons)\r\nformat: WARC File Format 1.1\r\nconformsTo: https://iipc.github.io/warc-specifications/specifications/warc-format/warc-1.1/"
}
|
{
"line_start_idx": [
0,
38,
39,
137,
138,
142,
143,
223,
224,
241,
242,
348,
349,
661,
662,
676,
677,
981,
982,
998,
999,
1114,
1115,
1171,
1172,
1174,
1187,
1206,
1242,
1263,
1274,
1318,
1343,
1371,
1396,
1407,
1415,
1420,
1422,
1423,
1439,
1440,
1442,
1456,
1464,
1488,
1515,
1537,
1576,
1607,
1643,
1668,
1697,
1724,
1752,
1783,
1814,
1848,
1871,
1901,
1925,
1957,
1980,
2012,
2041,
2095,
2130,
2142,
2173,
2212,
2243,
2276,
2298,
2337,
2371,
2384,
2392,
2397,
2399,
2400,
2487,
2488,
2567,
2568,
2611,
2612,
2695,
2696,
2730,
2776,
2777,
2997,
2998,
3034,
3035,
3152,
3153,
3233,
3234,
3236,
3256,
3264,
3297,
3326,
3348,
3356,
3361,
3363,
3364,
3548,
3549,
3628,
3629,
3631,
3651,
3659,
3680,
3710,
3739,
3769,
3820,
3847,
3893,
3917,
3943,
3966,
3990,
4010,
4036,
4059,
4088,
4121,
4145,
4178,
4210,
4238,
4263,
4292,
4319,
4342,
4364,
4387,
4420,
4456,
4506,
4514,
4519,
4521,
4522,
4587,
4588,
4739,
4740,
4806,
4807
],
"line_end_idx": [
38,
39,
137,
138,
142,
143,
223,
224,
241,
242,
348,
349,
661,
662,
676,
677,
981,
982,
998,
999,
1114,
1115,
1171,
1172,
1174,
1187,
1206,
1242,
1263,
1274,
1318,
1343,
1371,
1396,
1407,
1415,
1420,
1422,
1423,
1439,
1440,
1442,
1456,
1464,
1488,
1515,
1537,
1576,
1607,
1643,
1668,
1697,
1724,
1752,
1783,
1814,
1848,
1871,
1901,
1925,
1957,
1980,
2012,
2041,
2095,
2130,
2142,
2173,
2212,
2243,
2276,
2298,
2337,
2371,
2384,
2392,
2397,
2399,
2400,
2487,
2488,
2567,
2568,
2611,
2612,
2695,
2696,
2730,
2776,
2777,
2997,
2998,
3034,
3035,
3152,
3153,
3233,
3234,
3236,
3256,
3264,
3297,
3326,
3348,
3356,
3361,
3363,
3364,
3548,
3549,
3628,
3629,
3631,
3651,
3659,
3680,
3710,
3739,
3769,
3820,
3847,
3893,
3917,
3943,
3966,
3990,
4010,
4036,
4059,
4088,
4121,
4145,
4178,
4210,
4238,
4263,
4292,
4319,
4342,
4364,
4387,
4420,
4456,
4506,
4514,
4519,
4521,
4522,
4587,
4588,
4739,
4740,
4806,
4807,
4819
]
}
|
{
"red_pajama_v2": {
"ccnet_original_length": 4819,
"ccnet_original_nlines": 154,
"rps_doc_curly_bracket": 0.005810330156236887,
"rps_doc_ldnoobw_words": 0,
"rps_doc_lorem_ipsum": 0,
"rps_doc_stop_word_fraction": 0.20763187110424042,
"rps_doc_ut1_blacklist": 0,
"rps_doc_frac_all_caps_words": 0.03591470047831535,
"rps_doc_frac_lines_end_with_ellipsis": 0.006451610010117292,
"rps_doc_frac_no_alph_words": 0.4107744097709656,
"rps_doc_frac_unique_words": 0.5021276473999023,
"rps_doc_mean_word_length": 6.30638313293457,
"rps_doc_num_sentences": 33,
"rps_doc_symbol_to_word_ratio": 0.0011223299661651254,
"rps_doc_unigram_entropy": 5.000172138214111,
"rps_doc_word_count": 470,
"rps_doc_frac_chars_dupe_10grams": 0,
"rps_doc_frac_chars_dupe_5grams": 0.010121460072696209,
"rps_doc_frac_chars_dupe_6grams": 0,
"rps_doc_frac_chars_dupe_7grams": 0,
"rps_doc_frac_chars_dupe_8grams": 0,
"rps_doc_frac_chars_dupe_9grams": 0,
"rps_doc_frac_chars_top_2gram": 0.010121460072696209,
"rps_doc_frac_chars_top_3gram": 0.010121460072696209,
"rps_doc_frac_chars_top_4gram": 0.010121460072696209,
"rps_doc_books_importance": -392.49273681640625,
"rps_doc_books_importance_length_correction": -392.49273681640625,
"rps_doc_openwebtext_importance": -239.73988342285156,
"rps_doc_openwebtext_importance_length_correction": -239.73988342285156,
"rps_doc_wikipedia_importance": -131.70982360839844,
"rps_doc_wikipedia_importance_length_correction": -131.70982360839844
},
"fasttext": {
"dclm": 0.49840283393859863,
"english": 0.7735239267349243,
"fineweb_edu_approx": 1.4689418077468872,
"eai_general_math": 0.05324966087937355,
"eai_open_web_math": 0.07586740702390671,
"eai_web_code": 0.67613685131073
}
}
|
{
"free_decimal_correspondence": {
"primary": {
"code": "005.1",
"labels": {
"level_1": "General works, books and libraries, information sciences",
"level_2": "",
"level_3": "Computer programming"
}
},
"secondary": {
"code": "658.85",
"labels": {
"level_1": "Industrial arts, Technology, and Engineering",
"level_2": "Business",
"level_3": "Management"
}
}
},
"bloom_cognitive_process": {
"primary": {
"code": "3",
"label": "Apply"
},
"secondary": {
"code": "2",
"label": "Understand"
}
},
"bloom_knowledge_domain": {
"primary": {
"code": "3",
"label": "Procedural"
},
"secondary": {
"code": "2",
"label": "Conceptual"
}
},
"document_type_v1": {
"primary": {
"code": "3",
"label": "Reference/Encyclopedic/Educational"
},
"secondary": {
"code": "4",
"label": "Code/Software"
}
},
"extraction_artifacts": {
"primary": {
"code": "0",
"label": "No Artifacts"
},
"secondary": {
"code": "3",
"label": "Irrelevant Content"
}
},
"missing_content": {
"primary": {
"code": "0",
"label": "No missing content"
},
"secondary": {
"code": "-1",
"label": "Abstain"
}
},
"document_type_v2": {
"primary": {
"code": "8",
"label": "Documentation"
},
"secondary": {
"code": "23",
"label": "Tutorial"
}
},
"reasoning_depth": {
"primary": {
"code": "2",
"label": "Basic Reasoning"
},
"secondary": {
"code": "3",
"label": "Intermediate Reasoning"
}
},
"technical_correctness": {
"primary": {
"code": "4",
"label": "Highly Correct"
},
"secondary": {
"code": "3",
"label": "Mostly Correct"
}
},
"education_level": {
"primary": {
"code": "3",
"label": "Undergraduate Level"
},
"secondary": {
"code": "4",
"label": "Graduate/Expert Level"
}
}
}
|
672f1e42c33a7f9846924a2431ea77df
|
-2,700,962,634,356,471,000
|
Linux on Realtek RTL8181 SourceForge.net Logo
| home | devices | hacking | compat. | demo | toolchain | howto | participate | resources | | project page | news | forums | downloads |
Call for participation
The RTL8181 Linux port is an open source development effort. Like in all open source projects, the strength of the effort is given by the added strengths of the people involved. We encourage everybody to participate in the development of what we believe will become one of the few 100% open-source powered embedded wireless platforms. You can contribute as much or as little as you feel like: there are no obligations, no quotas to meet, plenty of ways to get involved, and many of them don't even require an ability to read, write, compile and debug code.
As you may have already noticed, our contributors are always properly credited, unless they specifically request their identity to remain private.
Here are just a few ideas:
Download, test or review the code
As of February 2004, the published code allows the building of complete uploadable "firmware" images for RTL8181 devices. As of October 2004, an open source driver for the wireless MAC (RTL8180) is also available.
Contribute code
Contribute without coding
Yes you can. See Craig Buchek's How to contribute to Open Source without coding for a few good suggestions.
Support and help enforce the GNU GPL
As an open source publisher, coder, contributor or just happy user, you probably share our feelings about those people who abuse other people's work in total contempt of the authors' expectations (and legal right) to receive proper compensation, reciprocal or material, for their efforts. If you do, remember that it's up to you to do something about it.
Two words: Create Awareness. If you have an interesting experience to share, please post it in the newly created GPL violation fightback forum, so that other people can learn from it as well.
Copyright (c) 2003, 2004, Streetdata Pty Ltd
|
{
"url": "http://rtl8181.sourceforge.net/rtl8181_participate.php",
"source_domain": "rtl8181.sourceforge.net",
"snapshot_id": "crawl=CC-MAIN-2017-30",
"warc_metadata": {
"Content-Length": "8552",
"Content-Type": "application/http; msgtype=response",
"WARC-Block-Digest": "sha1:OOM3NA245MHP5YT2E6SAYW3RNXQ4EQLW",
"WARC-Concurrent-To": "<urn:uuid:de0d444d-8a74-43b4-aea7-fb7f3be61d8e>",
"WARC-Date": "2017-07-28T12:49:18Z",
"WARC-IP-Address": "216.34.181.96",
"WARC-Identified-Payload-Type": "text/html",
"WARC-Payload-Digest": "sha1:YRN7S5VVJX2LEOZAE7RGVIQOKV4UYRK4",
"WARC-Record-ID": "<urn:uuid:dd7e5686-a580-437d-92c0-9046a25bddac>",
"WARC-Target-URI": "http://rtl8181.sourceforge.net/rtl8181_participate.php",
"WARC-Truncated": "length",
"WARC-Type": "response",
"WARC-Warcinfo-ID": "<urn:uuid:59c15c74-3776-45e1-9bcf-99c2f139f949>"
},
"warc_info": "robots: classic\r\nhostname: ip-10-233-137-12.ec2.internal\r\nsoftware: Nutch 1.6 (CC)\r\nisPartOf: CC-MAIN-2017-30\r\noperator: Common Crawl Admin\r\ndescription: Wide crawl of the web for July 2017\r\npublisher: Common Crawl\r\nformat: WARC File Format 1.0\r\nconformsTo: http://bibnum.bnf.fr/WARC/WARC_ISO_28500_version1_latestdraft.pdf"
}
|
{
"line_start_idx": [
0,
48,
185,
186,
209,
210,
767,
914,
915,
942,
943,
977,
978,
1192,
1193,
1209,
1210,
1236,
1237,
1345,
1346,
1383,
1384,
1739,
1740,
1932,
1933,
1935
],
"line_end_idx": [
48,
185,
186,
209,
210,
767,
914,
915,
942,
943,
977,
978,
1192,
1193,
1209,
1210,
1236,
1237,
1345,
1346,
1383,
1384,
1739,
1740,
1932,
1933,
1935,
1981
]
}
|
{
"red_pajama_v2": {
"ccnet_original_length": 1981,
"ccnet_original_nlines": 27,
"rps_doc_curly_bracket": 0,
"rps_doc_ldnoobw_words": 0,
"rps_doc_lorem_ipsum": 0,
"rps_doc_stop_word_fraction": 0.37851661443710327,
"rps_doc_ut1_blacklist": 0,
"rps_doc_frac_all_caps_words": 0.020460359752178192,
"rps_doc_frac_lines_end_with_ellipsis": 0,
"rps_doc_frac_no_alph_words": 0.18925830721855164,
"rps_doc_frac_unique_words": 0.6297468543052673,
"rps_doc_mean_word_length": 4.949367046356201,
"rps_doc_num_sentences": 16,
"rps_doc_symbol_to_word_ratio": 0,
"rps_doc_unigram_entropy": 4.998865604400635,
"rps_doc_word_count": 316,
"rps_doc_frac_chars_dupe_10grams": 0,
"rps_doc_frac_chars_dupe_5grams": 0,
"rps_doc_frac_chars_dupe_6grams": 0,
"rps_doc_frac_chars_dupe_7grams": 0,
"rps_doc_frac_chars_dupe_8grams": 0,
"rps_doc_frac_chars_dupe_9grams": 0,
"rps_doc_frac_chars_top_2gram": 0.031969308853149414,
"rps_doc_frac_chars_top_3gram": 0.023017900064587593,
"rps_doc_frac_chars_top_4gram": 0,
"rps_doc_books_importance": -168.14712524414062,
"rps_doc_books_importance_length_correction": -168.14712524414062,
"rps_doc_openwebtext_importance": -114.17989349365234,
"rps_doc_openwebtext_importance_length_correction": -114.17989349365234,
"rps_doc_wikipedia_importance": -83.53184509277344,
"rps_doc_wikipedia_importance_length_correction": -83.53184509277344
},
"fasttext": {
"dclm": 0.020773470401763916,
"english": 0.9396316409111023,
"fineweb_edu_approx": 1.97117018699646,
"eai_general_math": 0.03772563114762306,
"eai_open_web_math": 0.11717414855957031,
"eai_web_code": 0.28049176931381226
}
}
|
{
"free_decimal_correspondence": {
"primary": {
"code": "004.01",
"labels": {
"level_1": "General works, books and libraries, information sciences",
"level_2": "",
"level_3": "Computers and Computer science"
}
},
"secondary": {
"code": "004.6",
"labels": {
"level_1": "General works, books and libraries, information sciences",
"level_2": "",
"level_3": "Computers and Computer science"
}
}
},
"bloom_cognitive_process": {
"primary": {
"code": "2",
"label": "Understand"
},
"secondary": {
"code": "3",
"label": "Apply"
}
},
"bloom_knowledge_domain": {
"primary": {
"code": "2",
"label": "Conceptual"
},
"secondary": {
"code": "3",
"label": "Procedural"
}
},
"document_type_v1": {
"primary": {
"code": "3",
"label": "Reference/Encyclopedic/Educational"
},
"secondary": {
"code": "6",
"label": "Promotional/Advertisement"
}
},
"extraction_artifacts": {
"primary": {
"code": "3",
"label": "Irrelevant Content"
},
"secondary": {
"code": "-1",
"label": "Abstain"
}
},
"missing_content": {
"primary": {
"code": "0",
"label": "No missing content"
},
"secondary": {
"code": "-1",
"label": "Abstain"
}
},
"document_type_v2": {
"primary": {
"code": "8",
"label": "Documentation"
},
"secondary": {
"code": "1",
"label": "About (Org.)"
}
},
"reasoning_depth": {
"primary": {
"code": "2",
"label": "Basic Reasoning"
},
"secondary": {
"code": "1",
"label": "No Reasoning"
}
},
"technical_correctness": {
"primary": {
"code": "6",
"label": "Not Applicable/Indeterminate"
},
"secondary": {
"code": "4",
"label": "Highly Correct"
}
},
"education_level": {
"primary": {
"code": "2",
"label": "High School Level"
},
"secondary": {
"code": "1",
"label": "General Audience"
}
}
}
|
672f1e42c33a7f9846924a2431ea77df
|
339,859,965,025,830,850
|
2
$\begingroup$
I have downloaded two files:
File1.csv from: https://depmap.org/portal/download/data_slicer/download?file_path=20220227%2F3c335b7d-c18e-4788-b2e6-512d71f0a339%2Fexport.csv&name=Metabolomics.csv
File 1 looks like
,2-aminoadipate,3-phosphoglycerate,alpha-glycerophosphate
ACH-000698,6.1127272,6.034197900000001,5.8968963
ACH-000489,5.5774126,5.7270453,5.1114679,6.07325
File2.csv from: enter link description here https://cog.sanger.ac.uk/cmp/download/model_list_20220205.csv
File2 looks like:
model_id,model_name,synonyms,model_type
SIDM01774,PK-59,,Cell Line,Adherent
SIDM00192,SNU-1033,,Cell Line,Adherent
I want to replace ACH-* ids with SIDM* ids in File1.csv. The ACH-* id's for SIDM* ids are given in the "BROAD_ID" (col.no =40) column in the File2.csv
Desired output
,2-aminoadipate,3-phosphoglycerate,alpha-glycerophosphate
SIDM00523,6.1127272,6.034197900000001,5.8968963
SIDM00835,5.5774126,5.7270453,5.1114679,6.07325
I want to do this with python script. I tried some initial steps. Please forgive any grave mistake, as I am a beginner in Python
import pandas as pd
df = pd.read_csv("File1.csv", index_col=0).T
print(df)
models = pd.read_csv("File2.csv", index_col="model_id", usecols=["model_id", "BROAD_ID"]).rename(columns={"model_id": "Model"})
df = df.join(models).rename_axis(index="Model Name").reset_index()
print(df)
df2 = df.set_index("Model").drop(columns="Model Name")
df2.to_csv("Meta.tsv", sep="\t")
df2.index = df2.index + ".Demeter"
df2.T.rename_axis(index="Gene").to_csv("Meta_2.tsv", sep="\t")
$\endgroup$
0
2 Answers 2
4
$\begingroup$
I was not sure about the exact output (columns) you desired. The following code should inner merge both data frames. It writes a copy of 'model_list' column as a first column. You could remove any unwanted columns. I am sure there are more elegant ways of doing it. Hope it helps. It's totally different approach than yours.
import pandas as pd
metabolics = pd.read_csv("Metabolomics.csv", sep=",", header=0)
model_list = pd.read_csv("model_list_20220205.csv", sep=",", header=0)
metabolics=metabolics.rename(columns={'Unnamed: 0':'ACH_number'}) #rename the unnamed column.
merged_df = pd.merge(metabolics, model_list, left_on='ACH_number', right_on='BROAD_ID', how='inner') #join two files
#insert model_id column at the beginning
#You will have dupicae 'model_id' column
merged_df.insert(0, "model_id", merged_df['model_id'], allow_duplicates=True)
merged_df.to_csv('results.csv', sep=",", index=False)
print(merged_df.shape)
$\endgroup$
8
• 1
$\begingroup$ This looks about right $\endgroup$
– M__
Commented Feb 28, 2022 at 2:33
• 1
$\begingroup$ I agree with @M__ 's comment below. You would need to test the code make sure that merge on keys/columns as indicated give the desired output. $\endgroup$
– Supertech
Commented Feb 28, 2022 at 13:38
• 1
$\begingroup$ My pandas is rusty. The basic issue is that joint in SQL is merge in pandas. This might be why the OP used joint (except its pandas). I was always told SQL joint merges via a common key and I carried that through into pandas. $\endgroup$
– M__
Commented Feb 28, 2022 at 13:49
• 2
$\begingroup$ Code should be do the right thing. If you inner merge, your results file will have 923 lines excluding headers. Now, you file has 928 record. You are missing the following 5 records from results.> ACH-000338, ACH-000467, ACH-000710, ACH-000833, ACH-001063. The reason for is that one moodel_list file has irregular entries. For example if you look at the col-40, you will see that actual cell entry is "ACH-000338;ACH-000338", not "ACH-000338" thus pandas cannot merge these. $\endgroup$
– Supertech
Commented Feb 28, 2022 at 21:05
• 2
$\begingroup$ Either you live losing 5 records, or you need write another script that considers this kind of anomalies or update the tables. Hope this helps. $\endgroup$
– Supertech
Commented Feb 28, 2022 at 21:05
2
$\begingroup$
The basic strategy of merge 'left' (which I think is default) is the correct thing to do. However, I would be concerned by lack of a key between the two data sets and basically the merging will take place on the row order. Within merge is on= then the shared key, in the code by @supertech there is left-on='ACH_number', I dunno because ACH_number does not appear to be shared. The code needs testing.
If you assign an index it will attempt to merge on the index (which I think will therefore fail). What I think you want is the row order 1,2,3,4 in each dataframe to be the key that is merged. Therefore not specifying key might be the right thing to do, what can happen is it will then use the row order as the left-key. I cannot remember.
The insert is correct to reorder the columns to get the desired output.
Finally you want,
del merged_df['column_name']
for each column you don't want. There is a way to loop through this, but the above keeps things simple. You then do the standard csv dump.
Note, see comments on drop by @GOATNine, which strongly preferred.
Setting and unsetting indexes is key to manipulating pandas but it is within a specific contex.
Summary the command merge and insert are correct with the addition of del however, the code needs testing regarding merge left-on and assigning the index. It is much easier to print the output and visualise it.
$\endgroup$
7
• $\begingroup$ Thank you so much for explaining it so well $\endgroup$
– Megha
Commented Feb 28, 2022 at 8:43
• $\begingroup$ I do not know the reason why wget fails. Maybe someone else could help. I have clicked on the link on my Pc and it was sufficient to download. wget also failed for me. $\endgroup$
– Supertech
Commented Feb 28, 2022 at 13:45
• 1
$\begingroup$ If you're using pandas to drop the columns, you can just use df = df.drop(columns=['column1','column2'....]), or drop the assignment and use the option 'inplace=true' instead. This allows you to drop as many columns as you like at once, by making a string list of the column names. $\endgroup$
– GOATNine
Commented Feb 28, 2022 at 16:36
• $\begingroup$ Yes, I remember now. This is much better $\endgroup$
– M__
Commented Feb 28, 2022 at 17:00
• 2
$\begingroup$ @Megha see my comment under my answer. Your model_ file has anomalies in some of the cells therefore inner merge fails for 5 of the records. $\endgroup$
– Supertech
Commented Feb 28, 2022 at 21:07
Your Answer
By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.
Not the answer you're looking for? Browse other questions tagged or ask your own question.
|
{
"url": "https://bioinformatics.stackexchange.com/questions/18678/replacing-column-1-in-file1-with-matching-ids-in-file-2",
"source_domain": "bioinformatics.stackexchange.com",
"snapshot_id": "CC-MAIN-2024-26",
"warc_metadata": {
"Content-Length": "180825",
"Content-Type": "application/http; msgtype=response",
"WARC-Block-Digest": "sha1:PGCIQTEH4UOMW2AA3TMR4U65IXDMQ3OC",
"WARC-Concurrent-To": "<urn:uuid:3d83b3fa-da57-49ec-9f3f-915dc1cb8dcb>",
"WARC-Date": "2024-06-23T08:16:40Z",
"WARC-IP-Address": "104.18.43.226",
"WARC-Identified-Payload-Type": "text/html",
"WARC-Payload-Digest": "sha1:4ZEF2DE2VKWNNT4V6S4BTWYF6ZV5JJ5D",
"WARC-Record-ID": "<urn:uuid:27963e2d-b86f-4ccb-afd8-82a0a247ee6f>",
"WARC-Target-URI": "https://bioinformatics.stackexchange.com/questions/18678/replacing-column-1-in-file1-with-matching-ids-in-file-2",
"WARC-Truncated": null,
"WARC-Type": "response",
"WARC-Warcinfo-ID": "<urn:uuid:cc452eb8-6f60-4c3e-8625-b726dd571994>"
},
"warc_info": "isPartOf: CC-MAIN-2024-26\r\npublisher: Common Crawl\r\ndescription: Wide crawl of the web for June 2024\r\noperator: Common Crawl Admin (info@commoncrawl.org)\r\nhostname: ip-10-67-67-81\r\nsoftware: Apache Nutch 1.20 (modified, https://github.com/commoncrawl/nutch/)\r\nrobots: checked via crawler-commons 1.5-SNAPSHOT (https://github.com/crawler-commons/crawler-commons)\r\nformat: WARC File Format 1.1\r\nconformsTo: https://iipc.github.io/warc-specifications/specifications/warc-format/warc-1.1/"
}
|
{
"line_start_idx": [
0,
2,
16,
17,
46,
47,
212,
213,
231,
232,
290,
339,
388,
389,
495,
496,
514,
515,
556,
593,
633,
634,
785,
786,
801,
802,
860,
908,
956,
957,
1086,
1087,
1108,
1109,
1155,
1156,
1167,
1168,
1297,
1298,
1366,
1367,
1378,
1379,
1435,
1436,
1470,
1471,
1507,
1571,
1583,
1585,
1586,
1598,
1599,
1601,
1615,
1616,
1941,
1942,
1962,
1963,
2028,
2100,
2194,
2311,
2312,
2353,
2394,
2473,
2527,
2550,
2562,
2564,
2570,
2623,
2633,
2668,
2674,
2847,
2863,
2899,
2905,
3161,
3171,
3207,
3213,
3719,
3735,
3771,
3777,
3951,
3967,
4003,
4005,
4019,
4020,
4422,
4423,
4763,
4764,
4836,
4837,
4855,
4856,
4885,
4886,
5025,
5026,
5093,
5094,
5190,
5191,
5402,
5403,
5415,
5417,
5491,
5503,
5538,
5736,
5752,
5788,
5794,
6106,
6121,
6157,
6228,
6238,
6274,
6280,
6451,
6467,
6503,
6504,
6516,
6517,
6633,
6634
],
"line_end_idx": [
2,
16,
17,
46,
47,
212,
213,
231,
232,
290,
339,
388,
389,
495,
496,
514,
515,
556,
593,
633,
634,
785,
786,
801,
802,
860,
908,
956,
957,
1086,
1087,
1108,
1109,
1155,
1156,
1167,
1168,
1297,
1298,
1366,
1367,
1378,
1379,
1435,
1436,
1470,
1471,
1507,
1571,
1583,
1585,
1586,
1598,
1599,
1601,
1615,
1616,
1941,
1942,
1962,
1963,
2028,
2100,
2194,
2311,
2312,
2353,
2394,
2473,
2527,
2550,
2562,
2564,
2570,
2623,
2633,
2668,
2674,
2847,
2863,
2899,
2905,
3161,
3171,
3207,
3213,
3719,
3735,
3771,
3777,
3951,
3967,
4003,
4005,
4019,
4020,
4422,
4423,
4763,
4764,
4836,
4837,
4855,
4856,
4885,
4886,
5025,
5026,
5093,
5094,
5190,
5191,
5402,
5403,
5415,
5417,
5491,
5503,
5538,
5736,
5752,
5788,
5794,
6106,
6121,
6157,
6228,
6238,
6274,
6280,
6451,
6467,
6503,
6504,
6516,
6517,
6633,
6634,
6724
]
}
|
{
"red_pajama_v2": {
"ccnet_original_length": 6724,
"ccnet_original_nlines": 138,
"rps_doc_curly_bracket": 0.0005948800244368613,
"rps_doc_ldnoobw_words": 0,
"rps_doc_lorem_ipsum": 0,
"rps_doc_stop_word_fraction": 0.26002585887908936,
"rps_doc_ut1_blacklist": 0,
"rps_doc_frac_all_caps_words": 0.03298835828900337,
"rps_doc_frac_lines_end_with_ellipsis": 0,
"rps_doc_frac_no_alph_words": 0.362871915102005,
"rps_doc_frac_unique_words": 0.42719486355781555,
"rps_doc_mean_word_length": 5.339400291442871,
"rps_doc_num_sentences": 113,
"rps_doc_symbol_to_word_ratio": 0.0032341498881578445,
"rps_doc_unigram_entropy": 5.457530498504639,
"rps_doc_word_count": 934,
"rps_doc_frac_chars_dupe_10grams": 0,
"rps_doc_frac_chars_dupe_5grams": 0.06577099859714508,
"rps_doc_frac_chars_dupe_6grams": 0.0577501505613327,
"rps_doc_frac_chars_dupe_7grams": 0.0577501505613327,
"rps_doc_frac_chars_dupe_8grams": 0.0577501505613327,
"rps_doc_frac_chars_dupe_9grams": 0.01684379018843174,
"rps_doc_frac_chars_top_2gram": 0.018046919256448746,
"rps_doc_frac_chars_top_3gram": 0.028072990477085114,
"rps_doc_frac_chars_top_4gram": 0.03609383851289749,
"rps_doc_books_importance": -673.969970703125,
"rps_doc_books_importance_length_correction": -673.969970703125,
"rps_doc_openwebtext_importance": -388.6296691894531,
"rps_doc_openwebtext_importance_length_correction": -388.6296691894531,
"rps_doc_wikipedia_importance": -258.0160217285156,
"rps_doc_wikipedia_importance_length_correction": -258.0160217285156
},
"fasttext": {
"dclm": 0.05095816031098366,
"english": 0.8281784653663635,
"fineweb_edu_approx": 1.5741357803344727,
"eai_general_math": 0.15805292129516602,
"eai_open_web_math": 0.13683092594146729,
"eai_web_code": 0.10716623067855835
}
}
|
{
"free_decimal_correspondence": {
"primary": {
"code": "005.1",
"labels": {
"level_1": "General works, books and libraries, information sciences",
"level_2": "",
"level_3": "Computer programming"
}
},
"secondary": {
"code": "572.6",
"labels": {
"level_1": "Science and Natural history",
"level_2": "Biology and Anthropology",
"level_3": "Anthropology"
}
}
},
"bloom_cognitive_process": {
"primary": {
"code": "3",
"label": "Apply"
},
"secondary": {
"code": "2",
"label": "Understand"
}
},
"bloom_knowledge_domain": {
"primary": {
"code": "3",
"label": "Procedural"
},
"secondary": {
"code": "2",
"label": "Conceptual"
}
},
"document_type_v1": {
"primary": {
"code": "5",
"label": "Social/Forum"
},
"secondary": {
"code": "4",
"label": "Code/Software"
}
},
"extraction_artifacts": {
"primary": {
"code": "3",
"label": "Irrelevant Content"
},
"secondary": {
"code": "1",
"label": "Leftover HTML"
}
},
"missing_content": {
"primary": {
"code": "2",
"label": "Click Here References"
},
"secondary": {
"code": "-1",
"label": "Abstain"
}
},
"document_type_v2": {
"primary": {
"code": "18",
"label": "Q&A Forum"
},
"secondary": {
"code": "23",
"label": "Tutorial"
}
},
"reasoning_depth": {
"primary": {
"code": "3",
"label": "Intermediate Reasoning"
},
"secondary": {
"code": "2",
"label": "Basic Reasoning"
}
},
"technical_correctness": {
"primary": {
"code": "3",
"label": "Mostly Correct"
},
"secondary": {
"code": "2",
"label": "Partially Correct"
}
},
"education_level": {
"primary": {
"code": "3",
"label": "Undergraduate Level"
},
"secondary": {
"code": "2",
"label": "High School Level"
}
}
}
|
672f1e42c33a7f9846924a2431ea77df
|
-3,052,432,292,905,064,400
|
-How to Recover Deleted Text Messages from a Mobile Phone
Added by MobilePhoneSpyGuy Subscribe 10
Published 15 Apr 2011
10 183
••• More
Report video
0 0
You have already voted for this video.
To recover deleted text messages from a cell phone is actually a very simple and fast process. There are tw...
To recover deleted text messages from a cell phone is actually a very simple and fast process. There are two ways you can go about recovering deleted text messages. One is to use a hardware based device specifically made for recovering deleted text messages from a cell phone. The other is a software based method.
LINKS REFERRED TO IN VIDEO ----
http://www.mobiletelephonespy.info/mobiletelephonespyarticles/recover-deleted-sms-how-to-recover-deleted-text-messages-from-cell-phone.htm -original web address article this video on recovering deleted text messages is based on.
http://www.mobiletelephonespy.info/how-mobile-phone-spy-works.htm -detailed article on exactly how a cell phone spy that reads deleted text messages works.
To find out more about the physical cell phone spy from Brickhouse spy tools that lets you view deleted text messages - http://www.brickhousespytools.info
3 software cell phone spy programs that let you recover deleted text messages from a cell phone
http://www.cellphone-spybubble.info
http://www.cellphone-spousespy.info
http://www.cellphone-mobilespy.info
Categories: How To
Show moreShow less
Report this video as:
|
{
"url": "http://www.metacafe.com/watch/6258478/how_to_recover_deleted_text_messages_from_a_mobile_phone/",
"source_domain": "www.metacafe.com",
"snapshot_id": "crawl=CC-MAIN-2016-26",
"warc_metadata": {
"Content-Length": "59027",
"Content-Type": "application/http; msgtype=response",
"WARC-Block-Digest": "sha1:SMU67T2N5JVZU73PDEP6CY5NHGFD5G5L",
"WARC-Concurrent-To": "<urn:uuid:45ca0ee4-9e58-4be7-b6b2-d30895f143b4>",
"WARC-Date": "2016-06-27T23:20:34Z",
"WARC-IP-Address": "68.169.111.57",
"WARC-Identified-Payload-Type": null,
"WARC-Payload-Digest": "sha1:Q2K2ZIOFIWSRVEHGANDY4G4EVFHNV67P",
"WARC-Record-ID": "<urn:uuid:02de64ed-cf6d-4895-99c2-92ff1a2c5756>",
"WARC-Target-URI": "http://www.metacafe.com/watch/6258478/how_to_recover_deleted_text_messages_from_a_mobile_phone/",
"WARC-Truncated": "length",
"WARC-Type": "response",
"WARC-Warcinfo-ID": "<urn:uuid:d183785e-5e08-4b89-b7dc-1397a110ab44>"
},
"warc_info": "robots: classic\r\nhostname: ip-10-164-35-72.ec2.internal\r\nsoftware: Nutch 1.6 (CC)/CC WarcExport 1.0\r\nisPartOf: CC-MAIN-2016-26\r\noperator: CommonCrawl Admin\r\ndescription: Wide crawl of the web for June 2016\r\npublisher: CommonCrawl\r\nformat: WARC File Format 1.0\r\nconformsTo: http://bibnum.bnf.fr/WARC/WARC_ISO_28500_version1_latestdraft.pdf"
}
|
{
"line_start_idx": [
0,
58,
59,
99,
121,
128,
137,
150,
154,
193,
304,
619,
620,
652,
653,
882,
883,
1039,
1040,
1195,
1196,
1292,
1293,
1329,
1365,
1401,
1420,
1439
],
"line_end_idx": [
58,
59,
99,
121,
128,
137,
150,
154,
193,
304,
619,
620,
652,
653,
882,
883,
1039,
1040,
1195,
1196,
1292,
1293,
1329,
1365,
1401,
1420,
1439,
1460
]
}
|
{
"red_pajama_v2": {
"ccnet_original_length": 1460,
"ccnet_original_nlines": 27,
"rps_doc_curly_bracket": 0,
"rps_doc_ldnoobw_words": 0,
"rps_doc_lorem_ipsum": 0,
"rps_doc_stop_word_fraction": 0.22711864113807678,
"rps_doc_ut1_blacklist": 0,
"rps_doc_frac_all_caps_words": 0.01694915071129799,
"rps_doc_frac_lines_end_with_ellipsis": 0.035714291036129,
"rps_doc_frac_no_alph_words": 0.22372880578041077,
"rps_doc_frac_unique_words": 0.4771573543548584,
"rps_doc_mean_word_length": 5.994924068450928,
"rps_doc_num_sentences": 24,
"rps_doc_symbol_to_word_ratio": 0.0033898300025612116,
"rps_doc_unigram_entropy": 4.201723098754883,
"rps_doc_word_count": 197,
"rps_doc_frac_chars_dupe_10grams": 0.1439458131790161,
"rps_doc_frac_chars_dupe_5grams": 0.2337002456188202,
"rps_doc_frac_chars_dupe_6grams": 0.2337002456188202,
"rps_doc_frac_chars_dupe_7grams": 0.2337002456188202,
"rps_doc_frac_chars_dupe_8grams": 0.17781540751457214,
"rps_doc_frac_chars_dupe_9grams": 0.1439458131790161,
"rps_doc_frac_chars_top_2gram": 0.08382727205753326,
"rps_doc_frac_chars_top_3gram": 0.1447925567626953,
"rps_doc_frac_chars_top_4gram": 0.09737510979175568,
"rps_doc_books_importance": -112.10124969482422,
"rps_doc_books_importance_length_correction": -106.87262725830078,
"rps_doc_openwebtext_importance": -63.66192626953125,
"rps_doc_openwebtext_importance_length_correction": -63.66192626953125,
"rps_doc_wikipedia_importance": -64.51789093017578,
"rps_doc_wikipedia_importance_length_correction": -55.219966888427734
},
"fasttext": {
"dclm": 0.09620028734207153,
"english": 0.880287230014801,
"fineweb_edu_approx": 2.2232394218444824,
"eai_general_math": 0.020406659692525864,
"eai_open_web_math": 0.10494744777679443,
"eai_web_code": 0.0018065599724650383
}
}
|
{
"free_decimal_correspondence": {
"primary": {
"code": "004.68",
"labels": {
"level_1": "General works, books and libraries, information sciences",
"level_2": "",
"level_3": "Computers and Computer science"
}
},
"secondary": {
"code": "621.392",
"labels": {
"level_1": "Industrial arts, Technology, and Engineering",
"level_2": "Engineering",
"level_3": "Mechanical engineering and Machinery"
}
}
},
"bloom_cognitive_process": {
"primary": {
"code": "3",
"label": "Apply"
},
"secondary": {
"code": "2",
"label": "Understand"
}
},
"bloom_knowledge_domain": {
"primary": {
"code": "3",
"label": "Procedural"
},
"secondary": {
"code": "2",
"label": "Conceptual"
}
},
"document_type_v1": {
"primary": {
"code": "3",
"label": "Reference/Encyclopedic/Educational"
},
"secondary": {
"code": "6",
"label": "Promotional/Advertisement"
}
},
"extraction_artifacts": {
"primary": {
"code": "3",
"label": "Irrelevant Content"
},
"secondary": {
"code": "-1",
"label": "Abstain"
}
},
"missing_content": {
"primary": {
"code": "1",
"label": "Truncated Snippets"
},
"secondary": {
"code": "-1",
"label": "Abstain"
}
},
"document_type_v2": {
"primary": {
"code": "23",
"label": "Tutorial"
},
"secondary": {
"code": "17",
"label": "Product Page"
}
},
"reasoning_depth": {
"primary": {
"code": "2",
"label": "Basic Reasoning"
},
"secondary": {
"code": "1",
"label": "No Reasoning"
}
},
"technical_correctness": {
"primary": {
"code": "6",
"label": "Not Applicable/Indeterminate"
},
"secondary": {
"code": "2",
"label": "Partially Correct"
}
},
"education_level": {
"primary": {
"code": "1",
"label": "General Audience"
},
"secondary": {
"code": "2",
"label": "High School Level"
}
}
}
|
672f1e42c33a7f9846924a2431ea77df
|
-8,797,699,917,160,265,000
|
Leçon 5
Table des matières
Switches
In the the previous section, Setting a Switch using a Wwise-Type, you were asked to set the Surface_Type Switch for the Player's footsteps. Another Switch Container using the same Switch Group is the Impact_Weapon_Type Switch Container, called when the Player's weapon impacts on a surface. Both the Footstep_Surface and Impact_Weapon_Type Switch Container are performed by the Player and make use of the same Switch Group, so what happens when you alternate between moving and attacking? How do these two Switch Groups not interfere with each other?
In the following steps, let's capture a Profiler Session and look at the Switch changes. As you are not going to change properties or Scene assets, you can use the Main Scene, which is the complete version of the game.
1. In Unity, go to Audiokinetic > Game Scenes and select the Main Scene.
2. Click Play to enter Play mode, and then Connect Wwise to the WAG.
3. Press E to skip the dialogue until you see the Adventurer in the Game view.
4. Run over and attack a nearby stone in the Training Area.
5. Take a few footsteps, on both grass and dirt, and hit a stone again.
6. Click Play again to exit Play mode.
7. In Wwise's Capture Log, click on Filter...
8. Disable all Types, except for Switches and Events.
9. Click OK.
Let's now take a closer look at the Capture Log.
10. In the Capture Log's Game Object column, look for when the WeaponHolder's Surface_Type Switch is set for the first time.
Look for the first Switch to "Stone" message in the description column.
In the Game Object column, you will see that the Switch is being set on the WeaponHolder game object, which is the game object containing the Player's weapons. In the following row, the Player_WeaponImpact Event is played, which results in the impact on stone sound due to the Switch set just above. In the following rows the same Switch is being used for the Player_Footstep Event.
The Player repeatedly walks on grass or dirt, and as you will see in the Game Object column, the Switch is being set on a different game object, the toe_left and toe_right game object.
Lastly, as you start attacking the Stone again, notice that no Switch is being set on the WeaponHolder game object before thePlayer_WeaponImpact Event is posted, but it is still playing the impact on stone sound. This is because the Player_WeaponImpact Event is posted on the WeaponHolder game object and not any of the toes, where the Stone Switch has not been changed. As such, no matter on what other game object you might use the same Switch, the WeaponHolder game object will keep its Switch value. This demonstrates how you can effectively reuse Switches on multiple game objects without them affecting each other, as long as you make sure not to use the same game object.
|
{
"url": "https://www.audiokinetic.com/fr/courses/wwise301/?source=wwise301&id=Switches",
"source_domain": "www.audiokinetic.com",
"snapshot_id": "crawl=CC-MAIN-2019-30",
"warc_metadata": {
"Content-Length": "56785",
"Content-Type": "application/http; msgtype=response",
"WARC-Block-Digest": "sha1:DJS5MUUS62ESVOQDCYJ6QKHXMXTL5SFC",
"WARC-Concurrent-To": "<urn:uuid:2c6fb13c-65bd-4ffe-a184-0a4c77d6790e>",
"WARC-Date": "2019-07-23T20:42:33Z",
"WARC-IP-Address": "104.121.81.121",
"WARC-Identified-Payload-Type": "text/html",
"WARC-Payload-Digest": "sha1:EYV4B3O56EOGJAYYQHGG5PQA2S2W523I",
"WARC-Record-ID": "<urn:uuid:aa5bbd94-5b0e-4212-bb42-db270974d6fb>",
"WARC-Target-URI": "https://www.audiokinetic.com/fr/courses/wwise301/?source=wwise301&id=Switches",
"WARC-Truncated": null,
"WARC-Type": "response",
"WARC-Warcinfo-ID": "<urn:uuid:e8f916b9-f861-4eff-9832-552bbc2d7398>"
},
"warc_info": "isPartOf: CC-MAIN-2019-30\r\npublisher: Common Crawl\r\ndescription: Wide crawl of the web for July 2019\r\noperator: Common Crawl Admin (info@commoncrawl.org)\r\nhostname: ip-10-47-193-50.ec2.internal\r\nsoftware: Apache Nutch 1.15 (modified, https://github.com/commoncrawl/nutch/)\r\nrobots: checked via crawler-commons 1.1-SNAPSHOT (https://github.com/crawler-commons/crawler-commons)\r\nformat: WARC File Format 1.1\r\nconformsTo: http://iipc.github.io/warc-specifications/specifications/warc-format/warc-1.1/"
}
|
{
"line_start_idx": [
0,
8,
9,
28,
29,
38,
39,
590,
591,
810,
811,
886,
887,
958,
959,
1040,
1041,
1103,
1104,
1178,
1179,
1220,
1221,
1269,
1270,
1326,
1327,
1342,
1343,
1396,
1397,
1524,
1525,
1597,
1598,
1981,
1982,
2167,
2168
],
"line_end_idx": [
8,
9,
28,
29,
38,
39,
590,
591,
810,
811,
886,
887,
958,
959,
1040,
1041,
1103,
1104,
1178,
1179,
1220,
1221,
1269,
1270,
1326,
1327,
1342,
1343,
1396,
1397,
1524,
1525,
1597,
1598,
1981,
1982,
2167,
2168,
2846
]
}
|
{
"red_pajama_v2": {
"ccnet_original_length": 2846,
"ccnet_original_nlines": 38,
"rps_doc_curly_bracket": 0,
"rps_doc_ldnoobw_words": 0,
"rps_doc_lorem_ipsum": 0,
"rps_doc_stop_word_fraction": 0.4407665431499481,
"rps_doc_ut1_blacklist": 0,
"rps_doc_frac_all_caps_words": 0.005226479843258858,
"rps_doc_frac_lines_end_with_ellipsis": 0.025641029700636864,
"rps_doc_frac_no_alph_words": 0.15156793594360352,
"rps_doc_frac_unique_words": 0.42331287264823914,
"rps_doc_mean_word_length": 4.550102233886719,
"rps_doc_num_sentences": 36,
"rps_doc_symbol_to_word_ratio": 0.0017421599477529526,
"rps_doc_unigram_entropy": 4.6885480880737305,
"rps_doc_word_count": 489,
"rps_doc_frac_chars_dupe_10grams": 0,
"rps_doc_frac_chars_dupe_5grams": 0.09932584315538406,
"rps_doc_frac_chars_dupe_6grams": 0.049438200891017914,
"rps_doc_frac_chars_dupe_7grams": 0.038651689887046814,
"rps_doc_frac_chars_dupe_8grams": 0.038651689887046814,
"rps_doc_frac_chars_dupe_9grams": 0.038651689887046814,
"rps_doc_frac_chars_top_2gram": 0.05393258109688759,
"rps_doc_frac_chars_top_3gram": 0.023370789363980293,
"rps_doc_frac_chars_top_4gram": 0.04494382068514824,
"rps_doc_books_importance": -282.42999267578125,
"rps_doc_books_importance_length_correction": -282.42999267578125,
"rps_doc_openwebtext_importance": -125.72169494628906,
"rps_doc_openwebtext_importance_length_correction": -125.72169494628906,
"rps_doc_wikipedia_importance": -122.4355239868164,
"rps_doc_wikipedia_importance_length_correction": -122.4355239868164
},
"fasttext": {
"dclm": 0.8393194079399109,
"english": 0.9189779758453369,
"fineweb_edu_approx": 2.192972183227539,
"eai_general_math": 0.3233785033226013,
"eai_open_web_math": 0.2845849394798279,
"eai_web_code": 0.4231880307197571
}
}
|
{
"free_decimal_correspondence": {
"primary": {
"code": "005.1",
"labels": {
"level_1": "General works, books and libraries, information sciences",
"level_2": "",
"level_3": "Computer programming"
}
},
"secondary": {
"code": "794.8",
"labels": {
"level_1": "Arts",
"level_2": "Amusements and Recreation",
"level_3": ""
}
}
},
"bloom_cognitive_process": {
"primary": {
"code": "3",
"label": "Apply"
},
"secondary": {
"code": "2",
"label": "Understand"
}
},
"bloom_knowledge_domain": {
"primary": {
"code": "3",
"label": "Procedural"
},
"secondary": {
"code": "2",
"label": "Conceptual"
}
},
"document_type_v1": {
"primary": {
"code": "3",
"label": "Reference/Encyclopedic/Educational"
},
"secondary": {
"code": "4",
"label": "Code/Software"
}
},
"extraction_artifacts": {
"primary": {
"code": "0",
"label": "No Artifacts"
},
"secondary": {
"code": "3",
"label": "Irrelevant Content"
}
},
"missing_content": {
"primary": {
"code": "0",
"label": "No missing content"
},
"secondary": {
"code": "4",
"label": "Missing Images or Figures"
}
},
"document_type_v2": {
"primary": {
"code": "23",
"label": "Tutorial"
},
"secondary": {
"code": "8",
"label": "Documentation"
}
},
"reasoning_depth": {
"primary": {
"code": "3",
"label": "Intermediate Reasoning"
},
"secondary": {
"code": "2",
"label": "Basic Reasoning"
}
},
"technical_correctness": {
"primary": {
"code": "4",
"label": "Highly Correct"
},
"secondary": {
"code": "3",
"label": "Mostly Correct"
}
},
"education_level": {
"primary": {
"code": "3",
"label": "Undergraduate Level"
},
"secondary": {
"code": "2",
"label": "High School Level"
}
}
}
|
672f1e42c33a7f9846924a2431ea77df
|
-5,842,865,327,525,759,000
|
• Watch
Notification status
• Watch
• Unwatch
• Stop ignoring
• Unstar Star
• Fork
public / JSON-js
branch: master
Switch branches/tags
Nothing to show
file 487 lines (369 sloc) 17.53 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
/*
json2.js
2012-10-08
Public Domain.
NO WARRANTY EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK.
See http://www.JSON.org/js.html
This code should be minified before deployment.
See http://javascript.crockford.com/jsmin.html
USE YOUR OWN COPY. IT IS EXTREMELY UNWISE TO LOAD CODE FROM SERVERS YOU DO
NOT CONTROL.
This file creates a global JSON object containing two methods: stringify
and parse.
JSON.stringify(value, replacer, space)
value any JavaScript value, usually an object or array.
replacer an optional parameter that determines how object
values are stringified for objects. It can be a
function or an array of strings.
space an optional parameter that specifies the indentation
of nested structures. If it is omitted, the text will
be packed without extra whitespace. If it is a number,
it will specify the number of spaces to indent at each
level. If it is a string (such as '\t' or ' '),
it contains the characters used to indent at each level.
This method produces a JSON text from a JavaScript value.
When an object value is found, if the object contains a toJSON
method, its toJSON method will be called and the result will be
stringified. A toJSON method does not serialize: it returns the
value represented by the name/value pair that should be serialized,
or undefined if nothing should be serialized. The toJSON method
will be passed the key associated with the value, and this will be
bound to the value
For example, this would serialize Dates as ISO strings.
Date.prototype.toJSON = function (key) {
function f(n) {
// Format integers to have at least two digits.
return n < 10 ? '0' + n : n;
}
return this.getUTCFullYear() + '-' +
f(this.getUTCMonth() + 1) + '-' +
f(this.getUTCDate()) + 'T' +
f(this.getUTCHours()) + ':' +
f(this.getUTCMinutes()) + ':' +
f(this.getUTCSeconds()) + 'Z';
};
You can provide an optional replacer method. It will be passed the
key and value of each member, with this bound to the containing
object. The value that is returned from your method will be
serialized. If your method returns undefined, then the member will
be excluded from the serialization.
If the replacer parameter is an array of strings, then it will be
used to select the members to be serialized. It filters the results
such that only members with keys listed in the replacer array are
stringified.
Values that do not have JSON representations, such as undefined or
functions, will not be serialized. Such values in objects will be
dropped; in arrays they will be replaced with null. You can use
a replacer function to replace those with JSON values.
JSON.stringify(undefined) returns undefined.
The optional space parameter produces a stringification of the
value that is filled with line breaks and indentation to make it
easier to read.
If the space parameter is a non-empty string, then that string will
be used for indentation. If the space parameter is a number, then
the indentation will be that many spaces.
Example:
text = JSON.stringify(['e', {pluribus: 'unum'}]);
// text is '["e",{"pluribus":"unum"}]'
text = JSON.stringify(['e', {pluribus: 'unum'}], null, '\t');
// text is '[\n\t"e",\n\t{\n\t\t"pluribus": "unum"\n\t}\n]'
text = JSON.stringify([new Date()], function (key, value) {
return this[key] instanceof Date ?
'Date(' + this[key] + ')' : value;
});
// text is '["Date(---current time---)"]'
JSON.parse(text, reviver)
This method parses a JSON text to produce an object or array.
It can throw a SyntaxError exception.
The optional reviver parameter is a function that can filter and
transform the results. It receives each of the keys and values,
and its return value is used instead of the original value.
If it returns what it received, then the structure is not modified.
If it returns undefined then the member is deleted.
Example:
// Parse the text. Values that look like ISO date strings will
// be converted to Date objects.
myData = JSON.parse(text, function (key, value) {
var a;
if (typeof value === 'string') {
a =
/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2}(?:\.\d*)?)Z$/.exec(value);
if (a) {
return new Date(Date.UTC(+a[1], +a[2] - 1, +a[3], +a[4],
+a[5], +a[6]));
}
}
return value;
});
myData = JSON.parse('["Date(09/09/2001)"]', function (key, value) {
var d;
if (typeof value === 'string' &&
value.slice(0, 5) === 'Date(' &&
value.slice(-1) === ')') {
d = new Date(value.slice(5, -1));
if (d) {
return d;
}
}
return value;
});
This is a reference implementation. You are free to copy, modify, or
redistribute.
*/
/*jslint evil: true, regexp: true */
/*members "", "\b", "\t", "\n", "\f", "\r", "\"", JSON, "\\", apply,
call, charCodeAt, getUTCDate, getUTCFullYear, getUTCHours,
getUTCMinutes, getUTCMonth, getUTCSeconds, hasOwnProperty, join,
lastIndex, length, parse, prototype, push, replace, slice, stringify,
test, toJSON, toString, valueOf
*/
// Create a JSON object only if one does not already exist. We create the
// methods in a closure to avoid creating global variables.
if (typeof JSON !== 'object') {
JSON = {};
}
(function () {
'use strict';
function f(n) {
// Format integers to have at least two digits.
return n < 10 ? '0' + n : n;
}
if (typeof Date.prototype.toJSON !== 'function') {
Date.prototype.toJSON = function (key) {
return isFinite(this.valueOf())
? this.getUTCFullYear() + '-' +
f(this.getUTCMonth() + 1) + '-' +
f(this.getUTCDate()) + 'T' +
f(this.getUTCHours()) + ':' +
f(this.getUTCMinutes()) + ':' +
f(this.getUTCSeconds()) + 'Z'
: null;
};
String.prototype.toJSON =
Number.prototype.toJSON =
Boolean.prototype.toJSON = function (key) {
return this.valueOf();
};
}
var cx = /[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,
escapable = /[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,
gap,
indent,
meta = { // table of character substitutions
'\b': '\\b',
'\t': '\\t',
'\n': '\\n',
'\f': '\\f',
'\r': '\\r',
'"' : '\\"',
'\\': '\\\\'
},
rep;
function quote(string) {
// If the string contains no control characters, no quote characters, and no
// backslash characters, then we can safely slap some quotes around it.
// Otherwise we must also replace the offending characters with safe escape
// sequences.
escapable.lastIndex = 0;
return escapable.test(string) ? '"' + string.replace(escapable, function (a) {
var c = meta[a];
return typeof c === 'string'
? c
: '\\u' + ('0000' + a.charCodeAt(0).toString(16)).slice(-4);
}) + '"' : '"' + string + '"';
}
function str(key, holder) {
// Produce a string from holder[key].
var i, // The loop counter.
k, // The member key.
v, // The member value.
length,
mind = gap,
partial,
value = holder[key];
// If the value has a toJSON method, call it to obtain a replacement value.
if (value && typeof value === 'object' &&
typeof value.toJSON === 'function') {
value = value.toJSON(key);
}
// If we were called with a replacer function, then call the replacer to
// obtain a replacement value.
if (typeof rep === 'function') {
value = rep.call(holder, key, value);
}
// What happens next depends on the value's type.
switch (typeof value) {
case 'string':
return quote(value);
case 'number':
// JSON numbers must be finite. Encode non-finite numbers as null.
return isFinite(value) ? String(value) : 'null';
case 'boolean':
case 'null':
// If the value is a boolean or null, convert it to a string. Note:
// typeof null does not produce 'null'. The case is included here in
// the remote chance that this gets fixed someday.
return String(value);
// If the type is 'object', we might be dealing with an object or an array or
// null.
case 'object':
// Due to a specification blunder in ECMAScript, typeof null is 'object',
// so watch out for that case.
if (!value) {
return 'null';
}
// Make an array to hold the partial results of stringifying this object value.
gap += indent;
partial = [];
// Is the value an array?
if (Object.prototype.toString.apply(value) === '[object Array]') {
// The value is an array. Stringify every element. Use null as a placeholder
// for non-JSON values.
length = value.length;
for (i = 0; i < length; i += 1) {
partial[i] = str(i, value) || 'null';
}
// Join all of the elements together, separated with commas, and wrap them in
// brackets.
v = partial.length === 0
? '[]'
: gap
? '[\n' + gap + partial.join(',\n' + gap) + '\n' + mind + ']'
: '[' + partial.join(',') + ']';
gap = mind;
return v;
}
// If the replacer is an array, use it to select the members to be stringified.
if (rep && typeof rep === 'object') {
length = rep.length;
for (i = 0; i < length; i += 1) {
if (typeof rep[i] === 'string') {
k = rep[i];
v = str(k, value);
if (v) {
partial.push(quote(k) + (gap ? ': ' : ':') + v);
}
}
}
} else {
// Otherwise, iterate through all of the keys in the object.
for (k in value) {
if (Object.prototype.hasOwnProperty.call(value, k)) {
v = str(k, value);
if (v) {
partial.push(quote(k) + (gap ? ': ' : ':') + v);
}
}
}
}
// Join all of the member texts together, separated with commas,
// and wrap them in braces.
v = partial.length === 0
? '{}'
: gap
? '{\n' + gap + partial.join(',\n' + gap) + '\n' + mind + '}'
: '{' + partial.join(',') + '}';
gap = mind;
return v;
}
}
// If the JSON object does not yet have a stringify method, give it one.
if (typeof JSON.stringify !== 'function') {
JSON.stringify = function (value, replacer, space) {
// The stringify method takes a value and an optional replacer, and an optional
// space parameter, and returns a JSON text. The replacer can be a function
// that can replace values, or an array of strings that will select the keys.
// A default replacer method can be provided. Use of the space parameter can
// produce text that is more easily readable.
var i;
gap = '';
indent = '';
// If the space parameter is a number, make an indent string containing that
// many spaces.
if (typeof space === 'number') {
for (i = 0; i < space; i += 1) {
indent += ' ';
}
// If the space parameter is a string, it will be used as the indent string.
} else if (typeof space === 'string') {
indent = space;
}
// If there is a replacer, it must be a function or an array.
// Otherwise, throw an error.
rep = replacer;
if (replacer && typeof replacer !== 'function' &&
(typeof replacer !== 'object' ||
typeof replacer.length !== 'number')) {
throw new Error('JSON.stringify');
}
// Make a fake root object containing our value under the key of ''.
// Return the result of stringifying the value.
return str('', {'': value});
};
}
// If the JSON object does not yet have a parse method, give it one.
if (typeof JSON.parse !== 'function') {
JSON.parse = function (text, reviver) {
// The parse method takes a text and an optional reviver function, and returns
// a JavaScript value if the text is a valid JSON text.
var j;
function walk(holder, key) {
// The walk method is used to recursively walk the resulting structure so
// that modifications can be made.
var k, v, value = holder[key];
if (value && typeof value === 'object') {
for (k in value) {
if (Object.prototype.hasOwnProperty.call(value, k)) {
v = walk(value, k);
if (v !== undefined) {
value[k] = v;
} else {
delete value[k];
}
}
}
}
return reviver.call(holder, key, value);
}
// Parsing happens in four stages. In the first stage, we replace certain
// Unicode characters with escape sequences. JavaScript handles many characters
// incorrectly, either silently deleting them, or treating them as line endings.
text = String(text);
cx.lastIndex = 0;
if (cx.test(text)) {
text = text.replace(cx, function (a) {
return '\\u' +
('0000' + a.charCodeAt(0).toString(16)).slice(-4);
});
}
// In the second stage, we run the text against regular expressions that look
// for non-JSON patterns. We are especially concerned with '()' and 'new'
// because they can cause invocation, and '=' because it can cause mutation.
// But just to be safe, we want to reject all unexpected forms.
// We split the second stage into 4 regexp operations in order to work around
// crippling inefficiencies in IE's and Safari's regexp engines. First we
// replace the JSON backslash pairs with '@' (a non-JSON character). Second, we
// replace all simple value tokens with ']' characters. Third, we delete all
// open brackets that follow a colon or comma or that begin the text. Finally,
// we look to see that the remaining characters are only whitespace or ']' or
// ',' or ':' or '{' or '}'. If that is so, then the text is safe for eval.
if (/^[\],:{}\s]*$/
.test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g, '@')
.replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, ']')
.replace(/(?:^|:|,)(?:\s*\[)+/g, ''))) {
// In the third stage we use the eval function to compile the text into a
// JavaScript structure. The '{' operator is subject to a syntactic ambiguity
// in JavaScript: it can begin a block or an object literal. We wrap the text
// in parens to eliminate the ambiguity.
j = eval('(' + text + ')');
// In the optional fourth stage, we recursively walk the new structure, passing
// each name/value pair to a reviver function for possible transformation.
return typeof reviver === 'function'
? walk({'': j}, '')
: j;
}
// If the text is not JSON parseable, then a SyntaxError is thrown.
throw new SyntaxError('JSON.parse');
};
}
}());
Markdown Cheat Sheet
Format Text
Headers
# This is an <h1> tag
## This is an <h2> tag
###### This is an <h6> tag
Text styles
*This text will be italic*
_This will also be italic_
**This text will be bold**
__This will also be bold__
*You **can** combine them*
Lists
Unordered
* Item 1
* Item 2
* Item 2a
* Item 2b
Ordered
1. Item 1
2. Item 2
3. Item 3
* Item 3a
* Item 3b
Miscellaneous
Images

Format: 
Links
http://github.com - automatic!
[GitHub](http://github.com)
Blockquotes
As Kanye West said:
> We're living the future so
> the present is our past.
Code Examples in Markdown
Syntax highlighting with GFM
```javascript
function fancyAlert(arg) {
if(arg) {
$.facebox({div:'#foo'})
}
}
```
Or, indent your code 4 spaces
Here is a Python code example
without syntax highlighting:
def foo:
if not bar:
return true
Inline code for comments
I think you should use an
`<addr>` element here instead.
Something went wrong with that request. Please try again.
|
{
"url": "https://media.physics.hmc.edu/static/js/json2.js.html",
"source_domain": "media.physics.hmc.edu",
"snapshot_id": "crawl=CC-MAIN-2021-31",
"warc_metadata": {
"Content-Length": "129826",
"Content-Type": "application/http; msgtype=response",
"WARC-Block-Digest": "sha1:PRBYCLZQ4MQFMZN6Y7OEH7GPTAB6GMNX",
"WARC-Concurrent-To": "<urn:uuid:ab2710e8-4967-4d60-9bca-07bba19aeb0c>",
"WARC-Date": "2021-07-23T16:35:20Z",
"WARC-IP-Address": "134.173.33.195",
"WARC-Identified-Payload-Type": "text/html",
"WARC-Payload-Digest": "sha1:SMM56GN2AN2BOIFSIAUQEBNR6IOB727R",
"WARC-Record-ID": "<urn:uuid:1605c0e4-e66a-484b-adf2-9309e2af5ae1>",
"WARC-Target-URI": "https://media.physics.hmc.edu/static/js/json2.js.html",
"WARC-Truncated": null,
"WARC-Type": "response",
"WARC-Warcinfo-ID": "<urn:uuid:34c8489d-de4e-46ba-86e1-14aa749ca2f0>"
},
"warc_info": "isPartOf: CC-MAIN-2021-31\r\npublisher: Common Crawl\r\ndescription: Wide crawl of the web for July/August 2021\r\noperator: Common Crawl Admin (info@commoncrawl.org)\r\nhostname: ip-10-67-67-178.ec2.internal\r\nsoftware: Apache Nutch 1.18 (modified, https://github.com/commoncrawl/nutch/)\r\nrobots: checked via crawler-commons 1.2-SNAPSHOT (https://github.com/crawler-commons/crawler-commons)\r\nformat: WARC File Format 1.1\r\nconformsTo: https://iipc.github.io/warc-specifications/specifications/warc-format/warc-1.1/"
}
|
{
"line_start_idx": [
0,
10,
34,
46,
60,
80,
96,
105,
106,
123,
124,
139,
160,
176,
211,
213,
215,
217,
219,
221,
223,
225,
227,
229,
232,
235,
238,
241,
244,
247,
250,
253,
256,
259,
262,
265,
268,
271,
274,
277,
280,
283,
286,
289,
292,
295,
298,
301,
304,
307,
310,
313,
316,
319,
322,
325,
328,
331,
334,
337,
340,
343,
346,
349,
352,
355,
358,
361,
364,
367,
370,
373,
376,
379,
382,
385,
388,
391,
394,
397,
400,
403,
406,
409,
412,
415,
418,
421,
424,
427,
430,
433,
436,
439,
442,
445,
448,
451,
454,
457,
460,
463,
466,
469,
472,
475,
478,
481,
484,
487,
490,
493,
496,
499,
503,
507,
511,
515,
519,
523,
527,
531,
535,
539,
543,
547,
551,
555,
559,
563,
567,
571,
575,
579,
583,
587,
591,
595,
599,
603,
607,
611,
615,
619,
623,
627,
631,
635,
639,
643,
647,
651,
655,
659,
663,
667,
671,
675,
679,
683,
687,
691,
695,
699,
703,
707,
711,
715,
719,
723,
727,
731,
735,
739,
743,
747,
751,
755,
759,
763,
767,
771,
775,
779,
783,
787,
791,
795,
799,
803,
807,
811,
815,
819,
823,
827,
831,
835,
839,
843,
847,
851,
855,
859,
863,
867,
871,
875,
879,
883,
887,
891,
895,
899,
903,
907,
911,
915,
919,
923,
927,
931,
935,
939,
943,
947,
951,
955,
959,
963,
967,
971,
975,
979,
983,
987,
991,
995,
999,
1003,
1007,
1011,
1015,
1019,
1023,
1027,
1031,
1035,
1039,
1043,
1047,
1051,
1055,
1059,
1063,
1067,
1071,
1075,
1079,
1083,
1087,
1091,
1095,
1099,
1103,
1107,
1111,
1115,
1119,
1123,
1127,
1131,
1135,
1139,
1143,
1147,
1151,
1155,
1159,
1163,
1167,
1171,
1175,
1179,
1183,
1187,
1191,
1195,
1199,
1203,
1207,
1211,
1215,
1219,
1223,
1227,
1231,
1235,
1239,
1243,
1247,
1251,
1255,
1259,
1263,
1267,
1271,
1275,
1279,
1283,
1287,
1291,
1295,
1299,
1303,
1307,
1311,
1315,
1319,
1323,
1327,
1331,
1335,
1339,
1343,
1347,
1351,
1355,
1359,
1363,
1367,
1371,
1375,
1379,
1383,
1387,
1391,
1395,
1399,
1403,
1407,
1411,
1415,
1419,
1423,
1427,
1431,
1435,
1439,
1443,
1447,
1451,
1455,
1459,
1463,
1467,
1471,
1475,
1479,
1483,
1487,
1491,
1495,
1499,
1503,
1507,
1511,
1515,
1519,
1523,
1527,
1531,
1535,
1539,
1543,
1547,
1551,
1555,
1559,
1563,
1567,
1571,
1575,
1579,
1583,
1587,
1591,
1595,
1599,
1603,
1607,
1611,
1615,
1619,
1623,
1627,
1631,
1635,
1639,
1643,
1647,
1651,
1655,
1659,
1663,
1667,
1671,
1675,
1679,
1683,
1687,
1691,
1695,
1699,
1703,
1707,
1711,
1715,
1719,
1723,
1727,
1731,
1735,
1739,
1743,
1747,
1751,
1755,
1759,
1763,
1767,
1771,
1775,
1779,
1783,
1787,
1791,
1795,
1799,
1803,
1807,
1811,
1815,
1819,
1823,
1827,
1831,
1835,
1839,
1843,
1847,
1851,
1855,
1859,
1863,
1867,
1871,
1875,
1879,
1883,
1887,
1891,
1895,
1899,
1903,
1907,
1911,
1915,
1919,
1923,
1927,
1931,
1935,
1939,
1943,
1947,
1951,
1955,
1959,
1963,
1967,
1971,
1975,
1979,
1983,
1987,
1991,
1995,
1999,
2003,
2007,
2011,
2015,
2019,
2023,
2027,
2031,
2035,
2039,
2043,
2047,
2050,
2059,
2070,
2071,
2086,
2087,
2143,
2144,
2176,
2177,
2178,
2226,
2273,
2274,
2349,
2362,
2363,
2364,
2437,
2448,
2449,
2488,
2544,
2545,
2603,
2651,
2684,
2685,
2744,
2798,
2853,
2908,
2961,
3018,
3019,
3077,
3078,
3141,
3205,
3269,
3337,
3401,
3468,
3487,
3488,
3544,
3545,
3586,
3602,
3650,
3679,
3681,
3682,
3719,
3753,
3782,
3812,
3844,
3875,
3878,
3879,
3946,
4010,
4070,
4137,
4173,
4174,
4240,
4308,
4374,
4387,
4388,
4455,
4521,
4585,
4640,
4685,
4686,
4749,
4814,
4830,
4831,
4899,
4965,
5007,
5008,
5017,
5018,
5068,
5107,
5108,
5109,
5171,
5231,
5232,
5292,
5327,
5362,
5366,
5408,
5409,
5410,
5436,
5498,
5536,
5537,
5602,
5666,
5726,
5794,
5846,
5847,
5856,
5857,
5920,
5953,
5954,
6004,
6011,
6044,
6048,
6124,
6133,
6190,
6206,
6208,
6210,
6224,
6228,
6229,
6297,
6304,
6337,
6370,
6397,
6431,
6440,
6450,
6452,
6454,
6468,
6472,
6473,
6474,
6543,
6557,
6560,
6561,
6598,
6599,
6668,
6727,
6792,
6862,
6894,
6897,
6898,
6899,
6973,
7033,
7034,
7066,
7081,
7083,
7084,
7099,
7117,
7118,
7138,
7194,
7231,
7237,
7238,
7293,
7294,
7343,
7344,
7388,
7436,
7490,
7539,
7589,
7641,
7691,
7715,
7726,
7727,
7761,
7799,
7855,
7894,
7909,
7915,
7916,
8037,
8181,
8194,
8210,
8263,
8288,
8313,
8338,
8363,
8388,
8413,
8438,
8449,
8462,
8463,
8464,
8493,
8494,
8571,
8643,
8719,
8733,
8734,
8767,
8854,
8883,
8924,
8944,
9021,
9060,
9066,
9067,
9068,
9100,
9101,
9139,
9140,
9176,
9210,
9246,
9266,
9290,
9311,
9344,
9345,
9421,
9422,
9472,
9526,
9565,
9575,
9576,
9649,
9680,
9681,
9722,
9772,
9782,
9783,
9833,
9834,
9866,
9889,
9922,
9923,
9946,
9947,
10014,
10015,
10076,
10077,
10101,
10122,
10123,
10191,
10260,
10311,
10312,
10346,
10347,
10425,
10434,
10435,
10458,
10459,
10533,
10564,
10565,
10591,
10622,
10636,
10637,
10717,
10718,
10745,
10771,
10772,
10798,
10799,
10878,
10879,
10956,
10980,
10981,
11020,
11070,
11128,
11146,
11147,
11225,
11238,
11239,
11280,
11307,
11333,
11415,
11468,
11496,
11522,
11536,
11537,
11617,
11618,
11668,
11705,
11755,
11809,
11845,
11888,
11921,
11998,
12024,
12046,
12064,
12085,
12086,
12147,
12148,
12183,
12257,
12300,
12333,
12410,
12436,
12458,
12476,
12490,
12491,
12556,
12584,
12585,
12622,
12645,
12667,
12745,
12794,
12818,
12840,
12850,
12856,
12857,
12930,
12931,
12979,
13040,
13041,
13121,
13197,
13275,
13352,
13398,
13399,
13418,
13440,
13465,
13466,
13543,
13559,
13560,
13605,
13654,
13689,
13707,
13708,
13785,
13786,
13838,
13870,
13884,
13885,
13947,
13977,
13978,
14006,
14068,
14121,
14181,
14232,
14246,
14247,
14316,
14364,
14365,
14406,
14417,
14423,
14424,
14425,
14494,
14495,
14539,
14587,
14588,
14667,
14723,
14724,
14743,
14744,
14785,
14786,
14860,
14895,
14896,
14943,
15001,
15040,
15118,
15166,
15217,
15263,
15300,
15349,
15379,
15405,
15427,
15445,
15502,
15516,
15517,
15518,
15592,
15672,
15753,
15754,
15787,
15817,
15850,
15905,
15940,
16015,
16035,
16049,
16050,
16128,
16202,
16279,
16343,
16344,
16422,
16496,
16576,
16653,
16732,
16810,
16886,
16887,
16919,
17002,
17108,
17173,
17174,
17248,
17326,
17404,
17445,
17446,
17490,
17491,
17571,
17646,
17647,
17700,
17740,
17765,
17779,
17780,
17848,
17849,
17898,
17909,
17915,
17921,
17922,
17943,
17944,
17956,
17957,
17965,
17966,
17988,
18011,
18038,
18039,
18051,
18052,
18079,
18106,
18133,
18160,
18161,
18188,
18189,
18195,
18196,
18206,
18207,
18216,
18225,
18237,
18249,
18250,
18258,
18259,
18269,
18279,
18289,
18302,
18315,
18316,
18330,
18331,
18338,
18339,
18372,
18397,
18398,
18404,
18405,
18436,
18464,
18465,
18477,
18478,
18498,
18499,
18528,
18555,
18556,
18582,
18583,
18612,
18613,
18627,
18654,
18666,
18694,
18698,
18700,
18704,
18705,
18735,
18736,
18766,
18795,
18796,
18809,
18827,
18847,
18848,
18873,
18874,
18900,
18931
],
"line_end_idx": [
10,
34,
46,
60,
80,
96,
105,
106,
123,
124,
139,
160,
176,
211,
213,
215,
217,
219,
221,
223,
225,
227,
229,
232,
235,
238,
241,
244,
247,
250,
253,
256,
259,
262,
265,
268,
271,
274,
277,
280,
283,
286,
289,
292,
295,
298,
301,
304,
307,
310,
313,
316,
319,
322,
325,
328,
331,
334,
337,
340,
343,
346,
349,
352,
355,
358,
361,
364,
367,
370,
373,
376,
379,
382,
385,
388,
391,
394,
397,
400,
403,
406,
409,
412,
415,
418,
421,
424,
427,
430,
433,
436,
439,
442,
445,
448,
451,
454,
457,
460,
463,
466,
469,
472,
475,
478,
481,
484,
487,
490,
493,
496,
499,
503,
507,
511,
515,
519,
523,
527,
531,
535,
539,
543,
547,
551,
555,
559,
563,
567,
571,
575,
579,
583,
587,
591,
595,
599,
603,
607,
611,
615,
619,
623,
627,
631,
635,
639,
643,
647,
651,
655,
659,
663,
667,
671,
675,
679,
683,
687,
691,
695,
699,
703,
707,
711,
715,
719,
723,
727,
731,
735,
739,
743,
747,
751,
755,
759,
763,
767,
771,
775,
779,
783,
787,
791,
795,
799,
803,
807,
811,
815,
819,
823,
827,
831,
835,
839,
843,
847,
851,
855,
859,
863,
867,
871,
875,
879,
883,
887,
891,
895,
899,
903,
907,
911,
915,
919,
923,
927,
931,
935,
939,
943,
947,
951,
955,
959,
963,
967,
971,
975,
979,
983,
987,
991,
995,
999,
1003,
1007,
1011,
1015,
1019,
1023,
1027,
1031,
1035,
1039,
1043,
1047,
1051,
1055,
1059,
1063,
1067,
1071,
1075,
1079,
1083,
1087,
1091,
1095,
1099,
1103,
1107,
1111,
1115,
1119,
1123,
1127,
1131,
1135,
1139,
1143,
1147,
1151,
1155,
1159,
1163,
1167,
1171,
1175,
1179,
1183,
1187,
1191,
1195,
1199,
1203,
1207,
1211,
1215,
1219,
1223,
1227,
1231,
1235,
1239,
1243,
1247,
1251,
1255,
1259,
1263,
1267,
1271,
1275,
1279,
1283,
1287,
1291,
1295,
1299,
1303,
1307,
1311,
1315,
1319,
1323,
1327,
1331,
1335,
1339,
1343,
1347,
1351,
1355,
1359,
1363,
1367,
1371,
1375,
1379,
1383,
1387,
1391,
1395,
1399,
1403,
1407,
1411,
1415,
1419,
1423,
1427,
1431,
1435,
1439,
1443,
1447,
1451,
1455,
1459,
1463,
1467,
1471,
1475,
1479,
1483,
1487,
1491,
1495,
1499,
1503,
1507,
1511,
1515,
1519,
1523,
1527,
1531,
1535,
1539,
1543,
1547,
1551,
1555,
1559,
1563,
1567,
1571,
1575,
1579,
1583,
1587,
1591,
1595,
1599,
1603,
1607,
1611,
1615,
1619,
1623,
1627,
1631,
1635,
1639,
1643,
1647,
1651,
1655,
1659,
1663,
1667,
1671,
1675,
1679,
1683,
1687,
1691,
1695,
1699,
1703,
1707,
1711,
1715,
1719,
1723,
1727,
1731,
1735,
1739,
1743,
1747,
1751,
1755,
1759,
1763,
1767,
1771,
1775,
1779,
1783,
1787,
1791,
1795,
1799,
1803,
1807,
1811,
1815,
1819,
1823,
1827,
1831,
1835,
1839,
1843,
1847,
1851,
1855,
1859,
1863,
1867,
1871,
1875,
1879,
1883,
1887,
1891,
1895,
1899,
1903,
1907,
1911,
1915,
1919,
1923,
1927,
1931,
1935,
1939,
1943,
1947,
1951,
1955,
1959,
1963,
1967,
1971,
1975,
1979,
1983,
1987,
1991,
1995,
1999,
2003,
2007,
2011,
2015,
2019,
2023,
2027,
2031,
2035,
2039,
2043,
2047,
2050,
2059,
2070,
2071,
2086,
2087,
2143,
2144,
2176,
2177,
2178,
2226,
2273,
2274,
2349,
2362,
2363,
2364,
2437,
2448,
2449,
2488,
2544,
2545,
2603,
2651,
2684,
2685,
2744,
2798,
2853,
2908,
2961,
3018,
3019,
3077,
3078,
3141,
3205,
3269,
3337,
3401,
3468,
3487,
3488,
3544,
3545,
3586,
3602,
3650,
3679,
3681,
3682,
3719,
3753,
3782,
3812,
3844,
3875,
3878,
3879,
3946,
4010,
4070,
4137,
4173,
4174,
4240,
4308,
4374,
4387,
4388,
4455,
4521,
4585,
4640,
4685,
4686,
4749,
4814,
4830,
4831,
4899,
4965,
5007,
5008,
5017,
5018,
5068,
5107,
5108,
5109,
5171,
5231,
5232,
5292,
5327,
5362,
5366,
5408,
5409,
5410,
5436,
5498,
5536,
5537,
5602,
5666,
5726,
5794,
5846,
5847,
5856,
5857,
5920,
5953,
5954,
6004,
6011,
6044,
6048,
6124,
6133,
6190,
6206,
6208,
6210,
6224,
6228,
6229,
6297,
6304,
6337,
6370,
6397,
6431,
6440,
6450,
6452,
6454,
6468,
6472,
6473,
6474,
6543,
6557,
6560,
6561,
6598,
6599,
6668,
6727,
6792,
6862,
6894,
6897,
6898,
6899,
6973,
7033,
7034,
7066,
7081,
7083,
7084,
7099,
7117,
7118,
7138,
7194,
7231,
7237,
7238,
7293,
7294,
7343,
7344,
7388,
7436,
7490,
7539,
7589,
7641,
7691,
7715,
7726,
7727,
7761,
7799,
7855,
7894,
7909,
7915,
7916,
8037,
8181,
8194,
8210,
8263,
8288,
8313,
8338,
8363,
8388,
8413,
8438,
8449,
8462,
8463,
8464,
8493,
8494,
8571,
8643,
8719,
8733,
8734,
8767,
8854,
8883,
8924,
8944,
9021,
9060,
9066,
9067,
9068,
9100,
9101,
9139,
9140,
9176,
9210,
9246,
9266,
9290,
9311,
9344,
9345,
9421,
9422,
9472,
9526,
9565,
9575,
9576,
9649,
9680,
9681,
9722,
9772,
9782,
9783,
9833,
9834,
9866,
9889,
9922,
9923,
9946,
9947,
10014,
10015,
10076,
10077,
10101,
10122,
10123,
10191,
10260,
10311,
10312,
10346,
10347,
10425,
10434,
10435,
10458,
10459,
10533,
10564,
10565,
10591,
10622,
10636,
10637,
10717,
10718,
10745,
10771,
10772,
10798,
10799,
10878,
10879,
10956,
10980,
10981,
11020,
11070,
11128,
11146,
11147,
11225,
11238,
11239,
11280,
11307,
11333,
11415,
11468,
11496,
11522,
11536,
11537,
11617,
11618,
11668,
11705,
11755,
11809,
11845,
11888,
11921,
11998,
12024,
12046,
12064,
12085,
12086,
12147,
12148,
12183,
12257,
12300,
12333,
12410,
12436,
12458,
12476,
12490,
12491,
12556,
12584,
12585,
12622,
12645,
12667,
12745,
12794,
12818,
12840,
12850,
12856,
12857,
12930,
12931,
12979,
13040,
13041,
13121,
13197,
13275,
13352,
13398,
13399,
13418,
13440,
13465,
13466,
13543,
13559,
13560,
13605,
13654,
13689,
13707,
13708,
13785,
13786,
13838,
13870,
13884,
13885,
13947,
13977,
13978,
14006,
14068,
14121,
14181,
14232,
14246,
14247,
14316,
14364,
14365,
14406,
14417,
14423,
14424,
14425,
14494,
14495,
14539,
14587,
14588,
14667,
14723,
14724,
14743,
14744,
14785,
14786,
14860,
14895,
14896,
14943,
15001,
15040,
15118,
15166,
15217,
15263,
15300,
15349,
15379,
15405,
15427,
15445,
15502,
15516,
15517,
15518,
15592,
15672,
15753,
15754,
15787,
15817,
15850,
15905,
15940,
16015,
16035,
16049,
16050,
16128,
16202,
16279,
16343,
16344,
16422,
16496,
16576,
16653,
16732,
16810,
16886,
16887,
16919,
17002,
17108,
17173,
17174,
17248,
17326,
17404,
17445,
17446,
17490,
17491,
17571,
17646,
17647,
17700,
17740,
17765,
17779,
17780,
17848,
17849,
17898,
17909,
17915,
17921,
17922,
17943,
17944,
17956,
17957,
17965,
17966,
17988,
18011,
18038,
18039,
18051,
18052,
18079,
18106,
18133,
18160,
18161,
18188,
18189,
18195,
18196,
18206,
18207,
18216,
18225,
18237,
18249,
18250,
18258,
18259,
18269,
18279,
18289,
18302,
18315,
18316,
18330,
18331,
18338,
18339,
18372,
18397,
18398,
18404,
18405,
18436,
18464,
18465,
18477,
18478,
18498,
18499,
18528,
18555,
18556,
18582,
18583,
18612,
18613,
18627,
18654,
18666,
18694,
18698,
18700,
18704,
18705,
18735,
18736,
18766,
18795,
18796,
18809,
18827,
18847,
18848,
18873,
18874,
18900,
18931,
18988
]
}
|
{
"red_pajama_v2": {
"ccnet_original_length": 18988,
"ccnet_original_nlines": 1067,
"rps_doc_curly_bracket": 0.007636399939656258,
"rps_doc_ldnoobw_words": 0,
"rps_doc_lorem_ipsum": 0,
"rps_doc_stop_word_fraction": 0.23159697651863098,
"rps_doc_ut1_blacklist": 0,
"rps_doc_frac_all_caps_words": 0.018831010907888412,
"rps_doc_frac_lines_end_with_ellipsis": 0,
"rps_doc_frac_no_alph_words": 0.4671068787574768,
"rps_doc_frac_unique_words": 0.4327198266983032,
"rps_doc_mean_word_length": 4.629447937011719,
"rps_doc_num_sentences": 240,
"rps_doc_symbol_to_word_ratio": 0.0024455899838358164,
"rps_doc_unigram_entropy": 6.129268646240234,
"rps_doc_word_count": 2445,
"rps_doc_frac_chars_dupe_10grams": 0.022970229387283325,
"rps_doc_frac_chars_dupe_5grams": 0.11582294851541519,
"rps_doc_frac_chars_dupe_6grams": 0.09824188798666,
"rps_doc_frac_chars_dupe_7grams": 0.08004240691661835,
"rps_doc_frac_chars_dupe_8grams": 0.06961745768785477,
"rps_doc_frac_chars_dupe_9grams": 0.056630440056324005,
"rps_doc_frac_chars_top_2gram": 0.009011399932205677,
"rps_doc_frac_chars_top_3gram": 0.007509499788284302,
"rps_doc_frac_chars_top_4gram": 0.006714370101690292,
"rps_doc_books_importance": -1636.3387451171875,
"rps_doc_books_importance_length_correction": -1636.3387451171875,
"rps_doc_openwebtext_importance": -900.7296752929688,
"rps_doc_openwebtext_importance_length_correction": -900.7296752929688,
"rps_doc_wikipedia_importance": -774.456787109375,
"rps_doc_wikipedia_importance_length_correction": -774.456787109375
},
"fasttext": {
"dclm": 0.7913133502006531,
"english": 0.3972131311893463,
"fineweb_edu_approx": 2.6563847064971924,
"eai_general_math": 0.6629421710968018,
"eai_open_web_math": 0.228906512260437,
"eai_web_code": 0.6695378422737122
}
}
|
{
"free_decimal_correspondence": {
"primary": {
"code": "005.1",
"labels": {
"level_1": "General works, books and libraries, information sciences",
"level_2": "",
"level_3": "Computer programming"
}
},
"secondary": {
"code": "005.72",
"labels": {
"level_1": "General works, books and libraries, information sciences",
"level_2": "",
"level_3": "Computer programming"
}
}
},
"bloom_cognitive_process": {
"primary": {
"code": "3",
"label": "Apply"
},
"secondary": {
"code": "2",
"label": "Understand"
}
},
"bloom_knowledge_domain": {
"primary": {
"code": "3",
"label": "Procedural"
},
"secondary": {
"code": "2",
"label": "Conceptual"
}
},
"document_type_v1": {
"primary": {
"code": "4",
"label": "Code/Software"
},
"secondary": {
"code": "3",
"label": "Reference/Encyclopedic/Educational"
}
},
"extraction_artifacts": {
"primary": {
"code": "3",
"label": "Irrelevant Content"
},
"secondary": {
"code": "1",
"label": "Leftover HTML"
}
},
"missing_content": {
"primary": {
"code": "0",
"label": "No missing content"
},
"secondary": {
"code": "-1",
"label": "Abstain"
}
},
"document_type_v2": {
"primary": {
"code": "8",
"label": "Documentation"
},
"secondary": {
"code": "10",
"label": "Knowledge Article"
}
},
"reasoning_depth": {
"primary": {
"code": "3",
"label": "Intermediate Reasoning"
},
"secondary": {
"code": "2",
"label": "Basic Reasoning"
}
},
"technical_correctness": {
"primary": {
"code": "4",
"label": "Highly Correct"
},
"secondary": {
"code": "3",
"label": "Mostly Correct"
}
},
"education_level": {
"primary": {
"code": "3",
"label": "Undergraduate Level"
},
"secondary": {
"code": "4",
"label": "Graduate/Expert Level"
}
}
}
|
672f1e42c33a7f9846924a2431ea77df
|
-6,896,959,570,977,677,000
|
=head1 NAME perlguts - Introduction to the Perl API =head1 DESCRIPTION This document attempts to describe how to use the Perl API, as well as to provide some info on the basic workings of the Perl core. It is far from complete and probably contains many errors. Please refer any questions or comments to the author below. =head1 Variables =head2 Datatypes Perl has three typedefs that handle Perl's three main data types: SV Scalar Value AV Array Value HV Hash Value Each typedef has specific routines that manipulate the various data types. =head2 What is an "IV"? Perl uses a special typedef IV which is a simple signed integer type that is guaranteed to be large enough to hold a pointer (as well as an integer). Additionally, there is the UV, which is simply an unsigned IV. Perl also uses two special typedefs, I32 and I16, which will always be at least 32-bits and 16-bits long, respectively. (Again, there are U32 and U16, as well.) They will usually be exactly 32 and 16 bits long, but on Crays they will both be 64 bits. =head2 Working with SVs An SV can be created and loaded with one command. There are five types of values that can be loaded: an integer value (IV), an unsigned integer value (UV), a double (NV), a string (PV), and another scalar (SV). The seven routines are: SV* newSViv(IV); SV* newSVuv(UV); SV* newSVnv(double); SV* newSVpv(const char*, STRLEN); SV* newSVpvn(const char*, STRLEN); SV* newSVpvf(const char*, ...); SV* newSVsv(SV*); C is an integer type (Size_t, usually defined as size_t in F) guaranteed to be large enough to represent the size of any string that perl can handle. In the unlikely case of a SV requiring more complex initialisation, you can create an empty SV with newSV(len). If C is 0 an empty SV of type NULL is returned, else an SV of type PV is returned with len + 1 (for the NUL) bytes of storage allocated, accessible via SvPVX. In both cases the SV has value undef. SV *sv = newSV(0); /* no storage allocated */ SV *sv = newSV(10); /* 10 (+1) bytes of uninitialised storage allocated */ To change the value of an I SV, there are eight routines: void sv_setiv(SV*, IV); void sv_setuv(SV*, UV); void sv_setnv(SV*, double); void sv_setpv(SV*, const char*); void sv_setpvn(SV*, const char*, STRLEN) void sv_setpvf(SV*, const char*, ...); void sv_vsetpvfn(SV*, const char*, STRLEN, va_list *, SV **, I32, bool *); void sv_setsv(SV*, SV*); Notice that you can choose to specify the length of the string to be assigned by using C, C, or C, or you may allow Perl to calculate the length by using C or by specifying 0 as the second argument to C. Be warned, though, that Perl will determine the string's length by using C, which depends on the string terminating with a NUL character. The arguments of C are processed like C, and the formatted output becomes the value. C is an analogue of C, but it allows you to specify either a pointer to a variable argument list or the address and length of an array of SVs. The last argument points to a boolean; on return, if that boolean is true, then locale-specific information has been used to format the string, and the string's contents are therefore untrustworthy (see L). This pointer may be NULL if that information is not important. Note that this function requires you to specify the length of the format. The C functions are not generic enough to operate on values that have "magic". See L later in this document. All SVs that contain strings should be terminated with a NUL character. If it is not NUL-terminated there is a risk of core dumps and corruptions from code which passes the string to C functions or system calls which expect a NUL-terminated string. Perl's own functions typically add a trailing NUL for this reason. Nevertheless, you should be very careful when you pass a string stored in an SV to a C function or system call. To access the actual value that an SV points to, you can use the macros: SvIV(SV*) SvUV(SV*) SvNV(SV*) SvPV(SV*, STRLEN len) SvPV_nolen(SV*) which will automatically coerce the actual scalar type into an IV, UV, double, or string. In the C macro, the length of the string returned is placed into the variable C (this is a macro, so you do I use C<&len>). If you do not care what the length of the data is, use the C macro. Historically the C macro with the global variable C has been used in this case. But that can be quite inefficient because C must be accessed in thread-local storage in threaded Perl. In any case, remember that Perl allows arbitrary strings of data that may both contain NULs and might not be terminated by a NUL. Also remember that C doesn't allow you to safely say C. It might work with your compiler, but it won't work for everyone. Break this sort of statement up into separate assignments: SV *s; STRLEN len; char * ptr; ptr = SvPV(s, len); foo(ptr, len); If you want to know if the scalar value is TRUE, you can use: SvTRUE(SV*) Although Perl will automatically grow strings for you, if you need to force Perl to allocate more memory for your SV, you can use the macro SvGROW(SV*, STRLEN newlen) which will determine if more memory needs to be allocated. If so, it will call the function C. Note that C can only increase, not decrease, the allocated memory of an SV and that it does not automatically add a byte for the a trailing NUL (perl's own string functions typically do C). If you have an SV and want to know what kind of data Perl thinks is stored in it, you can use the following macros to check the type of SV you have. SvIOK(SV*) SvNOK(SV*) SvPOK(SV*) You can get and set the current length of the string stored in an SV with the following macros: SvCUR(SV*) SvCUR_set(SV*, I32 val) You can also get a pointer to the end of the string stored in the SV with the macro: SvEND(SV*) But note that these last three macros are valid only if C is true. If you want to append something to the end of string stored in an C, you can use the following functions: void sv_catpv(SV*, const char*); void sv_catpvn(SV*, const char*, STRLEN); void sv_catpvf(SV*, const char*, ...); void sv_vcatpvfn(SV*, const char*, STRLEN, va_list *, SV **, I32, bool); void sv_catsv(SV*, SV*); The first function calculates the length of the string to be appended by using C. In the second, you specify the length of the string yourself. The third function processes its arguments like C and appends the formatted output. The fourth function works like C. You can specify the address and length of an array of SVs instead of the va_list argument. The fifth function extends the string stored in the first SV with the string stored in the second SV. It also forces the second SV to be interpreted as a string. The C functions are not generic enough to operate on values that have "magic". See L later in this document. If you know the name of a scalar variable, you can get a pointer to its SV by using the following: SV* get_sv("package::varname", FALSE); This returns NULL if the variable does not exist. If you want to know if this variable (or any other SV) is actually C, you can call: SvOK(SV*) The scalar C value is stored in an SV instance called C. Its address can be used whenever an C is needed. Make sure that you don't try to compare a random sv with C<&PL_sv_undef>. For example when interfacing Perl code, it'll work correctly for: foo(undef); But won't work when called as: $x = undef; foo($x); So to repeat always use SvOK() to check whether an sv is defined. Also you have to be careful when using C<&PL_sv_undef> as a value in AVs or HVs (see L). There are also the two values C and C, which contain boolean TRUE and FALSE values, respectively. Like C, their addresses can be used whenever an C is needed. Do not be fooled into thinking that C<(SV *) 0> is the same as C<&PL_sv_undef>. Take this code: SV* sv = (SV*) 0; if (I-am-to-return-a-real-value) { sv = sv_2mortal(newSViv(42)); } sv_setsv(ST(0), sv); This code tries to return a new SV (which contains the value 42) if it should return a real value, or undef otherwise. Instead it has returned a NULL pointer which, somewhere down the line, will cause a segmentation violation, bus error, or just weird results. Change the zero to C<&PL_sv_undef> in the first line and all will be well. To free an SV that you've created, call C. Normally this call is not necessary (see L). =head2 Offsets Perl provides the function C to efficiently remove characters from the beginning of a string; you give it an SV and a pointer to somewhere inside the PV, and it discards everything before the pointer. The efficiency comes by means of a little hack: instead of actually removing the characters, C sets the flag C (offset OK) to signal to other functions that the offset hack is in effect, and it puts the number of bytes chopped off into the IV field of the SV. It then moves the PV pointer (called C) forward that many bytes, and adjusts C and C. Hence, at this point, the start of the buffer that we allocated lives at C in memory and the PV pointer is pointing into the middle of this allocated storage. This is best demonstrated by example: % ./perl -Ilib -MDevel::Peek -le '$a="12345"; $a=~s/.//; Dump($a)' SV = PVIV(0x8128450) at 0x81340f0 REFCNT = 1 FLAGS = (POK,OOK,pPOK) IV = 1 (OFFSET) PV = 0x8135781 ( "1" . ) "2345"\0 CUR = 4 LEN = 5 Here the number of bytes chopped off (1) is put into IV, and C helpfully reminds us that this is an offset. The portion of the string between the "real" and the "fake" beginnings is shown in parentheses, and the values of C and C reflect the fake beginning, not the real one. Something similar to the offset hack is performed on AVs to enable efficient shifting and splicing off the beginning of the array; while C points to the first element in the array that is visible from Perl, C points to the real start of the C array. These are usually the same, but a C operation can be carried out by increasing C by one and decreasing C and C. Again, the location of the real start of the C array only comes into play when freeing the array. See C in F. =head2 What's Really Stored in an SV? Recall that the usual method of determining the type of scalar you have is to use C macros. Because a scalar can be both a number and a string, usually these macros will always return TRUE and calling the C macros will do the appropriate conversion of string to integer/double or integer/double to string. If you I need to know if you have an integer, double, or string pointer in an SV, you can use the following three macros instead: SvIOKp(SV*) SvNOKp(SV*) SvPOKp(SV*) These will tell you if you truly have an integer, double, or string pointer stored in your SV. The "p" stands for private. The are various ways in which the private and public flags may differ. For example, a tied SV may have a valid underlying value in the IV slot (so SvIOKp is true), but the data should be accessed via the FETCH routine rather than directly, so SvIOK is false. Another is when numeric conversion has occurred and precision has been lost: only the private flag is set on 'lossy' values. So when an NV is converted to an IV with loss, SvIOKp, SvNOKp and SvNOK will be set, while SvIOK wont be. In general, though, it's best to use the C macros. =head2 Working with AVs There are two ways to create and load an AV. The first method creates an empty AV: AV* newAV(); The second method both creates the AV and initially populates it with SVs: AV* av_make(I32 num, SV **ptr); The second argument points to an array containing C C's. Once the AV has been created, the SVs can be destroyed, if so desired. Once the AV has been created, the following operations are possible on AVs: void av_push(AV*, SV*); SV* av_pop(AV*); SV* av_shift(AV*); void av_unshift(AV*, I32 num); These should be familiar operations, with the exception of C. This routine adds C elements at the front of the array with the C value. You must then use C (described below) to assign values to these new elements. Here are some other functions: I32 av_len(AV*); SV** av_fetch(AV*, I32 key, I32 lval); SV** av_store(AV*, I32 key, SV* val); The C function returns the highest index value in array (just like $#array in Perl). If the array is empty, -1 is returned. The C function returns the value at index C, but if C is non-zero, then C will store an undef value at that index. The C function stores the value C at index C, and does not increment the reference count of C. Thus the caller is responsible for taking care of that, and if C returns NULL, the caller will have to decrement the reference count to avoid a memory leak. Note that C and C both return C's, not C's as their return value. void av_clear(AV*); void av_undef(AV*); void av_extend(AV*, I32 key); The C function deletes all the elements in the AV* array, but does not actually delete the array itself. The C function will delete all the elements in the array plus the array itself. The C function extends the array so that it contains at least C elements. If C is less than the currently allocated length of the array, then nothing is done. If you know the name of an array variable, you can get a pointer to its AV by using the following: AV* get_av("package::varname", FALSE); This returns NULL if the variable does not exist. See L for more information on how to use the array access functions on tied arrays. =head2 Working with HVs To create an HV, you use the following routine: HV* newHV(); Once the HV has been created, the following operations are possible on HVs: SV** hv_store(HV*, const char* key, U32 klen, SV* val, U32 hash); SV** hv_fetch(HV*, const char* key, U32 klen, I32 lval); The C parameter is the length of the key being passed in (Note that you cannot pass 0 in as a value of C to tell Perl to measure the length of the key). The C argument contains the SV pointer to the scalar being stored, and C is the precomputed hash value (zero if you want C to calculate it for you). The C parameter indicates whether this fetch is actually a part of a store operation, in which case a new undefined value will be added to the HV with the supplied key and C will return as if the value had already existed. Remember that C and C return C's and not just C. To access the scalar value, you must first dereference the return value. However, you should check to make sure that the return value is not NULL before dereferencing it. These two functions check if a hash table entry exists, and deletes it. bool hv_exists(HV*, const char* key, U32 klen); SV* hv_delete(HV*, const char* key, U32 klen, I32 flags); If C does not include the C flag then C will create and return a mortal copy of the deleted value. And more miscellaneous functions: void hv_clear(HV*); void hv_undef(HV*); Like their AV counterparts, C deletes all the entries in the hash table but does not actually delete the hash table. The C deletes both the entries and the hash table itself. Perl keeps the actual data in linked list of structures with a typedef of HE. These contain the actual key and value pointers (plus extra administrative overhead). The key is a string pointer; the value is an C. However, once you have an C, to get the actual key and value, use the routines specified below. I32 hv_iterinit(HV*); /* Prepares starting point to traverse hash table */ HE* hv_iternext(HV*); /* Get the next entry, and return a pointer to a structure that has both the key and value */ char* hv_iterkey(HE* entry, I32* retlen); /* Get the key from an HE structure and also return the length of the key string */ SV* hv_iterval(HV*, HE* entry); /* Return an SV pointer to the value of the HE structure */ SV* hv_iternextsv(HV*, char** key, I32* retlen); /* This convenience routine combines hv_iternext, hv_iterkey, and hv_iterval. The key and retlen arguments are return values for the key and its length. The value is returned in the SV* argument */ If you know the name of a hash variable, you can get a pointer to its HV by using the following: HV* get_hv("package::varname", FALSE); This returns NULL if the variable does not exist. The hash algorithm is defined in the C macro: hash = 0; while (klen--) hash = (hash * 33) + *key++; hash = hash + (hash >> 5); /* after 5.6 */ The last step was added in version 5.6 to improve distribution of lower bits in the resulting hash value. See L for more information on how to use the hash access functions on tied hashes. =head2 Hash API Extensions Beginning with version 5.004, the following functions are also supported: HE* hv_fetch_ent (HV* tb, SV* key, I32 lval, U32 hash); HE* hv_store_ent (HV* tb, SV* key, SV* val, U32 hash); bool hv_exists_ent (HV* tb, SV* key, U32 hash); SV* hv_delete_ent (HV* tb, SV* key, I32 flags, U32 hash); SV* hv_iterkeysv (HE* entry); Note that these functions take C keys, which simplifies writing of extension code that deals with hash structures. These functions also allow passing of C keys to C functions without forcing you to stringify the keys (unlike the previous set of functions). They also return and accept whole hash entries (C), making their use more efficient (since the hash number for a particular string doesn't have to be recomputed every time). See L for detailed descriptions. The following macros must always be used to access the contents of hash entries. Note that the arguments to these macros must be simple variables, since they may get evaluated more than once. See L for detailed descriptions of these macros. HePV(HE* he, STRLEN len) HeVAL(HE* he) HeHASH(HE* he) HeSVKEY(HE* he) HeSVKEY_force(HE* he) HeSVKEY_set(HE* he, SV* sv) These two lower level macros are defined, but must only be used when dealing with keys that are not Cs: HeKEY(HE* he) HeKLEN(HE* he) Note that both C and C do not increment the reference count of the stored C, which is the caller's responsibility. If these functions return a NULL value, the caller will usually have to decrement the reference count of C to avoid a memory leak. =head2 AVs, HVs and undefined values Sometimes you have to store undefined values in AVs or HVs. Although this may be a rare case, it can be tricky. That's because you're used to using C<&PL_sv_undef> if you need an undefined SV. For example, intuition tells you that this XS code: AV *av = newAV(); av_store( av, 0, &PL_sv_undef ); is equivalent to this Perl code: my @av; $av[0] = undef; Unfortunately, this isn't true. AVs use C<&PL_sv_undef> as a marker for indicating that an array element has not yet been initialized. Thus, C would be true for the above Perl code, but false for the array generated by the XS code. Other problems can occur when storing C<&PL_sv_undef> in HVs: hv_store( hv, "key", 3, &PL_sv_undef, 0 ); This will indeed make the value C, but if you try to modify the value of C, you'll get the following error: Modification of non-creatable hash value attempted In perl 5.8.0, C<&PL_sv_undef> was also used to mark placeholders in restricted hashes. This caused such hash entries not to appear when iterating over the hash or when checking for the keys with the C function. You can run into similar problems when you store C<&PL_sv_true> or C<&PL_sv_false> into AVs or HVs. Trying to modify such elements will give you the following error: Modification of a read-only value attempted To make a long story short, you can use the special variables C<&PL_sv_undef>, C<&PL_sv_true> and C<&PL_sv_false> with AVs and HVs, but you have to make sure you know what you're doing. Generally, if you want to store an undefined value in an AV or HV, you should not use C<&PL_sv_undef>, but rather create a new undefined value using the C function, for example: av_store( av, 42, newSV(0) ); hv_store( hv, "foo", 3, newSV(0), 0 ); =head2 References References are a special type of scalar that point to other data types (including references). To create a reference, use either of the following functions: SV* newRV_inc((SV*) thing); SV* newRV_noinc((SV*) thing); The C argument can be any of an C, C, or C. The functions are identical except that C increments the reference count of the C, while C does not. For historical reasons, C is a synonym for C. Once you have a reference, you can use the following macro to dereference the reference: SvRV(SV*) then call the appropriate routines, casting the returned C to either an C or C, if required. To determine if an SV is a reference, you can use the following macro: SvROK(SV*) To discover what type of value the reference refers to, use the following macro and then check the return value. SvTYPE(SvRV(SV*)) The most useful types that will be returned are: SVt_IV Scalar SVt_NV Scalar SVt_PV Scalar SVt_RV Scalar SVt_PVAV Array SVt_PVHV Hash SVt_PVCV Code SVt_PVGV Glob (possible a file handle) SVt_PVMG Blessed or Magical Scalar See the sv.h header file for more details. =head2 Blessed References and Class Objects References are also used to support object-oriented programming. In perl's OO lexicon, an object is simply a reference that has been blessed into a package (or class). Once blessed, the programmer may now use the reference to access the various methods in the class. A reference can be blessed into a package with the following function: SV* sv_bless(SV* sv, HV* stash); The C argument must be a reference value. The C argument specifies which class the reference will belong to. See L for information on converting class names into stashes. /* Still under construction */ Upgrades rv to reference if not already one. Creates new SV for rv to point to. If C is non-null, the SV is blessed into the specified class. SV is returned. SV* newSVrv(SV* rv, const char* classname); Copies integer, unsigned integer or double into an SV whose reference is C. SV is blessed if C is non-null. SV* sv_setref_iv(SV* rv, const char* classname, IV iv); SV* sv_setref_uv(SV* rv, const char* classname, UV uv); SV* sv_setref_nv(SV* rv, const char* classname, NV iv); Copies the pointer value (I) into an SV whose reference is rv. SV is blessed if C is non-null. SV* sv_setref_pv(SV* rv, const char* classname, PV iv); Copies string into an SV whose reference is C. Set length to 0 to let Perl calculate the string length. SV is blessed if C is non-null. SV* sv_setref_pvn(SV* rv, const char* classname, PV iv, STRLEN length); Tests whether the SV is blessed into the specified class. It does not check inheritance relationships. int sv_isa(SV* sv, const char* name); Tests whether the SV is a reference to a blessed object. int sv_isobject(SV* sv); Tests whether the SV is derived from the specified class. SV can be either a reference to a blessed object or a string containing a class name. This is the function implementing the C functionality. bool sv_derived_from(SV* sv, const char* name); To check if you've got an object derived from a specific class you have to write: if (sv_isobject(sv) && sv_derived_from(sv, class)) { ... } =head2 Creating New Variables To create a new Perl variable with an undef value which can be accessed from your Perl script, use the following routines, depending on the variable type. SV* get_sv("package::varname", TRUE); AV* get_av("package::varname", TRUE); HV* get_hv("package::varname", TRUE); Notice the use of TRUE as the second parameter. The new variable can now be set, using the routines appropriate to the data type. There are additional macros whose values may be bitwise OR'ed with the C argument to enable certain extra features. Those bits are: =over =item GV_ADDMULTI Marks the variable as multiply defined, thus preventing the: Name used only once: possible typo warning. =item GV_ADDWARN Issues the warning: Had to create unexpectedly if the variable did not exist before the function was called. =back If you do not specify a package name, the variable is created in the current package. =head2 Reference Counts and Mortality Perl uses a reference count-driven garbage collection mechanism. SVs, AVs, or HVs (xV for short in the following) start their life with a reference count of 1. If the reference count of an xV ever drops to 0, then it will be destroyed and its memory made available for reuse. This normally doesn't happen at the Perl level unless a variable is undef'ed or the last variable holding a reference to it is changed or overwritten. At the internal level, however, reference counts can be manipulated with the following macros: int SvREFCNT(SV* sv); SV* SvREFCNT_inc(SV* sv); void SvREFCNT_dec(SV* sv); However, there is one other function which manipulates the reference count of its argument. The C function, you will recall, creates a reference to the specified argument. As a side effect, it increments the argument's reference count. If this is not what you want, use C instead. For example, imagine you want to return a reference from an XSUB function. Inside the XSUB routine, you create an SV which initially has a reference count of one. Then you call C, passing it the just-created SV. This returns the reference as a new SV, but the reference count of the SV you passed to C has been incremented to two. Now you return the reference from the XSUB routine and forget about the SV. But Perl hasn't! Whenever the returned reference is destroyed, the reference count of the original SV is decreased to one and nothing happens. The SV will hang around without any way to access it until Perl itself terminates. This is a memory leak. The correct procedure, then, is to use C instead of C. Then, if and when the last reference is destroyed, the reference count of the SV will go to zero and it will be destroyed, stopping any memory leak. There are some convenience functions available that can help with the destruction of xVs. These functions introduce the concept of "mortality". An xV that is mortal has had its reference count marked to be decremented, but not actually decremented, until "a short time later". Generally the term "short time later" means a single Perl statement, such as a call to an XSUB function. The actual determinant for when mortal xVs have their reference count decremented depends on two macros, SAVETMPS and FREETMPS. See L and L for more details on these macros. "Mortalization" then is at its simplest a deferred C. However, if you mortalize a variable twice, the reference count will later be decremented twice. "Mortal" SVs are mainly used for SVs that are placed on perl's stack. For example an SV which is created just to pass a number to a called sub is made mortal to have it cleaned up automatically when it's popped off the stack. Similarly, results returned by XSUBs (which are pushed on the stack) are often made mortal. To create a mortal variable, use the functions: SV* sv_newmortal() SV* sv_2mortal(SV*) SV* sv_mortalcopy(SV*) The first call creates a mortal SV (with no value), the second converts an existing SV to a mortal SV (and thus defers a call to C), and the third creates a mortal copy of an existing SV. Because C gives the new SV no value,it must normally be given one via C, C, etc. : SV *tmp = sv_newmortal(); sv_setiv(tmp, an_integer); As that is multiple C statements it is quite common so see this idiom instead: SV *tmp = sv_2mortal(newSViv(an_integer)); You should be careful about creating mortal variables. Strange things can happen if you make the same value mortal within multiple contexts, or if you make a variable mortal multiple times. Thinking of "Mortalization" as deferred C should help to minimize such problems. For example if you are passing an SV which you I has high enough REFCNT to survive its use on the stack you need not do any mortalization. If you are not sure then doing an C and C, or making a C is safer. The mortal routines are not just for SVs -- AVs and HVs can be made mortal by passing their address (type-casted to C) to the C or C routines. =head2 Stashes and Globs A B is a hash that contains all variables that are defined within a package. Each key of the stash is a symbol name (shared by all the different types of objects that have the same name), and each value in the hash table is a GV (Glob Value). This GV in turn contains references to the various objects of that name, including (but not limited to) the following: Scalar Value Array Value Hash Value I/O Handle Format Subroutine There is a single stash called C that holds the items that exist in the C
package. To get at the items in other packages, append the string "::" to the package name. The items in the C package are in the stash C in PL_defstash. The items in the C package are in the stash C in C's stash. To get the stash pointer for a particular package, use the function: HV* gv_stashpv(const char* name, I32 flags) HV* gv_stashsv(SV*, I32 flags) The first function takes a literal string, the second uses the string stored in the SV. Remember that a stash is just a hash table, so you get back an C. The C flag will create a new package if it is set to GV_ADD. The name that C wants is the name of the package whose symbol table you want. The default package is called C
. If you have multiply nested packages, pass their names to C, separated by C<::> as in the Perl language itself. Alternately, if you have an SV that is a blessed reference, you can find out the stash pointer by using: HV* SvSTASH(SvRV(SV*)); then use the following to get the package name itself: char* HvNAME(HV* stash); If you need to bless or re-bless an object you can use the following function: SV* sv_bless(SV*, HV* stash) where the first argument, an C, must be a reference, and the second argument is a stash. The returned C can now be used in the same way as any other SV. For more information on references and blessings, consult L. =head2 Double-Typed SVs Scalar variables normally contain only one type of value, an integer, double, pointer, or reference. Perl will automatically convert the actual scalar data from the stored type into the requested type. Some scalar variables contain more than one type of scalar data. For example, the variable C<$!> contains either the numeric value of C or its string equivalent from either C or C. To force multiple data values into an SV, you must do two things: use the C routines to add the additional scalar type, then set a flag so that Perl will believe it contains more than one type of data. The four macros to set the flags are: SvIOK_on SvNOK_on SvPOK_on SvROK_on The particular macro you must use depends on which C routine you called first. This is because every C routine turns on only the bit for the particular type of data being set, and turns off all the rest. For example, to create a new Perl variable called "dberror" that contains both the numeric and descriptive string error values, you could use the following code: extern int dberror; extern char *dberror_list; SV* sv = get_sv("dberror", TRUE); sv_setiv(sv, (IV) dberror); sv_setpv(sv, dberror_list[dberror]); SvIOK_on(sv); If the order of C and C had been reversed, then the macro C would need to be called instead of C. =head2 Magic Variables [This section still under construction. Ignore everything here. Post no bills. Everything not permitted is forbidden.] Any SV may be magical, that is, it has special features that a normal SV does not have. These features are stored in the SV structure in a linked list of C's, typedef'ed to C. struct magic { MAGIC* mg_moremagic; MGVTBL* mg_virtual; U16 mg_private; char mg_type; U8 mg_flags; I32 mg_len; SV* mg_obj; char* mg_ptr; }; Note this is current as of patchlevel 0, and could change at any time. =head2 Assigning Magic Perl adds magic to an SV using the sv_magic function: void sv_magic(SV* sv, SV* obj, int how, const char* name, I32 namlen); The C argument is a pointer to the SV that is to acquire a new magical feature. If C is not already magical, Perl uses the C macro to convert C to type C. Perl then continues by adding new magic to the beginning of the linked list of magical features. Any prior entry of the same type of magic is deleted. Note that this can be overridden, and multiple instances of the same type of magic can be associated with an SV. The C and C arguments are used to associate a string with the magic, typically the name of a variable. C is stored in the C field and if C is non-null then either a C copy of C or C itself is stored in the C field, depending on whether C is greater than zero or equal to zero respectively. As a special case, if C<(name && namlen == HEf_SVKEY)> then C is assumed to contain an C and is stored as-is with its REFCNT incremented. The sv_magic function uses C to determine which, if any, predefined "Magic Virtual Table" should be assigned to the C field. See the L section below. The C argument is also stored in the C field. The value of C should be chosen from the set of macros C found in F. Note that before these macros were added, Perl internals used to directly use character literals, so you may occasionally come across old code or documentation referring to 'U' magic rather than C for example. The C argument is stored in the C field of the C structure. If it is not the same as the C argument, the reference count of the C object is incremented. If it is the same, or if the C argument is C, or if it is a NULL pointer, then C is merely stored, without the reference count being incremented. See also C in L for a more flexible way to add magic to an SV. There is also a function to add magic to an C: void hv_magic(HV *hv, GV *gv, int how); This simply calls C and coerces the C argument into an C. To remove the magic from an SV, call the function sv_unmagic: void sv_unmagic(SV *sv, int type); The C argument should be equal to the C value when the C was initially made magical. =head2 Magic Virtual Tables The C field in the C structure is a pointer to an C, which is a structure of function pointers and stands for "Magic Virtual Table" to handle the various operations that might be applied to that variable. The C has five (or sometimes eight) pointers to the following routine types: int (*svt_get)(SV* sv, MAGIC* mg); int (*svt_set)(SV* sv, MAGIC* mg); U32 (*svt_len)(SV* sv, MAGIC* mg); int (*svt_clear)(SV* sv, MAGIC* mg); int (*svt_free)(SV* sv, MAGIC* mg); int (*svt_copy)(SV *sv, MAGIC* mg, SV *nsv, const char *name, int namlen); int (*svt_dup)(MAGIC *mg, CLONE_PARAMS *param); int (*svt_local)(SV *nsv, MAGIC *mg); This MGVTBL structure is set at compile-time in F and there are currently 19 types (or 21 with overloading turned on). These different structures contain pointers to various routines that perform additional actions depending on which function is being called. Function pointer Action taken ---------------- ------------ svt_get Do something before the value of the SV is retrieved. svt_set Do something after the SV is assigned a value. svt_len Report on the SV's length. svt_clear Clear something the SV represents. svt_free Free any extra storage associated with the SV. svt_copy copy tied variable magic to a tied element svt_dup duplicate a magic structure during thread cloning svt_local copy magic to local value during 'local' For instance, the MGVTBL structure called C (which corresponds to an C of C) contains: { magic_get, magic_set, magic_len, 0, 0 } Thus, when an SV is determined to be magical and of type C, if a get operation is being performed, the routine C is called. All the various routines for the various magical types begin with C. NOTE: the magic routines are not considered part of the Perl API, and may not be exported by the Perl library. The last three slots are a recent addition, and for source code compatibility they are only checked for if one of the three flags MGf_COPY, MGf_DUP or MGf_LOCAL is set in mg_flags. This means that most code can continue declaring a vtable as a 5-element value. These three are currently used exclusively by the threading code, and are highly subject to change. The current kinds of Magic Virtual Tables are: mg_type (old-style char and macro) MGVTBL Type of magic -------------------------- ------ ---------------------------- \0 PERL_MAGIC_sv vtbl_sv Special scalar variable A PERL_MAGIC_overload vtbl_amagic %OVERLOAD hash a PERL_MAGIC_overload_elem vtbl_amagicelem %OVERLOAD hash element c PERL_MAGIC_overload_table (none) Holds overload table (AMT) on stash B PERL_MAGIC_bm vtbl_bm Boyer-Moore (fast string search) D PERL_MAGIC_regdata vtbl_regdata Regex match position data (@+ and @- vars) d PERL_MAGIC_regdatum vtbl_regdatum Regex match position data element E PERL_MAGIC_env vtbl_env %ENV hash e PERL_MAGIC_envelem vtbl_envelem %ENV hash element f PERL_MAGIC_fm vtbl_fm Formline ('compiled' format) g PERL_MAGIC_regex_global vtbl_mglob m//g target / study()ed string H PERL_MAGIC_hints vtbl_sig %^H hash h PERL_MAGIC_hintselem vtbl_hintselem %^H hash element I PERL_MAGIC_isa vtbl_isa @ISA array i PERL_MAGIC_isaelem vtbl_isaelem @ISA array element k PERL_MAGIC_nkeys vtbl_nkeys scalar(keys()) lvalue L PERL_MAGIC_dbfile (none) Debugger %_ and C magic types are defined specifically for use by extensions and will not be used by perl itself. Extensions can use C magic to 'attach' private information to variables (typically objects). This is especially useful because there is no way for normal perl code to corrupt this private information (unlike using extra elements of a hash object). Similarly, C magic can be used much like tie() to call a C function any time a scalar's value is used or changed. The C's C field points to a C structure: struct ufuncs { I32 (*uf_val)(pTHX_ IV, SV*); I32 (*uf_set)(pTHX_ IV, SV*); IV uf_index; }; When the SV is read from or written to, the C or C function will be called with C as the first arg and a pointer to the SV as the second. A simple example of how to add C magic is shown below. Note that the ufuncs structure is copied by sv_magic, so you can safely allocate it on the stack. void Umagic(sv) SV *sv; PREINIT: struct ufuncs uf; CODE: uf.uf_val = &my_get_fn; uf.uf_set = &my_set_fn; uf.uf_index = 0; sv_magic(sv, 0, PERL_MAGIC_uvar, (char*)&uf, sizeof(uf)); Attaching C to arrays is permissible but has no effect. For hashes there is a specialized hook that gives control over hash keys (but not values). This hook calls C 'get' magic if the "set" function in the C structure is NULL. The hook is activated whenever the hash is accessed with a key specified as an C through the functions C, C, C, and C. Accessing the key as a string through the functions without the C<..._ent> suffix circumvents the hook. See L for a detailed description. Note that because multiple extensions may be using C or C magic, it is important for extensions to take extra care to avoid conflict. Typically only using the magic on objects blessed into the same class as the extension is sufficient. For C magic, it may also be appropriate to add an I32 'signature' at the top of the private data area and check that. Also note that the C and C functions described earlier do B invoke 'set' magic on their targets. This must be done by the user either by calling the C macro after calling these functions, or by using one of the C or C functions. Similarly, generic C code must call the C macro to invoke any 'get' magic if they use an SV obtained from external sources in functions that don't handle magic. See L for a description of these functions. For example, calls to the C functions typically need to be followed by C, but they don't need a prior C since their implementation handles 'get' magic. =head2 Finding Magic MAGIC* mg_find(SV*, int type); /* Finds the magic pointer of that type */ This routine returns a pointer to the C structure stored in the SV. If the SV does not have that magical feature, C is returned. Also, if the SV is not of type SVt_PVMG, Perl may core dump. int mg_copy(SV* sv, SV* nsv, const char* key, STRLEN klen); This routine checks to see what types of magic C has. If the mg_type field is an uppercase letter, then the mg_obj is copied to C, but the mg_type field is changed to be the lowercase letter. =head2 Understanding the Magic of Tied Hashes and Arrays Tied hashes and arrays are magical beasts of the C magic type. WARNING: As of the 5.004 release, proper usage of the array and hash access functions requires understanding a few caveats. Some of these caveats are actually considered bugs in the API, to be fixed in later releases, and are bracketed with [MAYCHANGE] below. If you find yourself actually applying such information in this section, be aware that the behavior may change in the future, umm, without warning. The perl tie function associates a variable with an object that implements the various GET, SET, etc methods. To perform the equivalent of the perl tie function from an XSUB, you must mimic this behaviour. The code below carries out the necessary steps - firstly it creates a new hash, and then creates a second hash which it blesses into the class which will implement the tie methods. Lastly it ties the two hashes together, and returns a reference to the new tied hash. Note that the code below does NOT call the TIEHASH method in the MyTie class - see L for details on how to do this. SV* mytie() PREINIT: HV *hash; HV *stash; SV *tie; CODE: hash = newHV(); tie = newRV_noinc((SV*)newHV()); stash = gv_stashpv("MyTie", GV_ADD); sv_bless(tie, stash); hv_magic(hash, (GV*)tie, PERL_MAGIC_tied); RETVAL = newRV_noinc(hash); OUTPUT: RETVAL The C function, when given a tied array argument, merely copies the magic of the array onto the value to be "stored", using C. It may also return NULL, indicating that the value did not actually need to be stored in the array. [MAYCHANGE] After a call to C on a tied array, the caller will usually need to call C to actually invoke the perl level "STORE" method on the TIEARRAY object. If C did return NULL, a call to C will also be usually necessary to avoid a memory leak. [/MAYCHANGE] The previous paragraph is applicable verbatim to tied hash access using the C and C functions as well. C and the corresponding hash functions C and C actually return an undefined mortal value whose magic has been initialized using C. Note the value so returned does not need to be deallocated, as it is already mortal. [MAYCHANGE] But you will need to call C on the returned value in order to actually invoke the perl level "FETCH" method on the underlying TIE object. Similarly, you may also call C on the return value after possibly assigning a suitable value to it using C, which will invoke the "STORE" method on the TIE object. [/MAYCHANGE] [MAYCHANGE] In other words, the array or hash fetch/store functions don't really fetch and store actual values in the case of tied arrays and hashes. They merely call C to attach magic to the values that were meant to be "stored" or "fetched". Later calls to C and C actually do the job of invoking the TIE methods on the underlying objects. Thus the magic mechanism currently implements a kind of lazy access to arrays and hashes. Currently (as of perl version 5.004), use of the hash and array access functions requires the user to be aware of whether they are operating on "normal" hashes and arrays, or on their tied variants. The API may be changed to provide more transparent access to both tied and normal data types in future versions. [/MAYCHANGE] You would do well to understand that the TIEARRAY and TIEHASH interfaces are mere sugar to invoke some perl method calls while using the uniform hash and array syntax. The use of this sugar imposes some overhead (typically about two to four extra opcodes per FETCH/STORE operation, in addition to the creation of all the mortal variables required to invoke the methods). This overhead will be comparatively small if the TIE methods are themselves substantial, but if they are only a few statements long, the overhead will not be insignificant. =head2 Localizing changes Perl has a very handy construction { local $var = 2; ... } This construction is I equivalent to { my $oldvar = $var; $var = 2; ... $var = $oldvar; } The biggest difference is that the first construction would reinstate the initial value of $var, irrespective of how control exits the block: C, C, C/C, etc. It is a little bit more efficient as well. There is a way to achieve a similar task from C via Perl API: create a I, and arrange for some changes to be automatically undone at the end of it, either explicit, or via a non-local exit (via die()). A I-like construct is created by a pair of C/C macros (see L). Such a construct may be created specially for some important localized task, or an existing one (like boundaries of enclosing Perl subroutine/block, or an existing pair for freeing TMPs) may be used. (In the second case the overhead of additional localization must be almost negligible.) Note that any XSUB is automatically enclosed in an C/C pair. Inside such a I the following service is available: =over 4 =item C =item C =item C =item C These macros arrange things to restore the value of integer variable C at the end of enclosing I. =item C =item C These macros arrange things to restore the value of pointers C and C
. C must be a pointer of a type which survives conversion to C and back, C
should be able to survive conversion to C and back. =item C The refcount of C would be decremented at the end of I. This is similar to C in that it is also a mechanism for doing a delayed C. However, while C extends the lifetime of C until the beginning of the next statement, C extends it until the end of the enclosing scope. These lifetimes can be wildly different. Also compare C. =item C Just like C, but mortalizes C at the end of the current scope instead of decrementing its reference count. This usually has the effect of keeping C alive until the statement that called the currently live scope has finished executing. =item C The C is op_free()ed at the end of I. =item C The chunk of memory which is pointed to by C
is Safefree()ed at the end of I. =item C Clears a slot in the current scratchpad which corresponds to C at the end of I. =item C The key C of C is deleted at the end of I. The string pointed to by C is Safefree()ed. If one has a I in short-lived storage, the corresponding string may be reallocated like this: SAVEDELETE(PL_defstash, savepv(tmpbuf), strlen(tmpbuf)); =item C At the end of I the function C is called with the only argument C
. =item C At the end of I the function C is called with the implicit context argument (if any), and C
. =item C The current offset on the Perl internal stack (cf. C) is restored at the end of I. =back The following API list contains functions, thus one needs to provide pointers to the modifiable data explicitly (either C pointers, or Perlish Cs). Where the above macros take C, a similar function takes C. =over 4 =item C Equivalent to Perl code C. =item C =item C Similar to C, but localize C<@gv> and C<%gv>. =item C Duplicates the current value of C, on the exit from the current C/C I will restore the value of C using the stored value. It doesn't handle magic. Use C if magic is affected. =item C A variant of C which takes multiple arguments via an array C of C of length C. =item C Similar to C, but will reinstate an C. =item C =item C Similar to C, but localize C and C. =back The C module implements localization of the basic types within the I. People who are interested in how to localize things in the containing scope should take a look there too. =head1 Subroutines =head2 XSUBs and the Argument Stack The XSUB mechanism is a simple way for Perl programs to access C subroutines. An XSUB routine will have a stack that contains the arguments from the Perl program, and a way to map from the Perl data structures to a C equivalent. The stack arguments are accessible through the C macro, which returns the C'th stack argument. Argument 0 is the first argument passed in the Perl subroutine call. These arguments are C, and can be used anywhere an C is used. Most of the time, output from the C routine can be handled through use of the RETVAL and OUTPUT directives. However, there are some cases where the argument stack is not already long enough to handle all the return values. An example is the POSIX tzname() call, which takes no arguments, but returns two, the local time zone's standard and summer time abbreviations. To handle this situation, the PPCODE directive is used and the stack is extended using the macro: EXTEND(SP, num); where C is the macro that represents the local copy of the stack pointer, and C is the number of elements the stack should be extended by. Now that there is room on the stack, values can be pushed on it using C macro. The pushed values will often need to be "mortal" (See L): PUSHs(sv_2mortal(newSViv(an_integer))) PUSHs(sv_2mortal(newSVuv(an_unsigned_integer))) PUSHs(sv_2mortal(newSVnv(a_double))) PUSHs(sv_2mortal(newSVpv("Some String",0))) And now the Perl program calling C, the two values will be assigned as in: ($standard_abbrev, $summer_abbrev) = POSIX::tzname; An alternate (and possibly simpler) method to pushing values on the stack is to use the macro: XPUSHs(SV*) This macro automatically adjust the stack for you, if needed. Thus, you do not need to call C to extend the stack. Despite their suggestions in earlier versions of this document the macros C<(X)PUSH[iunp]> are I suited to XSUBs which return multiple results. For that, either stick to the C<(X)PUSHs> macros shown above, or use the new C macros instead; see L. For more information, consult L and L. =head2 Calling Perl Routines from within C Programs There are four routines that can be used to call a Perl subroutine from within a C program. These four are: I32 call_sv(SV*, I32); I32 call_pv(const char*, I32); I32 call_method(const char*, I32); I32 call_argv(const char*, I32, register char**); The routine most often used is C. The C argument contains either the name of the Perl subroutine to be called, or a reference to the subroutine. The second argument consists of flags that control the context in which the subroutine is called, whether or not the subroutine is being passed arguments, how errors should be trapped, and how to treat return values. All four routines return the number of arguments that the subroutine returned on the Perl stack. These routines used to be called C, etc., before Perl v5.6.0, but those names are now deprecated; macros of the same name are provided for compatibility. When using any of these routines (except C), the programmer must manipulate the Perl stack. These include the following macros and functions: dSP SP PUSHMARK() PUTBACK SPAGAIN ENTER SAVETMPS FREETMPS LEAVE XPUSH*() POP*() For a detailed description of calling conventions from C to Perl, consult L. =head2 Memory Allocation =head3 Allocation All memory meant to be used with the Perl API functions should be manipulated using the macros described in this section. The macros provide the necessary transparency between differences in the actual malloc implementation that is used within perl. It is suggested that you enable the version of malloc that is distributed with Perl. It keeps pools of various sizes of unallocated memory in order to satisfy allocation requests more quickly. However, on some platforms, it may cause spurious malloc or free errors. The following three macros are used to initially allocate memory : Newx(pointer, number, type); Newxc(pointer, number, type, cast); Newxz(pointer, number, type); The first argument C should be the name of a variable that will point to the newly allocated memory. The second and third arguments C and C specify how many of the specified type of data structure should be allocated. The argument C is passed to C. The final argument to C, C, should be used if the C argument is different from the C argument. Unlike the C and C macros, the C macro calls C to zero out all the newly allocated memory. =head3 Reallocation Renew(pointer, number, type); Renewc(pointer, number, type, cast); Safefree(pointer) These three macros are used to change a memory buffer size or to free a piece of memory no longer needed. The arguments to C and C match those of C and C with the exception of not needing the "magic cookie" argument. =head3 Moving Move(source, dest, number, type); Copy(source, dest, number, type); Zero(dest, number, type); These three macros are used to move, copy, or zero out previously allocated memory. The C and C arguments point to the source and destination starting points. Perl will move, copy, or zero out C instances of the size of the C data structure (using the C function). =head2 PerlIO The most recent development releases of Perl has been experimenting with removing Perl's dependency on the "normal" standard I/O suite and allowing other stdio implementations to be used. This involves creating a new abstraction layer that then calls whichever implementation of stdio Perl was compiled with. All XSUBs should now use the functions in the PerlIO abstraction layer and not make any assumptions about what kind of stdio is being used. For a complete description of the PerlIO abstraction, consult L. =head2 Putting a C value on Perl stack A lot of opcodes (this is an elementary operation in the internal perl stack machine) put an SV* on the stack. However, as an optimization the corresponding SV is (usually) not recreated each time. The opcodes reuse specially assigned SVs (Is) which are (as a corollary) not constantly freed/created. Each of the targets is created only once (but see L below), and when an opcode needs to put an integer, a double, or a string on stack, it just sets the corresponding parts of its I and puts the I on stack. The macro to put this target on stack is C, and it is directly used in some opcodes, as well as indirectly in zillions of others, which use it via C<(X)PUSH[iunp]>. Because the target is reused, you must be careful when pushing multiple values on the stack. The following code will not do what you think: XPUSHi(10); XPUSHi(20); This translates as "set C to 10, push a pointer to C onto the stack; set C to 20, push a pointer to C onto the stack". At the end of the operation, the stack does not contain the values 10 and 20, but actually contains two pointers to C, which we have set to 20. If you need to push multiple different values then you should either use the C<(X)PUSHs> macros, or else use the new C macros, none of which make use of C. The C<(X)PUSHs> macros simply push an SV* on the stack, which, as noted under L, will often need to be "mortal". The new C macros make this a little easier to achieve by creating a new mortal for you (via C<(X)PUSHmortal>), pushing that onto the stack (extending it if necessary in the case of the C macros), and then setting its value. Thus, instead of writing this to "fix" the example above: XPUSHs(sv_2mortal(newSViv(10))) XPUSHs(sv_2mortal(newSViv(20))) you can simply write: mXPUSHi(10) mXPUSHi(20) On a related note, if you do use C<(X)PUSH[iunp]>, then you're going to need a C in your variable declarations so that the C<*PUSH*> macros can make use of the local variable C. See also C and C. =head2 Scratchpads The question remains on when the SVs which are Is for opcodes are created. The answer is that they are created when the current unit -- a subroutine or a file (for opcodes for statements outside of subroutines) -- is compiled. During this time a special anonymous Perl array is created, which is called a scratchpad for the current unit. A scratchpad keeps SVs which are lexicals for the current unit and are targets for opcodes. One can deduce that an SV lives on a scratchpad by looking on its flags: lexicals have C set, and Is have C set. The correspondence between OPs and Is is not 1-to-1. Different OPs in the compile tree of the unit can use the same target, if this would not conflict with the expected life of the temporary. =head2 Scratchpads and recursion In fact it is not 100% true that a compiled unit contains a pointer to the scratchpad AV. In fact it contains a pointer to an AV of (initially) one element, and this element is the scratchpad AV. Why do we need an extra level of indirection? The answer is B, and maybe B. Both these can create several execution pointers going into the same subroutine. For the subroutine-child not write over the temporaries for the subroutine-parent (lifespan of which covers the call to the child), the parent and the child should have different scratchpads. (I the lexicals should be separate anyway!) So each subroutine is born with an array of scratchpads (of length 1). On each entry to the subroutine it is checked that the current depth of the recursion is not more than the length of this array, and if it is, new scratchpad is created and pushed into the array. The Is on this scratchpad are Cs, but they are already marked with correct flags. =head1 Compiled code =head2 Code tree Here we describe the internal form your code is converted to by Perl. Start with a simple example: $a = $b + $c; This is converted to a tree similar to this one: assign-to / \ + $a / \ $b $c (but slightly more complicated). This tree reflects the way Perl parsed your code, but has nothing to do with the execution order. There is an additional "thread" going through the nodes of the tree which shows the order of execution of the nodes. In our simplified example above it looks like: $b ---> $c ---> + ---> $a ---> assign-to But with the actual compile tree for C<$a = $b + $c> it is different: some nodes I. As a corollary, though the actual tree contains more nodes than our simplified example, the execution order is the same as in our example. =head2 Examining the tree If you have your perl compiled for debugging (usually done with C<-DDEBUGGING> on the C command line), you may examine the compiled tree by specifying C<-Dx> on the Perl command line. The output takes several lines per node, and for C<$b+$c> it looks like this: 5 TYPE = add ===> 6 TARG = 1 FLAGS = (SCALAR,KIDS) { TYPE = null ===> (4) (was rv2sv) FLAGS = (SCALAR,KIDS) { 3 TYPE = gvsv ===> 4 FLAGS = (SCALAR) GV = main::b } } { TYPE = null ===> (5) (was rv2sv) FLAGS = (SCALAR,KIDS) { 4 TYPE = gvsv ===> 5 FLAGS = (SCALAR) GV = main::c } } This tree has 5 nodes (one per C specifier), only 3 of them are not optimized away (one per number in the left column). The immediate children of the given node correspond to C<{}> pairs on the same level of indentation, thus this listing corresponds to the tree: add / \ null null | | gvsv gvsv The execution order is indicated by C<===E> marks, thus it is C<3 4 5 6> (node C<6> is not included into above listing), i.e., C. Each of these nodes represents an op, a fundamental operation inside the Perl core. The code which implements each operation can be found in the F files; the function which implements the op with type C is C, and so on. As the tree above shows, different ops have different numbers of children: C is a binary operator, as one would expect, and so has two children. To accommodate the various different numbers of children, there are various types of op data structure, and they link together in different ways. The simplest type of op structure is C: this has no children. Unary operators, Cs, have one child, and this is pointed to by the C field. Binary operators (Cs) have not only an C field but also an C field. The most complex type of op is a C, which has any number of children. In this case, the first child is pointed to by C and the last child by C. The children in between can be found by iteratively following the C pointer from the first child to the last. There are also two other op types: a C holds a regular expression, and has no children, and a C may or may not have children. If the C field is non-zero, it behaves like a C. To complicate matters, if a C is actually a C op after optimization (see L) it will still have children in accordance with its former type. Another way to examine the tree is to use a compiler back-end module, such as L. =head2 Compile pass 1: check routines The tree is created by the compiler while I code feeds it the constructions it recognizes. Since I works bottom-up, so does the first pass of perl compilation. What makes this pass interesting for perl developers is that some optimization may be performed on this pass. This is optimization by so-called "check routines". The correspondence between node names and corresponding check routines is described in F (do not forget to run C if you modify this file). A check routine is called when the node is fully constructed except for the execution-order thread. Since at this time there are no back-links to the currently constructed node, one can do most any operation to the top-level node, including freeing it and/or creating new nodes above/below it. The check routine returns the node which should be inserted into the tree (if the top-level node was not modified, check routine returns its argument). By convention, check routines have names C. They are usually called from C subroutines (or C) (which in turn are called from F). =head2 Compile pass 1a: constant folding Immediately after the check routine is called the returned node is checked for being compile-time executable. If it is (the value is judged to be constant) it is immediately executed, and a I node with the "return value" of the corresponding subtree is substituted instead. The subtree is deleted. If constant folding was not performed, the execution-order thread is created. =head2 Compile pass 2: context propagation When a context for a part of compile tree is known, it is propagated down through the tree. At this time the context can have 5 values (instead of 2 for runtime context): void, boolean, scalar, list, and lvalue. In contrast with the pass 1 this pass is processed from top to bottom: a node's context determines the context for its children. Additional context-dependent optimizations are performed at this time. Since at this moment the compile tree contains back-references (via "thread" pointers), nodes cannot be free()d now. To allow optimized-away nodes at this stage, such nodes are null()ified instead of free()ing (i.e. their type is changed to OP_NULL). =head2 Compile pass 3: peephole optimization After the compile tree for a subroutine (or for an C or a file) is created, an additional pass over the code is performed. This pass is neither top-down or bottom-up, but in the execution order (with additional complications for conditionals). These optimizations are done in the subroutine peep(). Optimizations performed at this stage are subject to the same restrictions as in the pass 2. =head2 Pluggable runops The compile tree is executed in a runops function. There are two runops functions, in F and in F. C is used with DEBUGGING and C is used otherwise. For fine control over the execution of the compile tree it is possible to provide your own runops function. It's probably best to copy one of the existing runops functions and change it to suit your needs. Then, in the BOOT section of your XS file, add the line: PL_runops = my_runops; This function should be as efficient as possible to keep your programs running as fast as possible. =head1 Examining internal data structures with the C functions To aid debugging, the source file F contains a number of functions which produce formatted output of internal data structures. The most commonly used of these functions is C; it's used for dumping SVs, AVs, HVs, and CVs. The C module calls C to produce debugging output from Perl-space, so users of that module should already be familiar with its format. C can be used to dump an C structure or any of its derivatives, and produces output similar to C; in fact, C will dump the main root of the code being evaluated, exactly like C<-Dx>. Other useful functions are C, which turns a C into an op tree, C which calls C on all the subroutines in a package like so: (Thankfully, these are all xsubs, so there is no op tree) (gdb) print Perl_dump_packsubs(PL_defstash) SUB attributes::bootstrap = (xsub 0x811fedc 0) SUB UNIVERSAL::can = (xsub 0x811f50c 0) SUB UNIVERSAL::isa = (xsub 0x811f304 0) SUB UNIVERSAL::VERSION = (xsub 0x811f7ac 0) SUB DynaLoader::boot_DynaLoader = (xsub 0x805b188 0) and C, which dumps all the subroutines in the stash and the op tree of the main root. =head1 How multiple interpreters and concurrency are supported =head2 Background and PERL_IMPLICIT_CONTEXT The Perl interpreter can be regarded as a closed box: it has an API for feeding it code or otherwise making it do things, but it also has functions for its own use. This smells a lot like an object, and there are ways for you to build Perl so that you can have multiple interpreters, with one interpreter represented either as a C structure, or inside a thread-specific structure. These structures contain all the context, the state of that interpreter. One macro controls the major Perl build flavor: MULTIPLICITY. The MULTIPLICITY build has a C structure that packages all the interpreter state. With multiplicity-enabled perls, PERL_IMPLICIT_CONTEXT is also normally defined, and enables the support for passing in a "hidden" first argument that represents all three data structures. MULTIPLICITY makes mutli-threaded perls possible (with the ithreads threading model, related to the macro USE_ITHREADS.) Two other "encapsulation" macros are the PERL_GLOBAL_STRUCT and PERL_GLOBAL_STRUCT_PRIVATE (the latter turns on the former, and the former turns on MULTIPLICITY.) The PERL_GLOBAL_STRUCT causes all the internal variables of Perl to be wrapped inside a single global struct, struct perl_vars, accessible as (globals) &PL_Vars or PL_VarsPtr or the function Perl_GetVars(). The PERL_GLOBAL_STRUCT_PRIVATE goes one step further, there is still a single struct (allocated in main() either from heap or from stack) but there are no global data symbols pointing to it. In either case the global struct should be initialised as the very first thing in main() using Perl_init_global_struct() and correspondingly tear it down after perl_free() using Perl_free_global_struct(), please see F for usage details. You may also need to use C in your coding to "declare the global variables" when you are using them. dTHX does this for you automatically. To see whether you have non-const data you can use a BSD-compatible C: nm libperl.a | grep -v ' [TURtr] ' If this displays any C or C symbols, you have non-const data. For backward compatibility reasons defining just PERL_GLOBAL_STRUCT doesn't actually hide all symbols inside a big global struct: some PerlIO_xxx vtables are left visible. The PERL_GLOBAL_STRUCT_PRIVATE then hides everything (see how the PERLIO_FUNCS_DECL is used). All this obviously requires a way for the Perl internal functions to be either subroutines taking some kind of structure as the first argument, or subroutines taking nothing as the first argument. To enable these two very different ways of building the interpreter, the Perl source (as it does in so many other situations) makes heavy use of macros and subroutine naming conventions. First problem: deciding which functions will be public API functions and which will be private. All functions whose names begin C are private (think "S" for "secret" or "static"). All other functions begin with "Perl_", but just because a function begins with "Perl_" does not mean it is part of the API. (See L.) The easiest way to be B a function is part of the API is to find its entry in L. If it exists in L, it's part of the API. If it doesn't, and you think it should be (i.e., you need it for your extension), send mail via L explaining why you think it should be. Second problem: there must be a syntax so that the same subroutine declarations and calls can pass a structure as their first argument, or pass nothing. To solve this, the subroutines are named and declared in a particular way. Here's a typical start of a static function used within the Perl guts: STATIC void S_incline(pTHX_ char *s) STATIC becomes "static" in C, and may be #define'd to nothing in some configurations in future. A public function (i.e. part of the internal API, but not necessarily sanctioned for use in extensions) begins like this: void Perl_sv_setiv(pTHX_ SV* dsv, IV num) C is one of a number of macros (in perl.h) that hide the details of the interpreter's context. THX stands for "thread", "this", or "thingy", as the case may be. (And no, George Lucas is not involved. :-) The first character could be 'p' for a B
rototype, 'a' for Brgument, or 'd' for Beclaration, so we have C, C and C, and their variants. When Perl is built without options that set PERL_IMPLICIT_CONTEXT, there is no first argument containing the interpreter's context. The trailing underscore in the pTHX_ macro indicates that the macro expansion needs a comma after the context argument because other arguments follow it. If PERL_IMPLICIT_CONTEXT is not defined, pTHX_ will be ignored, and the subroutine is not prototyped to take the extra argument. The form of the macro without the trailing underscore is used when there are no additional explicit arguments. When a core function calls another, it must pass the context. This is normally hidden via macros. Consider C. It expands into something like this: #ifdef PERL_IMPLICIT_CONTEXT #define sv_setiv(a,b) Perl_sv_setiv(aTHX_ a, b) /* can't do this for vararg functions, see below */ #else #define sv_setiv Perl_sv_setiv #endif This works well, and means that XS authors can gleefully write: sv_setiv(foo, bar); and still have it work under all the modes Perl could have been compiled with. This doesn't work so cleanly for varargs functions, though, as macros imply that the number of arguments is known in advance. Instead we either need to spell them out fully, passing C as the first argument (the Perl core tends to do this with functions like Perl_warner), or use a context-free version. The context-free version of Perl_warner is called Perl_warner_nocontext, and does not take the extra argument. Instead it does dTHX; to get the context from thread-local storage. We C<#define warner Perl_warner_nocontext> so that extensions get source compatibility at the expense of performance. (Passing an arg is cheaper than grabbing it from thread-local storage.) You can ignore [pad]THXx when browsing the Perl headers/sources. Those are strictly for use within the core. Extensions and embedders need only be aware of [pad]THX. =head2 So what happened to dTHR? C was introduced in perl 5.005 to support the older thread model. The older thread model now uses the C mechanism to pass context pointers around, so C is not useful any more. Perl 5.6.0 and later still have it for backward source compatibility, but it is defined to be a no-op. =head2 How do I use all this in extensions? When Perl is built with PERL_IMPLICIT_CONTEXT, extensions that call any functions in the Perl API will need to pass the initial context argument somehow. The kicker is that you will need to write it in such a way that the extension still compiles when Perl hasn't been built with PERL_IMPLICIT_CONTEXT enabled. There are three ways to do this. First, the easy but inefficient way, which is also the default, in order to maintain source compatibility with extensions: whenever XSUB.h is #included, it redefines the aTHX and aTHX_ macros to call a function that will return the context. Thus, something like: sv_setiv(sv, num); in your extension will translate to this when PERL_IMPLICIT_CONTEXT is in effect: Perl_sv_setiv(Perl_get_context(), sv, num); or to this otherwise: Perl_sv_setiv(sv, num); You have to do nothing new in your extension to get this; since the Perl library provides Perl_get_context(), it will all just work. The second, more efficient way is to use the following template for your Foo.xs: #define PERL_NO_GET_CONTEXT /* we want efficiency */ #include "EXTERN.h" #include "perl.h" #include "XSUB.h" STATIC void my_private_function(int arg1, int arg2); STATIC void my_private_function(int arg1, int arg2) { dTHX; /* fetch context */ ... call many Perl API functions ... } [... etc ...] MODULE = Foo PACKAGE = Foo /* typical XSUB */ void my_xsub(arg) int arg CODE: my_private_function(arg, 10); Note that the only two changes from the normal way of writing an extension is the addition of a C<#define PERL_NO_GET_CONTEXT> before including the Perl headers, followed by a C declaration at the start of every function that will call the Perl API. (You'll know which functions need this, because the C compiler will complain that there's an undeclared identifier in those functions.) No changes are needed for the XSUBs themselves, because the XS() macro is correctly defined to pass in the implicit context if needed. The third, even more efficient way is to ape how it is done within the Perl guts: #define PERL_NO_GET_CONTEXT /* we want efficiency */ #include "EXTERN.h" #include "perl.h" #include "XSUB.h" /* pTHX_ only needed for functions that call Perl API */ STATIC void my_private_function(pTHX_ int arg1, int arg2); STATIC void my_private_function(pTHX_ int arg1, int arg2) { /* dTHX; not needed here, because THX is an argument */ ... call Perl API functions ... } [... etc ...] MODULE = Foo PACKAGE = Foo /* typical XSUB */ void my_xsub(arg) int arg CODE: my_private_function(aTHX_ arg, 10); This implementation never has to fetch the context using a function call, since it is always passed as an extra argument. Depending on your needs for simplicity or efficiency, you may mix the previous two approaches freely. Never add a comma after C yourself--always use the form of the macro with the underscore for functions that take explicit arguments, or the form without the argument for functions with no explicit arguments. If one is compiling Perl with the C<-DPERL_GLOBAL_STRUCT> the C definition is needed if the Perl global variables (see F or F) are accessed in the function and C is not used (the C includes the C if necessary). One notices the need for C only with the said compile-time define, because otherwise the Perl global variables are visible as-is. =head2 Should I do anything special if I call perl from multiple threads? If you create interpreters in one thread and then proceed to call them in another, you need to make sure perl's own Thread Local Storage (TLS) slot is initialized correctly in each of those threads. The C and C API functions will automatically set the TLS slot to the interpreter they created, so that there is no need to do anything special if the interpreter is always accessed in the same thread that created it, and that thread did not create or call any other interpreters afterwards. If that is not the case, you have to set the TLS slot of the thread before calling any functions in the Perl API on that particular interpreter. This is done by calling the C macro in that thread as the first thing you do: /* do this before doing anything else with some_perl */ PERL_SET_CONTEXT(some_perl); ... other Perl API calls on some_perl go here ... =head2 Future Plans and PERL_IMPLICIT_SYS Just as PERL_IMPLICIT_CONTEXT provides a way to bundle up everything that the interpreter knows about itself and pass it around, so too are there plans to allow the interpreter to bundle up everything it knows about the environment it's running on. This is enabled with the PERL_IMPLICIT_SYS macro. Currently it only works with USE_ITHREADS on Windows. This allows the ability to provide an extra pointer (called the "host" environment) for all the system calls. This makes it possible for all the system stuff to maintain their own state, broken down into seven C structures. These are thin wrappers around the usual system calls (see win32/perllib.c) for the default perl executable, but for a more ambitious host (like the one that would do fork() emulation) all the extra work needed to pretend that different interpreters are actually different "processes", would be done here. The Perl engine/interpreter and the host are orthogonal entities. There could be one or more interpreters in a process, and one or more "hosts", with free association between them. =head1 Internal Functions All of Perl's internal functions which will be exposed to the outside world are prefixed by C so that they will not conflict with XS functions or functions used in a program in which Perl is embedded. Similarly, all global variables begin with C. (By convention, static functions start with C.) Inside the Perl core, you can get at the functions either with or without the C prefix, thanks to a bunch of defines that live in F. This header file is generated automatically from F and F. F also creates the prototyping header files for the internal functions, generates the documentation and a lot of other bits and pieces. It's important that when you add a new function to the core or change an existing one, you change the data in the table in F as well. Here's a sample entry from that table: Apd |SV** |av_fetch |AV* ar|I32 key|I32 lval The second column is the return type, the third column the name. Columns after that are the arguments. The first column is a set of flags: =over 3 =item A This function is a part of the public API. All such functions should also have 'd', very few do not. =item p This function has a C prefix; i.e. it is defined as C. =item d This function has documentation using the C feature which we'll look at in a second. Some functions have 'd' but not 'A'; docs are good. =back Other available flags are: =over 3 =item s This is a static function and is defined as C, and usually called within the sources as C. =item n This does not need a interpreter context, so the definition has no C, and it follows that callers don't use C. (See L.) =item r This function never returns; C, C and friends. =item f This function takes a variable number of arguments, C style. The argument list should end with C<...>, like this: Afprd |void |croak |const char* pat|... =item M This function is part of the experimental development API, and may change or disappear without notice. =item o This function should not have a compatibility macro to define, say, C to C. It must be called as C. =item x This function isn't exported out of the Perl core. =item m This is implemented as a macro. =item X This function is explicitly exported. =item E This function is visible to extensions included in the Perl core. =item b Binary backward compatibility; this function is a macro but also has a C implementation (which is exported). =item others See the comments at the top of C for others. =back If you edit F or F, you will need to run C to force a rebuild of F and other auto-generated files. =head2 Formatted Printing of IVs, UVs, and NVs If you are printing IVs, UVs, or NVS instead of the stdio(3) style formatting codes like C<%d>, C<%ld>, C<%f>, you should use the following macros for portability IVdf IV in decimal UVuf UV in decimal UVof UV in octal UVxf UV in hexadecimal NVef NV %e-like NVff NV %f-like NVgf NV %g-like These will take care of 64-bit integers and long doubles. For example: printf("IV is %"IVdf"\n", iv); The IVdf will expand to whatever is the correct format for the IVs. If you are printing addresses of pointers, use UVxf combined with PTR2UV(), do not use %lx or %p. =head2 Pointer-To-Integer and Integer-To-Pointer Because pointer size does not necessarily equal integer size, use the follow macros to do it right. PTR2UV(pointer) PTR2IV(pointer) PTR2NV(pointer) INT2PTR(pointertotype, integer) For example: IV iv = ...; SV *sv = INT2PTR(SV*, iv); and AV *av = ...; UV uv = PTR2UV(av); =head2 Exception Handling There are a couple of macros to do very basic exception handling in XS modules. You have to define C before including F to be able to use these macros: #define NO_XSLOCKS #include "XSUB.h" You can use these macros if you call code that may croak, but you need to do some cleanup before giving control back to Perl. For example: dXCPT; /* set up necessary variables */ XCPT_TRY_START { code_that_may_croak(); } XCPT_TRY_END XCPT_CATCH { /* do cleanup here */ XCPT_RETHROW; } Note that you always have to rethrow an exception that has been caught. Using these macros, it is not possible to just catch the exception and ignore it. If you have to ignore the exception, you have to use the C function. The advantage of using the above macros is that you don't have to setup an extra function for C, and that using these macros is faster than using C. =head2 Source Documentation There's an effort going on to document the internal functions and automatically produce reference manuals from them - L is one such manual which details all the functions which are available to XS writers. L is the autogenerated manual for the functions which are not part of the API and are supposedly for internal use only. Source documentation is created by putting POD comments into the C source, like this: /* =for apidoc sv_setiv Copies an integer into the given SV. Does not handle 'set' magic. See C. =cut */ Please try and supply some documentation if you add functions to the Perl core. =head2 Backwards compatibility The Perl API changes over time. New functions are added or the interfaces of existing functions are changed. The C module tries to provide compatibility code for some of these changes, so XS writers don't have to code it themselves when supporting multiple versions of Perl. C generates a C header file F that can also be run as a Perl script. To generate F, run: perl -MDevel::PPPort -eDevel::PPPort::WriteFile Besides checking existing XS code, the script can also be used to retrieve compatibility information for various API calls using the C<--api-info> command line switch. For example: % perl ppport.h --api-info=sv_magicext For details, see C. =head1 Unicode Support Perl 5.6.0 introduced Unicode support. It's important for porters and XS writers to understand this support and make sure that the code they write does not corrupt Unicode data. =head2 What B Unicode, anyway? In the olden, less enlightened times, we all used to use ASCII. Most of us did, anyway. The big problem with ASCII is that it's American. Well, no, that's not actually the problem; the problem is that it's not particularly useful for people who don't use the Roman alphabet. What used to happen was that particular languages would stick their own alphabet in the upper range of the sequence, between 128 and 255. Of course, we then ended up with plenty of variants that weren't quite ASCII, and the whole point of it being a standard was lost. Worse still, if you've got a language like Chinese or Japanese that has hundreds or thousands of characters, then you really can't fit them into a mere 256, so they had to forget about ASCII altogether, and build their own systems using pairs of numbers to refer to one character. To fix this, some people formed Unicode, Inc. and produced a new character set containing all the characters you can possibly think of and more. There are several ways of representing these characters, and the one Perl uses is called UTF-8. UTF-8 uses a variable number of bytes to represent a character. You can learn more about Unicode and Perl's Unicode model in L. =head2 How can I recognise a UTF-8 string? You can't. This is because UTF-8 data is stored in bytes just like non-UTF-8 data. The Unicode character 200, (C<0xC8> for you hex types) capital E with a grave accent, is represented by the two bytes C. Unfortunately, the non-Unicode string C has that byte sequence as well. So you can't tell just by looking - this is what makes Unicode input an interesting problem. In general, you either have to know what you're dealing with, or you have to guess. The API function C can help; it'll tell you if a string contains only valid UTF-8 characters. However, it can't do the work for you. On a character-by-character basis, C will tell you whether the current character in a string is valid UTF-8. =head2 How does UTF-8 represent Unicode characters? As mentioned above, UTF-8 uses a variable number of bytes to store a character. Characters with values 0...127 are stored in one byte, just like good ol' ASCII. Character 128 is stored as C; this continues up to character 191, which is C. Now we've run out of bits (191 is binary C<10111111>) so we move on; 192 is C. And so it goes on, moving to three bytes at character 2048. Assuming you know you're dealing with a UTF-8 string, you can find out how long the first character in it is with the C macro: char *utf = "\305\233\340\240\201"; I32 len; len = UTF8SKIP(utf); /* len is 2 here */ utf += len; len = UTF8SKIP(utf); /* len is 3 here */ Another way to skip over characters in a UTF-8 string is to use C, which takes a string and a number of characters to skip over. You're on your own about bounds checking, though, so don't use it lightly. All bytes in a multi-byte UTF-8 character will have the high bit set, so you can test if you need to do something special with this character like this (the UTF8_IS_INVARIANT() is a macro that tests whether the byte can be encoded as a single byte even in UTF-8): U8 *utf; UV uv; /* Note: a UV, not a U8, not a char */ if (!UTF8_IS_INVARIANT(*utf)) /* Must treat this as UTF-8 */ uv = utf8_to_uv(utf); else /* OK to treat this character as a byte */ uv = *utf; You can also see in that example that we use C to get the value of the character; the inverse function C is available for putting a UV into UTF-8: if (!UTF8_IS_INVARIANT(uv)) /* Must treat this as UTF8 */ utf8 = uv_to_utf8(utf8, uv); else /* OK to treat this character as a byte */ *utf8++ = uv; You B convert characters to UVs using the above functions if you're ever in a situation where you have to match UTF-8 and non-UTF-8 characters. You may not skip over UTF-8 characters in this case. If you do this, you'll lose the ability to match hi-bit non-UTF-8 characters; for instance, if your UTF-8 string contains C, and you skip that character, you can never match a C in a non-UTF-8 string. So don't do that! =head2 How does Perl store UTF-8 strings? Currently, Perl deals with Unicode strings and non-Unicode strings slightly differently. A flag in the SV, C, indicates that the string is internally encoded as UTF-8. Without it, the byte value is the codepoint number and vice versa (in other words, the string is encoded as iso-8859-1). You can check and manipulate this flag with the following macros: SvUTF8(sv) SvUTF8_on(sv) SvUTF8_off(sv) This flag has an important effect on Perl's treatment of the string: if Unicode data is not properly distinguished, regular expressions, C, C and other string handling operations will have undesirable results. The problem comes when you have, for instance, a string that isn't flagged as UTF-8, and contains a byte sequence that could be UTF-8 - especially when combining non-UTF-8 and UTF-8 strings. Never forget that the C flag is separate to the PV value; you need be sure you don't accidentally knock it off while you're manipulating SVs. More specifically, you cannot expect to do this: SV *sv; SV *nsv; STRLEN len; char *p; p = SvPV(sv, len); frobnicate(p); nsv = newSVpvn(p, len); The C string does not tell you the whole story, and you can't copy or reconstruct an SV just by copying the string value. Check if the old SV has the UTF8 flag set, and act accordingly: p = SvPV(sv, len); frobnicate(p); nsv = newSVpvn(p, len); if (SvUTF8(sv)) SvUTF8_on(nsv); In fact, your C function should be made aware of whether or not it's dealing with UTF-8 data, so that it can handle the string appropriately. Since just passing an SV to an XS function and copying the data of the SV is not enough to copy the UTF8 flags, even less right is just passing a C to an XS function. =head2 How do I convert a string to UTF-8? If you're mixing UTF-8 and non-UTF-8 strings, it is necessary to upgrade one of the strings to UTF-8. If you've got an SV, the easiest way to do this is: sv_utf8_upgrade(sv); However, you must not do this, for example: if (!SvUTF8(left)) sv_utf8_upgrade(left); If you do this in a binary operator, you will actually change one of the strings that came into the operator, and, while it shouldn't be noticeable by the end user, it can cause problems in deficient code. Instead, C will give you a UTF-8-encoded B of its string argument. This is useful for having the data available for comparisons and so on, without harming the original SV. There's also C to go the other way, but naturally, this will fail if the string contains any characters above 255 that can't be represented in a single byte. =head2 Is there anything else I need to know? Not really. Just remember these things: =over 3 =item * There's no way to tell if a string is UTF-8 or not. You can tell if an SV is UTF-8 by looking at is C flag. Don't forget to set the flag if something should be UTF-8. Treat the flag as part of the PV, even though it's not - if you pass on the PV to somewhere, pass on the flag too. =item * If a string is UTF-8, B use C to get at the value, unless C in which case you can use C<*s>. =item * When writing a character C to a UTF-8 string, B use C, unless C in which case you can use C<*s = uv>. =item * Mixing UTF-8 and non-UTF-8 strings is tricky. Use C to get a new string which is UTF-8 encoded. There are tricks you can use to delay deciding whether you need to use a UTF-8 string until you get to a high character - C is one of those. =back =head1 Custom Operators Custom operator support is a new experimental feature that allows you to define your own ops. This is primarily to allow the building of interpreters for other languages in the Perl core, but it also allows optimizations through the creation of "macro-ops" (ops which perform the functions of multiple ops which are usually executed together, such as C.) This feature is implemented as a new op type, C. The Perl core does not "know" anything special about this op type, and so it will not be involved in any optimizations. This also means that you can define your custom ops to be any op structure - unary, binary, list and so on - you like. It's important to know what custom operators won't do for you. They won't let you add new syntax to Perl, directly. They won't even let you add new keywords, directly. In fact, they won't change the way Perl compiles a program at all. You have to do those changes yourself, after Perl has compiled the program. You do this either by manipulating the op tree using a C block and the C module, or by adding a custom peephole optimizer with the C module. When you do this, you replace ordinary Perl ops with custom ops by creating ops with the type C and the C of your own PP function. This should be defined in XS code, and should look like the PP ops in C. You are responsible for ensuring that your op takes the appropriate number of values from the stack, and you are responsible for adding stack marks if necessary. You should also "register" your op with the Perl interpreter so that it can produce sensible error and warning messages. Since it is possible to have multiple custom ops within the one "logical" op type C, Perl uses the value of C<< o->op_ppaddr >> as a key into the C and C hashes. This means you need to enter a name and description for your op at the appropriate place in the C and C hashes. Forthcoming versions of C (version 1.0 and above) should directly support the creation of custom ops by name. =head1 AUTHORS Until May 1997, this document was maintained by Jeff Okamoto Eokamoto@corp.hp.comE. It is now maintained as part of Perl itself by the Perl 5 Porters Eperl5-porters@perl.orgE. With lots of help and suggestions from Dean Roehrich, Malcolm Beattie, Andreas Koenig, Paul Hudson, Ilya Zakharevich, Paul Marquess, Neil Bowers, Matthew Green, Tim Bunce, Spider Boardman, Ulrich Pfeifer, Stephen McCamant, and Gurusamy Sarathy. =head1 SEE ALSO perlapi(1), perlintern(1), perlxs(1), perlembed(1)
|
{
"url": "http://cpansearch.perl.org/src/RGARCIA/perl-5.9.5/pod/perlguts.pod",
"source_domain": "cpansearch.perl.org",
"snapshot_id": "crawl=CC-MAIN-2014-23",
"warc_metadata": {
"Content-Length": "105707",
"Content-Type": "application/http; msgtype=response",
"WARC-Block-Digest": "sha1:TTSFEHTHYNGLEOYK7U27VE4RMO7SQZB3",
"WARC-Concurrent-To": "<urn:uuid:e6b4c0ae-4f34-48e6-a555-562ed39bd3cd>",
"WARC-Date": "2014-07-13T02:47:31Z",
"WARC-IP-Address": "207.171.7.59",
"WARC-Identified-Payload-Type": null,
"WARC-Payload-Digest": "sha1:3FUPDNSXP64UFZIY3UCBF33SKEHKFSUU",
"WARC-Record-ID": "<urn:uuid:7df6cf94-6ef9-4ed7-b4c6-a5241f8f28a9>",
"WARC-Target-URI": "http://cpansearch.perl.org/src/RGARCIA/perl-5.9.5/pod/perlguts.pod",
"WARC-Truncated": null,
"WARC-Type": "response",
"WARC-Warcinfo-ID": "<urn:uuid:37b4f8a1-187d-4b91-bd2c-160f027436d7>"
},
"warc_info": "robots: classic\r\nhostname: ip-10-180-212-248.ec2.internal\r\nsoftware: Nutch 1.6 (CC)/CC WarcExport 1.0\r\nisPartOf: CC-MAIN-2014-23\r\noperator: CommonCrawl Admin\r\ndescription: Wide crawl of the web with URLs provided by Blekko for July 2014\r\npublisher: CommonCrawl\r\nformat: WARC File Format 1.0\r\nconformsTo: http://bibnum.bnf.fr/WARC/WARC_ISO_28500_version1_latestdraft.pdf"
}
|
{
"line_start_idx": [
0,
28185,
28868,
44869,
44870,
44945,
44946,
45673,
45674,
46115,
46116,
46218,
46219,
68223,
68224
],
"line_end_idx": [
28185,
28868,
44869,
44870,
44945,
44946,
45673,
45674,
46115,
46116,
46218,
46219,
68223,
68224,
91606
]
}
|
{
"red_pajama_v2": {
"ccnet_original_length": 91606,
"ccnet_original_nlines": 14,
"rps_doc_curly_bracket": 0.0003493200056254864,
"rps_doc_ldnoobw_words": 0,
"rps_doc_lorem_ipsum": 0,
"rps_doc_stop_word_fraction": 0.38703280687332153,
"rps_doc_ut1_blacklist": 0,
"rps_doc_frac_all_caps_words": 0.07752552628517151,
"rps_doc_frac_lines_end_with_ellipsis": 0,
"rps_doc_frac_no_alph_words": 0.1967383772134781,
"rps_doc_frac_unique_words": 0.14576056599617004,
"rps_doc_mean_word_length": 4.478183746337891,
"rps_doc_num_sentences": 789,
"rps_doc_symbol_to_word_ratio": 0.0020818898919969797,
"rps_doc_unigram_entropy": 6.02877140045166,
"rps_doc_word_count": 15745,
"rps_doc_frac_chars_dupe_10grams": 0.014196770265698433,
"rps_doc_frac_chars_dupe_5grams": 0.07637322694063187,
"rps_doc_frac_chars_dupe_6grams": 0.052674129605293274,
"rps_doc_frac_chars_dupe_7grams": 0.034633878618478775,
"rps_doc_frac_chars_dupe_8grams": 0.027797870337963104,
"rps_doc_frac_chars_dupe_9grams": 0.018281349912285805,
"rps_doc_frac_chars_top_2gram": 0.006126880180090666,
"rps_doc_frac_chars_top_3gram": 0.0019146499689668417,
"rps_doc_frac_chars_top_4gram": 0.0017019100487232208,
"rps_doc_books_importance": -9567.3388671875,
"rps_doc_books_importance_length_correction": -9567.3388671875,
"rps_doc_openwebtext_importance": -5216.69091796875,
"rps_doc_openwebtext_importance_length_correction": -5216.69091796875,
"rps_doc_wikipedia_importance": -3754.867431640625,
"rps_doc_wikipedia_importance_length_correction": -3754.867431640625
},
"fasttext": {
"dclm": 0.43414562940597534,
"english": 0.8703125715255737,
"fineweb_edu_approx": 2.82326078414917,
"eai_general_math": 0.9601730108261108,
"eai_open_web_math": 0.32710933685302734,
"eai_web_code": 0.9728651642799377
}
}
|
{
"free_decimal_correspondence": {
"primary": {
"code": "005.1332",
"labels": {
"level_1": "General works, books and libraries, information sciences",
"level_2": "",
"level_3": "Computer programming"
}
},
"secondary": {
"code": "005.133",
"labels": {
"level_1": "General works, books and libraries, information sciences",
"level_2": "",
"level_3": "Computer programming"
}
}
},
"bloom_cognitive_process": {
"primary": {
"code": "2",
"label": "Understand"
},
"secondary": {
"code": "3",
"label": "Apply"
}
},
"bloom_knowledge_domain": {
"primary": {
"code": "2",
"label": "Conceptual"
},
"secondary": {
"code": "3",
"label": "Procedural"
}
},
"document_type_v1": {
"primary": {
"code": "3",
"label": "Reference/Encyclopedic/Educational"
},
"secondary": {
"code": "-1",
"label": "Abstain"
}
},
"extraction_artifacts": {
"primary": {
"code": "0",
"label": "No Artifacts"
},
"secondary": {
"code": "3",
"label": "Irrelevant Content"
}
},
"missing_content": {
"primary": {
"code": "0",
"label": "No missing content"
},
"secondary": {
"code": "-1",
"label": "Abstain"
}
},
"document_type_v2": {
"primary": {
"code": "8",
"label": "Documentation"
},
"secondary": {
"code": "10",
"label": "Knowledge Article"
}
},
"reasoning_depth": {
"primary": {
"code": "3",
"label": "Intermediate Reasoning"
},
"secondary": {
"code": "4",
"label": "Advanced Reasoning"
}
},
"technical_correctness": {
"primary": {
"code": "4",
"label": "Highly Correct"
},
"secondary": {
"code": "5",
"label": "Exceptionally Correct"
}
},
"education_level": {
"primary": {
"code": "3",
"label": "Undergraduate Level"
},
"secondary": {
"code": "4",
"label": "Graduate/Expert Level"
}
}
}
|
672f1e42c33a7f9846924a2431ea77df
|
4,732,700,533,088,037,000
|
A literate program to compute the inverse of the normal CDF
This page presents C++ code for computing the inverse of the normal (Gaussian) CDF. The emphasis, however, is on the process of writing the code. The discussion points out some of the things people are expected to pick up along the way but may never have been taught explicitly.
This page develops the code in the spirit of a literate program. The code will be developed in small pieces, then the final code presented at the bottom of the page. This page is not actually a literate program but it strives to serve the same purpose.
Problem statement
Basic solution
Numerical issues
Take away
Complete code
Problem statement
We need software to compute the inverse of the normal CDF (cumulative density function). That is, given a probability p, compute x such that Prob(Z < x) = p where Z is a standard normal (Gaussian) random variable. We don’t need high precision; three or four decimal places will suffice.
Basic solution
We can look up an algorithm that will essentially compute what we need. But there is some work to do in order to turn the algorithm we find into working code.
The first place to look for approximations to statistical functions is Abramowitz and Stegun or A&S at it is fondly known. Formula 26.2.23 from A&S is given below.
AS formula 26.2.23
A&S describes the formula above as a “rational approximation for xp where Q(xp) = p.” In A&S notation, Q is the CCDF (complementary cumulative distribution function) for a standard normal. Also, A&S says that the approximation is good for 0 < p ≤ 0.5. The reported absolute error in the approximation is less than 4 × 10-4, so the accuracy is sufficient. We have two immediate problems. First, we want to invert the CDF, not the CCDF. Second, we need an algorithm for 0 < p < 1 and not just for p < 0.5.
Let F(x) be the CDF of a standard normal and let G(x) be the corresponding CCDF. We want to compute the inverse CDF, F-1(p), but A & S gives us a way to compute G-1(p). Now for all x, F(x) + G(x) = 1. So if G(x) = 1-p then F(x) = p. That means that
F-1(p) = G-1(1-p)
and so our first problem is solved. If p ≥ 0.5, 1 – p ≤ 0.5 and so the approximation from A&S applies. But what if p < 0.5?
Since the standard normal distribution is symmetric about zero, the probability of being greater than x is the same as the probability of being less than -x. That is, G(x) = p if and only if F(-x) = p. So x = G-1(p) if and only if x = -F-1(p). Thus
F-1(p) = -G-1(p).
We can use the above formula to compute F-1(p) for p < 0.5.
Numerical issues
The first step in applying the formula from A&S is to transform p into sqrt(-2.0*log(p)). So for p < 0.5 we compute t = sqrt(-2.0*log(p)) and evaluate the ratio of polynomials for approximating G-1(p) and flip the sign of the result. For p ≥ 0.5, we compute t = sqrt(-2.0*log(1-p)). If RationalApproximation is the function to evaluate the ratio of polynomials, the code for computing F-1 starts as follows.
if (p < 0.5)
{
// F^-1(p) = - G^-1(p)
return -RationalApproximation( sqrt(-2.0*log(p)) );
}
else
{
// F^-1(p) = G^-1(1-p)
return RationalApproximation( sqrt(-2.0*log(1-p)) );
}
Writing the code for RationalApproximation is easy. However, we introduce a technique along the way. We could evaluate a polynomial of the form a + bx +cx2 + dx3 by computing
a + b*x + c*x*x + d*x*x*x
but we could save a few cycles using Horner's method to evaluate the polynomial as
((d*x + c)*x + b)*x + a.
The time savings isn't much for a low-order polynomial. On the other hand, Horner's rule is easy to apply so it's a good habit to always use it to evaluate polynomials. It could make a difference in evaluating high-order polynomials in the inner loop of a program.
Using Horner's rule, our code for RationalApproximation is as follows.
double RationalApproximation(double t)
{
const double c[] = {2.515517, 0.802853, 0.010328};
const double d[] = {1.432788, 0.189269, 0.001308};
return t - ((c[2]*t + c[1])*t + c[0]) /
(((d[2]*t + d[1])*t + d[0])*t + 1.0);
}
Take away
Here's a summary of a couple things this code illustrates.
1. Abramowitz and Stegun is a good place to start when looking for information about statistical functions.
2. Horner's method of evaluating polynomials is simple and runs faster than the most direct approach.
If you want to learn more about literate programming, I recommend Donald Knuth's book Literate Programming.
Complete code
Here we present the final code with some input validation added. We also include some code to test/demonstrate the code for evaluating F-1.= - G^-1(p)
#include <cmath>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <stdexcept>
double LogOnePlusX(double x);
double NormalCDFInverse(double p);
double RationalApproximation(double t);
void demo();
double RationalApproximation(double t)
{
// Abramowitz and Stegun formula 26.2.23.
// The absolute value of the error should be less than 4.5 e-4.
double c[] = {2.515517, 0.802853, 0.010328};
double d[] = {1.432788, 0.189269, 0.001308};
return t - ((c[2]*t + c[1])*t + c[0]) /
(((d[2]*t + d[1])*t + d[0])*t + 1.0);
}
double NormalCDFInverse(double p)
{
if (p <= 0.0 || p >= 1.0)
{
std::stringstream os;
os << "Invalid input argument (" << p
<< "); must be larger than 0 but less than 1.";
throw std::invalid_argument( os.str() );
}
// See article above for explanation of this section.
if (p < 0.5)
{
// F^-1(p) = - G^-1(p)
return -RationalApproximation( sqrt(-2.0*log(p)) );
}
else
{
// F^-1(p) = G^-1(1-p)
return RationalApproximation( sqrt(-2.0*log(1-p)) );
}
}
void demo()
{
std::cout << "\nShow that the NormalCDFInverse function is accurate at \n"
<< "0.05, 0.15, 0.25, ..., 0.95 and at a few extreme values.\n\n";
double p[] =
{
0.0000001,
0.00001,
0.001,
0.05,
0.15,
0.25,
0.35,
0.45,
0.55,
0.65,
0.75,
0.85,
0.95,
0.999,
0.99999,
0.9999999
};
// Exact values computed by Mathematica.
double exact[] =
{
-5.199337582187471,
-4.264890793922602,
-3.090232306167813,
-1.6448536269514729,
-1.0364333894937896,
-0.6744897501960817,
-0.38532046640756773,
-0.12566134685507402,
0.12566134685507402,
0.38532046640756773,
0.6744897501960817,
1.0364333894937896,
1.6448536269514729,
3.090232306167813,
4.264890793922602,
5.199337582187471
};
double maxerror = 0.0;
int numValues = sizeof(p)/sizeof(double);
std::cout << "p, exact CDF inverse, computed CDF inverse, diff\n\n";
std::cout << std::setprecision(7);
for (int i = 0; i < numValues; ++i)
{
double computed = NormalCDFInverse(p[i]);
double error = exact[i] - computed;
std::cout << p[i] << ", " << exact[i] << ", "
<< computed << ", " << error << "\n";
if (fabs(error) > maxerror)
maxerror = fabs(error);
}
std::cout << "\nMaximum error: " << maxerror << "\n\n";
}
int main()
{
demo();
return 0;
}
|
{
"url": "http://www.johndcook.com/blog/normal_cdf_inverse/",
"source_domain": "www.johndcook.com",
"snapshot_id": "crawl=CC-MAIN-2015-14",
"warc_metadata": {
"Content-Length": "55394",
"Content-Type": "application/http; msgtype=response",
"WARC-Block-Digest": "sha1:5O6QPVPP3SRSCCRIJQAXJOE7AZJTWPHS",
"WARC-Concurrent-To": "<urn:uuid:52fb5df5-f235-4fbc-9819-fde0035006e4>",
"WARC-Date": "2015-03-26T22:27:45Z",
"WARC-IP-Address": "104.219.43.115",
"WARC-Identified-Payload-Type": null,
"WARC-Payload-Digest": "sha1:EONJNJ36VSCXCUJU7TCDLZHQOJHNOZLV",
"WARC-Record-ID": "<urn:uuid:e16e3ff8-7334-40e3-98e4-f779c7593382>",
"WARC-Target-URI": "http://www.johndcook.com/blog/normal_cdf_inverse/",
"WARC-Truncated": "length",
"WARC-Type": "response",
"WARC-Warcinfo-ID": "<urn:uuid:70b74a81-e8f2-4b09-b1e5-98f03a301a77>"
},
"warc_info": "robots: classic\r\nhostname: ip-10-168-14-71.ec2.internal\r\nsoftware: Nutch 1.6 (CC)/CC WarcExport 1.0\r\nisPartOf: CC-MAIN-2015-14\r\noperator: CommonCrawl Admin\r\ndescription: Wide crawl of the web with URLs provided by Blekko for March 2015\r\npublisher: CommonCrawl\r\nformat: WARC File Format 1.0\r\nconformsTo: http://bibnum.bnf.fr/WARC/WARC_ISO_28500_version1_latestdraft.pdf"
}
|
{
"line_start_idx": [
0,
60,
61,
340,
341,
594,
595,
613,
628,
645,
655,
669,
670,
688,
689,
976,
977,
992,
993,
1152,
1153,
1317,
1318,
1337,
1338,
1842,
1843,
2092,
2093,
2111,
2112,
2236,
2237,
2486,
2487,
2505,
2506,
2566,
2567,
2584,
2585,
2993,
2994,
3007,
3009,
3036,
3092,
3094,
3099,
3101,
3128,
3185,
3187,
3188,
3363,
3364,
3390,
3391,
3474,
3475,
3500,
3501,
3766,
3767,
3838,
3839,
3878,
3880,
3935,
3990,
4035,
4088,
4090,
4091,
4101,
4102,
4161,
4162,
4272,
4376,
4377,
4485,
4486,
4500,
4501,
4652,
4653,
4670,
4689,
4709,
4728,
4749,
4750,
4780,
4815,
4855,
4868,
4869,
4908,
4910,
4956,
5024,
5073,
5122,
5167,
5220,
5222,
5223,
5257,
5259,
5289,
5295,
5325,
5372,
5431,
5480,
5486,
5487,
5545,
5562,
5568,
5599,
5659,
5665,
5674,
5680,
5711,
5772,
5778,
5780,
5781,
5793,
5795,
5874,
5955,
5956,
5973,
5979,
5998,
6015,
6030,
6044,
6058,
6072,
6086,
6100,
6114,
6128,
6142,
6156,
6170,
6185,
6202,
6220,
6227,
6228,
6273,
6294,
6300,
6328,
6356,
6384,
6413,
6442,
6471,
6501,
6531,
6561,
6591,
6620,
6649,
6678,
6706,
6734,
6761,
6768,
6769,
6796,
6842,
6915,
6954,
6994,
7000,
7050,
7094,
7149,
7205,
7241,
7277,
7283,
7284,
7344,
7346,
7347,
7358,
7360,
7372,
7386
],
"line_end_idx": [
60,
61,
340,
341,
594,
595,
613,
628,
645,
655,
669,
670,
688,
689,
976,
977,
992,
993,
1152,
1153,
1317,
1318,
1337,
1338,
1842,
1843,
2092,
2093,
2111,
2112,
2236,
2237,
2486,
2487,
2505,
2506,
2566,
2567,
2584,
2585,
2993,
2994,
3007,
3009,
3036,
3092,
3094,
3099,
3101,
3128,
3185,
3187,
3188,
3363,
3364,
3390,
3391,
3474,
3475,
3500,
3501,
3766,
3767,
3838,
3839,
3878,
3880,
3935,
3990,
4035,
4088,
4090,
4091,
4101,
4102,
4161,
4162,
4272,
4376,
4377,
4485,
4486,
4500,
4501,
4652,
4653,
4670,
4689,
4709,
4728,
4749,
4750,
4780,
4815,
4855,
4868,
4869,
4908,
4910,
4956,
5024,
5073,
5122,
5167,
5220,
5222,
5223,
5257,
5259,
5289,
5295,
5325,
5372,
5431,
5480,
5486,
5487,
5545,
5562,
5568,
5599,
5659,
5665,
5674,
5680,
5711,
5772,
5778,
5780,
5781,
5793,
5795,
5874,
5955,
5956,
5973,
5979,
5998,
6015,
6030,
6044,
6058,
6072,
6086,
6100,
6114,
6128,
6142,
6156,
6170,
6185,
6202,
6220,
6227,
6228,
6273,
6294,
6300,
6328,
6356,
6384,
6413,
6442,
6471,
6501,
6531,
6561,
6591,
6620,
6649,
6678,
6706,
6734,
6761,
6768,
6769,
6796,
6842,
6915,
6954,
6994,
7000,
7050,
7094,
7149,
7205,
7241,
7277,
7283,
7284,
7344,
7346,
7347,
7358,
7360,
7372,
7386,
7387
]
}
|
{
"red_pajama_v2": {
"ccnet_original_length": 7387,
"ccnet_original_nlines": 197,
"rps_doc_curly_bracket": 0.00460267998278141,
"rps_doc_ldnoobw_words": 0,
"rps_doc_lorem_ipsum": 0,
"rps_doc_stop_word_fraction": 0.2684098184108734,
"rps_doc_ut1_blacklist": 0,
"rps_doc_frac_all_caps_words": 0.03415155038237572,
"rps_doc_frac_lines_end_with_ellipsis": 0,
"rps_doc_frac_no_alph_words": 0.4589114189147949,
"rps_doc_frac_unique_words": 0.37917089462280273,
"rps_doc_mean_word_length": 4.866531848907471,
"rps_doc_num_sentences": 137,
"rps_doc_symbol_to_word_ratio": 0.003201710060238838,
"rps_doc_unigram_entropy": 5.34300422668457,
"rps_doc_word_count": 989,
"rps_doc_frac_chars_dupe_10grams": 0.06274673342704773,
"rps_doc_frac_chars_dupe_5grams": 0.10450862348079681,
"rps_doc_frac_chars_dupe_6grams": 0.07645958662033081,
"rps_doc_frac_chars_dupe_7grams": 0.07645958662033081,
"rps_doc_frac_chars_dupe_8grams": 0.07645958662033081,
"rps_doc_frac_chars_dupe_9grams": 0.06274673342704773,
"rps_doc_frac_chars_top_2gram": 0.00831081997603178,
"rps_doc_frac_chars_top_3gram": 0.009972989559173584,
"rps_doc_frac_chars_top_4gram": 0.011842929758131504,
"rps_doc_books_importance": -662.4193115234375,
"rps_doc_books_importance_length_correction": -662.4193115234375,
"rps_doc_openwebtext_importance": -402.78009033203125,
"rps_doc_openwebtext_importance_length_correction": -402.78009033203125,
"rps_doc_wikipedia_importance": -418.0740051269531,
"rps_doc_wikipedia_importance_length_correction": -418.0740051269531
},
"fasttext": {
"dclm": 0.8135820031166077,
"english": 0.7860468029975891,
"fineweb_edu_approx": 2.657534599304199,
"eai_general_math": 0.9999197721481323,
"eai_open_web_math": 0.6965494751930237,
"eai_web_code": 0.9768995642662048
}
}
|
{
"free_decimal_correspondence": {
"primary": {
"code": "519.2",
"labels": {
"level_1": "Science and Natural history",
"level_2": "Mathematics",
"level_3": "Probabilities; or, Mathematical statistics"
}
},
"secondary": {
"code": "005.1",
"labels": {
"level_1": "General works, books and libraries, information sciences",
"level_2": "",
"level_3": "Computer programming"
}
}
},
"bloom_cognitive_process": {
"primary": {
"code": "3",
"label": "Apply"
},
"secondary": {
"code": "4",
"label": "Analyze"
}
},
"bloom_knowledge_domain": {
"primary": {
"code": "3",
"label": "Procedural"
},
"secondary": {
"code": "2",
"label": "Conceptual"
}
},
"document_type_v1": {
"primary": {
"code": "3",
"label": "Reference/Encyclopedic/Educational"
},
"secondary": {
"code": "4",
"label": "Code/Software"
}
},
"extraction_artifacts": {
"primary": {
"code": "0",
"label": "No Artifacts"
},
"secondary": {
"code": "3",
"label": "Irrelevant Content"
}
},
"missing_content": {
"primary": {
"code": "0",
"label": "No missing content"
},
"secondary": {
"code": "-1",
"label": "Abstain"
}
},
"document_type_v2": {
"primary": {
"code": "23",
"label": "Tutorial"
},
"secondary": {
"code": "8",
"label": "Documentation"
}
},
"reasoning_depth": {
"primary": {
"code": "3",
"label": "Intermediate Reasoning"
},
"secondary": {
"code": "4",
"label": "Advanced Reasoning"
}
},
"technical_correctness": {
"primary": {
"code": "4",
"label": "Highly Correct"
},
"secondary": {
"code": "3",
"label": "Mostly Correct"
}
},
"education_level": {
"primary": {
"code": "3",
"label": "Undergraduate Level"
},
"secondary": {
"code": "4",
"label": "Graduate/Expert Level"
}
}
}
|
672f1e42c33a7f9846924a2431ea77df
|
833,563,320,991,351,300
|
IPv6 Deployment
IPv6 Deployment: Lessons from the Trenches
By: Gregory M. Lebovitz
Date: October 7, 2008
line break image
Panel discusses
IETF 72 panel discusses IPv6 deployment
During the IETF 72 technical plenary, the Internet Architecture Board (IAB) hosted a panel on the subject of IPv6 deployment. The five-member panel was composed of Internet community members who have firsthand experience with operational IPv6 deployments. They represent the perspectives of Regional Internet Registries, or RIRs; network operations teams; broadband services; content delivery services; and host applications. The panelists communicated their IPv6 adoption successes and hurdles, as well as their IPv4-depletion contingency plans, including carrier-grade network address translations (NATs), or CGNs, a concept that is currently under debate.
Motivation and Background
Studies suggest that the completion of IPv4 address allocations by IANA to the RIRs could occur as early as 2011 (seehttp://www.potaroo.net/tools/ipv4/). Regardless of the exact date, the idea of an empty storehouse will, without question, change the networking landscape. In an effort to prepare for that eventuality, various players are working toward widening and hastening IPv6 deployment.
Some content providers are planning ahead by readying their content for IPv6 endpoint hits. Some of the service providers and broadband providers that saw the need started their efforts some time ago, and they’re now moving toward infrastructure and service delivery that can and will run on IPv6. Both face a bit of a chicken-and-egg problem: the content providers would move faster if they knew the operators had the services fully baked to deliver IPv6 eyeballs to the content. And the operators would invest more in their IPv6 services and infrastructure deployments if the content the end customer demanded were available and abundant.
Enterprises are, in some way, the swing votes. Objectively, few enterprises have moved toward wide-scale deployments of IPv6. Some have IPv6 pilots; and a few have partial deployments, yet they may hit the v4 allocation cliff harder than either of the other two, aforementioned communities. This will leave enterprises in a costly scurry to rectify the situation at the last minute.
IPv6 deployment in operational networks across the Internet is a work in progress. Transition mechanisms have existed and been deployed for years, including dual stacks and various translation and tunnelling mechanisms. Over time, more hosts and networks are moving to native IPv6 operations. Collectively, we now have several years of experience with both.
The IAB established this plenary topic to provide background and input from those experienced with deployments and issues in order to empower the IETF community to do its part to encourage and facilitate the universal deployment of IPv6.
View from the RIRs
Mark Kosters, Chief Technology Officer, ARIN
RIR Allocations
Currently there are 39 IPv4 “/8″ address blocks (2^24, or 16,777,216 addresses) remaining in the IANA free pool that can be allocated by IANA to RIRs. In turn, the five RIRs that together cover the globe assign portions of the /8s to ISPs in their regions according to their local policies and practices. To give a sense of the allocation pace, in December 2004 there were 76 /8s remaining; in December 2005 there were 65; in December 2006 there were 55; in December 2007 there were 42; and in June 2008 there were 39. While the absolute number of allocations per year has remained somewhat constant, the percentage of remaining /8s being allocated is growing steadily each year.
If, as one model predicts (http://www.potaroo.net/tools/ipv4/), the IANA free pool runs dry in December 2011, then IP address blocks that have never been allocated to RIRs will be allocated. That won’t mean end users or corporations will no longer be able to get IPv4 public addresses from their ISPs. It means the currently defined IANA free pool allocations will be completed. Rather than receiving this news as Chicken Little would-as an indication that the sky is falling-Mark urged us to look at it like the westward expansion of the United States in the 1800s. At that time it was possible to go out and get land from the government for only a small registration fee-land that had not been previously farmed. Today, you can still acquire a farm or a large piece of land; it just costs a lot more, and it will have been owned by others-whether or not they used it-thereby giving it a definite market value. And today there exists a complex and robust market for titling, brokering, and owning the land. Likewise, the days of IPv4 address “homesteading” are coming to an end, and many more stringent policies, and, perhaps, markets, will emerge for dealing with IP address use and propriety.
The IPv6 address space, on the other hand, is a 128-bit space, of which IANA has given out very little. The homesteading of IPv6 has barely begun. The RIRs have been fairly active in the past few years in assigning IPv6 address blocks to their Local Internet Registries (LIRs) and ISPs, with RIPE NCC and APNIC being by far the most active. ARIN and APNIC were making similarly sized allocations since 2003-around the 40 to 50 mark per year-until 2007, when ARIN handled over a hundred IPv6 allocations. To date, RIPE NCC has dealt almost half of all of the IPv6 allocations-1,208-which equates to 33,041 /32s. The next closest is APNIC, with 580, accounting for 23,233 /32s, followed by ARIN with 496, LACNIC with 97, and AfriNIC with 47. These allocations are from the RIRs to providers. However, only ARIN, APNIC, and AfriNIC have actually assigned provider-independent (PI) address blocks to end sites directly. The RIPE NCC and LACNIC have not yet assigned PI IPv6 addresses; both have policy proposals in the works for doing so. PI address grants are held in tension because backbone routing for IPv6 has not yet reached the same scale and stability as those present in IPv4 BGP, and the community questions how much route bloat from PIs can be reasonably handled.
RIR Policy Development
With IPv4 allocation completion on the horizon, the volume of policy work by RIRs on this subject has ballooned. Fourteen policy proposals-almost half of the open proposals-concern IPv4 depletion policies. One of the proposals concerns global policy, which states that as IANA’s free allocations of /8s approach exhaustion, every RIR will get a /8. Another proposal deals with liberalizing the transfer policy for moving blocks of addresses between RIRs and LIRs and ISPs and organizations. In the IPv6 policy realm, proposals exist to make it easier to transition to and use IPv6. In the autonomous-system (AS) realm, the RIRs currently allocate a lot of 2-byte AS numbers. These would be exhausted in 2011 as well if the current allocation rate continues. There are 4-byte AS numbers available, but many parties have returned them because the network as a whole does not support them very well (e.g., BGP implementations and OSS systems). We need to encourage our vendors and ISPs to better support 4-byte ASs, because this is another hole-like the IPv4 depletion-looming on the Internet highway.
Building Awareness
In addition to policy and allocations, the RIRs conduct a fair amount of awareness and promotion work for IPv6. The RIRs have taken an aggressive stance on trying to move IPv6 adoption forward. They have issued position statements, delivered awareness-raising and educational workshops, conducted research on IPv4 allocations and IPv6 deployment, provided education and advice for governments and nongovernmental organizations, and hosted IPv6 networks during meetings, such as those of the IETF-all to help drive IPv6 adoption.
“This is an important time of transition, and people need to participate,” Mark said in closing. “The registries’ policy development process is very bottom-up. So come join the effort.”
Lessons Learned from IPv6 Deployment
Alain Durand, Director of Internet Governance and IPv6 Architecture, Comcast
Comcast, a large cable operator in the United States, began its IPv6 deployments several years ago with a two-phase approach. First, it is readying the infrastructure by using IPv6 for management of cable modem devices and network infrastructure. This paves the way for the second phase, wherein Comcast will offer home users IPv6 service to their endpoints. That second phase is now in planning stages, with some lab trials under way.
The cable industry’s Data over Cable Service Interface Specification (DOCSIS) model assigns an IP address to each customer’s cable modem. This differs from DSL, wherein an individual modem does not have its own IP address. Cable operators thus use a lot of IP addresses and are very involved in allocation policy. Their move to IPv6 was somewhat motivated by the depleting IPv4 address space. They foresaw that in a few years an organization requesting a few IPv4 addresses for Web and mail servers might still easily get them, whereas a request to IANA for a large-scale allocation is likely to be turned down much sooner. Moving the modems’ management interfaces to IPv6 means that they each get a globally unique and routable IP address, thereby avoiding messy address overlaps or NATs.
The company learned important lessons from its initial experiments with IPv6 deployment. The first lesson taught that starting early saves money. For example, including IPv6 early in the DOC-SIS 3.0 specifications in early 2005 ensured that products rolling out today include IPv6 at no extra cost. The second lesson was that the network buildout for IPv6 was easier than expected. Comcast started by adding IPv6 addresses on router interfaces-and nothing else. To its surprise, nothing bad happened. So Comcast left the network like that for several months. Next, it enabled IPv6 routing, ISIS, and BGP. Again, nothing bad happened. Not one outage occurred that was traced back to the IPv6 pieces. This was a critical step in building the confidence of the operations team, proving that IPv6 could run stably in a production dual stack network. Currently, IPv6 exists in both Comcast’s access and backbone networks.
Panel discusses
Photo by Peter Lötberg
For Comcast the problem with IPv6 was not in the networking layers but in the application and services ecosystem around the layers, like their operations and support, management, billing, and third-party systems. Not only do many of those systems lack the required IPv6 support, but getting that support is not high on most vendors’ priority lists. Adapting the code doesn’t happen overnight. It takes implementation, testing, debugging, deploying, scaling, and stabilizing. It’s a linear process that can be accelerated only so much by applying additional resources. “Nine women can’t make a baby in one month,” quipped Alain, urging application vendors to get moving. Hosted or out-sourced services from third-party vendors are in a spot similar to applications, wherein many do not yet support IPv6.
Seeing the IPv4 depletion ahead, the Comcast team is plotting a transition course that includes IPv4 access for quite some time. Once scarcity hits, the team imagines, a wide range of IPv4-only computers, devices, and operating systems will still exist in customers’ homes (e.g., Win95, 98, XP, PlayStations, Xboxes, and some consumer devices). Though more and more IPv6-ready equipment is entering homes, customers will not jettison the old IPv4-only equipment; they keep using the older devices. Also, the content on the Internet is almost exclusively IPv4. Recently, thanks to Google, we have some IPv6 content to look at, but not much. IPv4 hosts and content will need reachability for some time yet.
Comcast’s plan therefore involves a dual-stack core, which Alain says should work well-at least until it’s no longer possible to get any more IPv4 addresses. “Following IPv4 completion, if you give all new customers IPv6 only, with no IPv4 support, then the IPv4-only devices can’t get out of the home, and new, IPv6-only devices can’t get to the predominant IPv4-only content on the Internet.” To counter that hitch, one might add the practice of NATing new customers with overlays of private addresses from the RFC 1918 blocks. This brings undesirable results, though, such as NATs piled one on top of the other, with multiple overlapping addresses to customers. While not impossible, NATing creates a lot of complexity-especially in management-and it makes the troubleshooting of customer issues much more difficult. In addition, traffic-engineering gyrations, such as source-based routing, might be necessary to handle the overlaps. Outages are usually linked to complexity in the network, so this increased complexity in the network is less than desirable.
The Comcast team is looking at using tunnels and provisioning IPv6 to customers’ home gateways. This would enable Comcast to offer both IPv6 and IPv4 services to endpoints behind those gateways. IPv6 would run natively from hosts to IPv6 targets. IPv4 is delivered by first having the gateway speak IPv4 internally, and second, by transporting the IPv4 packet over the IPv6 infrastructure network via a tunnel. The IPv4 packet would be detunnelled inside the ISP network at a large v4-to-v4 NAT box, a CGN. That box translates the IPv4 packet to a globally routable IPv4 address and sends it off to the IPv4 target. Alain refers to this as a dualstack-lite service. (Work on this is occurring in the Softwire working group.) The advantage is that the infrastructure itself requires only IPv6 addresses for operated devices while allowing either IPv4-only or dual-stack hosts to reach IPv4-only content on the Internet. “This dual-stack-lite concept makes IPv6 services incrementally deployable,” claims Alain. “You don’t have to wait for the rest of the Internet-the content and applications-to move to IPv6 in order to roll out the service. You can deploy IPv6 in your own world and get some immediate benefit out of it.” The IETF’s most successful protocols over the past 15 years have been incrementally deployable, and that is Alain’s goal for networks transitioning to IPv6.
A Step-by-Step Transition Plan
Shin Miyakawa, Director of IP Technology Development at NTT Communications
While sharing much of Alain’s view of the need for incremental deployment of IPv6 in the face of depleted IPv4 space, Shin cautioned against accepting a common misunderstanding about carrier-grade NAT. “Please do not get comfortable with the idea that a carrier-grade NAT will “˜solve’ our problems,” he warned. “Do not believe that if we have a CGN, we need not move to IPv6.” On the contrary: according to Shin, the CGN concept has significant and serious restrictions as well as implications for the Internet’s end-to-end design principle. “The last thing we would want is the existence of a CGN to slow IPv6 adoption,” he said. Instead, Shin suggests employing CGN as a backward-compatible mechanism for the purpose of speeding along IPv6 adoption. “It will do so by ensuring an incremental deployability mechanism that does not exclude or alienate v4 hosts [nor v4 content] once deployed,” he said. Once such a model is supported, network operators will be able to see a clear transition path to IPv6 that contains neither product cliffs nor flagship upgrades.
Shin warned that the dual-stack lite’s CGN component may necessarily limit each customer’s number of concurrent sessions. TCP and UDP allow for only 65,535 total source ports per single IP address. As IPv4 addresses become scarce, a single public IPv4 address must support many CPE routers, each with several hosts behind it. How many hosts can be supported by one IPv4 address depends on the number of concurrent TCP and UDP connections being made by the average host.
Panel discusses
Figure 1: When concurrent connections are reduced, an image may not be able to load appropriately
To illustrate that point, Shin offered the example of browser connections to a Google Maps display of San Francisco International Airport, an application that employs AJAX technology. One characteristic of AJAX is that it simultaneously makes many discreet HTTP connections from the host to the server in order to pull down different small “pieces” of the content all at the same time (see Figure 1). As Shin demonstrated, if the session count is limited to 30 concurrent connections, the map loads appropriately. If it is limited to 20, one block of the picture is missing. If it is limited to 15, only 35 percent of the picture’s blocks are successfully received. At a limit of 5 connections, the browser throws an error message. If each user needs only one such application connection at a time, then one IPv4 address would serve approximately 2,100 hosts. This 30-concurrent-connections number is for Google Maps only. The NTT Communications research team has observed iTunes opening 230-270, Amazon grabbing 90, YouTube pulling 90, and OCN’s Photo Friend consuming 170-200.
If one estimates an average of 500 open connections from a host-allowing for no safety buffer-one could infer for a CGN deployment a user-to-IPv4-address ratio of about 130:1. An 8:1 ratio would allow for a worst case, of about 8,200 simultaneous per-user connections. And for a case where multiple computers are all connecting from the same customer premise, a 20:1 ratio would allow for a worst case of about 3,300. What is the right ratio to use?
After warning of the CGN issues, Shin proceeded to offer a graphical, time-lapsed, step-by-step progression of how an operator might transition to an IPv6 network by using a dual-stack-lite ser-vice architecture. This transition plan offers incremental deployment and IPv4 backward compatibility. The operator starts by enabling IPv6 on its peering routers and backbone. Then the CGN element/function is added, which logically sits north of the operator’s access concentrator in the POP. The operator may then place a private IPv4 address on the CPE router’s provider-edge-facing (PE) interface. This IP will be NAT’ed by the CGN sitting in the operator infrastructure. This step addresses the decreasing availability of routable IPv4 addresses.
Step two introduces IPv6 on the customer side of the CPE, a client-based Softwire tunnelling solution from the customer’s hosts, and a tunnelling concentrator in the POP. This solution encapsulates IPv6 over IPv4 by using L2TP as the encapsulating protocol. A client-side software component sits on the customer’s host, and a networking device sitting north of the CGN terminates the L2TP tunnel in the operator’s network. At this point, the deployed network supports dual-stack customer hosts and delivers to those hosts connectivity to both v4 and v6 content.
As new customer deployments occur, Step 3 involves moving the Softwire v6-in-L2TP-over-v4 client function off the hosts and into the CPE router. This allows the clients sitting on the CPE’s private side to contain any or all of IPv4-only, IPv6-only, or IPv4/IPv6 dual-stack hosts while still providing access to either native v4 or native v6 Internet content.
Step 4 upgrades the provider edge (PE) access concentrator to be IPv4/IPv6 dual stack. Note that the Softwire tunnelling mechanism is required only until such time as both the PE access concentrator and the CPE support v4/v6 dual stack. Once both can run IPv6 natively, the operator has no further need for the tunnelling mechanism. This captures the attractiveness of the proposed transition plan: any of the key pieces-PE access concentrator, CPE router, or end-host system-can be combined in any combination of their v4-only or dual-stack support, and still, the operator will be able to deliver a v4/v6 service. This provides true incremental deployability for operators, saving them from costly forklift upgrades (for end hosts, CPE gear, or access concentrators) and providing them with a grow-as-you-go transition. The CGN remains in the network until the provider was prepared to end the life of the IPv4 service.
NTT is considering putting in place by spring 2010 a service as described earlier-before the IPv4 address completion. NTT is working with other ISPs on the same architecture, and such was discussed extensively at a recent Internet Area interim meeting on the v4-to-v6 topic. In the assistance of various enterprises, application service providers, schools, and governmental agencies with dual-stack deployments, Shin notes, externally facing systems (e.g., Web, e-mail, and DNS) must be IPv6 capable first; then the customers’ other, internal systems follow.
In addition to the aforementioned dual-stack proposal, the NTT group in Japan has already deployed a commercialized IPv6 service to over 5 million customers. This solution uses a highly controlled (i.e., walled garden), all-IPv6 network, including endpoints, to deliver specialized value-based services to end users.
What can the IETF do to hasten IPv6 adoption? According to Shin, first is an additional IPv4 private address space allocation for carrier/operator access network equipment that sits in the IETF’s internal infrastructure devices, behind a CGN. Next would be defining a simple security scheme for IPv6 (see page 23). Implementations of IPv6 DNS deployments need wider dispersion. Multiprotocol label switching (MPLS) with IPv6 support must exist in the network devices. Though commercially available IPv6 supporting firewalls have been available since NetScreen (now Juniper) released its in the early 2000s, other security devices-like IDP, IPS, and Web filtering-are still awaited, as are load balancers.
A Simple Call to Action
Lorenzo Colitti, Network Engineer and Researcher, Google
Google has one of the only large content sites deploying IPv6 today. Explaining why the company made the investment, Lorenzo stated, “When the day comes that users have only IPv6, they will need to be able to get to Google. That’s the long-term view.” He identified several shorter-term reasons for the deployment, including lower latency and packet loss, AJAX applications breaking behind excessive NAT (as described in detail by Shin), and the irritation of NAT traversal mechanisms, such as STUN. The year 2011 is when Google foresees the RIR IPv4 address pool exhaustion to their ISPs and PIs, and they point to IPv6 as the only sensible solution. Starting as early as possible will ensure deployment is ready in time, if not well before. The Google IPv6 effort began as a side (20 percent) project on the part of a few employees. Once others caught wind of ipv6.google.com, they jumped in alongside Lorenzo and team, and now Gmail and News are IPv6 enabled too. They built a pilot network and ran the infrastructure at an IPv6 conference, proving that it worked.
As more and more people wanted to get IPv6 running for their applications, the team grew and they scaled up the pilot. Even though it was a pilot, they dispelled the notion that it was experimental, which could lead to skimping on quality. The key lay in incremental growth. A pilot IPv6 network doesn’t have to be as scalable or as capable as an IPv4 network on day one, but it does need the same types of production services as soon as possible, as are found in IPv4 networks, including monitoring, support, documentation, written quality standards, and audits.
Start small, and make steady progress. In addition, Lorenzo urged that, whenever possible, one should design the IPv6 deployment to be as similar as possible to one’s IPv4 network. “Every time I made a design decision that wasn’t the same as IPv4, it turned out to bite me down the road,” he said.
Lorenzo counselled against the use of tunnels in interdomain routing, citing increased latency and difficulty in debugging. Also, today most IPv6 operators are indiscriminately giving transit to any other IPv6 operator, which slows convergence, increases round-trip times, and creates partial visibility for yours and others’ networks. Some transit providers have incomplete IPv6 routing tables that cause black holes for those routes. The solution is direct peering with quality IPv6 networks, yielding direct contacts by which to address and improve routing and connectivity issues. “Don’t assume the current IPv6 Internet works,” he said. “On the other hand, get involved. The only way to accelerate the progress is to accelerate the involvement.”
Lorenzo’s IPv6 product feature/capability wish list included MPLS traffic engineering, mature load balancing, IPv4-style multihoming, and hardware processing for both 6to4 and extension header filtering. Lorenzo notes that today they have to drop at the edge of their network every IPv6 packet that is not clearly TCP, UDP or ICMP due to a lack of hardware filtering for extension headers. IPv6-style multiple-address multihoming has not worked well. Failovers break TCP connections. Lorenzo says HIP and SHIM6 do support failovers, but then new connections see timeouts; both lack load balancing or traffic engineering from the network side, which are features present in v4. Without those features it’s tough to make large-scale applications deployable. Lorenzo also says multihoming ought to be allowed using /48 prefixes. He expressed the need for /127′s on point-to-point links (currently prohibited by RFC 4291) to help avoid denial-of-service attacks, and VRRP for v6 because neighbor unreachability is not fast enough.
NAT-PT is another item big on Lorenzo’s list because, he says, it will lead to an all-IPv6 network more quickly than dual-stack lite will. He argues that once IPv4 address allocations slow significantly, parts of the network will be able to serve hosts an IPv6 address only. Of course, all IPv4 content will not be served immediately on v6, so v6-only hosts will, for some time, still need to reach v4-only sites. Using something like NAT-PT transforms the content deployment problem into an application porting problem. However, NAT-PT is deprecated in RFC 4966. “All of the draw-backs of RFC 4966 are really drawbacks of NAT, and they are all present in v4 NAT too,” said Lorenzo. Like Shin, Lorenzo doesn’t like NATs-or the NAT mechanisms in NAT-PT. However, being an IPv6 champion, he feels that incremental transition mechanisms are key to hastened adoption. “If we want to reclaim the end-to-end principle, then we must do it with IPv6.” And in order to do that, Lorenzo called for a barebones standard that addresses a v6 host connecting to a v4 server. This would require a DNS application layer gateway. The focus should be on network-based translation scenarios, not on a host-based solution. “[End-to-end connectivity] can happen in v6 but not while we still have v4 around.” Lorenzo thinks NAT-PT’s presence will lower the value of IPv4 on hosts, and operators and users will opt for IPv6 hosts, with NAT-PT fronting the v4 applications. As soon as the content is v6, the NAT-PT function will be removed, and it’s pure v6 from there.
First Impressions Are Everything
Stuart Cheshire, Wizard without Portfolio at Apple
Apple chose IPv6 link local addressing for the AirPort Express wireless base station because of the auto configuration features that require the user to do nothing to get LAN-based printing, streaming music, and network administration running. The solution has been more reliable and works better than IPv4 in a single-network home. The Internet, as Stuart pointed out, is a different story. Five elements interact to make an IPv6 solution work for the customer across the Internet: the operating system, application software (such as a Web browser), home network, ISP, and content (such as Web sites).
Without any one piece, the solution fails. Content is the key. Without IPv6 content, ISPs have no incentive to carry IPv6. As Stuart said, if a customer cannot get IPv6 from the ISP, then there’s no reason for content accessible via IPv6. If the browser is not IPv6 enabled, then the customer will not be able to access IPv6 content and therefore will not purchase IPv6 connectivity. If the OS is not v6 ready, then apps can’t be either. Incentives must exist for all of the players. Apple’s incentive was the so-called coolness factor of IPv6, so now Apple’s OS, Apple’s browser, and most of Apple’s networking apps support it. “Now we must find compelling incentives for the other three pieces to support v6,” encouraged Stuart. “Or, at the very least, make sure there are no disincentives.”
To drive home the point, Stuart described an application-level issue that Apple faced with regard to its Safari Web browser and certain performance delays associated with dual-stack clients. When a dual-stack-capable Web browser connects to the Internet, it first conducts an AAAA record lookup, then it does an A (Address) record lookup and tries an IPv6 connection. If that fails, it tries an IPv4 connection. Everything works as long as this series of events occurs quickly, including any failures. Unfortunately, lack of AAAA responses and IPv6 connection failures are common.
Apple faced an issue regarding a big-name Web site. Customers complained that the site was really slow. Upon investigation, Apple discovered that the site’s DNS servers did not send valid responses to AAAA queries. Either such sites do not respond to an AAAA query, or they send back a mangled, malformed response. The connection sequence blocks are waiting for an answer that isn’t coming. The user perceives this as application slowness, which started occurring when the user’s computer first got an IPv6 address.
The root issue is the getaddrinfo() API, which blocks waiting for an IPv6 address query that may never be answered. Because the problems first appeared when the ISP started offering IPv6 service, the issue landed in the ISPs’ laps. This is bad for the industry because both the customer and the ISP get a bad impression about IPv6. These thorny disincentives must be removed if we are to hasten deployment.
Apple’s implementation now disassociates the IPv4 and IPv6 tracks. The tracks perform the AAAA and A queries in parallel, and they try the IPv4 and IPv6 http connections in parallel, taking the first response and resetting the second. Failures or hangs at either step, on either track, no longer hang the user experience.
The getaddrinfo() API was the problem because it exposes addresses to the application when it shouldn’t. Applications don’t need to know about Ethernet addresses, and they don’t need to map IP addresses to Ethernet addresses; the kernel ought to do that for them with ARP. Likewise, an app should not be involved in mapping DNS names to addresses. The app should just tell the system, “Here are a name and an application/service. Please connect me to it.” Apple uses a connect-by-name API so that applications don’t even have to know or care whether the underlying connection is IPv4 or IPv6. Both Java and Windows have similar APIs.
The moral, according to Stuart, is that as we move toward IPv6, when you build an app, avoid getaddrinfo() and such APIs. Instead, use concurrency and asynchrony. Yes, these new mechanisms will send extra packets and initially open more connections than will actually be used. The first one that succeeds will proceed, while the others will be reset. This is the right design decision for IPv6. “We are trading off a few extra packets and connections to vastly improve the user experience,” said Stuart. “And that’s the point: let’s make sure to remove the barriers to transition that might otherwise make people regret their first tentative steps into IPv6 deployment and use.”
IPv6 Panel Takes Questions from the Floor
What are the biggest operational issues percolating up from the network administration staff?
Alain Durand:
IPv6 addresses are difficult to type. I often ask people to write down an IPv6 address and read it back over the phone. Of all the attempts, only one person has succeeded in repeating the address correctly. So we must avoid IPv6 addresses as much as possible, and we must be more ardent DNS users.
Shin Miyakawa:
It’s not technical, but the lack of education of the customer-facing support staff. We don’t want the front-line staff answering support calls by saying, “What is IPv6? I don’t know anything about it.” Getting IPv6 into all the training manuals and achieving a basic level of familiarity across all levels of staff are the hardest things NTT has faced.
Lorenzo Colitti:
Failure to follow familiar IPv4 design principles. There is muscle memory there, and so people just naturally try to do an operation the v4 way, but then something breaks, or it doesn’t work. They don’t know why, and they don’t know where to find the answer. Training everyone that something must be done differently in this situation is a challenge and takes time. Putting safeguards in place, like deployment templates, helps keep people from such mistakes.
Are you able to get the equipment you need? What are the equipment gaps?
Alain:
The back-office applications are the most difficult.
Mark Kosters:
The RIRs are putting our money where our mouths are by making our services available on IPv6. Some of the middle boxes such as load balancers are not really ready yet with their IPv6 support. Also, their technical support and best practices are not mature, so we do not get as much consultative assistance as we would expect.
Are you driving IPv6 to your customers, or are your customers driving you to IPv6?
Shin:
We are pushing customers to use IPv6. We need IPv6 because we have a lack of resources from which to offer customers advanced services.
Alain:
Many customers want to access their e-mail, browse the Web, and download a video from YouTube. I don’t think they care whether this gets accomplished over IPv4, IPv6, or avian carrier [RFC 1149]. What matters is that we can keep the services of the Internet growing regardless of whether we have IPv4 or are out of v4 and need IPv6.
Mark:
The research is pretty conclusive that people see that IPv4 works now, and so they feel no need for IPv6. They see IPv6 as a capital cost for them. The question arises: Where does the money come from that will help us solve a problem that we don’t have right now?
Gregory Lebovitz:
It appears unanimous that we are driving IPv6, not the customers, because we need to produce new services that customers do want, and we do not have enough IPv4 addresses going forward to accomplish the task. We need IPv6 as an enabler. If customers are not begging us for IPv6, then the stakes are very high for us to make its presence very transparent to users-or risk its rejection. It has to be invisible and usable by the “grandmother living in the countryside,” as Shin says.
NATs in the middle can break things and create walled gardens. Is it possible to demand that DOCSIS put NATs at the ends?
Alain:
DOCSIS is layer 2, not layer 3. We are not talking about centralized carrier NAT. The question is, Where is this divide in the network? I agree that this is bad and that it could provide a single point of failure and that NATs need to get close to the customer. I suggest talking to the application developers.
Is it possible to do some analysis to figure out how much it will cost an end user to have a public IPv4 address? Could this be an incentive for using IPv6?
Shin:
NTT is currently that kind of research.
Mark:
There is a new policy proposal that is related to IPv4 address transfers. One aspect of transfer is market-based transfer, which currently is not allowed by RIR policy. ARIN asked a lawyer to look into this, and the answer is that an open market would be best.
What is the state of readiness of IPv6 DHCP [Dynamic Host Configuration Protocol]?
Alain:
The DHCP community has worked quite a bit with vendors recently, and the results are quite promising. (Editor’s note: See articles on IPv6 DHCP back-offs in recent editions of the IETF Journal).
Applications developers are waiting for the peer-to-peer readiness of IPv6. Do you see inbound connectivity to the home as compelling-enough motivation?
Stuart: I agree that inbound connectivity is the only compelling reason to use IPv6. Everything else is currently also available on IPv4. So, the only reason is that it gives me unhindered peer-to-peer connectivity.
Related Links
|
{
"url": "https://www.ietfjournal.org/ipv6-deployment-lessons-from-the-trenches/",
"source_domain": "www.ietfjournal.org",
"snapshot_id": "crawl=CC-MAIN-2021-25",
"warc_metadata": {
"Content-Length": "86504",
"Content-Type": "application/http; msgtype=response",
"WARC-Block-Digest": "sha1:2FOHLN7DMVR4SWNDGNIAWGZAUP4AHA2H",
"WARC-Concurrent-To": "<urn:uuid:c5eb1477-7808-4595-ab22-a9a0c33dc630>",
"WARC-Date": "2021-06-20T06:58:59Z",
"WARC-IP-Address": "104.18.9.162",
"WARC-Identified-Payload-Type": "text/html",
"WARC-Payload-Digest": "sha1:KF7N75SDOBZ7V3XSHPXRQZJ3QLT6A5VP",
"WARC-Record-ID": "<urn:uuid:192be8cd-5e16-4992-b0ec-c57105b45e8b>",
"WARC-Target-URI": "https://www.ietfjournal.org/ipv6-deployment-lessons-from-the-trenches/",
"WARC-Truncated": null,
"WARC-Type": "response",
"WARC-Warcinfo-ID": "<urn:uuid:7bc742c1-f903-421a-aed5-13ffdafa3256>"
},
"warc_info": "isPartOf: CC-MAIN-2021-25\r\npublisher: Common Crawl\r\ndescription: Wide crawl of the web for June 2021\r\noperator: Common Crawl Admin (info@commoncrawl.org)\r\nhostname: ip-10-67-67-98.ec2.internal\r\nsoftware: Apache Nutch 1.18 (modified, https://github.com/commoncrawl/nutch/)\r\nrobots: checked via crawler-commons 1.2-SNAPSHOT (https://github.com/crawler-commons/crawler-commons)\r\nformat: WARC File Format 1.1\r\nconformsTo: https://iipc.github.io/warc-specifications/specifications/warc-format/warc-1.1/"
}
|
{
"line_start_idx": [
0,
16,
17,
60,
61,
85,
86,
108,
109,
126,
142,
182,
183,
842,
843,
869,
870,
1264,
1265,
1906,
1907,
2290,
2291,
2649,
2650,
2888,
2889,
2908,
2909,
2954,
2955,
2971,
2972,
3652,
3653,
4849,
4850,
6121,
6122,
6145,
6146,
7245,
7246,
7265,
7266,
7795,
7981,
7982,
8019,
8020,
8097,
8533,
8534,
9324,
9325,
10242,
10243,
10259,
10282,
10283,
11086,
11087,
11792,
11793,
12855,
12856,
14236,
14237,
14268,
14269,
14344,
15410,
15411,
15881,
15882,
15898,
15996,
15997,
17076,
17077,
17527,
17528,
18274,
18275,
18837,
18838,
19198,
19199,
20121,
20122,
20681,
20998,
20999,
21704,
21705,
21729,
21730,
21787,
22855,
22856,
23420,
23421,
23719,
23720,
24471,
24472,
25499,
25500,
27046,
27047,
27080,
27081,
27132,
27735,
27736,
28530,
28531,
29112,
29113,
29629,
29630,
30037,
30038,
30360,
30361,
30995,
30996,
31675,
31676,
31718,
31719,
31813,
31814,
31828,
31829,
32127,
32142,
32143,
32496,
32497,
32514,
32974,
32975,
33048,
33049,
33056,
33109,
33110,
33124,
33450,
33451,
33534,
33535,
33541,
33677,
33678,
33685,
34018,
34019,
34025,
34289,
34290,
34308,
34790,
34791,
34913,
34914,
34921,
35232,
35233,
35390,
35391,
35397,
35437,
35438,
35444,
35705,
35706,
35789,
35790,
35797,
35992,
35993,
36146,
36147,
36363,
36364
],
"line_end_idx": [
16,
17,
60,
61,
85,
86,
108,
109,
126,
142,
182,
183,
842,
843,
869,
870,
1264,
1265,
1906,
1907,
2290,
2291,
2649,
2650,
2888,
2889,
2908,
2909,
2954,
2955,
2971,
2972,
3652,
3653,
4849,
4850,
6121,
6122,
6145,
6146,
7245,
7246,
7265,
7266,
7795,
7981,
7982,
8019,
8020,
8097,
8533,
8534,
9324,
9325,
10242,
10243,
10259,
10282,
10283,
11086,
11087,
11792,
11793,
12855,
12856,
14236,
14237,
14268,
14269,
14344,
15410,
15411,
15881,
15882,
15898,
15996,
15997,
17076,
17077,
17527,
17528,
18274,
18275,
18837,
18838,
19198,
19199,
20121,
20122,
20681,
20998,
20999,
21704,
21705,
21729,
21730,
21787,
22855,
22856,
23420,
23421,
23719,
23720,
24471,
24472,
25499,
25500,
27046,
27047,
27080,
27081,
27132,
27735,
27736,
28530,
28531,
29112,
29113,
29629,
29630,
30037,
30038,
30360,
30361,
30995,
30996,
31675,
31676,
31718,
31719,
31813,
31814,
31828,
31829,
32127,
32142,
32143,
32496,
32497,
32514,
32974,
32975,
33048,
33049,
33056,
33109,
33110,
33124,
33450,
33451,
33534,
33535,
33541,
33677,
33678,
33685,
34018,
34019,
34025,
34289,
34290,
34308,
34790,
34791,
34913,
34914,
34921,
35232,
35233,
35390,
35391,
35397,
35437,
35438,
35444,
35705,
35706,
35789,
35790,
35797,
35992,
35993,
36146,
36147,
36363,
36364,
36377
]
}
|
{
"red_pajama_v2": {
"ccnet_original_length": 36377,
"ccnet_original_nlines": 186,
"rps_doc_curly_bracket": 0,
"rps_doc_ldnoobw_words": 1,
"rps_doc_lorem_ipsum": 0,
"rps_doc_stop_word_fraction": 0.3858114778995514,
"rps_doc_ut1_blacklist": 0,
"rps_doc_frac_all_caps_words": 0.02721088007092476,
"rps_doc_frac_lines_end_with_ellipsis": 0,
"rps_doc_frac_no_alph_words": 0.16090518236160278,
"rps_doc_frac_unique_words": 0.28710171580314636,
"rps_doc_mean_word_length": 5.016016483306885,
"rps_doc_num_sentences": 330,
"rps_doc_symbol_to_word_ratio": 0,
"rps_doc_unigram_entropy": 6.241741180419922,
"rps_doc_word_count": 5869,
"rps_doc_frac_chars_dupe_10grams": 0,
"rps_doc_frac_chars_dupe_5grams": 0.0033968500792980194,
"rps_doc_frac_chars_dupe_6grams": 0.0023777999449521303,
"rps_doc_frac_chars_dupe_7grams": 0.0023777999449521303,
"rps_doc_frac_chars_dupe_8grams": 0.0023777999449521303,
"rps_doc_frac_chars_dupe_9grams": 0.0023777999449521303,
"rps_doc_frac_chars_top_2gram": 0.005774649791419506,
"rps_doc_frac_chars_top_3gram": 0.0019022399792447686,
"rps_doc_frac_chars_top_4gram": 0.0012228699633851647,
"rps_doc_books_importance": -3097.126953125,
"rps_doc_books_importance_length_correction": -3097.126953125,
"rps_doc_openwebtext_importance": -1916.593017578125,
"rps_doc_openwebtext_importance_length_correction": -1916.593017578125,
"rps_doc_wikipedia_importance": -1112.9547119140625,
"rps_doc_wikipedia_importance_length_correction": -1112.9547119140625
},
"fasttext": {
"dclm": 0.03631085157394409,
"english": 0.9415361285209656,
"fineweb_edu_approx": 1.9988983869552612,
"eai_general_math": 0.24690431356430054,
"eai_open_web_math": 0.16596895456314087,
"eai_web_code": 0.21057641506195068
}
}
|
{
"free_decimal_correspondence": {
"primary": {
"code": "004.677",
"labels": {
"level_1": "General works, books and libraries, information sciences",
"level_2": "",
"level_3": "Computers and Computer science"
}
},
"secondary": {
"code": "004.67",
"labels": {
"level_1": "General works, books and libraries, information sciences",
"level_2": "",
"level_3": "Computers and Computer science"
}
}
},
"bloom_cognitive_process": {
"primary": {
"code": "4",
"label": "Analyze"
},
"secondary": {
"code": "5",
"label": "Evaluate"
}
},
"bloom_knowledge_domain": {
"primary": {
"code": "2",
"label": "Conceptual"
},
"secondary": {
"code": "3",
"label": "Procedural"
}
},
"document_type_v1": {
"primary": {
"code": "3",
"label": "Reference/Encyclopedic/Educational"
},
"secondary": {
"code": "-1",
"label": "Abstain"
}
},
"extraction_artifacts": {
"primary": {
"code": "3",
"label": "Irrelevant Content"
},
"secondary": {
"code": "0",
"label": "No Artifacts"
}
},
"missing_content": {
"primary": {
"code": "4",
"label": "Missing Images or Figures"
},
"secondary": {
"code": "0",
"label": "No missing content"
}
},
"document_type_v2": {
"primary": {
"code": "10",
"label": "Knowledge Article"
},
"secondary": {
"code": "8",
"label": "Documentation"
}
},
"reasoning_depth": {
"primary": {
"code": "3",
"label": "Intermediate Reasoning"
},
"secondary": {
"code": "4",
"label": "Advanced Reasoning"
}
},
"technical_correctness": {
"primary": {
"code": "4",
"label": "Highly Correct"
},
"secondary": {
"code": "3",
"label": "Mostly Correct"
}
},
"education_level": {
"primary": {
"code": "3",
"label": "Undergraduate Level"
},
"secondary": {
"code": "4",
"label": "Graduate/Expert Level"
}
}
}
|
672f1e42c33a7f9846924a2431ea77df
|
5,670,541,633,758,938,000
|
Deploying with QuintupleO
QuintupleO is short for OpenStack on OpenStack on OpenStack. It was the original name for OVB, and has been repurposed to indicate that this deployment method is able to deploy a full TripleO development environment in one command. It should be useful for non-TripleO users of OVB as well, however.
1. Copy the example env file and edit it to reflect the host environment:
cp environments/base.yaml env.yaml
vi env.yaml
2. Deploy a QuintupleO stack. The example command includes a number of environment files intended to simplify the deployment process or make it compatible with a broader set of host clouds. However, these environments are not necessary in every situation and may not even work with some older clouds. See below for details on customizing an OVB deployment for your particular situation:
bin/deploy.py --quintupleo -e env.yaml -e environments/all-networks-port-security.yaml -e environments/create-private-network.yaml
Note
There is a quintupleo-specific option --id in deploy.py. It appends the value passed in to the name of all resources in the stack. For example, if undercloud_name is set to ‘undercloud’ and --id foo is passed to deploy.py, the resulting undercloud VM will be named ‘undercloud-foo’. It is recommended that this be used any time multiple environments are being deployed in the same cloud/tenant to avoid name collisions.
Be aware that when --id is used, a new environment file will be generated that reflects the new names. The name of the new file will be env-${id}.yaml. This new file should be passed to build-nodes-json instead of the original.
Note
See Advanced Options for other ways to customize an OVB deployment.
3. Wait for Heat stack to complete. To make this easier, the --poll option can be passed to deploy.py.
Note
The BMC instance does post-deployment configuration that can take a while to complete, so the Heat stack completing does not necessarily mean the environment is entirely ready for use. To determine whether the BMC is finished starting up, run nova console-log bmc. The BMC service outputs a message like “Managing instance [uuid]” when it is fully configured. There should be one of these messages for each baremetal instance.
heat stack-show quintupleo
4. Build a nodes.json file that can be imported into Ironic:
bin/build-nodes-json
scp nodes.json centos@[undercloud floating ip]:~/instackenv.json
Note
Only the base environment file needs to be passed to this command. Additional option environments that may have been passed to the deploy command should not be included here.
Note
If --id was used to deploy the stack, make sure to pass the generated env-${id}.yaml file to build-nodes-json using the --env parameter. Example:
bin/build-nodes-json --env env-foo.yaml
Note
If roles were used for the deployment, separate node files named nodes-<profile>.json will also be output that list only the nodes for that particular profile. Nodes with no profile specified will go in nodes-no-profile.json. The base nodes.json will still contain all of the nodes in the deployment, regardless of profile.
Note
build-nodes-json also outputs a file named bmc_bm_pairs that lists which BMC address corresponds to a given baremetal instance.
Deleting an OVB Environment
All of the OpenStack resources created by OVB are part of the Heat stack, so to delete the environment just delete the Heat stack. There are a few local files that may also have been created as part of the deployment, such as ID environment files, nodes.json files, and bmc_bm_pairs. Once the stack is deleted these can be removed safely as well.
Advanced Options
There are also a number of advanced options that can be enabled for a QuintupleO deployment. For each such option there is a sample environment to be passed to the deploy command.
For example, to deploy using the Neutron port-security extension to allow DHCP and PXE booting, the following command could be used:
bin/deploy.py --quintupleo -e env.yaml -e environments/port-security.yaml
Important
When deploying with multiple environment files, env.yaml must be explicitly passed to the deploy command. deploy.py will only default to using env.yaml if no environments are specified.
Some options may have additional configuration parameters. These parameters will be listed in the environment file.
A full list of the option environments available can be found at Sample Environment Index.
Network Isolation
There are a number of environments related to enabling the network isolation functionality in OVB. These environments are named all-networks*.yaml and cause OVB to deploy additional network interfaces on the baremetal instances that allow the use of TripleO’s network isolation.
Note
There are templates suitable for doing a TripleO overcloud deployment with network isolation in the overcloud-templates directory. See the readme files in those directories for details on how to use them.
The v2 versions of the templates are suitable for use with the TripleO Ocata release and later. The others can be used in Newton and earlier.
Three primary networking layouts are included:
• Basic. This is the default and will only deploy a provisioning interface to the baremetal nodes. It is not suitable for use with network isolation.
• All Networks. This will deploy an interface per isolated network to the baremetal instances. It is suitable for use with any of the overcloud network isolation templates not starting with ‘bond’.
• All Networks, Public Bond. This will also deploy an interface per isolated network to the baremetal instances, but it will additionally deploy a second interface for the ‘public’ network that can be used to test bonding in an OVB environment. The bond-* overcloud templates must be used with this type of environment.
Each of the networking layouts has two variations: with and without the use of Neutron’s port-security extension. The reason for this is that older releases of OpenStack did not support port-security, so those templates cannot be used. However, use of the port-security extension allows OVB to work on a much larger number of clouds because it does not require insecure Neutron settings.
While the port-security extension existed as far back as the Liberty release, it has only been successfully tested with OVB on Newton and above.
The port-security environments can be recognized by the presence of port-security somewhere in the filename. Network environments without that substring are the standard ones that require the noop Neutron firewall driver.
|
{
"url": "http://openstack-virtual-baremetal.readthedocs.io/en/latest/deploy/quintupleo.html",
"source_domain": "openstack-virtual-baremetal.readthedocs.io",
"snapshot_id": "crawl=CC-MAIN-2018-09",
"warc_metadata": {
"Content-Length": "22817",
"Content-Type": "application/http; msgtype=response",
"WARC-Block-Digest": "sha1:GFNGLOVVXZRLMQJJTFYFGYRFGFU76G7T",
"WARC-Concurrent-To": "<urn:uuid:c110da47-aec7-4e3d-a71e-2c65a9d09238>",
"WARC-Date": "2018-02-20T05:58:55Z",
"WARC-IP-Address": "162.242.198.235",
"WARC-Identified-Payload-Type": "text/html",
"WARC-Payload-Digest": "sha1:U3YWLE7W4FC6UZ5HH3SDDJ2T4EKTJD3J",
"WARC-Record-ID": "<urn:uuid:f73b4061-5237-43bd-9a34-1ee4445bbd4b>",
"WARC-Target-URI": "http://openstack-virtual-baremetal.readthedocs.io/en/latest/deploy/quintupleo.html",
"WARC-Truncated": null,
"WARC-Type": "response",
"WARC-Warcinfo-ID": "<urn:uuid:831f18b9-7580-4fad-b0c2-c0c3984c8df6>"
},
"warc_info": "robots: classic\r\nhostname: ip-10-165-204-187.ec2.internal\r\nsoftware: Nutch 1.6 (CC)\r\nisPartOf: CC-MAIN-2018-09\r\noperator: Common Crawl Admin\r\ndescription: Wide crawl of the web for February 2018\r\npublisher: Common Crawl\r\nformat: WARC File Format 1.0\r\nconformsTo: http://bibnum.bnf.fr/WARC/WARC_ISO_28500_version1_latestdraft.pdf"
}
|
{
"line_start_idx": [
0,
26,
27,
326,
327,
403,
404,
443,
459,
464,
853,
854,
989,
994,
995,
1004,
1005,
1429,
1430,
1662,
1663,
1672,
1673,
1745,
1746,
1851,
1852,
1861,
1862,
2293,
2294,
2325,
2330,
2393,
2394,
2419,
2488,
2493,
2494,
2503,
2504,
2683,
2684,
2693,
2694,
2844,
2845,
2889,
2894,
2895,
2904,
2905,
3233,
3234,
3243,
3244,
3376,
3377,
3405,
3406,
3753,
3754,
3771,
3772,
3952,
3953,
4086,
4087,
4161,
4162,
4172,
4173,
4359,
4360,
4476,
4477,
4568,
4569,
4587,
4588,
4867,
4868,
4873,
4874,
5079,
5080,
5222,
5223,
5270,
5271,
5423,
5623,
5945,
5946,
6334,
6335,
6480,
6481
],
"line_end_idx": [
26,
27,
326,
327,
403,
404,
443,
459,
464,
853,
854,
989,
994,
995,
1004,
1005,
1429,
1430,
1662,
1663,
1672,
1673,
1745,
1746,
1851,
1852,
1861,
1862,
2293,
2294,
2325,
2330,
2393,
2394,
2419,
2488,
2493,
2494,
2503,
2504,
2683,
2684,
2693,
2694,
2844,
2845,
2889,
2894,
2895,
2904,
2905,
3233,
3234,
3243,
3244,
3376,
3377,
3405,
3406,
3753,
3754,
3771,
3772,
3952,
3953,
4086,
4087,
4161,
4162,
4172,
4173,
4359,
4360,
4476,
4477,
4568,
4569,
4587,
4588,
4867,
4868,
4873,
4874,
5079,
5080,
5222,
5223,
5270,
5271,
5423,
5623,
5945,
5946,
6334,
6335,
6480,
6481,
6702
]
}
|
{
"red_pajama_v2": {
"ccnet_original_length": 6702,
"ccnet_original_nlines": 97,
"rps_doc_curly_bracket": 0.0005968399927951396,
"rps_doc_ldnoobw_words": 0,
"rps_doc_lorem_ipsum": 0,
"rps_doc_stop_word_fraction": 0.3886733949184418,
"rps_doc_ut1_blacklist": 0,
"rps_doc_frac_all_caps_words": 0.01551590021699667,
"rps_doc_frac_lines_end_with_ellipsis": 0,
"rps_doc_frac_no_alph_words": 0.15593482553958893,
"rps_doc_frac_unique_words": 0.3369351625442505,
"rps_doc_mean_word_length": 5.208251476287842,
"rps_doc_num_sentences": 89,
"rps_doc_symbol_to_word_ratio": 0,
"rps_doc_unigram_entropy": 5.161220073699951,
"rps_doc_word_count": 1018,
"rps_doc_frac_chars_dupe_10grams": 0.021878540515899658,
"rps_doc_frac_chars_dupe_5grams": 0.04677480086684227,
"rps_doc_frac_chars_dupe_6grams": 0.021878540515899658,
"rps_doc_frac_chars_dupe_7grams": 0.021878540515899658,
"rps_doc_frac_chars_dupe_8grams": 0.021878540515899658,
"rps_doc_frac_chars_dupe_9grams": 0.021878540515899658,
"rps_doc_frac_chars_top_2gram": 0.010373439639806747,
"rps_doc_frac_chars_top_3gram": 0.007544320076704025,
"rps_doc_frac_chars_top_4gram": 0.009619009681046009,
"rps_doc_books_importance": -586.4571533203125,
"rps_doc_books_importance_length_correction": -586.4571533203125,
"rps_doc_openwebtext_importance": -266.89447021484375,
"rps_doc_openwebtext_importance_length_correction": -266.89447021484375,
"rps_doc_wikipedia_importance": -131.33627319335938,
"rps_doc_wikipedia_importance_length_correction": -131.33627319335938
},
"fasttext": {
"dclm": 0.038687169551849365,
"english": 0.8837461471557617,
"fineweb_edu_approx": 2.2328124046325684,
"eai_general_math": 0.927715003490448,
"eai_open_web_math": 0.41762328147888184,
"eai_web_code": 0.8965758681297302
}
}
|
{
"free_decimal_correspondence": {
"primary": {
"code": "004.678",
"labels": {
"level_1": "General works, books and libraries, information sciences",
"level_2": "",
"level_3": "Computers and Computer science"
}
},
"secondary": {
"code": "005.44",
"labels": {
"level_1": "General works, books and libraries, information sciences",
"level_2": "",
"level_3": "Computer programming"
}
}
},
"bloom_cognitive_process": {
"primary": {
"code": "3",
"label": "Apply"
},
"secondary": {
"code": "2",
"label": "Understand"
}
},
"bloom_knowledge_domain": {
"primary": {
"code": "3",
"label": "Procedural"
},
"secondary": {
"code": "2",
"label": "Conceptual"
}
},
"document_type_v1": {
"primary": {
"code": "3",
"label": "Reference/Encyclopedic/Educational"
},
"secondary": {
"code": "4",
"label": "Code/Software"
}
},
"extraction_artifacts": {
"primary": {
"code": "0",
"label": "No Artifacts"
},
"secondary": {
"code": "3",
"label": "Irrelevant Content"
}
},
"missing_content": {
"primary": {
"code": "0",
"label": "No missing content"
},
"secondary": {
"code": "-1",
"label": "Abstain"
}
},
"document_type_v2": {
"primary": {
"code": "8",
"label": "Documentation"
},
"secondary": {
"code": "23",
"label": "Tutorial"
}
},
"reasoning_depth": {
"primary": {
"code": "3",
"label": "Intermediate Reasoning"
},
"secondary": {
"code": "2",
"label": "Basic Reasoning"
}
},
"technical_correctness": {
"primary": {
"code": "4",
"label": "Highly Correct"
},
"secondary": {
"code": "3",
"label": "Mostly Correct"
}
},
"education_level": {
"primary": {
"code": "4",
"label": "Graduate/Expert Level"
},
"secondary": {
"code": "3",
"label": "Undergraduate Level"
}
}
}
|
672f1e42c33a7f9846924a2431ea77df
|
-6,503,009,152,949,027,000
|
CDAWlib
The CDF plotting routines available here underlie the CDAWeb software; they are supplied here in a package of IDL functions and procedures called CDAWlib.
Many functions exist in CDAWlib. We do not specifically call them all out here but they are all internally documented. The software has been tested but is not guaranteed to be bug free. We will try to address problems that you may find.
Get a copy of CDAWlib
On-line Help
General Instructions
The steps below outline how to run CDAWlib.
1. This software is written in IDL and must be run on a machine with an IDL licence.
2. Make sure that you are running X on your local machine and tell the computer to send any X-windows output to your X-terminal:
> setenv DISPLAY [Ethernet address]:0
3. Copy the packages of CDAWlib to your directory.
4. With IDL Version 6.2 and above, please also download the latest CDF/IDL patch available at:
http://cdf.gsfc.nasa.gov/ and follow the installation instructions.
5. Set the environment variable IDL_PATH to include the directories where the software is located. Your IDL_PATH should look something like:
IDL_PATH=+/cdawlib/dev/source:+/usr/local/rsi/idl_6.3/lib:/usr/local/rsi/idl_6.3
Which is set on unix with a command like: setenv IDL_PATH +/home/cdaweb/dev/source:+/usr/local/rsi/idl_6.3/lib:${IDL_DIR}
6. Begin your IDL session:
idl
7. To use read_mycdf, plotmaster or list_mystruct compile the general cdaweb functions. Then follow the instructions in the sections below.
IDL>@compile_cdaweb compile the CDAWlib software
8. To use IDLmakecdf, you need to compile it separately. Then follow the instructions in the sections below.
IDL>@compile_IDLmakecdf compile IDLmakecdf
9. READ_MYCDF returns a structure containing data and attributes to the IDL command line. To plot the data in the structure "a" you can use plotmaster or you can write your own plot routines.
Return to top
READ_MYCDF
The function READ_MYCDF reads from one to many variables from one to many CDF files, and returns all data and metadata for these variables in a single structure of the form:
structure_name.variable_name.attribute_name.value
The substructure for each variable will have three fields in addition to any fields holding any metadata information. These three fields are: VARNAME, which holds the name of the variable in a case-sensitive fashion, CDFTYPE, which holds the type of the CDF variable, and DAT, which holds the actual data values.
When reading more than one CDF, metadata and non-record-varying variables are only read from the first CDF, only record-varying data is read from all CDFs.
If an error occurs while reading the CDF(s), a -1 is returned
Calling Sequence
Result = READ_MYCDF(varnames, cdfnames)
Arguments
varnames
A string or string array containing the names of the variables to be read from the CDF file(s). If specifying the variable names in a single string, then the names should be separated by a comma. NOTE: CDF is case sensitive, so the given variable names must be an exact match.
cdfnames
A string or string array containing the names of the CDF file(s) to be read. If specifying the CDF filenames in a single string, then the names should be separated by a comma. NOTE: If reading a file outside your current directory, then the full filename, including directory/path information, must be provided. If running on a UNIX system, remember that all path and file information is case-sensitive.
Keywords
ALL
This keyword has three valid values: 0 - meaning ignore, 1 - meaning read all variables (use this option if you don't know the names of the variables contained in your CDF file, and 2 - meaning read all variables with CDFTYPE = "data" and their supporting variables).
NODATASTRUCT
If this keyword is set, then the .DAT field will be replaced with a field called .HANDLE. The value of this field is a handle_id where the data is located. Using this keyword can result in a performance improvement.
NOQUIET
Set this keyword to keep from disabling obnoxious warning messages from IDL's CDF file access routines.
TSTART
String of the form '1996/01/02 12:00:00' or a DOUBLE CDF_EPOCH time that is the desired start time of the data. Data is read between this TSTART value and the TSTOP value. Default is the start time of the earliest data.
TSTOP
String of the form '1996/01/02 12:00:00' or a DOUBLE CDF_EPOCH time that is the desired stop time of the plots. Data is read between the TSTART value and this TSTOP value. Default is the stop time of the latest data.
DEBUG
Set this keyword to turn on some progress messages.
Example
a=strarr(2)
a(0)='i8_k0_mag_19951008_v01.cdf'
a(1)='i8_k0_mag_19951013_v01.cdf'
b=read_mycdf('RMS,RMS_p',a)
help,/struct,b
** Structure < 4006fca8 >, 4 tags, length=296936, refs=1:
RMS STRUCT -> < Anonymous > Array(1)
RMS_P STRUCT -> < Anonymous > Array(1)
EPOCH STRUCT -> < Anonymous > Array(1)
CARTESIAN STRUCT -> < Anonymous > Array(1)
help,/struct,b.RMS
** Structure < 400cd808 >, 32 tags, length=147488, refs=2:
VARNAME STRING 'RMS'
TITLE STRING 'IMP-8 Magnetic Field'
PROJECT STRING 'ISTP>International Solar-Terrestrial Physics'
DISCIPLINE STRING 'Space Physics>Magnetospheric Science'
SOURCE_NAME STRING 'IMP-8>Interplanetary Monitoring Platform 8'
DESCRIPTOR STRING 'MAG>Magnetic Field Investigation'
DATA_TYPE STRING 'K0>Key Parameter'
DATA_VERSION STRING '1'
TEXT STRING Array(15)
MODS STRING Array(19)
ADID_REF STRING 'NSSD0094'
LOGICAL_FILE_ID STRING 'I8_K0_MAG_19951008_V01'
FIELDNAM STRING 'Components of RMS of B (GSE)'
VALIDMIN FLOAT Array(3)
VALIDMAX FLOAT Array(3)
SCALEMIN FLOAT Array(3)
SCALEMAX FLOAT Array(3)
UNITS STRING 'nT'
UNIT_PTR STRING ''
LABLAXIS STRING ''
LABL_PTR_1 STRING Array(3)
MONOTON STRING ''
FORMAT STRING 'F7.3'
FORM_PTR STRING ''
FILLVAL FLOAT -1.00000e+31
CATDESC STRING ''
VAR_TYPE STRING 'data'
DICT_KEY STRING ''
DEPEND_0 STRING 'Epoch'
DEPEND_1 STRING 'cartesian'
CDFTYPE STRING 'CDF_REAL4'
DAT FLOAT Array(3, 12206)
Return to top
PLOTMASTER
Important Note: In plotting each variable, PLOTMASTER looks for the associated attribute, DISPLAY_TYPE, and uses the value to determine how to plot the variable. If the attribute is not present, then PLOTMASTER uses a set of rules to determine how to plot the variable. For simple scalar variables the rules work well, but for complex dimensional variables the rules break down. For ISTP CDF data, we strongly recommend the use of our master CDFs (containing only the metadata - variable names and attributes) to be read along with the data. PLOTMASTER will then read the metadata out of the master CDF (PLOTMASTER reads the metadata only out of the first CDF of each type) and use that metadata for all decision making.
Get Master CDFs
Recommendation: When plotting variables use the /auto keyword (this turns on autoscaling)!
This function accepts from 1 to 10 structures of the type returned by READ_MYCDF and XREAD_MYCDF, determines the plot type for each variable in each of the structures, and plots it. Returns a 0 if plotting was successful, and a -1 if unsuccessful.
Calling Sequence
Result = PLOTMASTER(astruct1,[astruct2...astruct10], /keyword)
Arguments
astruct
A structure returned by the READ_MYCDF or XREAD_MYCDF functions. This structure, if the call to read_mycdf or Xread_mycdf was sucessful, will contain many elements useful in plotting and listing the data, as well as the data itself. Please refer to the description of READ_MYCDF.
Keywords
XSIZE
The width of the plot (in pixels). Default for GIF file is 640, default for x-windows is 90% of the screen resolution.
PANEL_HEIGHT
The height of each panel (in pixels). Default is 100 pixels.
TSTART
String of the form '1996/01/02 12:00:00' or a DOUBLE CDF_EPOCH time that is the desired start time of the plots. Data is clipped or padded to conform to this time. Default is the start time of the earliest data.
TSTOP
String of the form '1996/01/02 12:00:00' or a DOUBLE CDF_EPOCH time that is the desired stop time of the plots. Data is clipped or padded to conform to this time. Default is the stop time of the latest data.
GIF
Set to send plot(s) to a gif file (must be using IDL 5.3 for the gif option), ie. /GIF or GIF=1L. If set a file will be produced in the current working directory (see OUTDIR keyword), using the following naming conventions: Spacecraft_instrument_pid_# (see the PID keyword for customization). If GIF is not set then the plot(s) will be put into an x-window.
PID
May be used to customize part of the name of a gif file. The value of PID may be either a number or a string and will be inserted in the gif file name as follows: Spacecraft_instrument_pid_#.gif. If GIF is not set then the plot(s) will be put into an x-window and this keyword is ignored.
OUTDIR
This keyword names the output directory where a gif file will be placed. If GIF is set but OUTDIR is not, then the gif file will be put in the user's current working directory.
AUTO
Set this keyword to use autoscaling instead of the variables SCALEMIN and SCALEMAX attribute values. The scales will be set to the min and max values of the data, after fill values have been filtered from the data (see also NONOISE keyword). If the user wishes to modify variable scale values for plotting purposes, you may do so by changing the appropriate data structure values, ie. struct.variable.scalemin = 0.0. Please use great care in modifying the data structures values since they will greatly influence what your plots or listings may look like.
COMBINE
Set this keyword to ATTEMPT to force all time series and spectrograms to be plotted into a single x-window or GIF file. Default is to plot each structure in its own x-window/GIF file. PLOTMASTER may override this keyword if the plots cannot fit into the limited space of an x-window.
CDAWEB
Set this keyword to force the margin on the right side of time series plots to be 100 pixels. This is the same margin used for spectrograms for the color bar. By default, PLOTMASTER will examine the data, and if ANY spectrograms will be produced, then it will align the margins properly. This keyword is only necessary for use in the CDAWeb system.
SLOW
Set this keyword to have spectrogram plotted using the POLYFILL method. This method is slower but more accurate than TV (used in the QUICK method).
SMOOTH
Set this keyword to have spectrogram data reduced prior to plotting. This will increase plotting speed significantly.
QUICK
Set this keyword to have spectrograms plotted using the TV method. This method is very fast, but will produce inaccurate spectrograms if scales are non-linear or if fill data or data gaps are present in the data.
NONOISE
Set this keyword to filter out values outside of 3-sigma from the mean. This keyword is applied to timeseries and images plots only at this time.
THUMBSIZE
Set this to change the "thumbnail" size of each image when plotting a series of images. The default is 50w x 62h. 12 pixels is added to the height to allow for the time stamps under each image. So, if you specify a thumsize of 70 pixels, each will actually be 70x82.
FRAME
Used to indicate the frame number within a series of images. If you specify FRAME = 2, then plotmaster will produce a "full size" version of the 3rd image in a sequence of images .
DEBUG
Set this keyword to turn on some progress messages.
Example
; plot_VLF.pro
;
;name of cdf to plot (start with Master CDF)
a=strarr(2)
a(0)='/home/xfiles/kessel/vlfcdf/hk_h0_vlf_00000000_v01.cdf'
a(1)='/home/xfiles/kessel/vlfcdf/hk_h0_vlf_19740816_v01.cdf'
; list of variables I want to read from the skeleton table. Only need some of
; them and only the "data" varaibles. read_myCDF gets all of the associated
; variables.
x = ['b_spd','e_spd','BAVE','pos_mag','pos_GSM','activity_index']
buf1 = read_myCDF(x, a, /DEBUG)
;you could type "help, /struct, buf1" to see what was read...
;** Structure <401d0808>, 10 tags, length=11424, refs=1:
; B_SPD STRUCT -> Array[1]
; E_SPD STRUCT -> Array[1]
; BAVE STRUCT -> Array[1]
; POS_MAG STRUCT -> Array[1]
; POS_GSM STRUCT -> Array[1]
; ACTIVITY_INDEX STRUCT -> Array[1]
; EPOCH STRUCT -> Array[1]
; E_FREQ STRUCT -> Array[1]
; B_FREQ STRUCT -> Array[1]
; LABEL_MAG_POS STRUCT -> Array[1]
;pick and choose plots to make. if don't use /GIF, then an x plot is made
status=plotmaster(buf1,xsize=500,/AUTO)
status=plotmaster(buf1,xsize=500,/GIF,OUTDIR='/home/xfiles/kessel/vlfgif/',/AUTO)
; if plotting smaller than whole file define tstart and tstop. plotmaster
; can use either Epoch style or single real*8 number
tstart = '1974/08/15 20:00:00'
tstop = '1974/08/16 08:00:00'
start = encode_cdfepoch(tstart)
stop = encode_cdfepoch(tstop)
status=plotmaster(buf1,xsize=500,/AUTO,TSTART=tstart, TSTOP=tstop)
status=plotmaster(buf1,xsize=500,/AUTO,TSTART=start, TSTOP=stop,$
/GIF,OUTDIR='/home/xfiles/kessel/vlfgif/')
end
Return to top
LIST_mystruct
PURPOSE: Given a "data structure" read with read_mycdf or Xread_mycdf, LIST_mystruct generates an ascii listing of the data.
Calling Sequence
Result = LIST_mystruct(astruct,NOGATT=nogatt,NOVATT=novatt,NORV=norv,$ NONRV=nonrv,NO2DRV=no2drv,FILENAME=filename,$ TSTART=TSTART,TSTOP=TSTOP,MAXRECS=maxrecs)
Arguments
astruct
A structure returned by the READ_MYCDF or XREAD_MYCDF functions. This structure,if the call to read_mycdf or Xread_mycdf was sucessful, will contain many elements useful in plotting and listing the data, as well as the data itself. Please refer to the description of READ_MYCDF.
Keywords
NOGATT
Global attributes output: =0 (print), =1 (no print)
NOVATT
Variable attributes output: =0 (print), =1 (no print)
NORV
Record varying output: =0 (print), =1 (no print)
NONRV
Non record varying output: =0 (print), =1 (no print)
NO2DRV
2D record varying output: =0 (print), =1 (no print)
FILENAME
Output filename.
MAXRECS
Maximum records listed.
Example
a=xread_mycdf()
status=LIST_mystruct(a,TSTART=start, TSTOP=stop, /NOVATT)
Return to top
xread_mycdf_view
XREAD_MYCDF
NOTE: XREAD_MYCDF has a problem running under MacX.
This function provides a X-windows based interface to the function READ_MYCDF. This X-windows interface is invoked with the following
Calling Sequence
Result = XREAD_MYCDF()
There are three different windows. The first one, a CDF file selector window, appears to the right. You are presented with a list of CDF files in the current directory. You are allowed to change your path to CDFs of interest through the second window, a path selector window. Once you select and open CDFs then the third window, a variable selector window, is invoked (shown below). This window allows you to select variables of interest for plotting. Once you have selected variables the function returns a structure identical to that of READ_MYCDF. The x-windows disappear and you are back at the IDL command line.
You can now plot the data in the structure "a" using PLOTMASTER or write your own idl plot routines to plot the data.
xread_mycdf_view
Arguments
This function accepts no arguments at this time.
Keywords
NODATASTRUCT
If this keyword is set, then the .DAT field will be replaced with a field called .HANDLE. The value of this field is a handle_id where the data is located. Using this keyword can result in a performance improvement.
DEBUG
Set this keyword to turn on some progress messages.
Example
a=xread_mycdf()
Return to top
IDLmakecdf
Purpose: To copy a master ISTP/IACG cdf and then read just the data and support_data variables from it and create an IDL structure where each structure tag is the name of a variable. Each variable tag will then point to a data pointer. This structure is then returned to the user so that they can fill each data pointer w/ the real data. Once each pointer is assigned real data, the user should call the write_data_to_cdf function.
Calling Sequence
buf1 = read_master_cdf(master_cdf,out_cdf)
RESULT = write_data_to_cdf(out_cdf, buf1)
Arguments
master_cdf
A string containing the name of the master CDF. NOTE: If reading a file outside your current directory, then the full filename, including directory/path information, must be provided. If running on a UNIX system, remember that all path and file information is case-sensitive.
out_cdf
A string containing the name of the CDF file to be output. If specifying the CDF filenames in a single string, then the names should be separated by a comma. NOTE: If reading a file outside your current directory, then the full filename, including directory/path information, must be provided. If running on a UNIX system, remember that all path and file information is case-sensitive.
buf1
An IDL structure holding the names and dimensions of the variables associated with the Master CDF.
Keywords
DEBUG
Set this keyword to turn on some progress messages.
Example
; write_vlf.pro
; remove the cdf file if it exists
;$rm hk_h0_vlf_19741027_v01.cdf
; compile idl module before running this procedure
;.r IDLmakecdf.pro
;
; day 300 for 1974 is October 27
idl_saveset = 'hk_vlf_74300.idl'
out_cdf = 'hk_h0_vlf_19741027_v01.cdf'
; read in master cdf skeleton, specify output CDF
buf1 = read_master_cdf('hk_h0_vlf_00000000_v01.cdf',$
out_cdf)
restore, idl_saveset
;you could type "help, /struct, arec" to see what was read...
;** Structure <400502c8>, 11 tags, length=136, refs=1:
; EPOCH DOUBLE 6.2319283e+13
; SPDE FLOAT Array[16]
; SPDB FLOAT Array[8]
; BAVE FLOAT 58.0411
; RE FLOAT 12.0038
; MLAT FLOAT 55.0457
; MLT FLOAT 6.07035
; XGSM FLOAT -2.80766
; YGSM FLOAT -6.87608
; ZGSM FLOAT 9.43012
; determine the number of records
num_rec = n_elements(arec.epoch)
:set up arrays
Epoch = double(num_rec)
espd = fltarr(16,num_rec)
bspd = fltarr(16,num_rec)
bave = fltarr(num_rec)
pos_mag = fltarr(3,num_rec)
pos_gsm = fltarr(3,num_rec)
; copy values out of idl save set
Epoch = arec.EPOCH
espd = arec.spde
bspd = arec.spdb
bave = arec.BAVE
pos_mag(0,*) = arec.RE
pos_mag(1,*) = arec.MLAT
pos_mag(2,*) = arec.MLT
pos_gsm(0,*) = arec.XGSM
pos_gsm(1,*) = arec.YGSM
pos_gsm(2,*) = arec.ZGSM
;check for zeros in espd, bspd, bave and set to fill value
fillvalue = -1e31
i = where(espd ge 0)
if i[0] ne -1 then espd[i] = fillvalue
i = where(bspd ge 0)
if i[0] ne -1 then bspd[i] = fillvalue
i = where(bave eq 0)
if i[0] ne -1 then bave[i] = fillvalue
; copy processed data to buf1
*buf1.Epoch.data = epoch
*buf1.E_SPD.data = espd
*buf1.B_SPD.data = bspd
*buf1.BAVE.data = bave
*buf1.pos_mag.data = pos_mag
*buf1.pos_GSM.data = pos_gsm
; write output CDF file
stat2 = write_data_to_cdf(out_cdf, buf1)
end
Return to top
* Return to Space Physics Use of CDF
*CDF home page
Author and Curator
Tami Kovalick, tamara.j.kovalick@nasa.gov, (301)286-9422
ADNET, Code 672, NASA Goddard Space Flight Center
Greenbelt, MD 20771, USA
Authorized by R.E. McGuire, Head, Space Physics Data Facility
(Code 670, NASA/GSFC), Robert.E.McGuire@gsfc.nasa.gov, (301)286-7794
Last Updated: December 2008 TJK
|
{
"url": "http://spdf.gsfc.nasa.gov/CDAWlib.html",
"source_domain": "spdf.gsfc.nasa.gov",
"snapshot_id": "crawl=CC-MAIN-2013-20",
"warc_metadata": {
"Content-Length": "24232",
"Content-Type": "application/http; msgtype=response",
"WARC-Block-Digest": "sha1:CWAJY5LDNLW453MOYZXCDTFZF5EYUQWV",
"WARC-Concurrent-To": "<urn:uuid:ad6e05cf-948a-4321-8701-c44ff862824a>",
"WARC-Date": "2013-06-19T12:05:31Z",
"WARC-IP-Address": "128.183.173.149",
"WARC-Identified-Payload-Type": null,
"WARC-Payload-Digest": "sha1:6QWFRR4M6KXHPIXNWSVWAL5NG65IRJIW",
"WARC-Record-ID": "<urn:uuid:edb9efe5-9b4e-45d4-9a80-b9237d2f77f2>",
"WARC-Target-URI": "http://spdf.gsfc.nasa.gov/CDAWlib.html",
"WARC-Truncated": null,
"WARC-Type": "response",
"WARC-Warcinfo-ID": "<urn:uuid:b7d1a941-db75-4e96-bae6-77e12fc20165>"
},
"warc_info": "robots: classic\r\nhostname: ip-10-60-113-184.ec2.internal\r\nsoftware: Nutch 1.6 (CC)/CC WarcExport 1.0\r\nisPartOf: CC-MAIN-2013-20\r\noperator: CommonCrawl Admin\r\ndescription: Wide crawl of the web with URLs provided by Blekko for Spring 2013\r\npublisher: CommonCrawl\r\nformat: WARC File Format 1.0\r\nconformsTo: http://bibnum.bnf.fr/WARC/WARC_ISO_28500_version1_latestdraft.pdf"
}
|
{
"line_start_idx": [
0,
8,
9,
164,
165,
402,
403,
404,
426,
427,
440,
441,
442,
463,
464,
508,
509,
596,
727,
728,
770,
771,
824,
825,
922,
994,
995,
1138,
1139,
1224,
1225,
1351,
1352,
1381,
1382,
1390,
1391,
1533,
1539,
1618,
1729,
1735,
1804,
1998,
1999,
2013,
2014,
2015,
2026,
2027,
2201,
2202,
2252,
2565,
2566,
2722,
2723,
2785,
2786,
2803,
2804,
2844,
2845,
2855,
2856,
2865,
2866,
3143,
3144,
3153,
3154,
3558,
3559,
3568,
3569,
3573,
3574,
3842,
3843,
3856,
3857,
4073,
4074,
4082,
4083,
4187,
4188,
4195,
4196,
4416,
4417,
4423,
4424,
4641,
4642,
4648,
4649,
4701,
4702,
4710,
4711,
4723,
4757,
4791,
4819,
4834,
4892,
4947,
5002,
5057,
5112,
5131,
5190,
5225,
5277,
5353,
5421,
5495,
5559,
5607,
5640,
5679,
5718,
5758,
5812,
5872,
5910,
5948,
5986,
6024,
6058,
6090,
6122,
6160,
6192,
6228,
6260,
6303,
6335,
6371,
6403,
6440,
6481,
6522,
6567,
6568,
6582,
6583,
6584,
6595,
6596,
7317,
7318,
7334,
7335,
7426,
7427,
7675,
7676,
7693,
7694,
7757,
7758,
7768,
7769,
7777,
7778,
8058,
8059,
8068,
8069,
8075,
8076,
8195,
8196,
8209,
8210,
8271,
8272,
8279,
8280,
8492,
8493,
8499,
8500,
8708,
8709,
8713,
8714,
9072,
9073,
9077,
9078,
9367,
9368,
9375,
9376,
9553,
9554,
9559,
9560,
10116,
10117,
10125,
10126,
10410,
10411,
10418,
10419,
10768,
10769,
10774,
10775,
10923,
10924,
10931,
10932,
11050,
11051,
11057,
11058,
11271,
11272,
11280,
11281,
11427,
11428,
11438,
11439,
11706,
11707,
11713,
11714,
11895,
11896,
11902,
11903,
11955,
11956,
11964,
11965,
11980,
11982,
11983,
12028,
12040,
12101,
12162,
12163,
12242,
12319,
12333,
12399,
12400,
12433,
12495,
12552,
12595,
12638,
12681,
12724,
12767,
12810,
12853,
12896,
12939,
12982,
12983,
12984,
13058,
13059,
13099,
13181,
13182,
13256,
13309,
13341,
13372,
13404,
13434,
13435,
13502,
13568,
13611,
13612,
13616,
13617,
13631,
13632,
13633,
13647,
13648,
13773,
13774,
13791,
13792,
13952,
13953,
13963,
13964,
13972,
13973,
14252,
14253,
14262,
14263,
14270,
14271,
14323,
14324,
14331,
14332,
14386,
14387,
14392,
14393,
14442,
14443,
14449,
14450,
14503,
14504,
14511,
14512,
14564,
14565,
14574,
14575,
14592,
14593,
14601,
14602,
14626,
14627,
14635,
14636,
14652,
14710,
14711,
14725,
14726,
14727,
14744,
14745,
14757,
14758,
14810,
14811,
14945,
14946,
14963,
14964,
14987,
14988,
15605,
15606,
15724,
15725,
15726,
15743,
15744,
15745,
15755,
15756,
15805,
15806,
15815,
15816,
15829,
15830,
16046,
16047,
16053,
16054,
16106,
16107,
16115,
16116,
16132,
16133,
16147,
16148,
16149,
16160,
16161,
16593,
16594,
16611,
16612,
16655,
16656,
16698,
16699,
16709,
16710,
16721,
16722,
16998,
16999,
17007,
17008,
17394,
17395,
17400,
17401,
17500,
17501,
17510,
17511,
17517,
17518,
17570,
17571,
17579,
17580,
17596,
17597,
17632,
17665,
17716,
17735,
17736,
17738,
17771,
17805,
17846,
17847,
17848,
17898,
17953,
17963,
17964,
17965,
17987,
18049,
18104,
18151,
18191,
18230,
18274,
18318,
18362,
18406,
18450,
18494,
18538,
18539,
18540,
18574,
18608,
18609,
18624,
18649,
18676,
18703,
18727,
18756,
18785,
18786,
18820,
18840,
18858,
18876,
18894,
18918,
18944,
18969,
18995,
19021,
19047,
19048,
19049,
19108,
19127,
19149,
19189,
19211,
19251,
19273,
19313,
19314,
19315,
19345,
19371,
19396,
19421,
19445,
19475,
19505,
19506,
19507,
19531,
19573,
19574,
19578,
19579,
19593,
19594,
19595,
19632,
19633,
19648,
19649,
19650,
19669,
19670,
19727,
19777,
19802,
19803,
19804,
19866,
19935
],
"line_end_idx": [
8,
9,
164,
165,
402,
403,
404,
426,
427,
440,
441,
442,
463,
464,
508,
509,
596,
727,
728,
770,
771,
824,
825,
922,
994,
995,
1138,
1139,
1224,
1225,
1351,
1352,
1381,
1382,
1390,
1391,
1533,
1539,
1618,
1729,
1735,
1804,
1998,
1999,
2013,
2014,
2015,
2026,
2027,
2201,
2202,
2252,
2565,
2566,
2722,
2723,
2785,
2786,
2803,
2804,
2844,
2845,
2855,
2856,
2865,
2866,
3143,
3144,
3153,
3154,
3558,
3559,
3568,
3569,
3573,
3574,
3842,
3843,
3856,
3857,
4073,
4074,
4082,
4083,
4187,
4188,
4195,
4196,
4416,
4417,
4423,
4424,
4641,
4642,
4648,
4649,
4701,
4702,
4710,
4711,
4723,
4757,
4791,
4819,
4834,
4892,
4947,
5002,
5057,
5112,
5131,
5190,
5225,
5277,
5353,
5421,
5495,
5559,
5607,
5640,
5679,
5718,
5758,
5812,
5872,
5910,
5948,
5986,
6024,
6058,
6090,
6122,
6160,
6192,
6228,
6260,
6303,
6335,
6371,
6403,
6440,
6481,
6522,
6567,
6568,
6582,
6583,
6584,
6595,
6596,
7317,
7318,
7334,
7335,
7426,
7427,
7675,
7676,
7693,
7694,
7757,
7758,
7768,
7769,
7777,
7778,
8058,
8059,
8068,
8069,
8075,
8076,
8195,
8196,
8209,
8210,
8271,
8272,
8279,
8280,
8492,
8493,
8499,
8500,
8708,
8709,
8713,
8714,
9072,
9073,
9077,
9078,
9367,
9368,
9375,
9376,
9553,
9554,
9559,
9560,
10116,
10117,
10125,
10126,
10410,
10411,
10418,
10419,
10768,
10769,
10774,
10775,
10923,
10924,
10931,
10932,
11050,
11051,
11057,
11058,
11271,
11272,
11280,
11281,
11427,
11428,
11438,
11439,
11706,
11707,
11713,
11714,
11895,
11896,
11902,
11903,
11955,
11956,
11964,
11965,
11980,
11982,
11983,
12028,
12040,
12101,
12162,
12163,
12242,
12319,
12333,
12399,
12400,
12433,
12495,
12552,
12595,
12638,
12681,
12724,
12767,
12810,
12853,
12896,
12939,
12982,
12983,
12984,
13058,
13059,
13099,
13181,
13182,
13256,
13309,
13341,
13372,
13404,
13434,
13435,
13502,
13568,
13611,
13612,
13616,
13617,
13631,
13632,
13633,
13647,
13648,
13773,
13774,
13791,
13792,
13952,
13953,
13963,
13964,
13972,
13973,
14252,
14253,
14262,
14263,
14270,
14271,
14323,
14324,
14331,
14332,
14386,
14387,
14392,
14393,
14442,
14443,
14449,
14450,
14503,
14504,
14511,
14512,
14564,
14565,
14574,
14575,
14592,
14593,
14601,
14602,
14626,
14627,
14635,
14636,
14652,
14710,
14711,
14725,
14726,
14727,
14744,
14745,
14757,
14758,
14810,
14811,
14945,
14946,
14963,
14964,
14987,
14988,
15605,
15606,
15724,
15725,
15726,
15743,
15744,
15745,
15755,
15756,
15805,
15806,
15815,
15816,
15829,
15830,
16046,
16047,
16053,
16054,
16106,
16107,
16115,
16116,
16132,
16133,
16147,
16148,
16149,
16160,
16161,
16593,
16594,
16611,
16612,
16655,
16656,
16698,
16699,
16709,
16710,
16721,
16722,
16998,
16999,
17007,
17008,
17394,
17395,
17400,
17401,
17500,
17501,
17510,
17511,
17517,
17518,
17570,
17571,
17579,
17580,
17596,
17597,
17632,
17665,
17716,
17735,
17736,
17738,
17771,
17805,
17846,
17847,
17848,
17898,
17953,
17963,
17964,
17965,
17987,
18049,
18104,
18151,
18191,
18230,
18274,
18318,
18362,
18406,
18450,
18494,
18538,
18539,
18540,
18574,
18608,
18609,
18624,
18649,
18676,
18703,
18727,
18756,
18785,
18786,
18820,
18840,
18858,
18876,
18894,
18918,
18944,
18969,
18995,
19021,
19047,
19048,
19049,
19108,
19127,
19149,
19189,
19211,
19251,
19273,
19313,
19314,
19315,
19345,
19371,
19396,
19421,
19445,
19475,
19505,
19506,
19507,
19531,
19573,
19574,
19578,
19579,
19593,
19594,
19595,
19632,
19633,
19648,
19649,
19650,
19669,
19670,
19727,
19777,
19802,
19803,
19804,
19866,
19935,
19966
]
}
|
{
"red_pajama_v2": {
"ccnet_original_length": 19966,
"ccnet_original_nlines": 512,
"rps_doc_curly_bracket": 0.00010017000022344291,
"rps_doc_ldnoobw_words": 0,
"rps_doc_lorem_ipsum": 0,
"rps_doc_stop_word_fraction": 0.2759708762168884,
"rps_doc_ut1_blacklist": 0,
"rps_doc_frac_all_caps_words": 0.08567961305379868,
"rps_doc_frac_lines_end_with_ellipsis": 0.0038986399304121733,
"rps_doc_frac_no_alph_words": 0.2864077687263489,
"rps_doc_frac_unique_words": 0.28140702843666077,
"rps_doc_mean_word_length": 5.222541332244873,
"rps_doc_num_sentences": 222,
"rps_doc_symbol_to_word_ratio": 0.0012135900324210525,
"rps_doc_unigram_entropy": 5.718321323394775,
"rps_doc_word_count": 2786,
"rps_doc_frac_chars_dupe_10grams": 0.17415808141231537,
"rps_doc_frac_chars_dupe_5grams": 0.22515463829040527,
"rps_doc_frac_chars_dupe_6grams": 0.21725085377693176,
"rps_doc_frac_chars_dupe_7grams": 0.20872852206230164,
"rps_doc_frac_chars_dupe_8grams": 0.1908591091632843,
"rps_doc_frac_chars_dupe_9grams": 0.17814433574676514,
"rps_doc_frac_chars_top_2gram": 0.01134021021425724,
"rps_doc_frac_chars_top_3gram": 0.011546390131115913,
"rps_doc_frac_chars_top_4gram": 0.013195879757404327,
"rps_doc_books_importance": -1658.330078125,
"rps_doc_books_importance_length_correction": -1658.330078125,
"rps_doc_openwebtext_importance": -1051.617919921875,
"rps_doc_openwebtext_importance_length_correction": -1051.617919921875,
"rps_doc_wikipedia_importance": -820.68359375,
"rps_doc_wikipedia_importance_length_correction": -820.68359375
},
"fasttext": {
"dclm": 0.2870825529098511,
"english": 0.7587110996246338,
"fineweb_edu_approx": 2.976766347885132,
"eai_general_math": 0.9116641879081726,
"eai_open_web_math": 0.24937748908996582,
"eai_web_code": 0.9605340361595154
}
}
|
{
"free_decimal_correspondence": {
"primary": {
"code": "004.0285",
"labels": {
"level_1": "General works, books and libraries, information sciences",
"level_2": "",
"level_3": "Computers and Computer science"
}
},
"secondary": {
"code": "520",
"labels": {
"level_1": "Science and Natural history",
"level_2": "Astronomy",
"level_3": ""
}
}
},
"bloom_cognitive_process": {
"primary": {
"code": "3",
"label": "Apply"
},
"secondary": {
"code": "2",
"label": "Understand"
}
},
"bloom_knowledge_domain": {
"primary": {
"code": "3",
"label": "Procedural"
},
"secondary": {
"code": "2",
"label": "Conceptual"
}
},
"document_type_v1": {
"primary": {
"code": "3",
"label": "Reference/Encyclopedic/Educational"
},
"secondary": {
"code": "4",
"label": "Code/Software"
}
},
"extraction_artifacts": {
"primary": {
"code": "0",
"label": "No Artifacts"
},
"secondary": {
"code": "3",
"label": "Irrelevant Content"
}
},
"missing_content": {
"primary": {
"code": "0",
"label": "No missing content"
},
"secondary": {
"code": "2",
"label": "Click Here References"
}
},
"document_type_v2": {
"primary": {
"code": "8",
"label": "Documentation"
},
"secondary": {
"code": "23",
"label": "Tutorial"
}
},
"reasoning_depth": {
"primary": {
"code": "3",
"label": "Intermediate Reasoning"
},
"secondary": {
"code": "2",
"label": "Basic Reasoning"
}
},
"technical_correctness": {
"primary": {
"code": "4",
"label": "Highly Correct"
},
"secondary": {
"code": "3",
"label": "Mostly Correct"
}
},
"education_level": {
"primary": {
"code": "4",
"label": "Graduate/Expert Level"
},
"secondary": {
"code": "3",
"label": "Undergraduate Level"
}
}
}
|
672f1e42c33a7f9846924a2431ea77df
|
-6,764,939,747,190,561,000
|
Copied to clipboard
Flag this post as spam?
This post will be reported to the moderators as potential spam to be looked at
• Hryhorii 8 posts 129 karma points
Dec 05, 2017 @ 16:12
Hryhorii
0
I want created registration page for members
I created SurfaceController
public class MemberController : SurfaceController
{
[ChildActionOnly]
[HttpGet]
public ActionResult Index()
{
return PartialView("Registration", new MemberViewModel());
}
[HttpPost]
[ValidateAntiForgeryToken]
public ActionResult CreateMember(MemberViewModel model)
{
if (!this.ModelState.IsValid)
{
return CurrentUmbracoPage();
}
else
{
return this.RedirectToUmbracoPage(CurrentPage.Parent.Id);
}
}
}
I created partial view Registration
@inherits UmbracoViewPage<MemberViewModel>
@{
Html.EnableClientValidation(true);
Html.EnableUnobtrusiveJavaScript(true);
}
@using (Html.BeginUmbracoForm("CreateMember", "Member", FormMethod.Post, new { @class = "form-horizontal" }))
{
@Html.AntiForgeryToken()
<div class="form-group">
<div class="col-md-6">
@Html.TextBoxFor(m => m.FirstName, new { @class = "form-control placeholder-shown", placeholder = "First Name" })
</div>
<div class="col-md-6">
@Html.TextBoxFor(m => m.LastName, new { @class = "form-control placeholder-shown", placeholder = "Last Name" })
</div>
</div>
<div class="form-group">
<div class="col-md-12">
@Html.TextBoxFor(m => m.Email, new { @class = "form-control placeholder-shown", placeholder = "Email" })
</div>
</div>
<div class="form-group">
<div class="col-md-6">
@Html.TextBoxFor(m => m.Password, new { @class = "form-control placeholder-shown", placeholder = "Password" })
</div>
<div class="col-md-6">
@Html.TextBoxFor(m => m.ConfirmPassword, new { @class = "form-control placeholder-shown", placeholder = "Confirm password" })
</div>
</div>
<div class="text-center">
<small>Tip: Use at least one number and at least 7 characters</small>
</div>
<div class="form-group">
<div class="text-center">
<a data-toggle="collapse" href="#promoCodeSection" aria-expanded="False" aria-controls="promoCodeSection" class="collapsed">
I have a promo code
</a>
</div>
</div>
<div id="promoCodeSection" class="form-group collapse">
<div class="col-md-7 col-center">
@Html.TextBoxFor(m => m.PromoCode, new { @class = "col-md-7 form-control placeholder-shown", placeholder = "Promotion Code" })
</div>
</div>
<div class="form-group">
@Html.ValidationMessageFor(x => x.AcceptedTermsOfService)
<div class="small">
<label class="checkbox-inline">
@Html.CheckBoxFor(m => m.AcceptedTermsOfService)
<label for="@nameof(Model.AcceptedTermsOfService)">
I have read and agree
</label>
</label>
</div>
<div class="small">
<label class="checkbox-inline">
@Html.CheckBoxFor(m => m.SubscribedToEmails)
@Html.LabelFor(m => m.SubscribedToEmails)
</label>
</div>
</div>
<div class="form-group">
<button class="btn btn-primary btn-block">
<span class="enabled-content">Create my account</span>
</button>
</div>
}
I creted Registration view
@inherits Umbraco.Web.Mvc.UmbracoTemplatePage
@inherits UmbracoTemplatePage<RegistrationViewModel>
@using ClientDependency.Core.Mvc
@{
Layout = "Master.cshtml";
Html.RequiresCss("~/scss/registration.scss");
}
<div class="content-container">
<div class="login-block">
<div class="form-group">
<img src="@Model.Content.Logo.Crops.Src" />
</div>
<div class="form-group">
<h4 class="text-center">Create account</h4>
</div>
<div class="form-group">
@{
Html.RenderAction("Index", "Member");
}
</div>
</div>
</div>
When I click on button I get 404 error.
• Alex Skrypnyk 4282 posts 15451 karma points MVP
Dec 06, 2017 @ 14:13
Alex Skrypnyk
0
Hi Grifin
Have a look at this line:
return this.RedirectToUmbracoPage(CurrentPage.Parent.Id);
What is the current page where form is placed?
Is it in the root?
Thanks,
Alex
• Hryhorii 8 posts 129 karma points
Dec 06, 2017 @ 14:16
Hryhorii
0
I have problem with this code
return CurrentUmbracoPage();
Please Sign in or register to post replies
Write your reply to:
Draft
|
{
"url": "https://our.umbraco.org/forum/extending-umbraco-and-using-the-api/89572-how-using-from",
"source_domain": "our.umbraco.org",
"snapshot_id": "crawl=CC-MAIN-2018-09",
"warc_metadata": {
"Content-Length": "31899",
"Content-Type": "application/http; msgtype=response",
"WARC-Block-Digest": "sha1:54ORGU6WUE2B74Q2UB6XFG36UP3SBTTN",
"WARC-Concurrent-To": "<urn:uuid:f843b96e-b625-4fda-ad7e-bc0a23936ebe>",
"WARC-Date": "2018-02-23T02:45:27Z",
"WARC-IP-Address": "65.52.143.6",
"WARC-Identified-Payload-Type": "text/html",
"WARC-Payload-Digest": "sha1:TC3FXL3FRIR5AU3NT4JUFEWXQ7HCK3Q4",
"WARC-Record-ID": "<urn:uuid:26947ef9-75e3-461c-ae2c-f1ed06c2247c>",
"WARC-Target-URI": "https://our.umbraco.org/forum/extending-umbraco-and-using-the-api/89572-how-using-from",
"WARC-Truncated": null,
"WARC-Type": "response",
"WARC-Warcinfo-ID": "<urn:uuid:e005e853-e059-45f2-aaa5-77f24ab42fc2>"
},
"warc_info": "robots: classic\r\nhostname: ip-10-149-106-156.ec2.internal\r\nsoftware: Nutch 1.6 (CC)\r\nisPartOf: CC-MAIN-2018-09\r\noperator: Common Crawl Admin\r\ndescription: Wide crawl of the web for February 2018\r\npublisher: Common Crawl\r\nformat: WARC File Format 1.0\r\nconformsTo: http://bibnum.bnf.fr/WARC/WARC_ISO_28500_version1_latestdraft.pdf"
}
|
{
"line_start_idx": [
0,
20,
21,
45,
46,
125,
126,
127,
165,
190,
203,
209,
210,
259,
260,
292,
293,
347,
357,
387,
409,
449,
463,
538,
552,
557,
580,
619,
687,
701,
747,
765,
814,
832,
853,
871,
949,
967,
981,
991,
996,
997,
1037,
1038,
1085,
1092,
1135,
1183,
1189,
1303,
1309,
1342,
1375,
1410,
1540,
1559,
1594,
1722,
1741,
1756,
1789,
1825,
1946,
1965,
1980,
2013,
2048,
2175,
2194,
2229,
2371,
2390,
2405,
2439,
2521,
2536,
2569,
2607,
2748,
2788,
2809,
2828,
2843,
2907,
2953,
3096,
3115,
3130,
3163,
3233,
3265,
3313,
3382,
3454,
3500,
3529,
3554,
3573,
3605,
3653,
3718,
3780,
3805,
3824,
3839,
3872,
3927,
3998,
4020,
4035,
4041,
4046,
4047,
4078,
4079,
4129,
4186,
4223,
4230,
4264,
4318,
4324,
4329,
4334,
4370,
4404,
4441,
4501,
4520,
4557,
4617,
4636,
4673,
4692,
4750,
4768,
4787,
4802,
4813,
4818,
4819,
4863,
4864,
4916,
4941,
4959,
4965,
4966,
4980,
4981,
5011,
5012,
5074,
5079,
5080,
5131,
5132,
5155,
5156,
5168,
5169,
5178,
5179,
5217,
5242,
5255,
5261,
5262,
5296,
5297,
5330,
5335,
5378,
5379,
5400,
5401
],
"line_end_idx": [
20,
21,
45,
46,
125,
126,
127,
165,
190,
203,
209,
210,
259,
260,
292,
293,
347,
357,
387,
409,
449,
463,
538,
552,
557,
580,
619,
687,
701,
747,
765,
814,
832,
853,
871,
949,
967,
981,
991,
996,
997,
1037,
1038,
1085,
1092,
1135,
1183,
1189,
1303,
1309,
1342,
1375,
1410,
1540,
1559,
1594,
1722,
1741,
1756,
1789,
1825,
1946,
1965,
1980,
2013,
2048,
2175,
2194,
2229,
2371,
2390,
2405,
2439,
2521,
2536,
2569,
2607,
2748,
2788,
2809,
2828,
2843,
2907,
2953,
3096,
3115,
3130,
3163,
3233,
3265,
3313,
3382,
3454,
3500,
3529,
3554,
3573,
3605,
3653,
3718,
3780,
3805,
3824,
3839,
3872,
3927,
3998,
4020,
4035,
4041,
4046,
4047,
4078,
4079,
4129,
4186,
4223,
4230,
4264,
4318,
4324,
4329,
4334,
4370,
4404,
4441,
4501,
4520,
4557,
4617,
4636,
4673,
4692,
4750,
4768,
4787,
4802,
4813,
4818,
4819,
4863,
4864,
4916,
4941,
4959,
4965,
4966,
4980,
4981,
5011,
5012,
5074,
5079,
5080,
5131,
5132,
5155,
5156,
5168,
5169,
5178,
5179,
5217,
5242,
5255,
5261,
5262,
5296,
5297,
5330,
5335,
5378,
5379,
5400,
5401,
5406
]
}
|
{
"red_pajama_v2": {
"ccnet_original_length": 5406,
"ccnet_original_nlines": 175,
"rps_doc_curly_bracket": 0.0059193498454988,
"rps_doc_ldnoobw_words": 0,
"rps_doc_lorem_ipsum": 0,
"rps_doc_stop_word_fraction": 0.08519270271062851,
"rps_doc_ut1_blacklist": 0,
"rps_doc_frac_all_caps_words": 0.010141990147531033,
"rps_doc_frac_lines_end_with_ellipsis": 0,
"rps_doc_frac_no_alph_words": 0.49087220430374146,
"rps_doc_frac_unique_words": 0.5027027130126953,
"rps_doc_mean_word_length": 7.856756687164307,
"rps_doc_num_sentences": 53,
"rps_doc_symbol_to_word_ratio": 0.0010142000392079353,
"rps_doc_unigram_entropy": 4.734094619750977,
"rps_doc_word_count": 370,
"rps_doc_frac_chars_dupe_10grams": 0,
"rps_doc_frac_chars_dupe_5grams": 0.18025456368923187,
"rps_doc_frac_chars_dupe_6grams": 0.02201581932604313,
"rps_doc_frac_chars_dupe_7grams": 0.02201581932604313,
"rps_doc_frac_chars_dupe_8grams": 0.02201581932604313,
"rps_doc_frac_chars_dupe_9grams": 0,
"rps_doc_frac_chars_top_2gram": 0.04127966985106468,
"rps_doc_frac_chars_top_3gram": 0.021671829745173454,
"rps_doc_frac_chars_top_4gram": 0.060199521481990814,
"rps_doc_books_importance": -484.5429382324219,
"rps_doc_books_importance_length_correction": -484.5429382324219,
"rps_doc_openwebtext_importance": -302.72064208984375,
"rps_doc_openwebtext_importance_length_correction": -302.72064208984375,
"rps_doc_wikipedia_importance": -203.09010314941406,
"rps_doc_wikipedia_importance_length_correction": -203.09010314941406
},
"fasttext": {
"dclm": 0.21262091398239136,
"english": 0.45831942558288574,
"fineweb_edu_approx": 1.1744122505187988,
"eai_general_math": 0.011362019926309586,
"eai_open_web_math": 0.17819732427597046,
"eai_web_code": 0.5138351321220398
}
}
|
{
"free_decimal_correspondence": {
"primary": {
"code": "005.1",
"labels": {
"level_1": "General works, books and libraries, information sciences",
"level_2": "",
"level_3": "Computer programming"
}
},
"secondary": {
"code": "005.4",
"labels": {
"level_1": "General works, books and libraries, information sciences",
"level_2": "",
"level_3": "Computer programming"
}
}
},
"bloom_cognitive_process": {
"primary": {
"code": "3",
"label": "Apply"
},
"secondary": {
"code": "2",
"label": "Understand"
}
},
"bloom_knowledge_domain": {
"primary": {
"code": "3",
"label": "Procedural"
},
"secondary": {
"code": "2",
"label": "Conceptual"
}
},
"document_type_v1": {
"primary": {
"code": "5",
"label": "Social/Forum"
},
"secondary": {
"code": "4",
"label": "Code/Software"
}
},
"extraction_artifacts": {
"primary": {
"code": "3",
"label": "Irrelevant Content"
},
"secondary": {
"code": "-1",
"label": "Abstain"
}
},
"missing_content": {
"primary": {
"code": "4",
"label": "Missing Images or Figures"
},
"secondary": {
"code": "-1",
"label": "Abstain"
}
},
"document_type_v2": {
"primary": {
"code": "18",
"label": "Q&A Forum"
},
"secondary": {
"code": "8",
"label": "Documentation"
}
},
"reasoning_depth": {
"primary": {
"code": "2",
"label": "Basic Reasoning"
},
"secondary": {
"code": "3",
"label": "Intermediate Reasoning"
}
},
"technical_correctness": {
"primary": {
"code": "2",
"label": "Partially Correct"
},
"secondary": {
"code": "3",
"label": "Mostly Correct"
}
},
"education_level": {
"primary": {
"code": "3",
"label": "Undergraduate Level"
},
"secondary": {
"code": "4",
"label": "Graduate/Expert Level"
}
}
}
|
672f1e42c33a7f9846924a2431ea77df
|
5,950,181,964,507,891,000
|
Why dose AKASH choose JS to develop a sdk?
i’ve seen the roadmap of akash, i’m very happy that we will have a js sdk.
But why dose AKASH choose JS to develop a sdk? When can we use more language SDK?
JS always a good starting point, widest base of developers, most people have the skill.
Rust, Go are cool and all but much more limited pool of developers.
|
{
"url": "https://forum.akash.network/t/why-dose-akash-choose-js-to-develop-a-sdk/2930",
"source_domain": "forum.akash.network",
"snapshot_id": "crawl=CC-MAIN-2021-43",
"warc_metadata": {
"Content-Length": "16156",
"Content-Type": "application/http; msgtype=response",
"WARC-Block-Digest": "sha1:FHYBVVFRSZL2ZM65LWKVYMUUPYDJBBOX",
"WARC-Concurrent-To": "<urn:uuid:0629dbcc-544b-443d-829a-938298c463ac>",
"WARC-Date": "2021-10-28T18:05:55Z",
"WARC-IP-Address": "184.105.176.45",
"WARC-Identified-Payload-Type": "text/html",
"WARC-Payload-Digest": "sha1:UAZGGIFQPW6XRDCWL5EO6UYHYAV3FTST",
"WARC-Record-ID": "<urn:uuid:30c7e933-32c8-4b2d-8216-71d7ffb18f8a>",
"WARC-Target-URI": "https://forum.akash.network/t/why-dose-akash-choose-js-to-develop-a-sdk/2930",
"WARC-Truncated": null,
"WARC-Type": "response",
"WARC-Warcinfo-ID": "<urn:uuid:c0e25240-9f62-4e54-b173-133994dae2f2>"
},
"warc_info": "isPartOf: CC-MAIN-2021-43\r\npublisher: Common Crawl\r\ndescription: Wide crawl of the web for October 2021\r\noperator: Common Crawl Admin (info@commoncrawl.org)\r\nhostname: ip-10-67-67-227\r\nsoftware: Apache Nutch 1.18 (modified, https://github.com/commoncrawl/nutch/)\r\nrobots: checked via crawler-commons 1.2-SNAPSHOT (https://github.com/crawler-commons/crawler-commons)\r\nformat: WARC File Format 1.1\r\nconformsTo: https://iipc.github.io/warc-specifications/specifications/warc-format/warc-1.1/"
}
|
{
"line_start_idx": [
0,
43,
44,
119,
201,
202,
290,
291
],
"line_end_idx": [
43,
44,
119,
201,
202,
290,
291,
358
]
}
|
{
"red_pajama_v2": {
"ccnet_original_length": 358,
"ccnet_original_nlines": 7,
"rps_doc_curly_bracket": 0,
"rps_doc_ldnoobw_words": 0,
"rps_doc_lorem_ipsum": 0,
"rps_doc_stop_word_fraction": 0.4047619104385376,
"rps_doc_ut1_blacklist": 0,
"rps_doc_frac_all_caps_words": 0.0714285671710968,
"rps_doc_frac_lines_end_with_ellipsis": 0,
"rps_doc_frac_no_alph_words": 0.1428571343421936,
"rps_doc_frac_unique_words": 0.6571428775787354,
"rps_doc_mean_word_length": 3.942857027053833,
"rps_doc_num_sentences": 6,
"rps_doc_symbol_to_word_ratio": 0,
"rps_doc_unigram_entropy": 3.698831796646118,
"rps_doc_word_count": 70,
"rps_doc_frac_chars_dupe_10grams": 0,
"rps_doc_frac_chars_dupe_5grams": 0.239130437374115,
"rps_doc_frac_chars_dupe_6grams": 0.239130437374115,
"rps_doc_frac_chars_dupe_7grams": 0.239130437374115,
"rps_doc_frac_chars_dupe_8grams": 0.239130437374115,
"rps_doc_frac_chars_dupe_9grams": 0.239130437374115,
"rps_doc_frac_chars_top_2gram": 0.05072464048862457,
"rps_doc_frac_chars_top_3gram": 0.08695652335882187,
"rps_doc_frac_chars_top_4gram": 0.1304347813129425,
"rps_doc_books_importance": -37.966251373291016,
"rps_doc_books_importance_length_correction": -37.966251373291016,
"rps_doc_openwebtext_importance": -23.208969116210938,
"rps_doc_openwebtext_importance_length_correction": -23.208969116210938,
"rps_doc_wikipedia_importance": -19.367107391357422,
"rps_doc_wikipedia_importance_length_correction": -19.367107391357422
},
"fasttext": {
"dclm": 0.47194939851760864,
"english": 0.9332178235054016,
"fineweb_edu_approx": 1.7880232334136963,
"eai_general_math": 0.022768499329686165,
"eai_open_web_math": 0.23632967472076416,
"eai_web_code": 0.0245553907006979
}
}
|
{
"free_decimal_correspondence": {
"primary": {
"code": "005.1",
"labels": {
"level_1": "General works, books and libraries, information sciences",
"level_2": "",
"level_3": "Computer programming"
}
},
"secondary": {
"code": "004.02",
"labels": {
"level_1": "General works, books and libraries, information sciences",
"level_2": "",
"level_3": "Computers and Computer science"
}
}
},
"bloom_cognitive_process": {
"primary": {
"code": "5",
"label": "Evaluate"
},
"secondary": {
"code": "2",
"label": "Understand"
}
},
"bloom_knowledge_domain": {
"primary": {
"code": "2",
"label": "Conceptual"
},
"secondary": {
"code": "3",
"label": "Procedural"
}
},
"document_type_v1": {
"primary": {
"code": "5",
"label": "Social/Forum"
},
"secondary": {
"code": "-1",
"label": "Abstain"
}
},
"extraction_artifacts": {
"primary": {
"code": "0",
"label": "No Artifacts"
},
"secondary": {
"code": "3",
"label": "Irrelevant Content"
}
},
"missing_content": {
"primary": {
"code": "0",
"label": "No missing content"
},
"secondary": {
"code": "-1",
"label": "Abstain"
}
},
"document_type_v2": {
"primary": {
"code": "18",
"label": "Q&A Forum"
},
"secondary": {
"code": "8",
"label": "Documentation"
}
},
"reasoning_depth": {
"primary": {
"code": "2",
"label": "Basic Reasoning"
},
"secondary": {
"code": "3",
"label": "Intermediate Reasoning"
}
},
"technical_correctness": {
"primary": {
"code": "6",
"label": "Not Applicable/Indeterminate"
},
"secondary": {
"code": "3",
"label": "Mostly Correct"
}
},
"education_level": {
"primary": {
"code": "2",
"label": "High School Level"
},
"secondary": {
"code": "1",
"label": "General Audience"
}
}
}
|
672f1e42c33a7f9846924a2431ea77df
|
-7,244,684,541,385,711,000
|
3
To illustrate the problem, I'm defining a PositiveNumber class that is a subclass of a Number class. As Python doesn't support type casting, I'm defining the from_number as a convenience method I can use to cast one instance to another. This method is common to all subtypes of the Number class so I'm putting it into the parent class.
from __future__ import annotations
from typing import Any, Dict
class Number:
def __init__(self, value: float, *args, **kwargs) -> None:
self.value = value
@classmethod
def from_number(cls, other: Number) -> Number:
return cls(**other.dict())
def dict(self) -> Dict[str, Any]:
return {
"value": self.value
}
class PositiveNumber(Number):
def __init__(self, value: float, *args, **kwargs) -> None:
if value <= 0:
raise ValueError("Value must be a positive float value.")
super().__init__(value)
@property
def is_positive(self) -> bool:
return True
x = Number(1001) # this could be a positive number
# instead of writing this
y = PositiveNumber(value=x.value)
# I would like to be able to do this
y = PositiveNumber.from_number(x)
type(y)
# >> <class '__main__.PositiveNumber'>
As we can see, y is an instance of PositiveNumber as expected, but it's annotated as an instance of Number.
To avoid this, I would have to overwrite from_number in each subclass to correct the output annotation.
class PositiveNumber(Number):
def __init__(self, value: float, *args, **kwargs) -> None:
if value <= 0:
raise ValueError("Value must be a positive float value.")
super().__init__(value)
@classmethod
def from_number(cls, other: Number) -> PositiveNumber: #overridden
return super().from_number(other)
@property
def is_positive(self) -> bool:
return True
My thinking is that from_number should be an interface method instead, but then I will have to implement the same functionality in every single subtype, which will be tedious because the code will mostly be the same.
Is there a more elegant way of doing this or is this a completely bad design?
2
7
The concept that you need is called a MyType or SelfType in Type Theory. As you discovered, this is a very useful feature, with two major use cases (clone / copy / dup methods and factory / parse / deserialization methods), and I am always surprised that practically no mainstream type system has this feature. The only exceptions off the top of my head are TypeScript and Rust.
[Note: Scala has a concept named Self Type as well, but that is something different: it allows you to assign a type to this rather than to refer to the type of this. It also has Singleton Types which allow you to refer to a type only inhabited by a particular object, including something like this.type. But this is too restrictive: this refers to a type whose only instance is the current this, not to any instance which has the same type as this.]
With Python and MyPy, you are both in luck and out of luck: the good news is that Python has a Draft specification for Self Types in PEP 673:
from typing import Any, Dict, Self
class Number:
@classmethod
def from_number(cls, other: Number) -> Self:
return cls(**other.dict())
The bad news is that it is still a Draft, slated for implementation in Python 3.11 which is currently scheduled for release in 2022-Q4. It is already implemented in Pyright and in a fork of MyPy, but it is not yet implemented in typing (but there is a Pull Request) nor in the official release of MyPy.
Which means that, at the moment, you have to either use Pyright (which, however, makes no sense because while your code will statically type check, it will then fail at runtime with a missing import) or the workaround documented in PEP 673:
from typing import Any, Dict, TypeVar
Self = TypeVar("Self", bound="Number")
class Number:
@classmethod
def from_number(cls: type[Self], other: Number) -> Self:
return cls(**other.dict())
1
• Thank you! This is really thorough and helpful.
– Aresto
Jan 9 at 15:15
Your Answer
By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy
Not the answer you're looking for? Browse other questions tagged or ask your own question.
|
{
"url": "https://softwareengineering.stackexchange.com/questions/435804/designing-shared-subtype-functionality-with-correct-type-annotations-in-python",
"source_domain": "softwareengineering.stackexchange.com",
"snapshot_id": "crawl=CC-MAIN-2022-05",
"warc_metadata": {
"Content-Length": "145925",
"Content-Type": "application/http; msgtype=response",
"WARC-Block-Digest": "sha1:Y2RMBTL3D3NGKR5BAQ4XFZEJOXS6DF5R",
"WARC-Concurrent-To": "<urn:uuid:5eb440ae-27a4-4d36-b4dd-57ad0ea89091>",
"WARC-Date": "2022-01-24T12:14:25Z",
"WARC-IP-Address": "151.101.129.69",
"WARC-Identified-Payload-Type": "text/html",
"WARC-Payload-Digest": "sha1:AMFXLNQIJQVDAY4JJGXKIDWNVNK26DNK",
"WARC-Record-ID": "<urn:uuid:71c7ca10-40bc-4ce1-be09-e1c1470801e5>",
"WARC-Target-URI": "https://softwareengineering.stackexchange.com/questions/435804/designing-shared-subtype-functionality-with-correct-type-annotations-in-python",
"WARC-Truncated": null,
"WARC-Type": "response",
"WARC-Warcinfo-ID": "<urn:uuid:cf186b70-01b5-4e2b-935d-aa80766e0347>"
},
"warc_info": "isPartOf: CC-MAIN-2022-05\r\npublisher: Common Crawl\r\ndescription: Wide crawl of the web for January 2022\r\noperator: Common Crawl Admin (info@commoncrawl.org)\r\nhostname: ip-10-67-67-24\r\nsoftware: Apache Nutch 1.18 (modified, https://github.com/commoncrawl/nutch/)\r\nrobots: checked via crawler-commons 1.3-SNAPSHOT (https://github.com/crawler-commons/crawler-commons)\r\nformat: WARC File Format 1.1\r\nconformsTo: https://iipc.github.io/warc-specifications/specifications/warc-format/warc-1.1/"
}
|
{
"line_start_idx": [
0,
2,
3,
339,
340,
375,
376,
405,
406,
407,
421,
484,
511,
512,
529,
580,
615,
616,
654,
671,
703,
713,
714,
715,
745,
808,
831,
901,
933,
934,
948,
983,
1003,
1054,
1055,
1081,
1115,
1116,
1153,
1187,
1188,
1196,
1235,
1236,
1344,
1345,
1449,
1450,
1480,
1543,
1566,
1636,
1668,
1669,
1686,
1757,
1799,
1800,
1814,
1849,
1869,
1870,
2087,
2088,
2166,
2167,
2169,
2171,
2172,
2551,
2552,
3002,
3003,
3145,
3146,
3181,
3182,
3183,
3197,
3214,
3263,
3298,
3299,
3602,
3603,
3844,
3845,
3883,
3884,
3885,
3924,
3925,
3939,
3956,
4017,
4052,
4054,
4106,
4119,
4138,
4139,
4151,
4152,
4252,
4253
],
"line_end_idx": [
2,
3,
339,
340,
375,
376,
405,
406,
407,
421,
484,
511,
512,
529,
580,
615,
616,
654,
671,
703,
713,
714,
715,
745,
808,
831,
901,
933,
934,
948,
983,
1003,
1054,
1055,
1081,
1115,
1116,
1153,
1187,
1188,
1196,
1235,
1236,
1344,
1345,
1449,
1450,
1480,
1543,
1566,
1636,
1668,
1669,
1686,
1757,
1799,
1800,
1814,
1849,
1869,
1870,
2087,
2088,
2166,
2167,
2169,
2171,
2172,
2551,
2552,
3002,
3003,
3145,
3146,
3181,
3182,
3183,
3197,
3214,
3263,
3298,
3299,
3602,
3603,
3844,
3845,
3883,
3884,
3885,
3924,
3925,
3939,
3956,
4017,
4052,
4054,
4106,
4119,
4138,
4139,
4151,
4152,
4252,
4253,
4343
]
}
|
{
"red_pajama_v2": {
"ccnet_original_length": 4343,
"ccnet_original_nlines": 104,
"rps_doc_curly_bracket": 0.00046050999662838876,
"rps_doc_ldnoobw_words": 0,
"rps_doc_lorem_ipsum": 0,
"rps_doc_stop_word_fraction": 0.3674367368221283,
"rps_doc_ut1_blacklist": 0,
"rps_doc_frac_all_caps_words": 0.012101209722459316,
"rps_doc_frac_lines_end_with_ellipsis": 0,
"rps_doc_frac_no_alph_words": 0.25962597131729126,
"rps_doc_frac_unique_words": 0.4359374940395355,
"rps_doc_mean_word_length": 4.870312690734863,
"rps_doc_num_sentences": 34,
"rps_doc_symbol_to_word_ratio": 0.005500549916177988,
"rps_doc_unigram_entropy": 5.149594306945801,
"rps_doc_word_count": 640,
"rps_doc_frac_chars_dupe_10grams": 0.08148860931396484,
"rps_doc_frac_chars_dupe_5grams": 0.21495026350021362,
"rps_doc_frac_chars_dupe_6grams": 0.1376323401927948,
"rps_doc_frac_chars_dupe_7grams": 0.11260827630758286,
"rps_doc_frac_chars_dupe_8grams": 0.10137952864170074,
"rps_doc_frac_chars_dupe_9grams": 0.08148860931396484,
"rps_doc_frac_chars_top_2gram": 0.01796598918735981,
"rps_doc_frac_chars_top_3gram": 0.034648701548576355,
"rps_doc_frac_chars_top_4gram": 0.0182868093252182,
"rps_doc_books_importance": -458.7951965332031,
"rps_doc_books_importance_length_correction": -458.7951965332031,
"rps_doc_openwebtext_importance": -298.8719482421875,
"rps_doc_openwebtext_importance_length_correction": -298.8719482421875,
"rps_doc_wikipedia_importance": -181.43865966796875,
"rps_doc_wikipedia_importance_length_correction": -181.43865966796875
},
"fasttext": {
"dclm": 0.45337724685668945,
"english": 0.8758924007415771,
"fineweb_edu_approx": 2.2000699043273926,
"eai_general_math": 0.3383837938308716,
"eai_open_web_math": 0.04786444082856178,
"eai_web_code": 0.37958085536956787
}
}
|
{
"free_decimal_correspondence": {
"primary": {
"code": "005.1332",
"labels": {
"level_1": "General works, books and libraries, information sciences",
"level_2": "",
"level_3": "Computer programming"
}
},
"secondary": {
"code": "005.133",
"labels": {
"level_1": "General works, books and libraries, information sciences",
"level_2": "",
"level_3": "Computer programming"
}
}
},
"bloom_cognitive_process": {
"primary": {
"code": "4",
"label": "Analyze"
},
"secondary": {
"code": "3",
"label": "Apply"
}
},
"bloom_knowledge_domain": {
"primary": {
"code": "3",
"label": "Procedural"
},
"secondary": {
"code": "2",
"label": "Conceptual"
}
},
"document_type_v1": {
"primary": {
"code": "5",
"label": "Social/Forum"
},
"secondary": {
"code": "4",
"label": "Code/Software"
}
},
"extraction_artifacts": {
"primary": {
"code": "0",
"label": "No Artifacts"
},
"secondary": {
"code": "3",
"label": "Irrelevant Content"
}
},
"missing_content": {
"primary": {
"code": "0",
"label": "No missing content"
},
"secondary": {
"code": "-1",
"label": "Abstain"
}
},
"document_type_v2": {
"primary": {
"code": "18",
"label": "Q&A Forum"
},
"secondary": {
"code": "8",
"label": "Documentation"
}
},
"reasoning_depth": {
"primary": {
"code": "3",
"label": "Intermediate Reasoning"
},
"secondary": {
"code": "4",
"label": "Advanced Reasoning"
}
},
"technical_correctness": {
"primary": {
"code": "4",
"label": "Highly Correct"
},
"secondary": {
"code": "3",
"label": "Mostly Correct"
}
},
"education_level": {
"primary": {
"code": "3",
"label": "Undergraduate Level"
},
"secondary": {
"code": "4",
"label": "Graduate/Expert Level"
}
}
}
|
672f1e42c33a7f9846924a2431ea77df
|
2,216,491,471,932,484,900
|
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.
Sign up
Here's how it works:
1. Anybody can ask a question
2. Anybody can answer
3. The best answers are voted up and rise to the top
.com,.us are TLD,top level domain, and co.uk are SLD,second level domain.
Are there "third level domain, fourth level domain" and so on?
How many different TLDs and SLDs are out there?
share|improve this question
This link seems to have the most relevant detail Wiki - DNS_Label - Domain name formulation
The hierarchy of domains descends from right to left; each label to the left specifies a subdivision, or subdomain of the domain to the right. For example: the label example specifies a subdomain of the com domain, and www is a subdomain of example.com. This tree of subdivisions may consist of 127 levels.
Each label may contain up to 63 characters. The full domain name may not exceed a total length of 253 characters. In practice, some domain registries may have shorter limits.
You asked in a comment
sub1.google.com is also owned by owner of google.com,but that's not the case for news.bbs.co.uk,say it's not owned by owner of co.uk,but bbs.co.uk!
Any owner of a domain may delegate authority to anyone else. If I was the owner of example.com, I could delegate authority for sub.example.com to you. Anyone can delegate their subdomains to other organizations. If you curious about the policies for a particular domain you'll probably need to find the correct contact for that domain.
share|improve this answer
http://en.wikipedia.org/wiki/Domain_name#Second-level_and_lower_level_domains
share|improve this answer
But sub1.google.com is essentially google.com.While it's not the case for news.bbs.co.uk,its domain is bbs.co.uk – PHP Feb 4 '10 at 2:16
2
sub1.google.com is not essentially google.com, if an A record for abc.com and an A record for sub1.abc.com that are the same then there won't be any difference in the website you visit unless the web server implements host header filtering. It depends where people point their domains to. – ta.speot.is Feb 4 '10 at 3:32
I mean sub1.google.com is also owned by owner of google.com,but that's not the case for news.bbs.co.uk,say it's not owned by owner of co.uk,but bbs.co.uk! – PHP Feb 4 '10 at 4:25
Who is the "owner" of a subdomain is decided by the one owning the domain above. So who owns sub1.google.com is decided by google.com and who owns news.bbs.co.uk is decided by bbs.co.uk. And who owns uk is decided by the owner of .. – Anders Jan 2 '15 at 3:43
I'm not aware of a technical limit to the number of levels but to be sure you should consult the RFCs relating to DNS.
An example such as news.bbs.co.uk, as you used in a comment, shows four levels already.
share|improve this answer
I just jumped onto my DNS and created this:
alt text
That's 29 levels and counting, so I guess as John said, you can just keep going and going and going
share|improve this answer
2
"the full domain name may not exceed a total length of 253 characters" apparently, so assuming a very short top+second (for example is.gd) you could have 126 levels (including the .is and .gd) if each sub division is only a single character. – David Spillett Feb 6 '10 at 12:39
That is actually 127, as you have the top level "." too. The one above is and gd. – Anders Jan 2 '15 at 3:40
co.uk is in fact TLD
share|improve this answer
1
I don't think you're right about that. As others have said, .uk is the TLD; Nominet (the UK namespace authority) makes this point fairly clear in nic.uk/registrants/register/choose . It is, however, a TLD in which direct registrations are not currently permitted; instead, a fairly-constant list of SLDs have been created, and direct registrations are allowed in these. – MadHatter Oct 4 '10 at 16:29
1
See here as well dotuklaunch.co.uk – Christian Seiler Feb 12 '14 at 20:44
.co.uk is not a TLD, but .uk is a TLD and ccTLD (country code top level domain).
The manager of .uk have decided to divide its sub domains into commercial, education etc. But others has not, like .se or .us. That is up to the owner of the TLD to decide how to do.
share|improve this answer
Your Answer
discard
By posting your answer, you agree to the privacy policy and terms of service.
|
{
"url": "http://serverfault.com/questions/109409/how-many-domain-levels-are-there/109411",
"source_domain": "serverfault.com",
"snapshot_id": "crawl=CC-MAIN-2016-07",
"warc_metadata": {
"Content-Length": "98966",
"Content-Type": "application/http; msgtype=response",
"WARC-Block-Digest": "sha1:DAITJTMGW373LZJ7ZO3IOUAZSZOFRHHU",
"WARC-Concurrent-To": "<urn:uuid:c8af556d-1e77-4da9-bba8-762b2ab2cd05>",
"WARC-Date": "2016-02-13T04:43:21Z",
"WARC-IP-Address": "104.16.46.232",
"WARC-Identified-Payload-Type": null,
"WARC-Payload-Digest": "sha1:XAUUBNU6HGO6IWTU2V5RA7V5NVLSA4Z4",
"WARC-Record-ID": "<urn:uuid:22c969ae-17ef-4cb0-8562-b0839b496d39>",
"WARC-Target-URI": "http://serverfault.com/questions/109409/how-many-domain-levels-are-there/109411",
"WARC-Truncated": null,
"WARC-Type": "response",
"WARC-Warcinfo-ID": "<urn:uuid:7fbc5940-74d3-4f98-a73a-c26e00e96f53>"
},
"warc_info": "robots: classic\r\nhostname: ip-10-236-182-209.ec2.internal\r\nsoftware: Nutch 1.6 (CC)/CC WarcExport 1.0\r\nisPartOf: CC-MAIN-2016-07\r\noperator: CommonCrawl Admin\r\ndescription: Wide crawl of the web for February 2016\r\npublisher: CommonCrawl\r\nformat: WARC File Format 1.0\r\nconformsTo: http://bibnum.bnf.fr/WARC/WARC_ISO_28500_version1_latestdraft.pdf"
}
|
{
"line_start_idx": [
0,
124,
125,
133,
154,
186,
210,
265,
266,
340,
341,
404,
405,
453,
454,
482,
483,
575,
576,
883,
884,
1059,
1060,
1083,
1084,
1232,
1233,
1569,
1570,
1596,
1597,
1675,
1676,
1702,
1707,
1844,
1848,
2169,
2174,
2353,
2358,
2618,
2619,
2738,
2739,
2827,
2828,
2854,
2855,
2899,
2900,
2909,
2910,
3010,
3011,
3037,
3041,
3319,
3324,
3433,
3434,
3455,
3456,
3482,
3486,
3887,
3891,
3965,
3966,
4047,
4048,
4231,
4232,
4258,
4259,
4271,
4272,
4274,
4282,
4283
],
"line_end_idx": [
124,
125,
133,
154,
186,
210,
265,
266,
340,
341,
404,
405,
453,
454,
482,
483,
575,
576,
883,
884,
1059,
1060,
1083,
1084,
1232,
1233,
1569,
1570,
1596,
1597,
1675,
1676,
1702,
1707,
1844,
1848,
2169,
2174,
2353,
2358,
2618,
2619,
2738,
2739,
2827,
2828,
2854,
2855,
2899,
2900,
2909,
2910,
3010,
3011,
3037,
3041,
3319,
3324,
3433,
3434,
3455,
3456,
3482,
3486,
3887,
3891,
3965,
3966,
4047,
4048,
4231,
4232,
4258,
4259,
4271,
4272,
4274,
4282,
4283,
4360
]
}
|
{
"red_pajama_v2": {
"ccnet_original_length": 4360,
"ccnet_original_nlines": 79,
"rps_doc_curly_bracket": 0,
"rps_doc_ldnoobw_words": 0,
"rps_doc_lorem_ipsum": 0,
"rps_doc_stop_word_fraction": 0.38952380418777466,
"rps_doc_ut1_blacklist": 0,
"rps_doc_frac_all_caps_words": 0.0209523793309927,
"rps_doc_frac_lines_end_with_ellipsis": 0,
"rps_doc_frac_no_alph_words": 0.2504761815071106,
"rps_doc_frac_unique_words": 0.4136054515838623,
"rps_doc_mean_word_length": 4.537415027618408,
"rps_doc_num_sentences": 108,
"rps_doc_symbol_to_word_ratio": 0.0009523800108581781,
"rps_doc_unigram_entropy": 5.160330772399902,
"rps_doc_word_count": 735,
"rps_doc_frac_chars_dupe_10grams": 0.10014992952346802,
"rps_doc_frac_chars_dupe_5grams": 0.11844077706336975,
"rps_doc_frac_chars_dupe_6grams": 0.11844077706336975,
"rps_doc_frac_chars_dupe_7grams": 0.10944528132677078,
"rps_doc_frac_chars_dupe_8grams": 0.10014992952346802,
"rps_doc_frac_chars_dupe_9grams": 0.10014992952346802,
"rps_doc_frac_chars_top_2gram": 0.01889055036008358,
"rps_doc_frac_chars_top_3gram": 0.03958021104335785,
"rps_doc_frac_chars_top_4gram": 0.016791600733995438,
"rps_doc_books_importance": -410.25311279296875,
"rps_doc_books_importance_length_correction": -410.25311279296875,
"rps_doc_openwebtext_importance": -250.49560546875,
"rps_doc_openwebtext_importance_length_correction": -250.49560546875,
"rps_doc_wikipedia_importance": -165.17921447753906,
"rps_doc_wikipedia_importance_length_correction": -165.17921447753906
},
"fasttext": {
"dclm": 0.2539938688278198,
"english": 0.9310515522956848,
"fineweb_edu_approx": 1.6217488050460815,
"eai_general_math": 0.09050899744033813,
"eai_open_web_math": 0.4226287603378296,
"eai_web_code": 0.0017212600214406848
}
}
|
{
"free_decimal_correspondence": {
"primary": {
"code": "004.67",
"labels": {
"level_1": "General works, books and libraries, information sciences",
"level_2": "",
"level_3": "Computers and Computer science"
}
},
"secondary": {
"code": "-1",
"labels": {
"level_1": "",
"level_2": "",
"level_3": ""
}
}
},
"bloom_cognitive_process": {
"primary": {
"code": "2",
"label": "Understand"
},
"secondary": {
"code": "3",
"label": "Apply"
}
},
"bloom_knowledge_domain": {
"primary": {
"code": "2",
"label": "Conceptual"
},
"secondary": {
"code": "3",
"label": "Procedural"
}
},
"document_type_v1": {
"primary": {
"code": "5",
"label": "Social/Forum"
},
"secondary": {
"code": "-1",
"label": "Abstain"
}
},
"extraction_artifacts": {
"primary": {
"code": "3",
"label": "Irrelevant Content"
},
"secondary": {
"code": "0",
"label": "No Artifacts"
}
},
"missing_content": {
"primary": {
"code": "4",
"label": "Missing Images or Figures"
},
"secondary": {
"code": "0",
"label": "No missing content"
}
},
"document_type_v2": {
"primary": {
"code": "18",
"label": "Q&A Forum"
},
"secondary": {
"code": "8",
"label": "Documentation"
}
},
"reasoning_depth": {
"primary": {
"code": "2",
"label": "Basic Reasoning"
},
"secondary": {
"code": "3",
"label": "Intermediate Reasoning"
}
},
"technical_correctness": {
"primary": {
"code": "3",
"label": "Mostly Correct"
},
"secondary": {
"code": "4",
"label": "Highly Correct"
}
},
"education_level": {
"primary": {
"code": "3",
"label": "Undergraduate Level"
},
"secondary": {
"code": "2",
"label": "High School Level"
}
}
}
|
672f1e42c33a7f9846924a2431ea77df
|
-3,017,836,809,393,130,500
|
Google Sync For Mobile Works, “Sync” Fails
Friday, March 20, 2009
I used to be very happy with Google Sync. It worked great and got my outlook calendar to my google calendar reliably and easily. And with google’s gears-based offline calendar, my calendar life seemed complete.
Until… it just didn’t sync. Not at all. I was always disappointed it would only sync to my default calendar, but not syncing at all, well that just sucks.
sync for mobile.jpg
So I tried Sync for my blackberry. It worked perfectly (so far) and lets me choose which calendar to send my data to, which is perfect for keeping work and personal calendars separate and allows me do bidirectional sync without populating my work calendar with embarrassing personal events.
The only problem is that I tried to sync my contacts from Google Contacts. That was bad, mmmkay, because Google contacts SAID it would parse VCAL files, so I exported a vcal directory from Mulberry mail (and you know Cyrus got the format perfect to the letter) and google read every VCAL field as an entry, so I had 1200 people named BEGIN: VCAL, and 1200 people named END… etc.
mail contacts.png
Now Google, in their unfathomable wisdom, only lets you delete 500 entries at a time. Which means individually ticking the entries one at a time until there are less than 500 identical entries (like BEGIN: VCAL) which can then be bulk deleted. That was not happening. I tried, thus, to sync 8,000 plus entries to my blackberry and that did not work… that’s why there is the “fail” notice.
But somebody pointed out that you can switch to the “Older Version” and from that you can delete more than 500 entries a time and this bug was fixed in the newer version to prevent such deletions. From the older version you can search and delete larger groups (at least 1324 at a time).
You may need to log out of google and log back in to propagate the deletions to the New Version.
Posted at 21:56:44 GMT-0700
Category: photoPositiveReviewsTechnology
|
{
"url": "https://gessel.blackrosetech.com/2009/03/20",
"source_domain": "gessel.blackrosetech.com",
"snapshot_id": "CC-MAIN-2024-38",
"warc_metadata": {
"Content-Length": "56091",
"Content-Type": "application/http; msgtype=response",
"WARC-Block-Digest": "sha1:M4BT45CMMLUJ53FY6JNFF2LIJTLL6QBU",
"WARC-Concurrent-To": "<urn:uuid:248c60fb-fd9d-4ecd-ac32-9084b8b67975>",
"WARC-Date": "2024-09-20T23:21:49Z",
"WARC-IP-Address": "23.114.97.241",
"WARC-Identified-Payload-Type": "text/html",
"WARC-Payload-Digest": "sha1:L5UBXB5L2TKVA6DVZIQLNMF44BBCPOWM",
"WARC-Record-ID": "<urn:uuid:1746a139-3dce-47a6-9afa-550d5fd80d59>",
"WARC-Target-URI": "https://gessel.blackrosetech.com/2009/03/20",
"WARC-Truncated": null,
"WARC-Type": "response",
"WARC-Warcinfo-ID": "<urn:uuid:5dc8a0cb-d60f-437d-9f75-ebeb3a580a78>"
},
"warc_info": "isPartOf: CC-MAIN-2024-38\r\npublisher: Common Crawl\r\ndescription: Wide crawl of the web for September 2024\r\noperator: Common Crawl Admin (info@commoncrawl.org)\r\nhostname: ip-10-67-67-163\r\nsoftware: Apache Nutch 1.20 (modified, https://github.com/commoncrawl/nutch/)\r\nrobots: checked via crawler-commons 1.5-SNAPSHOT (https://github.com/crawler-commons/crawler-commons)\r\nformat: WARC File Format 1.1\r\nconformsTo: https://iipc.github.io/warc-specifications/specifications/warc-format/warc-1.1/"
}
|
{
"line_start_idx": [
0,
1,
2,
3,
4,
5,
6,
49,
50,
73,
74,
285,
440,
441,
461,
462,
753,
754,
1133,
1134,
1152,
1153,
1542,
1543,
1830,
1831,
1928,
1929,
1957,
1958
],
"line_end_idx": [
1,
2,
3,
4,
5,
6,
49,
50,
73,
74,
285,
440,
441,
461,
462,
753,
754,
1133,
1134,
1152,
1153,
1542,
1543,
1830,
1831,
1928,
1929,
1957,
1958,
1998
]
}
|
{
"red_pajama_v2": {
"ccnet_original_length": 1998,
"ccnet_original_nlines": 29,
"rps_doc_curly_bracket": 0,
"rps_doc_ldnoobw_words": 1,
"rps_doc_lorem_ipsum": 0,
"rps_doc_stop_word_fraction": 0.3961813747882843,
"rps_doc_ut1_blacklist": 0,
"rps_doc_frac_all_caps_words": 0.03818615898489952,
"rps_doc_frac_lines_end_with_ellipsis": 0,
"rps_doc_frac_no_alph_words": 0.18138425052165985,
"rps_doc_frac_unique_words": 0.5158501267433167,
"rps_doc_mean_word_length": 4.564841270446777,
"rps_doc_num_sentences": 20,
"rps_doc_symbol_to_word_ratio": 0.007159899920225143,
"rps_doc_unigram_entropy": 4.822124481201172,
"rps_doc_word_count": 347,
"rps_doc_frac_chars_dupe_10grams": 0,
"rps_doc_frac_chars_dupe_5grams": 0,
"rps_doc_frac_chars_dupe_6grams": 0,
"rps_doc_frac_chars_dupe_7grams": 0,
"rps_doc_frac_chars_dupe_8grams": 0,
"rps_doc_frac_chars_dupe_9grams": 0,
"rps_doc_frac_chars_top_2gram": 0.012626259587705135,
"rps_doc_frac_chars_top_3gram": 0.013257579877972603,
"rps_doc_frac_chars_top_4gram": 0,
"rps_doc_books_importance": -165.92762756347656,
"rps_doc_books_importance_length_correction": -165.92762756347656,
"rps_doc_openwebtext_importance": -101.9328384399414,
"rps_doc_openwebtext_importance_length_correction": -101.9328384399414,
"rps_doc_wikipedia_importance": -45.998558044433594,
"rps_doc_wikipedia_importance_length_correction": -45.998558044433594
},
"fasttext": {
"dclm": 0.03845369815826416,
"english": 0.9483919739723206,
"fineweb_edu_approx": 1.0745116472244263,
"eai_general_math": 0.6021318435668945,
"eai_open_web_math": 0.40164703130722046,
"eai_web_code": 0.261228084564209
}
}
|
{
"free_decimal_correspondence": {
"primary": {
"code": "005.4",
"labels": {
"level_1": "General works, books and libraries, information sciences",
"level_2": "",
"level_3": "Computer programming"
}
},
"secondary": {
"code": "004.678",
"labels": {
"level_1": "General works, books and libraries, information sciences",
"level_2": "",
"level_3": "Computers and Computer science"
}
}
},
"bloom_cognitive_process": {
"primary": {
"code": "2",
"label": "Understand"
},
"secondary": {
"code": "3",
"label": "Apply"
}
},
"bloom_knowledge_domain": {
"primary": {
"code": "3",
"label": "Procedural"
},
"secondary": {
"code": "2",
"label": "Conceptual"
}
},
"document_type_v1": {
"primary": {
"code": "9",
"label": "Personal/Misc"
},
"secondary": {
"code": "-1",
"label": "Abstain"
}
},
"extraction_artifacts": {
"primary": {
"code": "0",
"label": "No Artifacts"
},
"secondary": {
"code": "-1",
"label": "Abstain"
}
},
"missing_content": {
"primary": {
"code": "4",
"label": "Missing Images or Figures"
},
"secondary": {
"code": "-1",
"label": "Abstain"
}
},
"document_type_v2": {
"primary": {
"code": "16",
"label": "Personal Blog"
},
"secondary": {
"code": "24",
"label": "User Review"
}
},
"reasoning_depth": {
"primary": {
"code": "2",
"label": "Basic Reasoning"
},
"secondary": {
"code": "3",
"label": "Intermediate Reasoning"
}
},
"technical_correctness": {
"primary": {
"code": "3",
"label": "Mostly Correct"
},
"secondary": {
"code": "4",
"label": "Highly Correct"
}
},
"education_level": {
"primary": {
"code": "2",
"label": "High School Level"
},
"secondary": {
"code": "1",
"label": "General Audience"
}
}
}
|
672f1e42c33a7f9846924a2431ea77df
|
-7,355,678,668,375,921,000
|
30
Mar 18
See if this definition of a function is better than others
See if this definition of a function is better than others
Try the definitions from the Khan Academy, Math is Fun, WikipediaPaul's Online Math Notes, and there are some others. Most of them are obsessed with the input-output terminology, which is not used by professionals. I think my explanation is more visual.
"Sending letters" is associated with arrows
Situation: every citizen a from the city of A sends letters to some citizen(s) b of the city of B. In Figure 1, the arrows show that citizen a_1 sends letters to three citizens of B: they are b_1,b_2,b_3, while citizen a_2 sends letters to only b_1. Let us write f(a)=b if a sends letters to b. Here, a is called an argument (some people say an input) and b is called a value (some people say an output).
This is not a function
Figure 1. This is not a function
Definitionf is called a function if for each argument, the corresponding value is unique.
The situation depicted in Figure 1 does not describe a function, because a_1 sends letters to more than one person. The visualization of a function is given in Figure 2, where arrows going from one citizen of A to more that one citizen of B are excluded.
This is a function
Figure 2. This is a function
We finalize the function definition with some remarks. In theory, of course, instead of cities, we talk about sets. Also, instead of "sending letters" we say "the function f maps a to b". f(a) is called an image of a.
The set A is called the domain of the function f. Go to the beginning of this section and see that we said "every citizen a from the city of A..." This means that our function is defined everywhere in the domain. In practice, when you are given a function, you may have to describe the domain by removing all elements where your function is not defined.
Here is a detective story
One citizen of B mysteriously dies. Before dying, he manages to tell those around him that he had visited his correspondent in A and was probably poisoned during the visit. The local detective's task will be simpler if the poor guy had been receiving letters from only one person. We write f^{-1}(b)=a if b receives letters from a. If nobody in B receives letters from more than one sender, then f^{-1} satisfies the definition of a function.
Definition. We say that the inverse function exists if f^{-1} satisfies the definition of a function. Equivalently,
(1) whenever a_1\ne a_2, their images should be different: f(a_1)\ne f(a_2).
In Figure 2, the inverse does not exist. In Figure 3, it does. The function f takes us along the red arrow from a to its image f(a)=b. The inverse function f^{-1} takes us back along the yellow arrow from b to a=f^{-1}(b), which is called a counterimage (or preimage) of b.
This function has an inverse
Figure 3. This function has an inverse
How to find the derivative of the inverse
From now on the arguments and values will be real.
The direct function f maps a to b and the inverse function maps b back to a. This gives an obvious identity: f^{-1}(f(a))=a. Similarly, f(f^{-1}(b))=b. Since this is true for all b, we can differentiate this equation using the chain rule to get
f'(f^{-1}(b))\frac{df^{-1}(b)}{db}=1.
Hence, \frac{df^{-1}(b)}{db}=\frac{1}{f'(f^{-1}(b))}, which is often written as \frac{df^{-1}(b)}{db}=\frac{1}{f'(a)} with a=f^{-1}(b).
Conditions sufficient for existence of the inverse
Condition 1. Let the function f be strictly monotone. If it is increasing, for example, then this condition means that x_1<x_2 implies f(x_1)<f(x_2). Obviously, this implies (1) and the inverse exists.
Condition 2 (condition sufficient for Condition 1). Suppose the derivative of f does not change sign. For example, if the derivative is everywhere positive (think about the exponential function), then the function is strictly increasing and we can apply Condition 1.
Example. The function f(x)=x^2 is not one-to-one on the real line. If we take as its domain [0,\infty), it will be one-to-one (it is strictly monotone and its derivative is positive on the set of positive numbers). On this set, it's inverse is f^{-1}(y)=\sqrt{y}. The equations f^{-1}(f(x))=x and f(f^{-1}(y))=y take the form \sqrt{x^2}=x and (\sqrt{y})^2=y. The equations y=x^2 and x=\sqrt{y} are equivalent.
Leave a Reply
You must be logged in to post a comment.
|
{
"url": "http://raisingthebar.nl/2018/03/30/see-if-this-definition-of-a-function-is-better-than-others/",
"source_domain": "raisingthebar.nl",
"snapshot_id": "crawl=CC-MAIN-2018-39",
"warc_metadata": {
"Content-Length": "94732",
"Content-Type": "application/http; msgtype=response",
"WARC-Block-Digest": "sha1:HLTAWWHQOJ3MGMGZQKWEGN44JLQQ27U2",
"WARC-Concurrent-To": "<urn:uuid:dc7a631a-8709-43ca-b05e-457ae95eed87>",
"WARC-Date": "2018-09-21T22:11:17Z",
"WARC-IP-Address": "146.66.86.164",
"WARC-Identified-Payload-Type": "text/html",
"WARC-Payload-Digest": "sha1:ITH4NEVZFNDQ2IPOQABHXVISQSS7JQHA",
"WARC-Record-ID": "<urn:uuid:611a9004-bb09-4e9e-8ef6-343d0247c685>",
"WARC-Target-URI": "http://raisingthebar.nl/2018/03/30/see-if-this-definition-of-a-function-is-better-than-others/",
"WARC-Truncated": null,
"WARC-Type": "response",
"WARC-Warcinfo-ID": "<urn:uuid:4f0f86b8-d283-4b63-8c95-f1dced1e27b6>"
},
"warc_info": "isPartOf: CC-MAIN-2018-39\r\npublisher: Common Crawl\r\ndescription: Wide crawl of the web for September 2018\r\noperator: Common Crawl Admin (info@commoncrawl.org)\r\nhostname: ip-10-65-123-119.ec2.internal\r\nsoftware: Apache Nutch 1.15 (modified, https://github.com/commoncrawl/nutch/)\r\nrobots: checked via crawler-commons 0.11-SNAPSHOT (https://github.com/crawler-commons/crawler-commons)\r\nformat: WARC File Format 1.1\r\nconformsTo: http://iipc.github.io/warc-specifications/specifications/warc-format/warc-1.1/"
}
|
{
"line_start_idx": [
0,
3,
10,
11,
70,
71,
130,
131,
385,
386,
430,
431,
836,
837,
860,
861,
894,
895,
985,
986,
1241,
1242,
1261,
1262,
1291,
1292,
1510,
1511,
1865,
1866,
1892,
1893,
2336,
2337,
2453,
2454,
2531,
2532,
2806,
2807,
2836,
2837,
2876,
2877,
2919,
2920,
2971,
2972,
3217,
3218,
3256,
3257,
3393,
3394,
3445,
3446,
3648,
3649,
3916,
3917,
4327,
4328,
4342,
4343
],
"line_end_idx": [
3,
10,
11,
70,
71,
130,
131,
385,
386,
430,
431,
836,
837,
860,
861,
894,
895,
985,
986,
1241,
1242,
1261,
1262,
1291,
1292,
1510,
1511,
1865,
1866,
1892,
1893,
2336,
2337,
2453,
2454,
2531,
2532,
2806,
2807,
2836,
2837,
2876,
2877,
2919,
2920,
2971,
2972,
3217,
3218,
3256,
3257,
3393,
3394,
3445,
3446,
3648,
3649,
3916,
3917,
4327,
4328,
4342,
4343,
4383
]
}
|
{
"red_pajama_v2": {
"ccnet_original_length": 4383,
"ccnet_original_nlines": 63,
"rps_doc_curly_bracket": 0.013689249753952026,
"rps_doc_ldnoobw_words": 0,
"rps_doc_lorem_ipsum": 0,
"rps_doc_stop_word_fraction": 0.43127962946891785,
"rps_doc_ut1_blacklist": 0,
"rps_doc_frac_all_caps_words": 0.010426539927721024,
"rps_doc_frac_lines_end_with_ellipsis": 0,
"rps_doc_frac_no_alph_words": 0.24454976618289948,
"rps_doc_frac_unique_words": 0.36486485600471497,
"rps_doc_mean_word_length": 4.428378582000732,
"rps_doc_num_sentences": 53,
"rps_doc_symbol_to_word_ratio": 0.0009478700230829418,
"rps_doc_unigram_entropy": 4.915964126586914,
"rps_doc_word_count": 740,
"rps_doc_frac_chars_dupe_10grams": 0.029295090585947037,
"rps_doc_frac_chars_dupe_5grams": 0.1031431183218956,
"rps_doc_frac_chars_dupe_6grams": 0.07750991731882095,
"rps_doc_frac_chars_dupe_7grams": 0.0671345666050911,
"rps_doc_frac_chars_dupe_8grams": 0.045773569494485855,
"rps_doc_frac_chars_dupe_9grams": 0.029295090585947037,
"rps_doc_frac_chars_top_2gram": 0.03295696899294853,
"rps_doc_frac_chars_top_3gram": 0.016783639788627625,
"rps_doc_frac_chars_top_4gram": 0.025633199140429497,
"rps_doc_books_importance": -540.6680297851562,
"rps_doc_books_importance_length_correction": -540.6680297851562,
"rps_doc_openwebtext_importance": -267.3406066894531,
"rps_doc_openwebtext_importance_length_correction": -267.3406066894531,
"rps_doc_wikipedia_importance": -160.5889892578125,
"rps_doc_wikipedia_importance_length_correction": -160.5889892578125
},
"fasttext": {
"dclm": 0.7553164958953857,
"english": 0.8649191856384277,
"fineweb_edu_approx": 3.1756539344787598,
"eai_general_math": 0.999009907245636,
"eai_open_web_math": 0.8594045639038086,
"eai_web_code": 0.7697075605392456
}
}
|
{
"free_decimal_correspondence": {
"primary": {
"code": "511.3",
"labels": {
"level_1": "Science and Natural history",
"level_2": "Mathematics",
"level_3": "Arithmetic"
}
},
"secondary": {
"code": "515",
"labels": {
"level_1": "Science and Natural history",
"level_2": "Mathematics",
"level_3": "Calculus and Mathematical analysis"
}
}
},
"bloom_cognitive_process": {
"primary": {
"code": "2",
"label": "Understand"
},
"secondary": {
"code": "3",
"label": "Apply"
}
},
"bloom_knowledge_domain": {
"primary": {
"code": "2",
"label": "Conceptual"
},
"secondary": {
"code": "3",
"label": "Procedural"
}
},
"document_type_v1": {
"primary": {
"code": "3",
"label": "Reference/Encyclopedic/Educational"
},
"secondary": {
"code": "-1",
"label": "Abstain"
}
},
"extraction_artifacts": {
"primary": {
"code": "0",
"label": "No Artifacts"
},
"secondary": {
"code": "3",
"label": "Irrelevant Content"
}
},
"missing_content": {
"primary": {
"code": "4",
"label": "Missing Images or Figures"
},
"secondary": {
"code": "-1",
"label": "Abstain"
}
},
"document_type_v2": {
"primary": {
"code": "23",
"label": "Tutorial"
},
"secondary": {
"code": "10",
"label": "Knowledge Article"
}
},
"reasoning_depth": {
"primary": {
"code": "3",
"label": "Intermediate Reasoning"
},
"secondary": {
"code": "2",
"label": "Basic Reasoning"
}
},
"technical_correctness": {
"primary": {
"code": "4",
"label": "Highly Correct"
},
"secondary": {
"code": "3",
"label": "Mostly Correct"
}
},
"education_level": {
"primary": {
"code": "3",
"label": "Undergraduate Level"
},
"secondary": {
"code": "2",
"label": "High School Level"
}
}
}
|
672f1e42c33a7f9846924a2431ea77df
|
-7,635,960,370,238,240,000
|
Merge two tables
Hi there
I inherited information from a colleague who had created 2 tables instead of
one table with all the information.
How do I combine the information from the 2 separate tables into 1?
Essentially the original 2 tables are two different halves of the same
survey, Survey 1 and Survey 2.
Thank you in advance.
0
Utf
12/5/2009 4:01:01 AM
access 16762 articles. 3 followers. Follow
2 Replies
589 Views
Similar Articles
[PageSpeed] 4
On Fri, 4 Dec 2009 20:01:01 -0800, forest8 <forest8@discussions.microsoft.com>
wrote:
>Hi there
>
>I inherited information from a colleague who had created 2 tables instead of
>one table with all the information.
>
>How do I combine the information from the 2 separate tables into 1?
>
>Essentially the original 2 tables are two different halves of the same
>survey, Survey 1 and Survey 2.
>
>Thank you in advance.
Probably an Append Query, but the details will depend on the structure of the
tables. Do they have Autonumber primary keys? If so, it's likely that you have
records in the two tables with duplicate ID's; this can cause hassles if there
are related tables.
Are there related tables? Do you have Autonumbers? More details please!
--
John W. Vinson [MVP]
0
John
12/5/2009 4:09:57 AM
forest8,
With the limited information you provided I would say use an Append query.
HOWEVER, note the big however, using one table sounds more like a
spreadsheet then a normalized database which is what Access is. Perhaps you
could provide details on your table structure so we may better reply to your
question... Why? Because it might be that you actualy needed 6 tables
instead on trying to turn two tables into one.
To get a better example of what I'm talking about have a look at the table
structure in this database...
http://www.rogersaccesslibrary.com/forum/forum_posts.asp?TID=3
--
Gina Whipp
"I feel I have been denied critical, need to know, information!" - Tremors
II
http://www.regina-whipp.com/index_files/TipList.htm
"forest8" <forest8@discussions.microsoft.com> wrote in message
news:CFA42788-3DFE-4ABE-8987-45CE852A2F88@microsoft.com...
> Hi there
>
> I inherited information from a colleague who had created 2 tables instead
> of
> one table with all the information.
>
> How do I combine the information from the 2 separate tables into 1?
>
> Essentially the original 2 tables are two different halves of the same
> survey, Survey 1 and Survey 2.
>
> Thank you in advance.
0
Gina
12/5/2009 3:49:08 PM
Reply:
Similar Artilces:
Two at once??
Hi I would like to be able to see the contents of 2, or even better 3, mail folders when I open Outlook rather than just the one at present. Ideally one above the other. Any ideas that could help me. Thanks Right click on a folder and choose "Open in a new window". Then right click on the taskbar & choose "Tile Windows Horizontally" "Zaphod" <zaphodbeeb@ntlworld.com> wrote in message news:hZFLe.8727$wh6.2887@newsfe2-win.ntli.net... > Hi > > I would like to be able to see the contents of 2, or even better 3, mail > folders when I ...
Merge same transaction #2
I've had transactions that I've placed in my register with detailed info in the memo area only to have the same exact transaction download with no info and unrecognized as the same transaction. Traditionally I've copied and pasted the info into the downloaded transaction and then deleted my transaction. This is a real PAIN... Is there a way to tell Money that these two separate transactions are the SAME transaction and then have it merge them? It works exactly as intended when Money recognizes the transaction that's already in the register and then merges them beautiful...
Recordset merge
I am merging from an Access 2007 Form/subforms to a bookmarked Word document. I am able to use <.MoveNext> to merge the recordsets, but get an error if there are less records. The DAO Library is referenced, I've tried this code, but now only the first record is merged and the fields of the recordsets of the form are replaced with #Name? (Fortunately, rebooting Access returns the recordset fields to former state). Any suggestions? Dim db As DAO.Database Dim rs As DAO.Recordset Set db = CurrentDb Set rs = Forms("OGML").qryMineralOwnersub.Form.Recordset rs...
Duplex printing two up
I am working on a program to print bills. I designed a report with two pages, the customer address on page one and the billing info on page two. I then print it auto duplex in landscape and it works correctly. We then fold it in half to be mailed like a postcard and the bill is hidden inside. Life is good, except for one small problem. I need to print them two-up, because our printer will only auto duplex a full page, and we do not want to waist half of every sheet of stock. We need two addresses on the front with two bills on the back. We will then cut them into two bills and fold a...
Two versions of "personal folders"
I seem to have two versions of "personal folders" in my Outlook 2003. Only one of them is used really, I think the other must have been created during a backup from file or something. Can I merge them together somehow? I tried to copy the unused one into the other, but it claims that special folders can't be moved. They each point to a different data file, the second one pointing to my backup. The weird thing is that as far as I can tell, everything from backup went into the "main" personal folder too; I had no files or folders at all before backup. Thanks for any help...
merge 2 copies of xml file???
i want to combine data from 2 versions of a music playlist , but can o0nly find help about merging 2 shared workbooks. can't seem to re-set my xml files as shared workbooks. how do i simply merge 2 lists?? -- musicman toronto On Sun, 16 Dec 2007 19:25:01 -0800, musiclover wrote: > i want to combine data from 2 versions of a music playlist , but can > o0nly find help about merging 2 shared workbooks. can't seem to re-set > my xml files as shared workbooks. how do i simply merge 2 lists?? It is not obvious why you'd want to combine two XML files with Excel. Are t...
pivot table help!
I need some help with an issue I cannot seem to solve! I have a pivot table in Excel that is based off of a data input sheet. The data changes every month and the pivot table is always linked to the specific data tab. When the underlying data changes, the "old data" still displays as options to check in the pivot table. The refresh option does not seem to fix this, nor does the "Save data with table layout" option. I only want the options to check to be current data. For example, my data sheet only has data for July and August, but the pivot table has options to check...
Tables not changing in GP
I have created a GP add-in. The latest version of this app uses 5 new tables, which are created by a process run at "Startup". The tables are created fine in SQL Server, along with the appropriate permissions. My problem is that the resources (Tools > Resources > Tables) for my product still show an old table (which has been renamed in the app) and does not show the new table. Both the changed table and the new one are in the same Table Group as the other tables and they are all in the same series (Purchasing). Before installing my nw chunk I have deleted the old dict...
empty lines in catalog merge
I am using Publisher 2003 to create a student directory. Some students have more information to be printed than others. For example, if dad or mom lives at a different address than the student that entry will have additional fields. Currently the product of my merge is working fine, but longer than it needs to be because of many blank lines. I know I can select "dont print empty lines" in Print Merge, but I want the empty lines to not be in the merge output. (I am choosing "Create new publication" in the wizard.) I am taking that merge output and combining it with s...
mail merge for brochure
Howdy all... Created a mail merge between Pub 2007 tri-fold brochure (wizard created) and Excel file...the merge works fine. But I have two issues: 1- Pub refuses to print only page 1 to pdf - I don't want the other side because I will bring this to a printer to have 3000 prints made...and see #2 - I suppose I can just delete it prior to printing. 2- So I would like to output this to ONE big pdf, so I will have 3000 copies of the same front page of brochure with different clients' names/addresses preprinted on it. Then just have the print house use a second pdf for the backsid...
make a duplicate table in access and save changes
I have a table that gives the rates of Dearness Allowance.These rates are given for different periods in percentages. ex: 01-01-2009 to 30-06-2009 37% 01-07-2009 to 30-11-2009 45% etc.. This is the default table and is applicable to almost 95% to 97% of employees. I want to make a duplicate of this table and display it in an unbound subform ( which is a continuous form). If the user makes any changes in it, it is then clear that Default rates are not applicable to him. Then, i want to store the data in a new table tblDeviations where i will store the EmployeeId also ...
Formatting Pivot Table- when doble clicking to show Detail
He there, Can I modified the format of the detail that I get once I doble click my pivot Table? Or Is there a way that once I dobleclick in my pivot table to obtain the detail, a macro can be fired to apply the format that I want?. ...
In Access 2007, how do I get a chart to reflect table data?
Am not sure how to get charts to reflect table data. It appears that you can create charts in forms and reports, and there's a chart wizard in which I select a table and fields, but the resulting chart does not have table data in it. Any suggestions? ...
Combining two worksheets with same case identifiers
Hello, I am trying to merge two workbooks containing data from an experiment. The first three columns have identical data in both workbooks, and include a participant number, value for Variable1,and value for Variable2. Each participant takes up about 12 rows of the worksheet, this includes all possible combinations of Variable1 and Variable2. The last three columns represent judge ratings. Half of these ratings are entered in Worksheet I, and half of them in Worksheet II. Some rows in Worksheet I contain missing data which is contained in Worksheet II. How do I go about combining these...
Mail Merge with Template Letter
Hi. I'm trying to set up Mail Merge in MS CRM 3.0 for some Contact records and want to use the contact's Nickname when one exists. When I create a blank letter or try to edit an existing letter template, the Nickname field doesn't seem to be available. I know that custom fields aren't available, but where are the other out-of-the-box fields besides the first, middle, and last name and address fields? Am I missing something? Is it really this limited? Hi, Out of the box email merging is limited. Couple of ways get around it: 1. Connect Excel to the Filteredcontacts...
Printing Two Forms with one Command Button
Is there a way to allow someone to print record information from two different forms with one command button. Situation is I have a form that has basic information about a contact, user click on a command button to open a new form if they need additional "detailed" information about this contact. What I would like to do is on the second form is have users press a print button that would allow them to print both forms. At this time the user needs to go to each form and press print. Both forms are set to stay open. -- Message posted via AccessMonster.com http://www.accessmonster.c...
Error message with Publisher 2007 Catalog Merge to SQL 2005
Hello When I attempt a Catalog Merge to SQL 2005 with Publisher 2007, I get an 'invalid object name' error. Yet, when I use the exact same .odc connection in Excel 2007, the SQL view opens with no problems. Can anyone duplicate this bug and/or have a solution besides load the data into Excel, save it, and reload it into Publisher? Thanks. I can't find too much about this error. Publisher 2003 had merge problems, maybe by reading the fix, it will give you insight. Error message when you use an .odc file to connect to a specific table in a mail merge data source in Office 20...
Compare two files
I have two spreadsheets that I need to compare and then combine. The first file includes all employees including file number, name and address. The second file is for active employees only. It includes only file number and name. I want to add the second file to the first so I can eliminate terminated employees. Is there a way to do this See Chip's site www.cpearson.com He has lots of stuff on comapring sheets. Best wishes -- Bernard Liengme www.stfx.ca/people/bliengme remove CAPS in e-mail address "Peter" <anonymous@discussions.microsoft.com> wrote in message news:...
How do I merge several workbooks into one on my desktop?
I have several spreadsheet (workbooks) on my desktop that I want to put into one spreadsheet. Without havingto manually copy all ofthem individually, is there an easy way to merge them into one workbook. ...
How do you make a two page purchase order?
I am using a Purchase order template, and the order needs to be 2-3 pages long. How do I continue the page on to another page and have the ending total be correct? If the sheet formulas are working correctly, then just put page breaks at the spots you want the new pages to begin. -- Gary''s Student - gsnu200713 ...
Functionality Question: Can you have two views of a folder?
We're looking a building a project/knowledge management system & are considering the options within outlook. Ideally, I'd rather have a single calendar (or other folder) which has a view of certain projects for me; other projects for my co-workers, and sub-set of both for our boss. Obviously we'll need to be *able* to see the suppressed items, but normally wont. While reading "Outlook 2000: In a nutshell" by Syroid & Leuf (O'Reilly), I'm wondering if we could have a master calendar folder, and have other folders with filters applied that show a subset o...
two users, one computer, shared folders??
I am trying to set up Outlook so that two different users can access the same Calendar, Tasks, Contacts, etc. Has anyone done this successfully? So far I have two users with two independent sets of folders, but I want the same Calendar etc. to show up for both users. thanks! What operating system and version of Outlook are you using? Do you use windows profiles or only Outlook profiles? --� Milly Staples [MVP - Outlook] Post all replies to the group to keep the discussion intact. After searching google.groups.com and finding no answer: Sue G <anonymous@discussions.microsoft.com&g...
Adress Book Sync over two Sites
We have a one Ex2k3 at our site with a own AD site1.com and we have still a tust to an other AD site2.se how can i sync the adressbooks (like a Siteconnector at Ex5.5) MIIS - Identity Integration Services. "HWU" <HWU@discussions.microsoft.com> wrote in message news:CA18AFD6-70F8-444B-B04E-B1D6A99DB547@microsoft.com... > We have a one Ex2k3 at our site with a own AD site1.com and we have still > a > tust to an other AD site2.se > how can i sync the adressbooks (like a Siteconnector at Ex5.5) > > Take a look at Jim McBee's blog, he recently wrot...
new table from same data as report
Greetings, I hope this is the correct group, my question spans several topics. I have created a db from the Access 2000 time and billing wizard. Mostly it works ok. There are about a hundred peculiarities that I do not yet understand. But for now, this is the thing I have decided to work on. The db allows you to create an invoice from data that is displayed on a form from a form and some criteria info you provide. You click a command button and voila, a report with the same info. No real magic, but handy. What is missing from the template db is the real magic, a way to keep track...
creating a table automatically
hi this is my first post, i'm fairly new to excel & i was hoping someone could help me out. i'm doing some computer work for my uncle & as i was going through everything that needed doing & i came accross this excel problem. I'd already created the document which is an operational status report. when he asked me to set it up so that a section of the report would automatically appear on each new page of the document. he's given me a list of the cells he wants to appear automatically. the list is a box from the cell A8 down to the cell N17. within the box is at least...
|
{
"url": "https://msgroups.net/access/merge-two-tables/113448",
"source_domain": "msgroups.net",
"snapshot_id": "crawl=CC-MAIN-2022-05",
"warc_metadata": {
"Content-Length": "33994",
"Content-Type": "application/http; msgtype=response",
"WARC-Block-Digest": "sha1:H3CJVRZ6VMGDMF2P4LIRRC23FSYDGGAL",
"WARC-Concurrent-To": "<urn:uuid:7a8b8d57-3d47-40d9-b7f8-0cd72c6f97ae>",
"WARC-Date": "2022-01-21T13:39:53Z",
"WARC-IP-Address": "108.170.9.13",
"WARC-Identified-Payload-Type": "text/html",
"WARC-Payload-Digest": "sha1:XHQMFL2ZGARILXUVKWTPIMJBZN2L6B5F",
"WARC-Record-ID": "<urn:uuid:cbcd4a17-5caa-4381-85a3-76329f0988a8>",
"WARC-Target-URI": "https://msgroups.net/access/merge-two-tables/113448",
"WARC-Truncated": null,
"WARC-Type": "response",
"WARC-Warcinfo-ID": "<urn:uuid:143ab544-ce82-459f-8628-cfa8f8fc55a1>"
},
"warc_info": "isPartOf: CC-MAIN-2022-05\r\npublisher: Common Crawl\r\ndescription: Wide crawl of the web for January 2022\r\noperator: Common Crawl Admin (info@commoncrawl.org)\r\nhostname: ip-10-67-67-58\r\nsoftware: Apache Nutch 1.18 (modified, https://github.com/commoncrawl/nutch/)\r\nrobots: checked via crawler-commons 1.3-SNAPSHOT (https://github.com/crawler-commons/crawler-commons)\r\nformat: WARC File Format 1.1\r\nconformsTo: https://iipc.github.io/warc-specifications/specifications/warc-format/warc-1.1/"
}
|
{
"line_start_idx": [
0,
1,
2,
3,
4,
21,
22,
31,
32,
110,
146,
147,
215,
216,
288,
319,
320,
342,
344,
348,
369,
412,
413,
423,
433,
434,
451,
452,
466,
467,
546,
553,
554,
564,
566,
645,
682,
684,
753,
755,
828,
860,
862,
885,
886,
964,
1043,
1122,
1142,
1143,
1215,
1219,
1220,
1254,
1256,
1261,
1282,
1291,
1292,
1368,
1435,
1513,
1591,
1664,
1711,
1712,
1788,
1818,
1881,
1882,
1886,
1897,
1898,
1974,
1977,
1978,
2030,
2031,
2095,
2154,
2165,
2167,
2244,
2249,
2287,
2289,
2359,
2361,
2434,
2467,
2469,
2494,
2495,
2496,
2498,
2503,
2524,
2531,
2532,
2550,
2551,
2565,
3104,
3105,
3131,
3711,
3712,
3728,
4291,
4292,
4315,
4909,
4910,
4945,
5524,
5525,
5555,
6126,
6127,
6145,
6723,
6724,
6750,
7328,
7329,
7358,
7934,
7935,
7959,
8546,
8547,
8597,
9174,
9175,
9234,
9470,
9471,
9531,
9786,
9787,
9839,
10436,
10437,
10469,
11043,
11044,
11087,
11676,
11677,
11737,
12320,
12321,
12339,
12914,
12915,
12972,
13180,
13181,
13224,
13541,
13542,
13602,
14165,
14166,
14208,
14798,
14799,
14831,
15384,
15385,
15420,
16010,
16011,
16042
],
"line_end_idx": [
1,
2,
3,
4,
21,
22,
31,
32,
110,
146,
147,
215,
216,
288,
319,
320,
342,
344,
348,
369,
412,
413,
423,
433,
434,
451,
452,
466,
467,
546,
553,
554,
564,
566,
645,
682,
684,
753,
755,
828,
860,
862,
885,
886,
964,
1043,
1122,
1142,
1143,
1215,
1219,
1220,
1254,
1256,
1261,
1282,
1291,
1292,
1368,
1435,
1513,
1591,
1664,
1711,
1712,
1788,
1818,
1881,
1882,
1886,
1897,
1898,
1974,
1977,
1978,
2030,
2031,
2095,
2154,
2165,
2167,
2244,
2249,
2287,
2289,
2359,
2361,
2434,
2467,
2469,
2494,
2495,
2496,
2498,
2503,
2524,
2531,
2532,
2550,
2551,
2565,
3104,
3105,
3131,
3711,
3712,
3728,
4291,
4292,
4315,
4909,
4910,
4945,
5524,
5525,
5555,
6126,
6127,
6145,
6723,
6724,
6750,
7328,
7329,
7358,
7934,
7935,
7959,
8546,
8547,
8597,
9174,
9175,
9234,
9470,
9471,
9531,
9786,
9787,
9839,
10436,
10437,
10469,
11043,
11044,
11087,
11676,
11677,
11737,
12320,
12321,
12339,
12914,
12915,
12972,
13180,
13181,
13224,
13541,
13542,
13602,
14165,
14166,
14208,
14798,
14799,
14831,
15384,
15385,
15420,
16010,
16011,
16042,
16616
]
}
|
{
"red_pajama_v2": {
"ccnet_original_length": 16616,
"ccnet_original_nlines": 173,
"rps_doc_curly_bracket": 0,
"rps_doc_ldnoobw_words": 0,
"rps_doc_lorem_ipsum": 0,
"rps_doc_stop_word_fraction": 0.41313910484313965,
"rps_doc_ut1_blacklist": 0,
"rps_doc_frac_all_caps_words": 0.038482680916786194,
"rps_doc_frac_lines_end_with_ellipsis": 0.1551724076271057,
"rps_doc_frac_no_alph_words": 0.195986807346344,
"rps_doc_frac_unique_words": 0.28279682993888855,
"rps_doc_mean_word_length": 4.460020542144775,
"rps_doc_num_sentences": 238,
"rps_doc_symbol_to_word_ratio": 0.010170419700443745,
"rps_doc_unigram_entropy": 5.771308422088623,
"rps_doc_word_count": 2889,
"rps_doc_frac_chars_dupe_10grams": 0.11416375637054443,
"rps_doc_frac_chars_dupe_5grams": 0.12991851568222046,
"rps_doc_frac_chars_dupe_6grams": 0.11540550738573074,
"rps_doc_frac_chars_dupe_7grams": 0.11416375637054443,
"rps_doc_frac_chars_dupe_8grams": 0.11416375637054443,
"rps_doc_frac_chars_dupe_9grams": 0.11416375637054443,
"rps_doc_frac_chars_top_2gram": 0.005044629797339439,
"rps_doc_frac_chars_top_3gram": 0.004190919920802116,
"rps_doc_frac_chars_top_4gram": 0.003725260030478239,
"rps_doc_books_importance": -1576.0494384765625,
"rps_doc_books_importance_length_correction": -1576.0494384765625,
"rps_doc_openwebtext_importance": -950.701416015625,
"rps_doc_openwebtext_importance_length_correction": -950.701416015625,
"rps_doc_wikipedia_importance": -547.7213745117188,
"rps_doc_wikipedia_importance_length_correction": -547.7213745117188
},
"fasttext": {
"dclm": 0.024511460214853287,
"english": 0.9269278049468994,
"fineweb_edu_approx": 1.3605376482009888,
"eai_general_math": 0.7671994566917419,
"eai_open_web_math": 0.17558908462524414,
"eai_web_code": 0.7894991636276245
}
}
|
{
"free_decimal_correspondence": {
"primary": {
"code": "005.74",
"labels": {
"level_1": "General works, books and libraries, information sciences",
"level_2": "",
"level_3": "Computer programming"
}
},
"secondary": {
"code": "005.1",
"labels": {
"level_1": "General works, books and libraries, information sciences",
"level_2": "",
"level_3": "Computer programming"
}
}
},
"bloom_cognitive_process": {
"primary": {
"code": "3",
"label": "Apply"
},
"secondary": {
"code": "2",
"label": "Understand"
}
},
"bloom_knowledge_domain": {
"primary": {
"code": "3",
"label": "Procedural"
},
"secondary": {
"code": "2",
"label": "Conceptual"
}
},
"document_type_v1": {
"primary": {
"code": "5",
"label": "Social/Forum"
},
"secondary": {
"code": "-1",
"label": "Abstain"
}
},
"extraction_artifacts": {
"primary": {
"code": "3",
"label": "Irrelevant Content"
},
"secondary": {
"code": "0",
"label": "No Artifacts"
}
},
"missing_content": {
"primary": {
"code": "0",
"label": "No missing content"
},
"secondary": {
"code": "-1",
"label": "Abstain"
}
},
"document_type_v2": {
"primary": {
"code": "18",
"label": "Q&A Forum"
},
"secondary": {
"code": "8",
"label": "Documentation"
}
},
"reasoning_depth": {
"primary": {
"code": "3",
"label": "Intermediate Reasoning"
},
"secondary": {
"code": "2",
"label": "Basic Reasoning"
}
},
"technical_correctness": {
"primary": {
"code": "3",
"label": "Mostly Correct"
},
"secondary": {
"code": "4",
"label": "Highly Correct"
}
},
"education_level": {
"primary": {
"code": "2",
"label": "High School Level"
},
"secondary": {
"code": "3",
"label": "Undergraduate Level"
}
}
}
|
672f1e42c33a7f9846924a2431ea77df
|
-5,204,943,014,328,886,000
|
Math - Slope intercept
posted by PleaseCheckMyAnswer
Write this equation in slope intercept form. 6x-3y-2=0 and solve for Y.?
My answer: Slope-intercept form:
y = 2x-2/3
I don't know what is the value of y.
Can you help me? Would it also be y = 2x-2/3? Please explain it
1. Damon
sure looks like it to me.
They asked the same question twice.
I bet they meant to say:
Write the equation in standard form
6 x - 3 y = 2
then solve for y in slope intercept form
but who knows
Respond to this Question
First Name
Your Answer
Similar Questions
1. Algerba
Find slope and y-intercept of following equation y=-3 x -2 knowing the slope of intercept 5 formula is y=mx+b slope is m or -3 y=-3 or m (0) -2 m=slope 5 5 y-intercept = let x=o solve for y y=0-2 y=-2 You can tell by inspecting the …
2. algebra[please check]
in questions 1 and 2, write an equation of the line in slope-intercept form. 1. the slope is -4/3; the y-intercept is -2. 2. the slope is 0; the y-intercept is -5. my answers: 1.y=-4/3-2 2. y=-5 ______________________ write an equation …
3. math
i have more than one question so if u no any of the answers please tell me 1.) write the point-slope form of the equation of the line with slope -2 passing through the point ( -5, -9). 2.) write the point-slope form of an equation …
4. Algebra..
HELP. Problems 4 - 7: Write an equation for the line in point/slope form and slope/intercept form that has the given condition. 4. Slope = 3/2 and passes through the origin. 5. x-intercept = 4 and y-intercept = -3
5. Algebra2
Help? Write an equation for the line in point/slope form and slope/intercept form that has the given condition. 4. Slope = 3/2 and passes through the origin. 5. x-intercept = 4 and y-intercept = -3
6. Algebra
I have an assignment that asks me to write an equation in slope-intercept, point-slope, or standard form for the information given and to explain why the chosen form would be best. Below is the information given. 1. passing through …
7. math - pls check!!!
Write an equation in point-slope form for the line that passes through one of the following pairs of points (you may choose the pair you want to work with). Then, use the same set of points to write the equation in standard form and …
8. math - slope-intercept
How do I write one equations in slope-intercept form, and three other lines in slope-intercept form that are perpendicular to the first line ?
9. Algebra 2
Can someone help me with this equation please?
10. ALGEBRA
Solve for y intercepts 7x+y=-2 Answer: Y = -2 7x + 2y = 4 Answer: Y = 2 -------------- If (3,-5) is a point on the graph for the equation in the form y=mx+7, then m=?
More Similar Questions
|
{
"url": "https://www.jiskha.com/display.cgi?id=1459400424",
"source_domain": "www.jiskha.com",
"snapshot_id": "crawl=CC-MAIN-2018-22",
"warc_metadata": {
"Content-Length": "11958",
"Content-Type": "application/http; msgtype=response",
"WARC-Block-Digest": "sha1:V5AJP6C7Z42OMQLYS2CPU4HUHYJ3HWPK",
"WARC-Concurrent-To": "<urn:uuid:405539d8-e128-4ca7-a5b5-695ed542d902>",
"WARC-Date": "2018-05-22T19:50:34Z",
"WARC-IP-Address": "69.16.226.225",
"WARC-Identified-Payload-Type": "text/html",
"WARC-Payload-Digest": "sha1:FCNX3LMX6EIXLRBKY5WWLRPZL5PAAU7C",
"WARC-Record-ID": "<urn:uuid:81b79623-6d47-42ef-98ed-0f7064eea719>",
"WARC-Target-URI": "https://www.jiskha.com/display.cgi?id=1459400424",
"WARC-Truncated": null,
"WARC-Type": "response",
"WARC-Warcinfo-ID": "<urn:uuid:d1212641-8f23-40d3-bc46-8c1a7037c19e>"
},
"warc_info": "robots: classic\r\nhostname: ip-10-229-164-201.ec2.internal\r\nsoftware: Nutch 1.6 (CC)\r\nisPartOf: CC-MAIN-2018-22\r\noperator: Common Crawl Admin\r\ndescription: Wide crawl of the web for May 2018\r\npublisher: Common Crawl\r\nformat: WARC File Format 1.0\r\nconformsTo: http://bibnum.bnf.fr/WARC/WARC_ISO_28500_version1_latestdraft.pdf"
}
|
{
"line_start_idx": [
0,
23,
24,
54,
55,
128,
129,
162,
173,
174,
211,
212,
276,
277,
288,
289,
319,
359,
388,
428,
446,
491,
509,
510,
535,
536,
547,
548,
560,
561,
579,
580,
593,
594,
832,
859,
860,
1102,
1112,
1113,
1350,
1365,
1366,
1584,
1598,
1599,
1801,
1814,
1815,
2053,
2078,
2079,
2318,
2346,
2347,
2494,
2509,
2510,
2561,
2575,
2576,
2747,
2748
],
"line_end_idx": [
23,
24,
54,
55,
128,
129,
162,
173,
174,
211,
212,
276,
277,
288,
289,
319,
359,
388,
428,
446,
491,
509,
510,
535,
536,
547,
548,
560,
561,
579,
580,
593,
594,
832,
859,
860,
1102,
1112,
1113,
1350,
1365,
1366,
1584,
1598,
1599,
1801,
1814,
1815,
2053,
2078,
2079,
2318,
2346,
2347,
2494,
2509,
2510,
2561,
2575,
2576,
2747,
2748,
2770
]
}
|
{
"red_pajama_v2": {
"ccnet_original_length": 2770,
"ccnet_original_nlines": 62,
"rps_doc_curly_bracket": 0,
"rps_doc_ldnoobw_words": 0,
"rps_doc_lorem_ipsum": 0,
"rps_doc_stop_word_fraction": 0.34310850501060486,
"rps_doc_ut1_blacklist": 0,
"rps_doc_frac_all_caps_words": 0.013196480460464954,
"rps_doc_frac_lines_end_with_ellipsis": 0.0793650820851326,
"rps_doc_frac_no_alph_words": 0.34457477927207947,
"rps_doc_frac_unique_words": 0.3375527262687683,
"rps_doc_mean_word_length": 4.126582145690918,
"rps_doc_num_sentences": 48,
"rps_doc_symbol_to_word_ratio": 0.007331380154937506,
"rps_doc_unigram_entropy": 4.57145357131958,
"rps_doc_word_count": 474,
"rps_doc_frac_chars_dupe_10grams": 0.14826175570487976,
"rps_doc_frac_chars_dupe_5grams": 0.20347647368907928,
"rps_doc_frac_chars_dupe_6grams": 0.17893661558628082,
"rps_doc_frac_chars_dupe_7grams": 0.14826175570487976,
"rps_doc_frac_chars_dupe_8grams": 0.14826175570487976,
"rps_doc_frac_chars_dupe_9grams": 0.14826175570487976,
"rps_doc_frac_chars_top_2gram": 0.035787321627140045,
"rps_doc_frac_chars_top_3gram": 0.0460122711956501,
"rps_doc_frac_chars_top_4gram": 0.02044989913702011,
"rps_doc_books_importance": -234.6731414794922,
"rps_doc_books_importance_length_correction": -234.6731414794922,
"rps_doc_openwebtext_importance": -192.84584045410156,
"rps_doc_openwebtext_importance_length_correction": -192.84584045410156,
"rps_doc_wikipedia_importance": -137.77227783203125,
"rps_doc_wikipedia_importance_length_correction": -137.77227783203125
},
"fasttext": {
"dclm": 0.9992943406105042,
"english": 0.9172695279121399,
"fineweb_edu_approx": 3.2044179439544678,
"eai_general_math": 0.9992351531982422,
"eai_open_web_math": 0.6776862144470215,
"eai_web_code": 0.09396404027938843
}
}
|
{
"free_decimal_correspondence": {
"primary": {
"code": "512",
"labels": {
"level_1": "Science and Natural history",
"level_2": "Mathematics",
"level_3": "Algebra"
}
},
"secondary": {
"code": "-1",
"labels": {
"level_1": "",
"level_2": "",
"level_3": ""
}
}
},
"bloom_cognitive_process": {
"primary": {
"code": "3",
"label": "Apply"
},
"secondary": {
"code": "2",
"label": "Understand"
}
},
"bloom_knowledge_domain": {
"primary": {
"code": "3",
"label": "Procedural"
},
"secondary": {
"code": "2",
"label": "Conceptual"
}
},
"document_type_v1": {
"primary": {
"code": "3",
"label": "Reference/Encyclopedic/Educational"
},
"secondary": {
"code": "-1",
"label": "Abstain"
}
},
"extraction_artifacts": {
"primary": {
"code": "0",
"label": "No Artifacts"
},
"secondary": {
"code": "3",
"label": "Irrelevant Content"
}
},
"missing_content": {
"primary": {
"code": "0",
"label": "No missing content"
},
"secondary": {
"code": "-1",
"label": "Abstain"
}
},
"document_type_v2": {
"primary": {
"code": "18",
"label": "Q&A Forum"
},
"secondary": {
"code": "23",
"label": "Tutorial"
}
},
"reasoning_depth": {
"primary": {
"code": "2",
"label": "Basic Reasoning"
},
"secondary": {
"code": "3",
"label": "Intermediate Reasoning"
}
},
"technical_correctness": {
"primary": {
"code": "3",
"label": "Mostly Correct"
},
"secondary": {
"code": "4",
"label": "Highly Correct"
}
},
"education_level": {
"primary": {
"code": "2",
"label": "High School Level"
},
"secondary": {
"code": "3",
"label": "Undergraduate Level"
}
}
}
|
672f1e42c33a7f9846924a2431ea77df
|
-3,286,162,521,865,839,600
|
node package manager
nitrogen-imagesnap
This module allows you to use the Mac command line utility imagesnap as a Nitrogen camera device.
nitrogen-imagesnap
This module allows you to use the Mac command line utility imagesnap as a Nitrogen camera device.
How to use in your project
1. Clone the camera project if you do not already have a camera project to start from.
2. Add 'nitrogen-imagesnap' to your packages.json.
3. Add a ImageSnapCamera to your cameras in config.js:
var config = {
cameras: [
new ImageSnapCamera({
name: 'Mac Camera'
})
]
};
|
{
"url": "https://www.npmjs.com/package/nitrogen-imagesnap",
"source_domain": "www.npmjs.com",
"snapshot_id": "crawl=CC-MAIN-2017-09",
"warc_metadata": {
"Content-Length": "22337",
"Content-Type": "application/http; msgtype=response",
"WARC-Block-Digest": "sha1:4SJR4XVLLSZXVHFA34HVJPKZVOPYD3M5",
"WARC-Concurrent-To": "<urn:uuid:50fe8c25-5a55-4f74-9d03-48b496b8542b>",
"WARC-Date": "2017-02-24T08:28:36Z",
"WARC-IP-Address": "151.101.32.162",
"WARC-Identified-Payload-Type": null,
"WARC-Payload-Digest": "sha1:WA4UOMJYQOH2CWSOPJAP2VZ3L32455DD",
"WARC-Record-ID": "<urn:uuid:140ddd1e-da71-4df4-9e35-056aba99bdc9>",
"WARC-Target-URI": "https://www.npmjs.com/package/nitrogen-imagesnap",
"WARC-Truncated": "length",
"WARC-Type": "response",
"WARC-Warcinfo-ID": "<urn:uuid:fbdfc457-d307-412a-9c50-824e36fabe38>"
},
"warc_info": "robots: classic\r\nhostname: ip-10-171-10-108.ec2.internal\r\nsoftware: Nutch 1.6 (CC)/CC WarcExport 1.0\r\nisPartOf: CC-MAIN-2017-09\r\noperator: CommonCrawl Admin\r\ndescription: Wide crawl of the web for February 2017\r\npublisher: CommonCrawl\r\nformat: WARC File Format 1.0\r\nconformsTo: http://bibnum.bnf.fr/WARC/WARC_ISO_28500_version1_latestdraft.pdf"
}
|
{
"line_start_idx": [
0,
21,
22,
41,
42,
140,
141,
160,
161,
259,
260,
287,
288,
377,
378,
431,
432,
489,
490,
505,
520,
550,
581,
592,
598
],
"line_end_idx": [
21,
22,
41,
42,
140,
141,
160,
161,
259,
260,
287,
288,
377,
378,
431,
432,
489,
490,
505,
520,
550,
581,
592,
598,
600
]
}
|
{
"red_pajama_v2": {
"ccnet_original_length": 600,
"ccnet_original_nlines": 24,
"rps_doc_curly_bracket": 0.006666670087724924,
"rps_doc_ldnoobw_words": 0,
"rps_doc_lorem_ipsum": 0,
"rps_doc_stop_word_fraction": 0.3103448152542114,
"rps_doc_ut1_blacklist": 0,
"rps_doc_frac_all_caps_words": 0,
"rps_doc_frac_lines_end_with_ellipsis": 0,
"rps_doc_frac_no_alph_words": 0.25,
"rps_doc_frac_unique_words": 0.5294117331504822,
"rps_doc_mean_word_length": 5.058823585510254,
"rps_doc_num_sentences": 10,
"rps_doc_symbol_to_word_ratio": 0,
"rps_doc_unigram_entropy": 3.6565113067626953,
"rps_doc_word_count": 85,
"rps_doc_frac_chars_dupe_10grams": 0.45116278529167175,
"rps_doc_frac_chars_dupe_5grams": 0.45116278529167175,
"rps_doc_frac_chars_dupe_6grams": 0.45116278529167175,
"rps_doc_frac_chars_dupe_7grams": 0.45116278529167175,
"rps_doc_frac_chars_dupe_8grams": 0.45116278529167175,
"rps_doc_frac_chars_dupe_9grams": 0.45116278529167175,
"rps_doc_frac_chars_top_2gram": 0.03488371893763542,
"rps_doc_frac_chars_top_3gram": 0.12558139860630035,
"rps_doc_frac_chars_top_4gram": 0.1534883677959442,
"rps_doc_books_importance": -57.51041793823242,
"rps_doc_books_importance_length_correction": -71.27288818359375,
"rps_doc_openwebtext_importance": -33.016414642333984,
"rps_doc_openwebtext_importance_length_correction": -46.77888870239258,
"rps_doc_wikipedia_importance": -17.095178604125977,
"rps_doc_wikipedia_importance_length_correction": -30.857650756835938
},
"fasttext": {
"dclm": 0.3380358815193176,
"english": 0.6213257312774658,
"fineweb_edu_approx": 1.4423712491989136,
"eai_general_math": 0.10846936702728271,
"eai_open_web_math": 0.048328038305044174,
"eai_web_code": 0.00905727967619896
}
}
|
{
"free_decimal_correspondence": {
"primary": {
"code": "005.4",
"labels": {
"level_1": "General works, books and libraries, information sciences",
"level_2": "",
"level_3": "Computer programming"
}
},
"secondary": {
"code": "621.392",
"labels": {
"level_1": "Industrial arts, Technology, and Engineering",
"level_2": "Engineering",
"level_3": "Mechanical engineering and Machinery"
}
}
},
"bloom_cognitive_process": {
"primary": {
"code": "3",
"label": "Apply"
},
"secondary": {
"code": "2",
"label": "Understand"
}
},
"bloom_knowledge_domain": {
"primary": {
"code": "3",
"label": "Procedural"
},
"secondary": {
"code": "2",
"label": "Conceptual"
}
},
"document_type_v1": {
"primary": {
"code": "4",
"label": "Code/Software"
},
"secondary": {
"code": "3",
"label": "Reference/Encyclopedic/Educational"
}
},
"extraction_artifacts": {
"primary": {
"code": "0",
"label": "No Artifacts"
},
"secondary": {
"code": "3",
"label": "Irrelevant Content"
}
},
"missing_content": {
"primary": {
"code": "0",
"label": "No missing content"
},
"secondary": {
"code": "-1",
"label": "Abstain"
}
},
"document_type_v2": {
"primary": {
"code": "8",
"label": "Documentation"
},
"secondary": {
"code": "23",
"label": "Tutorial"
}
},
"reasoning_depth": {
"primary": {
"code": "2",
"label": "Basic Reasoning"
},
"secondary": {
"code": "1",
"label": "No Reasoning"
}
},
"technical_correctness": {
"primary": {
"code": "4",
"label": "Highly Correct"
},
"secondary": {
"code": "3",
"label": "Mostly Correct"
}
},
"education_level": {
"primary": {
"code": "3",
"label": "Undergraduate Level"
},
"secondary": {
"code": "2",
"label": "High School Level"
}
}
}
|
672f1e42c33a7f9846924a2431ea77df
|
-3,717,753,692,768,589,300
|
Introducing NLog to SignalR
{ NLog+SignalR+Toastr==NLogToSignalR }
I have created a simple NLog target which uses SignalR (calling it NLogToSignalR) under the covers and delivers the log to either Hub or PersistentConnection and deliver nice messages using toastr.
Where does it fit?
Schematic
Purpose
If you use NLog as a logging tool, you can use this to deliver log messages to either same (or remote server) in real time in true toastr style
e.g. Information can be displayed as
Information
Warning
Warning
Error
Error
How does this work?
You need follow these steps:
1. Put NLog.Targets.SignalR in the same folder as your App.Config/ Web.Config file
2. If you are going to be using Hub for SignalR, use following configuration
nlogconfig
3. Deploy the Server NLog.Targets.SignalR.AspNetServer on local IIS.
4. Browse the website after deployment. (Ensure .NET Framework 4.5 is installed)
5. Start logging and watch the logs in real time.
The code is available for download from github.
Enjoy!
Advertisements
Leave a Reply
Fill in your details below or click an icon to log in:
WordPress.com Logo
You are commenting using your WordPress.com account. Log Out / Change )
Twitter picture
You are commenting using your Twitter account. Log Out / Change )
Facebook photo
You are commenting using your Facebook account. Log Out / Change )
Google+ photo
You are commenting using your Google+ account. Log Out / Change )
Connecting to %s
|
{
"url": "https://himanshudesai.wordpress.com/2012/11/14/introducing-nlog-to-signalr/",
"source_domain": "himanshudesai.wordpress.com",
"snapshot_id": "crawl=CC-MAIN-2017-26",
"warc_metadata": {
"Content-Length": "49061",
"Content-Type": "application/http; msgtype=response",
"WARC-Block-Digest": "sha1:ZY55ZGNFTR6O5MYOLNTURKT7LIDGTH7U",
"WARC-Concurrent-To": "<urn:uuid:b947c69c-f743-4ab8-a5ba-fbe1718717fd>",
"WARC-Date": "2017-06-22T11:55:15Z",
"WARC-IP-Address": "192.0.78.12",
"WARC-Identified-Payload-Type": "text/html",
"WARC-Payload-Digest": "sha1:GKWLXAPZD5HJYT7ORMDJPRXSY272RE67",
"WARC-Record-ID": "<urn:uuid:2ab47b31-208a-4a9c-9e5f-b5b052421c4d>",
"WARC-Target-URI": "https://himanshudesai.wordpress.com/2012/11/14/introducing-nlog-to-signalr/",
"WARC-Truncated": "length",
"WARC-Type": "response",
"WARC-Warcinfo-ID": "<urn:uuid:f8a0ea19-f668-4c72-b172-977a7d7c2e16>"
},
"warc_info": "robots: classic\r\nhostname: ip-10-170-183-89.ec2.internal\r\nsoftware: Nutch 1.6 (CC)\r\nisPartOf: CC-MAIN-2017-26\r\noperator: Common Crawl Admin\r\ndescription: Wide crawl of the web for June 2017\r\npublisher: Common Crawl\r\nformat: WARC File Format 1.0\r\nconformsTo: http://bibnum.bnf.fr/WARC/WARC_ISO_28500_version1_latestdraft.pdf"
}
|
{
"line_start_idx": [
0,
28,
29,
69,
70,
268,
269,
288,
289,
299,
300,
308,
309,
453,
454,
491,
492,
504,
505,
513,
514,
522,
523,
529,
530,
536,
537,
557,
558,
587,
588,
671,
672,
749,
750,
761,
762,
831,
832,
913,
914,
964,
965,
1013,
1014,
1021,
1022,
1037,
1038,
1052,
1053,
1108,
1109,
1128,
1129,
1201,
1202,
1218,
1219,
1285,
1286,
1301,
1302,
1369,
1370,
1384,
1385,
1451,
1452
],
"line_end_idx": [
28,
29,
69,
70,
268,
269,
288,
289,
299,
300,
308,
309,
453,
454,
491,
492,
504,
505,
513,
514,
522,
523,
529,
530,
536,
537,
557,
558,
587,
588,
671,
672,
749,
750,
761,
762,
831,
832,
913,
914,
964,
965,
1013,
1014,
1021,
1022,
1037,
1038,
1052,
1053,
1108,
1109,
1128,
1129,
1201,
1202,
1218,
1219,
1285,
1286,
1301,
1302,
1369,
1370,
1384,
1385,
1451,
1452,
1468
]
}
|
{
"red_pajama_v2": {
"ccnet_original_length": 1468,
"ccnet_original_nlines": 68,
"rps_doc_curly_bracket": 0.0013624000130221248,
"rps_doc_ldnoobw_words": 0,
"rps_doc_lorem_ipsum": 0,
"rps_doc_stop_word_fraction": 0.3084745705127716,
"rps_doc_ut1_blacklist": 0,
"rps_doc_frac_all_caps_words": 0.010169490240514278,
"rps_doc_frac_lines_end_with_ellipsis": 0,
"rps_doc_frac_no_alph_words": 0.21694914996623993,
"rps_doc_frac_unique_words": 0.5714285969734192,
"rps_doc_mean_word_length": 5.098214149475098,
"rps_doc_num_sentences": 31,
"rps_doc_symbol_to_word_ratio": 0,
"rps_doc_unigram_entropy": 4.612120628356934,
"rps_doc_word_count": 224,
"rps_doc_frac_chars_dupe_10grams": 0,
"rps_doc_frac_chars_dupe_5grams": 0.09632223844528198,
"rps_doc_frac_chars_dupe_6grams": 0.0525394007563591,
"rps_doc_frac_chars_dupe_7grams": 0,
"rps_doc_frac_chars_dupe_8grams": 0,
"rps_doc_frac_chars_dupe_9grams": 0,
"rps_doc_frac_chars_top_2gram": 0.02626970037817955,
"rps_doc_frac_chars_top_3gram": 0.056042030453681946,
"rps_doc_frac_chars_top_4gram": 0.07355517148971558,
"rps_doc_books_importance": -101.5205078125,
"rps_doc_books_importance_length_correction": -95.46492004394531,
"rps_doc_openwebtext_importance": -63.33840560913086,
"rps_doc_openwebtext_importance_length_correction": -63.33840560913086,
"rps_doc_wikipedia_importance": -25.588790893554688,
"rps_doc_wikipedia_importance_length_correction": -15.691405296325684
},
"fasttext": {
"dclm": 0.20522058010101318,
"english": 0.755581259727478,
"fineweb_edu_approx": 1.5257232189178467,
"eai_general_math": -0.000010009999641624745,
"eai_open_web_math": 0.027880489826202393,
"eai_web_code": -0.000010009999641624745
}
}
|
{
"free_decimal_correspondence": {
"primary": {
"code": "005.1",
"labels": {
"level_1": "General works, books and libraries, information sciences",
"level_2": "",
"level_3": "Computer programming"
}
},
"secondary": {
"code": "004.678",
"labels": {
"level_1": "General works, books and libraries, information sciences",
"level_2": "",
"level_3": "Computers and Computer science"
}
}
},
"bloom_cognitive_process": {
"primary": {
"code": "3",
"label": "Apply"
},
"secondary": {
"code": "2",
"label": "Understand"
}
},
"bloom_knowledge_domain": {
"primary": {
"code": "3",
"label": "Procedural"
},
"secondary": {
"code": "2",
"label": "Conceptual"
}
},
"document_type_v1": {
"primary": {
"code": "4",
"label": "Code/Software"
},
"secondary": {
"code": "3",
"label": "Reference/Encyclopedic/Educational"
}
},
"extraction_artifacts": {
"primary": {
"code": "3",
"label": "Irrelevant Content"
},
"secondary": {
"code": "-1",
"label": "Abstain"
}
},
"missing_content": {
"primary": {
"code": "4",
"label": "Missing Images or Figures"
},
"secondary": {
"code": "-1",
"label": "Abstain"
}
},
"document_type_v2": {
"primary": {
"code": "23",
"label": "Tutorial"
},
"secondary": {
"code": "8",
"label": "Documentation"
}
},
"reasoning_depth": {
"primary": {
"code": "2",
"label": "Basic Reasoning"
},
"secondary": {
"code": "3",
"label": "Intermediate Reasoning"
}
},
"technical_correctness": {
"primary": {
"code": "3",
"label": "Mostly Correct"
},
"secondary": {
"code": "4",
"label": "Highly Correct"
}
},
"education_level": {
"primary": {
"code": "3",
"label": "Undergraduate Level"
},
"secondary": {
"code": "4",
"label": "Graduate/Expert Level"
}
}
}
|
672f1e42c33a7f9846924a2431ea77df
|
-8,805,433,539,479,218,000
|
Graphically illustrate the concept of power.
Share:
Description
Create graphs of a normal test statistic under the null and alternative hypotheses to graphically show the idea of power.
Usage
1
2
3
power.examp(n = 1, stdev = 1, diff = 1, alpha = 0.05, xmin = -2, xmax = 4)
run.power.examp(hscale=1.5, vscale=1.5, wait=FALSE)
run.power.examp.old()
Arguments
n
The sample size for the test statistic.
stdev
The standard deviation of the population.
diff
The true difference in means (alternate hypothesis).
alpha
The type I error rate to use for the test.
xmin
The minimum x value to show on the graph.
xmax
The maximum x value to show on the graph.
hscale
Controls width of plot, passed to tkrplot.
vscale
Controls height of plot, passed to tkrplot.
wait
Should R wait for the window to close.
Details
This function will draw 2 graphs representing an upper-tailed test of hypothesis.
The upper panel represents the test statistic under the null hypothesis that the true mean (or mean difference) is 0. It then also shows the upper tail area equal to alpha and the rejection region for the test statistic.
The lower panel shows the normal distribution for the test statistic under the alternative hypothesis where the true mean (or mean difference) is diff. Using the rejection region from the upper panel it shades the upper tail area that corresponds to the power of the test.
Both curves are affected by the specified stdev and sample size n.
The function run.power.examp will in addition create a Tk slider box that will allow you to interactively change the values of stdev, diff, alpha, and n to dynamically see the effects of the change on the graphs and on the power of the test.
This can be used to demonstrate the concept of power, show the effect of sample size on power, show the inverse relationship between the type I and type II error rates, and show how power is dependent on the true mean (or difference) and the population standard deviation.
Value
power.examp invisibly returns the power computed.
run.power.examp returns a list with the parameter settings and the power if wait is TRUE.
run.power.examp.old does not return anything meaningful.
Author(s)
Greg Snow 538280@gmail.com
See Also
power.t.test
Examples
1
2
3
power.examp()
power.examp(n=25)
power.examp(alpha=0.1)
Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.
|
{
"url": "https://rdrr.io/cran/TeachingDemos/man/power.examp.html",
"source_domain": "rdrr.io",
"snapshot_id": "crawl=CC-MAIN-2016-50",
"warc_metadata": {
"Content-Length": "31650",
"Content-Type": "application/http; msgtype=response",
"WARC-Block-Digest": "sha1:LFNWNNIQEVBU3RFPVU3HPYTW2KXPEDC3",
"WARC-Concurrent-To": "<urn:uuid:ae435001-0792-400c-aa49-f47427f35d01>",
"WARC-Date": "2016-12-10T10:58:50Z",
"WARC-IP-Address": "52.85.142.215",
"WARC-Identified-Payload-Type": null,
"WARC-Payload-Digest": "sha1:K3JE2IL5AYRQPVU6VOL3URQFTLXKIQC5",
"WARC-Record-ID": "<urn:uuid:490f8431-8005-4f65-bc93-26b61efe84c3>",
"WARC-Target-URI": "https://rdrr.io/cran/TeachingDemos/man/power.examp.html",
"WARC-Truncated": "length",
"WARC-Type": "response",
"WARC-Warcinfo-ID": "<urn:uuid:ca9b2055-4767-4a09-816b-69615da97813>"
},
"warc_info": "robots: classic\r\nhostname: ip-10-31-129-80.ec2.internal\r\nsoftware: Nutch 1.6 (CC)/CC WarcExport 1.0\r\nisPartOf: CC-MAIN-2016-50\r\noperator: CommonCrawl Admin\r\ndescription: Wide crawl of the web for November 2016\r\npublisher: CommonCrawl\r\nformat: WARC File Format 1.0\r\nconformsTo: http://bibnum.bnf.fr/WARC/WARC_ISO_28500_version1_latestdraft.pdf"
}
|
{
"line_start_idx": [
0,
45,
46,
53,
54,
66,
67,
189,
190,
196,
197,
199,
201,
203,
278,
330,
352,
353,
363,
364,
366,
367,
407,
408,
414,
415,
457,
458,
463,
464,
517,
518,
524,
525,
568,
569,
574,
575,
617,
618,
623,
624,
666,
667,
674,
675,
718,
719,
726,
727,
771,
772,
777,
778,
817,
818,
826,
827,
909,
910,
1131,
1132,
1405,
1406,
1473,
1474,
1716,
1717,
1990,
1991,
1997,
1998,
2048,
2049,
2139,
2140,
2197,
2198,
2208,
2209,
2236,
2237,
2246,
2247,
2260,
2261,
2270,
2271,
2273,
2275,
2277,
2291,
2309,
2332,
2333
],
"line_end_idx": [
45,
46,
53,
54,
66,
67,
189,
190,
196,
197,
199,
201,
203,
278,
330,
352,
353,
363,
364,
366,
367,
407,
408,
414,
415,
457,
458,
463,
464,
517,
518,
524,
525,
568,
569,
574,
575,
617,
618,
623,
624,
666,
667,
674,
675,
718,
719,
726,
727,
771,
772,
777,
778,
817,
818,
826,
827,
909,
910,
1131,
1132,
1405,
1406,
1473,
1474,
1716,
1717,
1990,
1991,
1997,
1998,
2048,
2049,
2139,
2140,
2197,
2198,
2208,
2209,
2236,
2237,
2246,
2247,
2260,
2261,
2270,
2271,
2273,
2275,
2277,
2291,
2309,
2332,
2333,
2415
]
}
|
{
"red_pajama_v2": {
"ccnet_original_length": 2415,
"ccnet_original_nlines": 94,
"rps_doc_curly_bracket": 0,
"rps_doc_ldnoobw_words": 0,
"rps_doc_lorem_ipsum": 0,
"rps_doc_stop_word_fraction": 0.2917466461658478,
"rps_doc_ut1_blacklist": 0,
"rps_doc_frac_all_caps_words": 0.011516310274600983,
"rps_doc_frac_lines_end_with_ellipsis": 0,
"rps_doc_frac_no_alph_words": 0.23224568367004395,
"rps_doc_frac_unique_words": 0.44041451811790466,
"rps_doc_mean_word_length": 4.873056888580322,
"rps_doc_num_sentences": 49,
"rps_doc_symbol_to_word_ratio": 0,
"rps_doc_unigram_entropy": 4.591057777404785,
"rps_doc_word_count": 386,
"rps_doc_frac_chars_dupe_10grams": 0,
"rps_doc_frac_chars_dupe_5grams": 0.13556618988513947,
"rps_doc_frac_chars_dupe_6grams": 0.054226480424404144,
"rps_doc_frac_chars_dupe_7grams": 0.054226480424404144,
"rps_doc_frac_chars_dupe_8grams": 0,
"rps_doc_frac_chars_dupe_9grams": 0,
"rps_doc_frac_chars_top_2gram": 0.026049969717860222,
"rps_doc_frac_chars_top_3gram": 0.02126527950167656,
"rps_doc_frac_chars_top_4gram": 0.03349281847476959,
"rps_doc_books_importance": -211.88096618652344,
"rps_doc_books_importance_length_correction": -211.88096618652344,
"rps_doc_openwebtext_importance": -122.06449127197266,
"rps_doc_openwebtext_importance_length_correction": -122.06449127197266,
"rps_doc_wikipedia_importance": -96.62120056152344,
"rps_doc_wikipedia_importance_length_correction": -96.62120056152344
},
"fasttext": {
"dclm": 0.05550212040543556,
"english": 0.8128406405448914,
"fineweb_edu_approx": 2.213120222091675,
"eai_general_math": 0.9886147975921631,
"eai_open_web_math": 0.4306918978691101,
"eai_web_code": 0.9961209893226624
}
}
|
{
"free_decimal_correspondence": {
"primary": {
"code": "519.5",
"labels": {
"level_1": "Science and Natural history",
"level_2": "Mathematics",
"level_3": "Probabilities; or, Mathematical statistics"
}
},
"secondary": {
"code": "005.133",
"labels": {
"level_1": "General works, books and libraries, information sciences",
"level_2": "",
"level_3": "Computer programming"
}
}
},
"bloom_cognitive_process": {
"primary": {
"code": "2",
"label": "Understand"
},
"secondary": {
"code": "3",
"label": "Apply"
}
},
"bloom_knowledge_domain": {
"primary": {
"code": "2",
"label": "Conceptual"
},
"secondary": {
"code": "3",
"label": "Procedural"
}
},
"document_type_v1": {
"primary": {
"code": "3",
"label": "Reference/Encyclopedic/Educational"
},
"secondary": {
"code": "4",
"label": "Code/Software"
}
},
"extraction_artifacts": {
"primary": {
"code": "0",
"label": "No Artifacts"
},
"secondary": {
"code": "-1",
"label": "Abstain"
}
},
"missing_content": {
"primary": {
"code": "0",
"label": "No missing content"
},
"secondary": {
"code": "-1",
"label": "Abstain"
}
},
"document_type_v2": {
"primary": {
"code": "8",
"label": "Documentation"
},
"secondary": {
"code": "23",
"label": "Tutorial"
}
},
"reasoning_depth": {
"primary": {
"code": "2",
"label": "Basic Reasoning"
},
"secondary": {
"code": "3",
"label": "Intermediate Reasoning"
}
},
"technical_correctness": {
"primary": {
"code": "4",
"label": "Highly Correct"
},
"secondary": {
"code": "3",
"label": "Mostly Correct"
}
},
"education_level": {
"primary": {
"code": "3",
"label": "Undergraduate Level"
},
"secondary": {
"code": "4",
"label": "Graduate/Expert Level"
}
}
}
|
672f1e42c33a7f9846924a2431ea77df
|
-4,137,473,251,236,084,700
|
2010-08-06
Upgrading MacBook Hard Disk
I thought I'd share my adventures of swapping my 160GB disk for a 340GB disk in my MacBook (Black one, bought Summer 2007).
I have been running this 160GB disk since I got the laptop, and since TimeMachine (Apples built in backup system) became available I've been using an external 2.5" 250GB USB disk for the TimeMachine backup. The reason for the 2.5" is quite simple, it's small, and it doesn't require an external power source. This means I can easily do backups wherever I want them.
To upgrade I bought a new SATA 340GB disk (Western Digital Black). I opted for a 7,200rpm one as I'm mostly using my laptop plugged in, so a decline in battery life isn't that critical. Then I also bought a new external backup disk. My choice fell upon the Buffalo 500GB one. I'm pretty pleased with it, it's black and shiny, pretty much similar to my old WD backup disk.
To get started with the disk swap I watched a YouTube video about it. As it turns out, Apple's hardware is, as it has always been, lovely (and we only buy these machines because they're "shiny" - right!!!). The procedure is, simplified, remove the battery. Unscrew the shiny L-shaped guard by undoing (not unscrewing) the three small phillips head screws. Carefully remove the L-shaped bracket. The disk is hidden at the short end - you'll see a white plastic tab, unfold it and pull the disk assembly out. Use a Torx T8 (I carefully used a Torx T7) tool to unscrew the four bolts that hold the "caddy" on the disk. Swap disks, reverse procedure to assemble. That's the hardware done.
Then you stick your Snow Leopard (or whatever MacOS you're using on the old disk and the backup disk) into your CD/DVD drive. Also plug in the TimeMachine USB disk. Boot the machine. It should now boot up to the Mac OS installer. At the installer choose the option for restoring your machine from a TimeMachine backup. You can now click forward in the wizard interface until you get to the spot where you select the disk to restore to. In my case, my disk was either unformatted or, formatted with the file system of a more commonly used operating system. Fret not, dear upgrader. Simply go to the "Utilities" menu and select "Disk Utility". Locate your new "blank" disk, and on the "Partition" "tab", select Options and choose "GUID Partition Table". Proceed and wipe the new disk and format it with the new filesystem. When done, exit "Disk Utility" and return to the Installer/Restorer. In my case the newly formatted disk was already found, so all I had to do was to select the steaming fresh disk and click forward until the restore proceeded.
The actual restore too about 4 hours or so.
The next part is to move your existing backups to the new backup drive. This is, simplified, done by "just dragging the 'Backups.backupdb' folder from the old disk to the new disk". However, there's a few things you need to do, such as turning the automatic backups off. See this Apple Knowledgebase article for full details: Mac 101: Time Machine. The information is under the "Mac OS X v10.6: How to transfer your backups from your current hard drive to a new hard drive" sub-heading.
BUT! There had to be one, hadn't there?! The Apple KB article mentions that "This may take some time to complete". In my case, "some time" meant 24 hours. I'm not kidding you. You have been warned! Now, there's a speck of good news; Firstly you don't have to do this on your own machine. You can use any Mac (or any other machine that can read/write that OS - I'm guessing) to copy the folder over. Secondly, I assume that using a command line option would be better, such as plain old cp (copy) or rsync (remote synchronisation). If I'd do this again, I'd use my girlfriends Mac and I'd use rsync to do it. That way I could interrupt the copying if needed.
Once you've got your old backkup on the new backup disk, it's time to reactivate your automatic TimeMachine backups and obviously to choose the new disk as backup target. And then you need to make a new fresh backup of your system. This might take some while as the file modification times have changed etc. It took about 2-4 hours for me - I don't know exactly as I don't know when it finished. :) Also, Spotlight will want to index your new backup disk too (process named mds), so expect your laptops fans to whirr away whilst this is happening.
So, not totally painless, but a lot less pain than I expected. If the backup copying would have been faster I think it would have been pretty much totally painless. There's a few caveats, but all in all, quite a straight forward process.
If you wonder about the faster disk? Did it make any difference? Yes, it has, but it could also be due to that the machine, now, has got "unlimited" swap capacity. (160GB+ compared to 1-4GB before). The machine feels a bit nippier and I'm very pleased with it. Battery life has decreased quite a bit, but the only time I've ran it off battery power, I wasn't very kind to the CPU with a lot of software running, so that was definitely contributing to the short battery life. Either way, very pleased. :)
1 comment:
Unknown said...
This comment has been removed by a blog administrator.
|
{
"url": "http://jocke-blog.selincite.com/2010/08/upgrading-macbook-hard-disk.html",
"source_domain": "jocke-blog.selincite.com",
"snapshot_id": "crawl=CC-MAIN-2019-04",
"warc_metadata": {
"Content-Length": "51552",
"Content-Type": "application/http; msgtype=response",
"WARC-Block-Digest": "sha1:SBJRP4Y6NFJBNTZ5R3BCJ7MF34YGJCBO",
"WARC-Concurrent-To": "<urn:uuid:5aad9da9-ee8c-48dd-bc72-b14ef36f86bc>",
"WARC-Date": "2019-01-23T06:52:04Z",
"WARC-IP-Address": "172.217.7.211",
"WARC-Identified-Payload-Type": "text/html",
"WARC-Payload-Digest": "sha1:Z2L73LIGTWMKBEURE3IUYNGXULPUVNGS",
"WARC-Record-ID": "<urn:uuid:df007ad6-c95b-496b-abe3-173ba688031a>",
"WARC-Target-URI": "http://jocke-blog.selincite.com/2010/08/upgrading-macbook-hard-disk.html",
"WARC-Truncated": null,
"WARC-Type": "response",
"WARC-Warcinfo-ID": "<urn:uuid:e983e688-a2c8-4ffb-973e-93d7cb1bd551>"
},
"warc_info": "isPartOf: CC-MAIN-2019-04\r\npublisher: Common Crawl\r\ndescription: Wide crawl of the web for January 2019\r\noperator: Common Crawl Admin (info@commoncrawl.org)\r\nhostname: ip-10-140-176-207.ec2.internal\r\nsoftware: Apache Nutch 1.15 (modified, https://github.com/commoncrawl/nutch/)\r\nrobots: checked via crawler-commons 0.11-SNAPSHOT (https://github.com/crawler-commons/crawler-commons)\r\nformat: WARC File Format 1.1\r\nconformsTo: http://iipc.github.io/warc-specifications/specifications/warc-format/warc-1.1/"
}
|
{
"line_start_idx": [
0,
11,
12,
40,
41,
165,
531,
903,
1588,
2637,
2681,
3168,
3826,
4374,
4612,
5116,
5117,
5128,
5129,
5145,
5200
],
"line_end_idx": [
11,
12,
40,
41,
165,
531,
903,
1588,
2637,
2681,
3168,
3826,
4374,
4612,
5116,
5117,
5128,
5129,
5145,
5200,
5201
]
}
|
{
"red_pajama_v2": {
"ccnet_original_length": 5201,
"ccnet_original_nlines": 20,
"rps_doc_curly_bracket": 0,
"rps_doc_ldnoobw_words": 0,
"rps_doc_lorem_ipsum": 0,
"rps_doc_stop_word_fraction": 0.3969722390174866,
"rps_doc_ut1_blacklist": 0,
"rps_doc_frac_all_caps_words": 0.04625736176967621,
"rps_doc_frac_lines_end_with_ellipsis": 0.0476190485060215,
"rps_doc_frac_no_alph_words": 0.19343987107276917,
"rps_doc_frac_unique_words": 0.41783028841018677,
"rps_doc_mean_word_length": 4.325456619262695,
"rps_doc_num_sentences": 69,
"rps_doc_symbol_to_word_ratio": 0.0008410399896092713,
"rps_doc_unigram_entropy": 5.359559535980225,
"rps_doc_word_count": 931,
"rps_doc_frac_chars_dupe_10grams": 0,
"rps_doc_frac_chars_dupe_5grams": 0,
"rps_doc_frac_chars_dupe_6grams": 0,
"rps_doc_frac_chars_dupe_7grams": 0,
"rps_doc_frac_chars_dupe_8grams": 0,
"rps_doc_frac_chars_dupe_9grams": 0,
"rps_doc_frac_chars_top_2gram": 0.009932950139045715,
"rps_doc_frac_chars_top_3gram": 0.005959770176559687,
"rps_doc_frac_chars_top_4gram": 0,
"rps_doc_books_importance": -618.269287109375,
"rps_doc_books_importance_length_correction": -618.269287109375,
"rps_doc_openwebtext_importance": -358.0218200683594,
"rps_doc_openwebtext_importance_length_correction": -358.0218200683594,
"rps_doc_wikipedia_importance": -315.3929138183594,
"rps_doc_wikipedia_importance_length_correction": -315.3929138183594
},
"fasttext": {
"dclm": 0.19262558221817017,
"english": 0.9573798775672913,
"fineweb_edu_approx": 1.1473991870880127,
"eai_general_math": 0.6427890062332153,
"eai_open_web_math": 0.2528814673423767,
"eai_web_code": 0.4961445927619934
}
}
|
{
"free_decimal_correspondence": {
"primary": {
"code": "004.16",
"labels": {
"level_1": "General works, books and libraries, information sciences",
"level_2": "",
"level_3": "Computers and Computer science"
}
},
"secondary": {
"code": "005.456",
"labels": {
"level_1": "General works, books and libraries, information sciences",
"level_2": "",
"level_3": "Computer programming"
}
}
},
"bloom_cognitive_process": {
"primary": {
"code": "3",
"label": "Apply"
},
"secondary": {
"code": "2",
"label": "Understand"
}
},
"bloom_knowledge_domain": {
"primary": {
"code": "3",
"label": "Procedural"
},
"secondary": {
"code": "2",
"label": "Conceptual"
}
},
"document_type_v1": {
"primary": {
"code": "3",
"label": "Reference/Encyclopedic/Educational"
},
"secondary": {
"code": "9",
"label": "Personal/Misc"
}
},
"extraction_artifacts": {
"primary": {
"code": "0",
"label": "No Artifacts"
},
"secondary": {
"code": "-1",
"label": "Abstain"
}
},
"missing_content": {
"primary": {
"code": "0",
"label": "No missing content"
},
"secondary": {
"code": "-1",
"label": "Abstain"
}
},
"document_type_v2": {
"primary": {
"code": "23",
"label": "Tutorial"
},
"secondary": {
"code": "16",
"label": "Personal Blog"
}
},
"reasoning_depth": {
"primary": {
"code": "2",
"label": "Basic Reasoning"
},
"secondary": {
"code": "3",
"label": "Intermediate Reasoning"
}
},
"technical_correctness": {
"primary": {
"code": "3",
"label": "Mostly Correct"
},
"secondary": {
"code": "4",
"label": "Highly Correct"
}
},
"education_level": {
"primary": {
"code": "2",
"label": "High School Level"
},
"secondary": {
"code": "1",
"label": "General Audience"
}
}
}
|
672f1e42c33a7f9846924a2431ea77df
|
6,452,406,150,762,352,000
|
Normal Distribution on the TI89 using Statistics Made Easy
Read below please:
ex1. What is the probability of obtaining a sample mean greater than M=60 for a random sample of n=16 scores selected from a normal population with a mean of 65 and a standard deviation of 20?
Go To F3 7 and select Normal distribution, enter
mu=65
std dev=20/sqrt(16)=20/4 = 5 so just enter 5
M = 60
Then in the dropdown menu select option 2: P(x>a) . Voila 84.1345%
ex2. What are the boundaries for the middle 50% of all possible random samples of n=25 scores selected from a normal population with a mean of 80 and a standard deviation of 10?
Go To F3 7 , enter
mu=80
std dev=10/sqrt(25)=10/5 = 2 so just enter 2
and in the dropdown menu select 6 NormInverse :
enter .25 (for the left 50% bound)
next redo above and enter .75 to the upper right bound.
Also, is there any way to use SPME to obtain or calculate values found in Statistical unit normal tables?
Sure, F3 7 . Use mu=1 and Std Dev=0 and a and b is desired , then use options 1, 2, 3 in the dropdown menu.
Leave a Reply
Your email address will not be published. Required fields are marked *
You may use these HTML tags and attributes:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>
|
{
"url": "https://blog.ti89.com/normal-distribution-on-the-ti89-using-statistics-made-easy/?share=google-plus-1",
"source_domain": "blog.ti89.com",
"snapshot_id": "crawl=CC-MAIN-2019-35",
"warc_metadata": {
"Content-Length": "45066",
"Content-Type": "application/http; msgtype=response",
"WARC-Block-Digest": "sha1:LVRL7N6LFLO3IF3I2YVYS5IA324LOJZ5",
"WARC-Concurrent-To": "<urn:uuid:2db32942-38e9-450f-b0f6-8fa3db34b293>",
"WARC-Date": "2019-08-20T16:10:14Z",
"WARC-IP-Address": "146.66.64.95",
"WARC-Identified-Payload-Type": "text/html",
"WARC-Payload-Digest": "sha1:OLPH7SHYQN4CZSHCCAWPA4CDSDPUFONV",
"WARC-Record-ID": "<urn:uuid:43f92641-ff0a-42f0-a6fe-57057d131a42>",
"WARC-Target-URI": "https://blog.ti89.com/normal-distribution-on-the-ti89-using-statistics-made-easy/?share=google-plus-1",
"WARC-Truncated": null,
"WARC-Type": "response",
"WARC-Warcinfo-ID": "<urn:uuid:ba732499-ad93-4d03-a603-694de0d39665>"
},
"warc_info": "isPartOf: CC-MAIN-2019-35\r\npublisher: Common Crawl\r\ndescription: Wide crawl of the web for August 2019\r\noperator: Common Crawl Admin (info@commoncrawl.org)\r\nhostname: ip-10-67-67-159.ec2.internal\r\nsoftware: Apache Nutch 1.15 (modified, https://github.com/commoncrawl/nutch/)\r\nrobots: checked via crawler-commons 1.1-SNAPSHOT (https://github.com/crawler-commons/crawler-commons)\r\nformat: WARC File Format 1.1\r\nconformsTo: http://iipc.github.io/warc-specifications/specifications/warc-format/warc-1.1/"
}
|
{
"line_start_idx": [
0,
59,
60,
79,
80,
273,
274,
323,
329,
374,
381,
382,
449,
450,
628,
629,
648,
654,
699,
747,
782,
838,
839,
945,
946,
1054,
1055,
1069,
1070,
1141,
1142,
1186
],
"line_end_idx": [
59,
60,
79,
80,
273,
274,
323,
329,
374,
381,
382,
449,
450,
628,
629,
648,
654,
699,
747,
782,
838,
839,
945,
946,
1054,
1055,
1069,
1070,
1141,
1142,
1186,
1341
]
}
|
{
"red_pajama_v2": {
"ccnet_original_length": 1341,
"ccnet_original_nlines": 31,
"rps_doc_curly_bracket": 0,
"rps_doc_ldnoobw_words": 0,
"rps_doc_lorem_ipsum": 0,
"rps_doc_stop_word_fraction": 0.28106507658958435,
"rps_doc_ut1_blacklist": 0,
"rps_doc_frac_all_caps_words": 0.02662722021341324,
"rps_doc_frac_lines_end_with_ellipsis": 0,
"rps_doc_frac_no_alph_words": 0.3550295829772949,
"rps_doc_frac_unique_words": 0.5889830589294434,
"rps_doc_mean_word_length": 4.161016941070557,
"rps_doc_num_sentences": 14,
"rps_doc_symbol_to_word_ratio": 0,
"rps_doc_unigram_entropy": 4.658649444580078,
"rps_doc_word_count": 236,
"rps_doc_frac_chars_dupe_10grams": 0.09368634968996048,
"rps_doc_frac_chars_dupe_5grams": 0.18737271428108215,
"rps_doc_frac_chars_dupe_6grams": 0.09368634968996048,
"rps_doc_frac_chars_dupe_7grams": 0.09368634968996048,
"rps_doc_frac_chars_dupe_8grams": 0.09368634968996048,
"rps_doc_frac_chars_dupe_9grams": 0.09368634968996048,
"rps_doc_frac_chars_top_2gram": 0.012219959869980812,
"rps_doc_frac_chars_top_3gram": 0.03971486911177635,
"rps_doc_frac_chars_top_4gram": 0.05193483084440231,
"rps_doc_books_importance": -123.2567367553711,
"rps_doc_books_importance_length_correction": -123.25672912597656,
"rps_doc_openwebtext_importance": -74.46270751953125,
"rps_doc_openwebtext_importance_length_correction": -74.46270751953125,
"rps_doc_wikipedia_importance": -68.3262710571289,
"rps_doc_wikipedia_importance_length_correction": -68.31907653808594
},
"fasttext": {
"dclm": 0.12400674819946289,
"english": 0.693729043006897,
"fineweb_edu_approx": 1.5032272338867188,
"eai_general_math": 0.004581510089337826,
"eai_open_web_math": 0.29445236921310425,
"eai_web_code": 0.00000501000022268272
}
}
|
{
"free_decimal_correspondence": {
"primary": {
"code": "519.5",
"labels": {
"level_1": "Science and Natural history",
"level_2": "Mathematics",
"level_3": "Probabilities; or, Mathematical statistics"
}
},
"secondary": {
"code": "004.164",
"labels": {
"level_1": "General works, books and libraries, information sciences",
"level_2": "",
"level_3": "Computers and Computer science"
}
}
},
"bloom_cognitive_process": {
"primary": {
"code": "3",
"label": "Apply"
},
"secondary": {
"code": "2",
"label": "Understand"
}
},
"bloom_knowledge_domain": {
"primary": {
"code": "3",
"label": "Procedural"
},
"secondary": {
"code": "2",
"label": "Conceptual"
}
},
"document_type_v1": {
"primary": {
"code": "3",
"label": "Reference/Encyclopedic/Educational"
},
"secondary": {
"code": "-1",
"label": "Abstain"
}
},
"extraction_artifacts": {
"primary": {
"code": "3",
"label": "Irrelevant Content"
},
"secondary": {
"code": "0",
"label": "No Artifacts"
}
},
"missing_content": {
"primary": {
"code": "0",
"label": "No missing content"
},
"secondary": {
"code": "-1",
"label": "Abstain"
}
},
"document_type_v2": {
"primary": {
"code": "23",
"label": "Tutorial"
},
"secondary": {
"code": "8",
"label": "Documentation"
}
},
"reasoning_depth": {
"primary": {
"code": "2",
"label": "Basic Reasoning"
},
"secondary": {
"code": "3",
"label": "Intermediate Reasoning"
}
},
"technical_correctness": {
"primary": {
"code": "3",
"label": "Mostly Correct"
},
"secondary": {
"code": "4",
"label": "Highly Correct"
}
},
"education_level": {
"primary": {
"code": "2",
"label": "High School Level"
},
"secondary": {
"code": "3",
"label": "Undergraduate Level"
}
}
}
|
672f1e42c33a7f9846924a2431ea77df
|
-2,506,771,488,712,862,700
|
Secret Materials: Real Estate Application Development
16 FEB 2017
3376 VIEWS
12 MIN
Share
My home is my castle. Everyone has their own associations when hearing this phrase. In case living together with parents is no longer an option then you will probably face a problem. What house is it better to choose? Fortunately, commercial real estate apps were created to help us solve this problem. Remember how tiring it is to look for an appropriate accommodation? It takes days if not weeks.
Until recently, you had to keep in touch with your estate agent in order to choose an apartment that corresponds your requirements. Nowadays, everything is much easier since a lot of real estate platforms appeared. Users are only in need of an Internet connection and an application itself.
In this article, we are going to discuss the creation of a similar platform using the examples of the market leaders Zillow and Trulia.
Win-win solution or real estate mobile app ideas
Apps for real estate are not only a promising direction for a new startup creation but also a good idea for an estate agent. Everything is moving towards digitization and many professionals have to adapt to these changes. Sometimes to increase the profit and sometimes to continue professional activities at all.
The Internet is able to simplify professional life, and at the same time endanger it, since a certain part of the demand for services goes online. Concerning estate agents, they are still in demand worldwide. However, those without any digital presence are losing prospective clients. A digital presence is able to help estate agents with increasing clients' loyalty and sales at the same time.
Building an app is not enough. Learn how to keep your users engaged all the time in this related article
The demand for real estate tends to grow and in dozens of cities, there is a thorny question concerning the expediency of it's purchasing or renting. Thus, the creation of an app for real estate is not a bad idea for a startup.
Real estate application development: graph of rental prices
Example of U.S. cities with the highest rental (Source: Statista)
Real estate software development
Before you get started with the app development, you should think through all the business processes you will face with. If we are talking about a real estate application, it is extremely important to fill it with proposals for rent and sale.
I mean, you must have a certain database right after the launch. In case users see rental application without any rental proposals - they simply will not run this app the second time.
How to build the database? Well, probably you should cooperate with several real estate agencies to borrow their database for the first time or to build a long-term cooperation in such a way. In turn, you can provide your partners with free advertising within the platform for some time.
The game is worth the candle
High rental prices force people to seek advice in order to decide if it's better to buy or rent property? Where do you think the first place are going is? Of course to their devices. For instance, on Zillow 186 homes are viewed per second. While monthly, this number exceeds 420 million homes.
Impressive, isn't it? This statistics shows that there is an extensive audience interested in apps like Zillow and Trulia.
The working model of these apps is quite similar. In both cases, there is a database with information about property for sale or rent. The deal itself is conducted by an estate agent. Users choose an agent from the proposed list before applying for the house. Thus, these apps are only mediators between users and agents.
Let's compare two market leaders and find out what features attract users there.
Trulia
Available: Web, iOS, Android
Founded: 2004
Founders: Pete Flint and Sami Inkinen
Downloads: over 10 million
On the home screen of the app, users can see a list of homes from different categories. For example, 'Homes with Pools', 'Homes Under $560,000' etc. This way, users get immediate access to different estates that may interest them and lead to successful purchases.
The Trulia real estate app has a full-featured map that allows users to gain understanding of a separate districts or areas.
The first thing the user sees after zooming a map is a variety of homes for sale or rent with their prices. Also, the map interacts closely with search features. Since you can choose needed parameters, only those real estates corresponding them will be displayed on the map. Filters are quite flexible and a user can choose from a wide range of options from price to the number of beds.
One more map-related feature is local info. This feature is intended to extend knowledge about a certain area via the map. For example, a user can learn whether there are any schools in that district as well as the level of crime, availability of various amenities and even natural disasters.
Trulia mobile app: map screen
Trulia local info interface
The next worth noting feature concerns mortgages. Trulia mobile app allows users to see current mortgage rates and calculate them individually according to the income or mortgage itself.
Real estate calculator app in trulia mobile app
Trulia mortgage calculator
Zillow
Available: Web, iOS, Android
Founded: 2006
Founders: Rich Barton and Lloyd Frink
Downloads: over 10 million
In the Zillow real estate app there is a map on the home screen. Users can start searching as soon as the app is launched. The principle of the real estate displayed on the map is exactly like Trulia, i.e. house location with it's price.
Concerning search filters, they are pretty similar to Trulia's and function in a similar way.
Using Zillow, users are able to calculate the mortgage and hide property they are not interested in. However, this app offers more detailed information about the house itself. This way, a user can learn the price and tax history of his future accommodation. In the Web version, there is an opportunity to see the forecast on the property's price.
Probably one of the main distinctive features of the Zillow rental application is Google Street View support realized by mobile developers. Thus, clients may take a closer look at the property they would like to buy.
Zillow real estate app: Google Street View
Zillow app interface
Switch on your critical thinking
Do not try to build a Zillow or Trulia app clone. In case you want to make the grade, your solution should contain features and opportunities your competitors cannot offer clients.
So, looking back on the market leaders, we can conclude that a convenient and informative map is a must as well as detailed real estate information. Then, you should analyze weak sides of the most popular apps like Trulia or Zillow and think about what aspects you do not like as a user. After that, you will have a certain understanding of your future app concept.
You may apply AR or VR technologies in your app too. Talking about AR, it is possible to create a feature that allows users to find real estate for sale or rent while pointing their phone camera at some buildings or houses.
Interested in VR feature for your app? Learn about VR perspectives in our related article
Except for AR, VR technologies also take place in applications connected with renting and selling property. Thus, the feature of virtual tours of the house can be realized. Actually, there are already several services that allow you to easily take a virtual tour by means of a 3D camera and some cloud-based technologies. However, it will cost you a pretty penny since you should buy specialized video equipment plus monthly subscription payments.
Ways to increase the user base
In order to draw the customers' attention to your real estate app, you need to think of a strategy that provides you with constant user growth. Let's discuss some components that can help you to handle this task.
Build referral program
Statistics claim that 92% of people trust to digital resources recommended by their friends or relatives more than to any other kind of marketing. Moreover, 82% of all transactions in real estate business are made due to referral or repeat business. You may suppose that nobody wants to give referrals but that is not true. Again, statistics say that 91% of satisfied clients are willing to give referrals while only 9% of salesmen ask them about that.
Strong motivation to build your own referral program, isn't it? However, the ways it can be implemented depends on various peculiarities of your real estate app. For example, it is a widespread practice to give a premium for certain actions such as sharing, recommendations or inviting friends.
Your referral model should coincide with a monetization model in order to motivate users for giving referrals.
Be a multi-platform
When it comes to a potentially huge target audience it is vital to provide them with access to your service on any device suitable for them. Engage mobile and web developers for your real estate development software.
How can you prevent miscalculation when choosing a platform? Find the answer to this question in our related article
Thus, users can start searching for an apartment in the morning using a desktop with a huge screen and continue doing that having breakfast somewhere outside. This step will definitely increase clients loyalty and extend the number of successful transactions.
Real estate application development: graph of platforms' ratio
The ratio of time spent on content and platforms (Source: Statista)
Be marketing-friendly
You should not underestimate the importance of such things as promotional emails and promotion in social networks.
Email promotion has become a kind of a standard in recent years. Marketers claim that emails are the most effective way to gain a user's awareness about their company's news and campaigns.
What makes them effective? The fact that 70% of people always open the emails they receive from the companies they are interested in.
One more resource opening great opportunities for real estate app startups is Instagram. Every social network should be involved in your marketing campaign. However, I would like to single out Instagram as a network that fits perfectly for this kind of business.
People are fond of visualization. Instagram not only easily handles this task but complements it with another useful feature - geotagging. Users can geotag their photos to a specific location. In turn, Instagram creates a photo map of all geotagged posts in a separate area and when somebody is typing the area name into a search line your post is seen in a result list.
Commercial real estate app: graph of Instagram importance
The number of Instagram users is growing (Source: Statista)
Monetize your real estate investment app wisely
It is a high time to talk about the profit models.
Advertising model
Zillow and Trulia earn money on professional advertising. Their ad system is implemented in a way that allows estate agents and brokers to promote themselves directly to the transaction-ready customer. So users will not find any annoying advertisements.
Since Trulia was bought by Zillow, they connected their efforts and created a real estate agent app focused on professional activities. Now, agents are able to manage their business in a more convenient way and use the power of both apps. This step has helped the company to acquire more loyal consumers represented by agents and brokers.
Worth to mention that Trulia has already added one more monetization model - Premium while Zillow will do this step later this year.
Trulia mobile app: monetization model
Monetization model in Trulia mobile app
White label model
In case you have a really great platform with interesting capabilities, some other developers may be interested in using the power of your app's code in their own projects. Thus, you can license your code and sell it to other companies.
Level of app usage
In case you have not chosen the previous two models, there is one more widespread method. I am talking about simple ads that you can see in every third free app. You can give users an opportunity to switch them off with the help of a premium account or some in-app purchases.
There is a positive side - you earn a profit, in any case, be it ordinary or premium users. However, this model implies the rejection of the monetization model connected with agents promotion and means tit will be necessary to create a new transaction model.
Summing up
As we can see, real estate mobile app development demands clear goals, good planning, and well-thought out branding.
If you decided to launch your own real estate startup or to make an app for your clients - contact us. Our professional team will be glad to help you build your ideas.
Frequently Asked Questions
1. Research the market. Study your competitors (Trulia, Zillow) and come up with the general conception of your business.
2. Form a list of features. Based on your research, make a list of features your real estate app should have. Search, filters, description, and photos are must-haves.
3. Collect proposals for rent and sale. Your real estate app must be filled in with offers right after the launch. That means you'll need a specific database of real estate for rent and/or sale.
4. Find a software development company. If you're not an experienced developer yourself, cooperate with a software development team. Try outsourcing if you're on a limited budget.
There are quite a few ways to monetize a real estate app. The most common are:
• In-app advertising
• White labeling (license your code and sell it to other companies)
• Freemium model (all people can use the app, but premium users have access to more features)
Before you start developing a real estate app, it's a good idea to analyze current competitors, their apps, monetization sources, and features. There's little use in making another Zillow clone: without a great idea, you'll never catch up to the company.
We can divide the expenses for making a real estate app into three categories:
1. Business analysis. Suppose all you have is just an idea and no documentation. In that case, you'll need to work with a Business Analyst who will help you analyze competitors, make a list of features, and prepare documentation. Same for the UI design of the future app done at this stage.
2. Development. The cost depends on the number of hours and developers spend on implementing the features from your list.
3. Support and maintenance. After release, you'll need people to fix bugs and control the app's performance. If the project turns out to be a successful one, it's a good idea to expand its functionality over time.
Rate this article!
1384 ratings, average: 4.68 out of 5
Comments
Leave a comment
|
{
"url": "https://www.cleveroad.com/blog/real-estate-application-development--how-to-build-your-real-business",
"source_domain": "www.cleveroad.com",
"snapshot_id": "crawl=CC-MAIN-2021-04",
"warc_metadata": {
"Content-Length": "123579",
"Content-Type": "application/http; msgtype=response",
"WARC-Block-Digest": "sha1:6EWF3OTXBNH5P6MBM2ZHM4BFXXNPPN3V",
"WARC-Concurrent-To": "<urn:uuid:541ab7d0-c31e-4bd5-ba4c-c5d5600d4e63>",
"WARC-Date": "2021-01-21T07:26:08Z",
"WARC-IP-Address": "104.26.10.41",
"WARC-Identified-Payload-Type": "text/html",
"WARC-Payload-Digest": "sha1:6Y2Y6G77MDHV7JGKA7P7PTJSCLR4DCBZ",
"WARC-Record-ID": "<urn:uuid:a773bdfe-cb48-4d09-a43c-dd816e8e905d>",
"WARC-Target-URI": "https://www.cleveroad.com/blog/real-estate-application-development--how-to-build-your-real-business",
"WARC-Truncated": null,
"WARC-Type": "response",
"WARC-Warcinfo-ID": "<urn:uuid:6163b405-156f-4d66-b13c-36024cc9ad56>"
},
"warc_info": "isPartOf: CC-MAIN-2021-04\r\npublisher: Common Crawl\r\ndescription: Wide crawl of the web for January 2021\r\noperator: Common Crawl Admin (info@commoncrawl.org)\r\nhostname: ip-10-67-67-90.ec2.internal\r\nsoftware: Apache Nutch 1.17 (modified, https://github.com/commoncrawl/nutch/)\r\nrobots: checked via crawler-commons 1.2-SNAPSHOT (https://github.com/crawler-commons/crawler-commons)\r\nformat: WARC File Format 1.1\r\nconformsTo: http://iipc.github.io/warc-specifications/specifications/warc-format/warc-1.1/"
}
|
{
"line_start_idx": [
0,
54,
55,
67,
78,
85,
86,
92,
93,
492,
493,
784,
785,
921,
922,
971,
972,
1285,
1286,
1681,
1682,
1788,
1789,
2017,
2018,
2078,
2079,
2145,
2146,
2179,
2180,
2423,
2424,
2608,
2609,
2897,
2898,
2927,
2928,
3222,
3223,
3346,
3347,
3669,
3670,
3751,
3752,
3759,
3760,
3789,
3790,
3804,
3842,
3869,
3870,
4134,
4135,
4260,
4261,
4648,
4649,
4942,
4943,
4973,
4974,
5002,
5003,
5190,
5191,
5239,
5240,
5267,
5268,
5275,
5276,
5305,
5306,
5320,
5358,
5385,
5386,
5624,
5625,
5719,
5720,
6067,
6068,
6285,
6286,
6329,
6330,
6351,
6352,
6385,
6386,
6567,
6568,
6934,
6935,
7159,
7160,
7251,
7252,
7700,
7701,
7732,
7733,
7946,
7947,
7970,
7971,
8424,
8425,
8720,
8721,
8832,
8833,
8853,
8854,
9071,
9072,
9190,
9191,
9451,
9452,
9515,
9516,
9584,
9585,
9607,
9608,
9723,
9724,
9913,
9914,
10048,
10049,
10312,
10313,
10684,
10685,
10743,
10744,
10804,
10805,
10853,
10854,
10905,
10906,
10924,
10925,
11179,
11180,
11519,
11520,
11653,
11654,
11692,
11693,
11733,
11734,
11752,
11753,
11990,
11991,
12010,
12011,
12287,
12288,
12547,
12548,
12559,
12560,
12677,
12678,
12846,
12847,
12874,
12998,
12999,
13168,
13169,
13366,
13367,
13549,
13550,
13629,
13630,
13653,
13723,
13819,
13820,
14075,
14076,
14155,
14156,
14449,
14450,
14574,
14575,
14791,
14792,
14811,
14848,
14849,
14858,
14859
],
"line_end_idx": [
54,
55,
67,
78,
85,
86,
92,
93,
492,
493,
784,
785,
921,
922,
971,
972,
1285,
1286,
1681,
1682,
1788,
1789,
2017,
2018,
2078,
2079,
2145,
2146,
2179,
2180,
2423,
2424,
2608,
2609,
2897,
2898,
2927,
2928,
3222,
3223,
3346,
3347,
3669,
3670,
3751,
3752,
3759,
3760,
3789,
3790,
3804,
3842,
3869,
3870,
4134,
4135,
4260,
4261,
4648,
4649,
4942,
4943,
4973,
4974,
5002,
5003,
5190,
5191,
5239,
5240,
5267,
5268,
5275,
5276,
5305,
5306,
5320,
5358,
5385,
5386,
5624,
5625,
5719,
5720,
6067,
6068,
6285,
6286,
6329,
6330,
6351,
6352,
6385,
6386,
6567,
6568,
6934,
6935,
7159,
7160,
7251,
7252,
7700,
7701,
7732,
7733,
7946,
7947,
7970,
7971,
8424,
8425,
8720,
8721,
8832,
8833,
8853,
8854,
9071,
9072,
9190,
9191,
9451,
9452,
9515,
9516,
9584,
9585,
9607,
9608,
9723,
9724,
9913,
9914,
10048,
10049,
10312,
10313,
10684,
10685,
10743,
10744,
10804,
10805,
10853,
10854,
10905,
10906,
10924,
10925,
11179,
11180,
11519,
11520,
11653,
11654,
11692,
11693,
11733,
11734,
11752,
11753,
11990,
11991,
12010,
12011,
12287,
12288,
12547,
12548,
12559,
12560,
12677,
12678,
12846,
12847,
12874,
12998,
12999,
13168,
13169,
13366,
13367,
13549,
13550,
13629,
13630,
13653,
13723,
13819,
13820,
14075,
14076,
14155,
14156,
14449,
14450,
14574,
14575,
14791,
14792,
14811,
14848,
14849,
14858,
14859,
14874
]
}
|
{
"red_pajama_v2": {
"ccnet_original_length": 14874,
"ccnet_original_nlines": 206,
"rps_doc_curly_bracket": 0,
"rps_doc_ldnoobw_words": 1,
"rps_doc_lorem_ipsum": 0,
"rps_doc_stop_word_fraction": 0.41199156641960144,
"rps_doc_ut1_blacklist": 0,
"rps_doc_frac_all_caps_words": 0.006311359815299511,
"rps_doc_frac_lines_end_with_ellipsis": 0,
"rps_doc_frac_no_alph_words": 0.1272791028022766,
"rps_doc_frac_unique_words": 0.3208383619785309,
"rps_doc_mean_word_length": 4.81056022644043,
"rps_doc_num_sentences": 158,
"rps_doc_symbol_to_word_ratio": 0,
"rps_doc_unigram_entropy": 5.789020538330078,
"rps_doc_word_count": 2481,
"rps_doc_frac_chars_dupe_10grams": 0,
"rps_doc_frac_chars_dupe_5grams": 0.027482200413942337,
"rps_doc_frac_chars_dupe_6grams": 0.013238370418548584,
"rps_doc_frac_chars_dupe_7grams": 0.006702969782054424,
"rps_doc_frac_chars_dupe_8grams": 0.006702969782054424,
"rps_doc_frac_chars_dupe_9grams": 0.006702969782054424,
"rps_doc_frac_chars_top_2gram": 0.029325509443879128,
"rps_doc_frac_chars_top_3gram": 0.013070800341665745,
"rps_doc_frac_chars_top_4gram": 0.0056975302286446095,
"rps_doc_books_importance": -1491.4798583984375,
"rps_doc_books_importance_length_correction": -1491.4798583984375,
"rps_doc_openwebtext_importance": -781.5392456054688,
"rps_doc_openwebtext_importance_length_correction": -781.5392456054688,
"rps_doc_wikipedia_importance": -614.3820190429688,
"rps_doc_wikipedia_importance_length_correction": -614.3820190429688
},
"fasttext": {
"dclm": 0.02846718020737171,
"english": 0.9480826258659363,
"fineweb_edu_approx": 1.4113521575927734,
"eai_general_math": 0.04038221016526222,
"eai_open_web_math": 0.036369439214468,
"eai_web_code": 0.04819511994719505
}
}
|
{
"free_decimal_correspondence": {
"primary": {
"code": "005.44",
"labels": {
"level_1": "General works, books and libraries, information sciences",
"level_2": "",
"level_3": "Computer programming"
}
},
"secondary": {
"code": "338.92",
"labels": {
"level_1": "Social sciences",
"level_2": "Economics",
"level_3": "Industries, Prices, and Microeconomics"
}
}
},
"bloom_cognitive_process": {
"primary": {
"code": "3",
"label": "Apply"
},
"secondary": {
"code": "4",
"label": "Analyze"
}
},
"bloom_knowledge_domain": {
"primary": {
"code": "3",
"label": "Procedural"
},
"secondary": {
"code": "2",
"label": "Conceptual"
}
},
"document_type_v1": {
"primary": {
"code": "3",
"label": "Reference/Encyclopedic/Educational"
},
"secondary": {
"code": "-1",
"label": "Abstain"
}
},
"extraction_artifacts": {
"primary": {
"code": "0",
"label": "No Artifacts"
},
"secondary": {
"code": "3",
"label": "Irrelevant Content"
}
},
"missing_content": {
"primary": {
"code": "0",
"label": "No missing content"
},
"secondary": {
"code": "4",
"label": "Missing Images or Figures"
}
},
"document_type_v2": {
"primary": {
"code": "10",
"label": "Knowledge Article"
},
"secondary": {
"code": "23",
"label": "Tutorial"
}
},
"reasoning_depth": {
"primary": {
"code": "3",
"label": "Intermediate Reasoning"
},
"secondary": {
"code": "2",
"label": "Basic Reasoning"
}
},
"technical_correctness": {
"primary": {
"code": "6",
"label": "Not Applicable/Indeterminate"
},
"secondary": {
"code": "3",
"label": "Mostly Correct"
}
},
"education_level": {
"primary": {
"code": "2",
"label": "High School Level"
},
"secondary": {
"code": "1",
"label": "General Audience"
}
}
}
|
672f1e42c33a7f9846924a2431ea77df
|
-3,121,324,125,116,146,000
|
10
I want to set the default target of the image block in Gutenberg to "Media File":
Link target
I've found solutions for the classic editor, and one that appears to work for Gutenberg galleries by editing the block's template, but I was under the impression that the intended way to modify the editor's behaviour is via JavaScript hooks in the block editor.
Is there a way to set the default target using a JavaScript hook in the block editor?
UPDATE: I made a pull request on the Gutenberg GitHub repository to try to implement the ability to override the default link target with a plugin. The latest version is here. As of writing, this has not yet been merged.
4
Using the filter blocks.registerBlockType we can alter block registration settings. We simply need to target the core/image block and modify the default value for the attribute linkDestination which is none by default.
function modifyLinkDestinationDefault(settings, name) {
if (name !== "core/image") {
return settings;
}
settings.attributes.linkDestination.default = "media";
return settings;
}
wp.hooks.addFilter(
"blocks.registerBlockType",
"my-plugin/modify-linkDestination-default",
modifyLinkDestinationDefault
);
| improve this answer | |
• 1
Worked like a charm, thanks a lot! I wrapped your code in a ( function( wp ) { ... } )( window.wp ); block, and enqueued the script using the enqueue_block_editor_assets PHP hook. The enqueued script should have the wp-hooks dependency specified. – Sean Feb 2 '19 at 9:37
• 1
And, to set the default for galleries, you must modify the core/gallery block and set settings.attributes.linkTo.default. Gutenberg inconsistencies... – Sean Feb 2 '19 at 10:08
• 1
@Sean You can see here for what is the purpose of wrapping functions in that way. When you use a script dependency enqueuing your own script, in this case wp-hooks as you indicated, you can then safely use the contents of that dependency in your script. – Alvaro Feb 2 '19 at 11:54
• 2
Update: unfortunately this solution doesn't actually work. The new default is set, but the href property is not - and this is required for the saved image to actually display the link. It seems that I actually have to somehow execute the onSetLinkDestination function to set the href, but this can't be done until an image is actually uploaded (i.e. not possible on the registerBlockType hook). Any ideas for how this might be fixed? – Sean Feb 6 '19 at 18:35
• 1
I submitted a pull request to implement this in Gutenberg which was later improved by another user... if you need this feature, please poke the developers on those GitHub threads to implement it. – Sean Jul 28 '19 at 19:43
Your Answer
By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy
Not the answer you're looking for? Browse other questions tagged or ask your own question.
|
{
"url": "https://wordpress.stackexchange.com/questions/327396/set-default-image-link-target-in-gutenberg-image-block",
"source_domain": "wordpress.stackexchange.com",
"snapshot_id": "crawl=CC-MAIN-2020-45",
"warc_metadata": {
"Content-Length": "153756",
"Content-Type": "application/http; msgtype=response",
"WARC-Block-Digest": "sha1:N72WXUXA236BUV32HYYZJAHOJ6IHATXZ",
"WARC-Concurrent-To": "<urn:uuid:e1499ebf-9d19-4668-87f9-d52ef8ec7d24>",
"WARC-Date": "2020-10-30T22:15:45Z",
"WARC-IP-Address": "151.101.193.69",
"WARC-Identified-Payload-Type": "text/html",
"WARC-Payload-Digest": "sha1:M5S67LBTZJWEH3NCCF3OYFOD7CFH3VSA",
"WARC-Record-ID": "<urn:uuid:7457d99a-c859-4614-b917-e732451403c5>",
"WARC-Target-URI": "https://wordpress.stackexchange.com/questions/327396/set-default-image-link-target-in-gutenberg-image-block",
"WARC-Truncated": null,
"WARC-Type": "response",
"WARC-Warcinfo-ID": "<urn:uuid:2875a33a-2910-40da-88f6-e3205d69104a>"
},
"warc_info": "isPartOf: CC-MAIN-2020-45\r\npublisher: Common Crawl\r\ndescription: Wide crawl of the web for October 2020\r\noperator: Common Crawl Admin (info@commoncrawl.org)\r\nhostname: ip-10-67-67-244.ec2.internal\r\nsoftware: Apache Nutch 1.17 (modified, https://github.com/commoncrawl/nutch/)\r\nrobots: checked via crawler-commons 1.2-SNAPSHOT (https://github.com/crawler-commons/crawler-commons)\r\nformat: WARC File Format 1.1\r\nconformsTo: http://iipc.github.io/warc-specifications/specifications/warc-format/warc-1.1/"
}
|
{
"line_start_idx": [
0,
3,
4,
86,
87,
99,
100,
362,
363,
449,
450,
671,
672,
674,
675,
894,
895,
951,
984,
1009,
1015,
1016,
1075,
1076,
1097,
1099,
1100,
1120,
1152,
1200,
1233,
1236,
1262,
1268,
1544,
1550,
1731,
1737,
2023,
2029,
2493,
2499,
2726,
2727,
2739,
2740,
2840,
2841
],
"line_end_idx": [
3,
4,
86,
87,
99,
100,
362,
363,
449,
450,
671,
672,
674,
675,
894,
895,
951,
984,
1009,
1015,
1016,
1075,
1076,
1097,
1099,
1100,
1120,
1152,
1200,
1233,
1236,
1262,
1268,
1544,
1550,
1731,
1737,
2023,
2029,
2493,
2499,
2726,
2727,
2739,
2740,
2840,
2841,
2931
]
}
|
{
"red_pajama_v2": {
"ccnet_original_length": 2931,
"ccnet_original_nlines": 47,
"rps_doc_curly_bracket": 0.0020470800809562206,
"rps_doc_ldnoobw_words": 0,
"rps_doc_lorem_ipsum": 0,
"rps_doc_stop_word_fraction": 0.36092716455459595,
"rps_doc_ut1_blacklist": 0,
"rps_doc_frac_all_caps_words": 0.014900660142302513,
"rps_doc_frac_lines_end_with_ellipsis": 0,
"rps_doc_frac_no_alph_words": 0.251655638217926,
"rps_doc_frac_unique_words": 0.46929824352264404,
"rps_doc_mean_word_length": 4.9210524559021,
"rps_doc_num_sentences": 37,
"rps_doc_symbol_to_word_ratio": 0.004966889973729849,
"rps_doc_unigram_entropy": 4.916070461273193,
"rps_doc_word_count": 456,
"rps_doc_frac_chars_dupe_10grams": 0,
"rps_doc_frac_chars_dupe_5grams": 0.030303029343485832,
"rps_doc_frac_chars_dupe_6grams": 0.011586450040340424,
"rps_doc_frac_chars_dupe_7grams": 0,
"rps_doc_frac_chars_dupe_8grams": 0,
"rps_doc_frac_chars_dupe_9grams": 0,
"rps_doc_frac_chars_top_2gram": 0.022281639277935028,
"rps_doc_frac_chars_top_3gram": 0.014260250143706799,
"rps_doc_frac_chars_top_4gram": 0.020053479820489883,
"rps_doc_books_importance": -309.88775634765625,
"rps_doc_books_importance_length_correction": -309.88775634765625,
"rps_doc_openwebtext_importance": -158.3265380859375,
"rps_doc_openwebtext_importance_length_correction": -158.3265380859375,
"rps_doc_wikipedia_importance": -104.41873931884766,
"rps_doc_wikipedia_importance_length_correction": -104.41873931884766
},
"fasttext": {
"dclm": 0.0377541184425354,
"english": 0.8622652292251587,
"fineweb_edu_approx": 1.271320104598999,
"eai_general_math": 0.037142571061849594,
"eai_open_web_math": 0.09771960973739624,
"eai_web_code": 0.006374480202794075
}
}
|
{
"free_decimal_correspondence": {
"primary": {
"code": "005.1",
"labels": {
"level_1": "General works, books and libraries, information sciences",
"level_2": "",
"level_3": "Computer programming"
}
},
"secondary": {
"code": "-1",
"labels": {
"level_1": "",
"level_2": "",
"level_3": ""
}
}
},
"bloom_cognitive_process": {
"primary": {
"code": "3",
"label": "Apply"
},
"secondary": {
"code": "2",
"label": "Understand"
}
},
"bloom_knowledge_domain": {
"primary": {
"code": "3",
"label": "Procedural"
},
"secondary": {
"code": "2",
"label": "Conceptual"
}
},
"document_type_v1": {
"primary": {
"code": "5",
"label": "Social/Forum"
},
"secondary": {
"code": "4",
"label": "Code/Software"
}
},
"extraction_artifacts": {
"primary": {
"code": "3",
"label": "Irrelevant Content"
},
"secondary": {
"code": "-1",
"label": "Abstain"
}
},
"missing_content": {
"primary": {
"code": "4",
"label": "Missing Images or Figures"
},
"secondary": {
"code": "-1",
"label": "Abstain"
}
},
"document_type_v2": {
"primary": {
"code": "18",
"label": "Q&A Forum"
},
"secondary": {
"code": "8",
"label": "Documentation"
}
},
"reasoning_depth": {
"primary": {
"code": "3",
"label": "Intermediate Reasoning"
},
"secondary": {
"code": "2",
"label": "Basic Reasoning"
}
},
"technical_correctness": {
"primary": {
"code": "3",
"label": "Mostly Correct"
},
"secondary": {
"code": "4",
"label": "Highly Correct"
}
},
"education_level": {
"primary": {
"code": "3",
"label": "Undergraduate Level"
},
"secondary": {
"code": "4",
"label": "Graduate/Expert Level"
}
}
}
|
672f1e42c33a7f9846924a2431ea77df
|
-5,411,238,295,961,944,000
|
получение div, который обрабатывает сообщение моих категорий в wp jquery/ajax
92
11
У меня есть wp_list_categories, который отображает мои категории сайта wordpress. Теперь мне удается отобразить сообщение из моих категорий wordpress из wp_list_categories, включив пользователя onClick, какую категорию будет отображаться, не перезагружая/не обновляя страницу. У меня есть код, но я не могу получить конкретный div, содержащий мой пост, где он возвращает всю мою страницу, которая будет отображаться. Результатом моего кода является ajax/jquery, возвращает всю страницу и помещает ее в мой div id="inside". Я хочу только получить часть div id = "inside" которой есть запись из выбранной категории onclick.
Вот мой код:
$(document).ready(function(){
$.ajaxSetup({cache:true});
var $mainCategory = $('#inside'),
$cat_links = $('ul.categories-filters li a');
$cat_links.on('click', function (e) {
e.preventDefault();
$el = $(this);
var value = $el.attr("href");
$mainCategory.animate({opacity: "0.5"});
$mainCategory.load(value + "#inside", function() {
$mainCategory.animate({opacity: "1"});
});
});
});
my wp_list_categories и внутри div id="#inside" где сообщения должны отображаться.
<ul class="categories-filters">
<?php
$args2 = array(
'exclude' => array( 6,7,9 ),
'order' => 'DESC',
'title_li' => __(''),
);
wp_list_categories($args2);
?>
</ul>
</div>
<div class="col-md-8">
<div id="main-category" class="row row-left">
<?php if(have_posts()) :
$count = 0;
while(have_posts()) : the_post(); ?>
<div div id="inside" class="col-xs-3 col-box2">
<?php the_post_thumbnail('thumbnail'); ?>
</div>
<?php if($count==2) :
echo '</div>';
echo '<div class="row row-left">';
endif;
$count++; endwhile;
endif;
wp_reset_postdata();
?>
</div>
</div>
спросил(а) 2021-01-19T16:36:37+03:00 9 месяцев назад
1
Решение
111
Проблема заключается в том, как вы используете функцию jquery.load
$mainCategory.load(value + "#inside", function() {
в документации указывается, что между URL-адресом и "селектором" должно быть пространство для частичной загрузки извлеченного html
так что просто
$mainCategory.load(value + " #inside", function() {
ответил(а) 2021-01-19T16:36:37+03:00 9 месяцев назад
Ваш ответ
Введите минимум 50 символов
Чтобы , пожалуйста,
Выберите тему жалобы:
Другая проблема
|
{
"url": "https://progi.pro/poluchenie-div-kotoriy-obrabativaet-soobshenie-moih-kategoriy-v-wp-jqueryajax-11620961",
"source_domain": "progi.pro",
"snapshot_id": "crawl=CC-MAIN-2021-43",
"warc_metadata": {
"Content-Length": "28796",
"Content-Type": "application/http; msgtype=response",
"WARC-Block-Digest": "sha1:SBI5QU2CINOHJMIOTVSAQXTB2IKXUDIH",
"WARC-Concurrent-To": "<urn:uuid:90034ed8-695d-4822-af57-9aff1b803bd2>",
"WARC-Date": "2021-10-23T07:11:24Z",
"WARC-IP-Address": "195.201.175.115",
"WARC-Identified-Payload-Type": "text/html",
"WARC-Payload-Digest": "sha1:F6TID7DBDNPVA2X7F4DTAX6VJW3WR3YY",
"WARC-Record-ID": "<urn:uuid:7c4ae18b-8c13-443a-a2fb-db5d0a2f6b75>",
"WARC-Target-URI": "https://progi.pro/poluchenie-div-kotoriy-obrabativaet-soobshenie-moih-kategoriy-v-wp-jqueryajax-11620961",
"WARC-Truncated": null,
"WARC-Type": "response",
"WARC-Warcinfo-ID": "<urn:uuid:1385347a-4ed3-45d6-afbb-65ad3f9341d1>"
},
"warc_info": "isPartOf: CC-MAIN-2021-43\r\npublisher: Common Crawl\r\ndescription: Wide crawl of the web for October 2021\r\noperator: Common Crawl Admin (info@commoncrawl.org)\r\nhostname: ip-10-67-67-88\r\nsoftware: Apache Nutch 1.18 (modified, https://github.com/commoncrawl/nutch/)\r\nrobots: checked via crawler-commons 1.2-SNAPSHOT (https://github.com/crawler-commons/crawler-commons)\r\nformat: WARC File Format 1.1\r\nconformsTo: https://iipc.github.io/warc-specifications/specifications/warc-format/warc-1.1/"
}
|
{
"line_start_idx": [
0,
78,
79,
82,
85,
86,
708,
709,
722,
723,
753,
780,
814,
860,
861,
899,
919,
934,
964,
1005,
1056,
1095,
1099,
1103,
1107,
1108,
1191,
1192,
1224,
1230,
1246,
1275,
1294,
1316,
1319,
1347,
1350,
1356,
1363,
1386,
1432,
1457,
1469,
1506,
1507,
1555,
1597,
1604,
1626,
1641,
1676,
1683,
1703,
1710,
1731,
1734,
1741,
1748,
1749,
1802,
1804,
1812,
1816,
1817,
1884,
1885,
1936,
1937,
2068,
2069,
2084,
2085,
2137,
2138,
2191,
2201,
2229,
2249,
2271,
2272
],
"line_end_idx": [
78,
79,
82,
85,
86,
708,
709,
722,
723,
753,
780,
814,
860,
861,
899,
919,
934,
964,
1005,
1056,
1095,
1099,
1103,
1107,
1108,
1191,
1192,
1224,
1230,
1246,
1275,
1294,
1316,
1319,
1347,
1350,
1356,
1363,
1386,
1432,
1457,
1469,
1506,
1507,
1555,
1597,
1604,
1626,
1641,
1676,
1683,
1703,
1710,
1731,
1734,
1741,
1748,
1749,
1802,
1804,
1812,
1816,
1817,
1884,
1885,
1936,
1937,
2068,
2069,
2084,
2085,
2137,
2138,
2191,
2201,
2229,
2249,
2271,
2272,
2287
]
}
|
{
"red_pajama_v2": {
"ccnet_original_length": 2287,
"ccnet_original_nlines": 79,
"rps_doc_curly_bracket": 0.006121559999883175,
"rps_doc_ldnoobw_words": 0,
"rps_doc_lorem_ipsum": 0,
"rps_doc_stop_word_fraction": 0.024436090141534805,
"rps_doc_ut1_blacklist": 0,
"rps_doc_frac_all_caps_words": 0.013157890178263187,
"rps_doc_frac_lines_end_with_ellipsis": 0,
"rps_doc_frac_no_alph_words": 0.7255638837814331,
"rps_doc_frac_unique_words": 0.6803278923034668,
"rps_doc_mean_word_length": 6.799180507659912,
"rps_doc_num_sentences": 28,
"rps_doc_symbol_to_word_ratio": 0.009398500435054302,
"rps_doc_unigram_entropy": 4.920472621917725,
"rps_doc_word_count": 244,
"rps_doc_frac_chars_dupe_10grams": 0,
"rps_doc_frac_chars_dupe_5grams": 0,
"rps_doc_frac_chars_dupe_6grams": 0,
"rps_doc_frac_chars_dupe_7grams": 0,
"rps_doc_frac_chars_dupe_8grams": 0,
"rps_doc_frac_chars_dupe_9grams": 0,
"rps_doc_frac_chars_top_2gram": 0.01989150047302246,
"rps_doc_frac_chars_top_3gram": 0.06329113990068436,
"rps_doc_frac_chars_top_4gram": 0.03857745975255966,
"rps_doc_books_importance": -232.64334106445312,
"rps_doc_books_importance_length_correction": -232.64334106445312,
"rps_doc_openwebtext_importance": -148.43829345703125,
"rps_doc_openwebtext_importance_length_correction": -148.43829345703125,
"rps_doc_wikipedia_importance": -71.19883728027344,
"rps_doc_wikipedia_importance_length_correction": -71.19883728027344
},
"fasttext": {
"dclm": 0.8816695809364319,
"english": 0.0010406100191175938,
"fineweb_edu_approx": 2.7873401641845703,
"eai_general_math": 0.00010943000233964995,
"eai_open_web_math": 0.24620360136032104,
"eai_web_code": 0.898474395275116
}
}
|
{
"free_decimal_correspondence": {
"primary": {
"code": "005.1",
"labels": {
"level_1": "General works, books and libraries, information sciences",
"level_2": "",
"level_3": "Computer programming"
}
},
"secondary": {
"code": "-1",
"labels": {
"level_1": "",
"level_2": "",
"level_3": ""
}
}
},
"bloom_cognitive_process": {
"primary": {
"code": "3",
"label": "Apply"
},
"secondary": {
"code": "2",
"label": "Understand"
}
},
"bloom_knowledge_domain": {
"primary": {
"code": "3",
"label": "Procedural"
},
"secondary": {
"code": "2",
"label": "Conceptual"
}
},
"document_type_v1": {
"primary": {
"code": "5",
"label": "Social/Forum"
},
"secondary": {
"code": "4",
"label": "Code/Software"
}
},
"extraction_artifacts": {
"primary": {
"code": "0",
"label": "No Artifacts"
},
"secondary": {
"code": "3",
"label": "Irrelevant Content"
}
},
"missing_content": {
"primary": {
"code": "0",
"label": "No missing content"
},
"secondary": {
"code": "-1",
"label": "Abstain"
}
},
"document_type_v2": {
"primary": {
"code": "18",
"label": "Q&A Forum"
},
"secondary": {
"code": "8",
"label": "Documentation"
}
},
"reasoning_depth": {
"primary": {
"code": "2",
"label": "Basic Reasoning"
},
"secondary": {
"code": "3",
"label": "Intermediate Reasoning"
}
},
"technical_correctness": {
"primary": {
"code": "3",
"label": "Mostly Correct"
},
"secondary": {
"code": "4",
"label": "Highly Correct"
}
},
"education_level": {
"primary": {
"code": "3",
"label": "Undergraduate Level"
},
"secondary": {
"code": "4",
"label": "Graduate/Expert Level"
}
}
}
|
672f1e42c33a7f9846924a2431ea77df
|
8,349,208,838,054,299,000
|
Home » Blog » Determine the convergence or divergence of f(n) = (n+1)1/2 – n1/2
Determine the convergence or divergence of f(n) = (n+1)1/2 – n1/2
Consider the function f(n) defined by
\[ f(n) = \sqrt{n+1} - \sqrt{n}. \]
Determine whether the sequence \{ f(n) \} converges or diverges, and if it converges find the limit.
First, we use multiply the numerator and denominator by \sqrt{n+1} + \sqrt{n},
\begin{align*} f(n) &= \sqrt{n+1} - \sqrt{n} \\[9pt] &= \frac{(\sqrt{n+1} - \sqrt{n})(\sqrt{n+1} + \sqrt{n})}{\sqrt{n+1} + \sqrt{n}} \\[9pt] &= \frac{n+1 - n}{\sqrt{n+1} + \sqrt{n}} \\[9pt] &= \frac{1}{\sqrt{n+1} + \sqrt{n}}. \end{align*}
Then, since \sqrt{n+1} > \sqrt{n} we have
\[ 0 < \frac{1}{\sqrt{n+1} + \sqrt{n}} < \frac{1}{2 \sqrt{n}}. \]
Since we know from property (10.9) on page 380 of Apostol that
\[ \lim_{n \to \infty} \frac{1}{n^{\alpha}} = 0 \qquad \text{if } \alpha > 0 \]
we then have
\[ \lim_{n \to \infty} \frac{1}{2 \sqrt{n}} = 0. \]
Hence, by the squeeze theorem we have
\[ \lim_{n \to \infty} f(n) = 0. \]
Therefore the sequence \{ f(n) \} converges with limit 0.
Point out an error, ask a question, offer an alternative solution (to use Latex type [latexpage] at the top of your comment):
|
{
"url": "http://www.stumblingrobot.com/2016/02/27/determine-the-convergence-or-divergence-of-fn-n112-n12/",
"source_domain": "www.stumblingrobot.com",
"snapshot_id": "crawl=CC-MAIN-2019-47",
"warc_metadata": {
"Content-Length": "59698",
"Content-Type": "application/http; msgtype=response",
"WARC-Block-Digest": "sha1:RQHKXQ53OJJORREWT7VG3EBXSVP5H5BQ",
"WARC-Concurrent-To": "<urn:uuid:f58e84d0-7fa4-4d73-a786-8dacb2bfdbe6>",
"WARC-Date": "2019-11-18T20:33:51Z",
"WARC-IP-Address": "194.1.147.69",
"WARC-Identified-Payload-Type": "text/html",
"WARC-Payload-Digest": "sha1:YKVROUMQP4XPPXMESRM7EXUKMX7ILJUB",
"WARC-Record-ID": "<urn:uuid:8492c9d7-eb23-4f50-93ad-a7b814cf0825>",
"WARC-Target-URI": "http://www.stumblingrobot.com/2016/02/27/determine-the-convergence-or-divergence-of-fn-n112-n12/",
"WARC-Truncated": null,
"WARC-Type": "response",
"WARC-Warcinfo-ID": "<urn:uuid:af4ec870-2e70-445c-927a-100ab84d5b2e>"
},
"warc_info": "isPartOf: CC-MAIN-2019-47\r\npublisher: Common Crawl\r\ndescription: Wide crawl of the web for November 2019\r\noperator: Common Crawl Admin (info@commoncrawl.org)\r\nhostname: ip-10-67-67-133.ec2.internal\r\nsoftware: Apache Nutch 1.16 (modified, https://github.com/commoncrawl/nutch/)\r\nrobots: checked via crawler-commons 1.1-SNAPSHOT (https://github.com/crawler-commons/crawler-commons)\r\nformat: WARC File Format 1.1\r\nconformsTo: http://iipc.github.io/warc-specifications/specifications/warc-format/warc-1.1/"
}
|
{
"line_start_idx": [
0,
80,
81,
147,
148,
186,
187,
227,
228,
329,
330,
331,
410,
411,
658,
659,
701,
702,
772,
773,
836,
837,
921,
922,
935,
936,
992,
993,
1031,
1032,
1072,
1073,
1131,
1132
],
"line_end_idx": [
80,
81,
147,
148,
186,
187,
227,
228,
329,
330,
331,
410,
411,
658,
659,
701,
702,
772,
773,
836,
837,
921,
922,
935,
936,
992,
993,
1031,
1032,
1072,
1073,
1131,
1132,
1257
]
}
|
{
"red_pajama_v2": {
"ccnet_original_length": 1257,
"ccnet_original_nlines": 33,
"rps_doc_curly_bracket": 0.07159905135631561,
"rps_doc_ldnoobw_words": 0,
"rps_doc_lorem_ipsum": 0,
"rps_doc_stop_word_fraction": 0.22654461860656738,
"rps_doc_ut1_blacklist": 0,
"rps_doc_frac_all_caps_words": 0,
"rps_doc_frac_lines_end_with_ellipsis": 0,
"rps_doc_frac_no_alph_words": 0.5606407523155212,
"rps_doc_frac_unique_words": 0.5345911979675293,
"rps_doc_mean_word_length": 4.704402446746826,
"rps_doc_num_sentences": 9,
"rps_doc_symbol_to_word_ratio": 0,
"rps_doc_unigram_entropy": 4.166910171508789,
"rps_doc_word_count": 159,
"rps_doc_frac_chars_dupe_10grams": 0.1256684511899948,
"rps_doc_frac_chars_dupe_5grams": 0.1256684511899948,
"rps_doc_frac_chars_dupe_6grams": 0.1256684511899948,
"rps_doc_frac_chars_dupe_7grams": 0.1256684511899948,
"rps_doc_frac_chars_dupe_8grams": 0.1256684511899948,
"rps_doc_frac_chars_dupe_9grams": 0.1256684511899948,
"rps_doc_frac_chars_top_2gram": 0.05882352963089943,
"rps_doc_frac_chars_top_3gram": 0.04411764815449715,
"rps_doc_frac_chars_top_4gram": 0.06684491783380508,
"rps_doc_books_importance": -247.1324005126953,
"rps_doc_books_importance_length_correction": -247.1324005126953,
"rps_doc_openwebtext_importance": -164.55935668945312,
"rps_doc_openwebtext_importance_length_correction": -164.55935668945312,
"rps_doc_wikipedia_importance": -140.73521423339844,
"rps_doc_wikipedia_importance_length_correction": -140.73521423339844
},
"fasttext": {
"dclm": 0.8959088325500488,
"english": 0.6116529107093811,
"fineweb_edu_approx": 2.3527448177337646,
"eai_general_math": 0.9731443524360657,
"eai_open_web_math": 0.9992699027061462,
"eai_web_code": 0.6125710606575012
}
}
|
{
"free_decimal_correspondence": {
"primary": {
"code": "515.24",
"labels": {
"level_1": "Science and Natural history",
"level_2": "Mathematics",
"level_3": "Calculus and Mathematical analysis"
}
},
"secondary": {
"code": "515",
"labels": {
"level_1": "Science and Natural history",
"level_2": "Mathematics",
"level_3": "Calculus and Mathematical analysis"
}
}
},
"bloom_cognitive_process": {
"primary": {
"code": "4",
"label": "Analyze"
},
"secondary": {
"code": "3",
"label": "Apply"
}
},
"bloom_knowledge_domain": {
"primary": {
"code": "3",
"label": "Procedural"
},
"secondary": {
"code": "2",
"label": "Conceptual"
}
},
"document_type_v1": {
"primary": {
"code": "3",
"label": "Reference/Encyclopedic/Educational"
},
"secondary": {
"code": "-1",
"label": "Abstain"
}
},
"extraction_artifacts": {
"primary": {
"code": "0",
"label": "No Artifacts"
},
"secondary": {
"code": "0",
"label": "No Artifacts"
}
},
"missing_content": {
"primary": {
"code": "0",
"label": "No missing content"
},
"secondary": {
"code": "0",
"label": "No missing content"
}
},
"document_type_v2": {
"primary": {
"code": "23",
"label": "Tutorial"
},
"secondary": {
"code": "10",
"label": "Knowledge Article"
}
},
"reasoning_depth": {
"primary": {
"code": "3",
"label": "Intermediate Reasoning"
},
"secondary": {
"code": "4",
"label": "Advanced Reasoning"
}
},
"technical_correctness": {
"primary": {
"code": "4",
"label": "Highly Correct"
},
"secondary": {
"code": "5",
"label": "Exceptionally Correct"
}
},
"education_level": {
"primary": {
"code": "3",
"label": "Undergraduate Level"
},
"secondary": {
"code": "4",
"label": "Graduate/Expert Level"
}
}
}
|
672f1e42c33a7f9846924a2431ea77df
|
229,296,871,079,959,420
|
Skip site navigation (1) Skip section navigation (2)
JDBC: pl/pgsql function runs but does not do anything
From: Rob W <digital_illuminati(at)yahoo(dot)com>
To: pgsql-novice(at)postgresql(dot)org
Subject: JDBC: pl/pgsql function runs but does not do anything
Date: 2009-07-13 14:23:27
Message-ID: 806276.32534.qm@web34607.mail.mud.yahoo.com (view raw, whole thread or download thread mbox)
Thread:
Lists: pgsql-novice
I have a PL/pgsql function called "move_records" that does not take any parameters and does not return any results. It performs inserts on a few tables (as the name suggests, it copies records from one table to another).
When I run this function using pgAdminIII's query window, using the command "select move_records()", it executes correctly and as expected.
However, when I call the function via JDBC, it runs, but appears to do nothing. It's as if nothing it does is getting committed. The relevant Java code is:
CallableStatement statement = connection.prepareCall("{call move_records()}");
statement.execute();
At first I thought it was not running at all, so I put in "RAISE INFO" statements to see if it was actually working -- and those did indeed print statements. So I know for sure it is actually running. I tried commenting out different things in case it was failing silently, but that made no difference. Running the stored procedure does not return any errors or warnings.
There must be something really obvious I'm overlooking?
Any help would be greatly appreciated!
Responses
pgsql-novice by date
Next:From: John DeSoiDate: 2009-07-13 14:37:32
Subject: Re: JDBC: pl/pgsql function runs but does not do anything
Previous:From: Bryan NuseDate: 2009-07-13 00:33:07
Subject: presence/absence
Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group
|
{
"url": "https://www.postgresql.org/message-id/806276.32534.qm@web34607.mail.mud.yahoo.com",
"source_domain": "www.postgresql.org",
"snapshot_id": "crawl=CC-MAIN-2017-39",
"warc_metadata": {
"Content-Length": "11772",
"Content-Type": "application/http; msgtype=response",
"WARC-Block-Digest": "sha1:KTVBR5VV7ZYP4Y25C3FDY7VZW47W4VHU",
"WARC-Concurrent-To": "<urn:uuid:dffa5312-b4f3-4500-9d82-86157f02f58a>",
"WARC-Date": "2017-09-23T20:38:40Z",
"WARC-IP-Address": "174.143.35.230",
"WARC-Identified-Payload-Type": "application/xhtml+xml",
"WARC-Payload-Digest": "sha1:UAWAQMWV6QLHYOMNJB4HZJMS3HL3Z42D",
"WARC-Record-ID": "<urn:uuid:c4283b35-433d-40fd-9c6c-8cee45f0a4f9>",
"WARC-Target-URI": "https://www.postgresql.org/message-id/806276.32534.qm@web34607.mail.mud.yahoo.com",
"WARC-Truncated": "length",
"WARC-Type": "response",
"WARC-Warcinfo-ID": "<urn:uuid:aac97e86-5a6e-424f-b305-68c57cbda9ee>"
},
"warc_info": "robots: classic\r\nhostname: ip-10-237-176-178.ec2.internal\r\nsoftware: Nutch 1.6 (CC)\r\nisPartOf: CC-MAIN-2017-39\r\noperator: Common Crawl Admin\r\ndescription: Wide crawl of the web for September 2017\r\npublisher: Common Crawl\r\nformat: WARC File Format 1.0\r\nconformsTo: http://bibnum.bnf.fr/WARC/WARC_ISO_28500_version1_latestdraft.pdf"
}
|
{
"line_start_idx": [
0,
53,
54,
108,
109,
159,
198,
261,
287,
392,
400,
420,
641,
642,
782,
783,
939,
940,
1019,
1040,
1041,
1413,
1414,
1470,
1471,
1510,
1511,
1512,
1522,
1523,
1544,
1545,
1592,
1659,
1710,
1736,
1737,
1771
],
"line_end_idx": [
53,
54,
108,
109,
159,
198,
261,
287,
392,
400,
420,
641,
642,
782,
783,
939,
940,
1019,
1040,
1041,
1413,
1414,
1470,
1471,
1510,
1511,
1512,
1522,
1523,
1544,
1545,
1592,
1659,
1710,
1736,
1737,
1771,
1832
]
}
|
{
"red_pajama_v2": {
"ccnet_original_length": 1832,
"ccnet_original_nlines": 37,
"rps_doc_curly_bracket": 0.0010917000472545624,
"rps_doc_ldnoobw_words": 0,
"rps_doc_lorem_ipsum": 0,
"rps_doc_stop_word_fraction": 0.281862735748291,
"rps_doc_ut1_blacklist": 0,
"rps_doc_frac_all_caps_words": 0.0416666716337204,
"rps_doc_frac_lines_end_with_ellipsis": 0,
"rps_doc_frac_no_alph_words": 0.3112744987010956,
"rps_doc_frac_unique_words": 0.6245210766792297,
"rps_doc_mean_word_length": 5.50191593170166,
"rps_doc_num_sentences": 20,
"rps_doc_symbol_to_word_ratio": 0,
"rps_doc_unigram_entropy": 4.858992576599121,
"rps_doc_word_count": 261,
"rps_doc_frac_chars_dupe_10grams": 0,
"rps_doc_frac_chars_dupe_5grams": 0.08983287215232849,
"rps_doc_frac_chars_dupe_6grams": 0.08983287215232849,
"rps_doc_frac_chars_dupe_7grams": 0.08983287215232849,
"rps_doc_frac_chars_dupe_8grams": 0.08983287215232849,
"rps_doc_frac_chars_dupe_9grams": 0.08983287215232849,
"rps_doc_frac_chars_top_2gram": 0.029247909784317017,
"rps_doc_frac_chars_top_3gram": 0.03969359025359154,
"rps_doc_frac_chars_top_4gram": 0.04805013909935951,
"rps_doc_books_importance": -184.1742706298828,
"rps_doc_books_importance_length_correction": -182.83409118652344,
"rps_doc_openwebtext_importance": -104.09577178955078,
"rps_doc_openwebtext_importance_length_correction": -104.09577178955078,
"rps_doc_wikipedia_importance": -70.53556823730469,
"rps_doc_wikipedia_importance_length_correction": -70.53189849853516
},
"fasttext": {
"dclm": 0.03689318895339966,
"english": 0.8830706477165222,
"fineweb_edu_approx": 1.025778889656067,
"eai_general_math": 0.33302414417266846,
"eai_open_web_math": 0.2385953664779663,
"eai_web_code": 0.35973429679870605
}
}
|
{
"free_decimal_correspondence": {
"primary": {
"code": "005.44",
"labels": {
"level_1": "General works, books and libraries, information sciences",
"level_2": "",
"level_3": "Computer programming"
}
},
"secondary": {
"code": "005.1",
"labels": {
"level_1": "General works, books and libraries, information sciences",
"level_2": "",
"level_3": "Computer programming"
}
}
},
"bloom_cognitive_process": {
"primary": {
"code": "2",
"label": "Understand"
},
"secondary": {
"code": "3",
"label": "Apply"
}
},
"bloom_knowledge_domain": {
"primary": {
"code": "3",
"label": "Procedural"
},
"secondary": {
"code": "2",
"label": "Conceptual"
}
},
"document_type_v1": {
"primary": {
"code": "5",
"label": "Social/Forum"
},
"secondary": {
"code": "4",
"label": "Code/Software"
}
},
"extraction_artifacts": {
"primary": {
"code": "3",
"label": "Irrelevant Content"
},
"secondary": {
"code": "-1",
"label": "Abstain"
}
},
"missing_content": {
"primary": {
"code": "0",
"label": "No missing content"
},
"secondary": {
"code": "-1",
"label": "Abstain"
}
},
"document_type_v2": {
"primary": {
"code": "18",
"label": "Q&A Forum"
},
"secondary": {
"code": "21",
"label": "Customer Support"
}
},
"reasoning_depth": {
"primary": {
"code": "2",
"label": "Basic Reasoning"
},
"secondary": {
"code": "3",
"label": "Intermediate Reasoning"
}
},
"technical_correctness": {
"primary": {
"code": "3",
"label": "Mostly Correct"
},
"secondary": {
"code": "4",
"label": "Highly Correct"
}
},
"education_level": {
"primary": {
"code": "3",
"label": "Undergraduate Level"
},
"secondary": {
"code": "4",
"label": "Graduate/Expert Level"
}
}
}
|
672f1e42c33a7f9846924a2431ea77df
|
3,240,945,698,452,782,600
|
简述浅拷贝与深拷贝
数据类型
JavaScript 中可以把数据类型简单的分为基本数据类型和引用数据类型。
1. 基本数据类型的特点:直接在栈中存储数据。
2. 引用数据类型的特点:在栈中存储该对象的引用,真实的数据存放在堆内存中。
浅拷贝与深拷贝
1. 浅拷贝:浅拷贝只会复制指向对象的指针,而不复制对象本身,新旧对象还是共享同一块内存,所以修改新的对象时,原对象也会发生修改。
2. 深拷贝:深拷贝会另外创造一个一模一样的对象,新对象跟原对象不共享内存,修改新的对象,原对象不会发生改变。
两种简单实现方式
1. 浅拷贝
// 当对象只有一层直接使用赋值运算符和浅拷贝是一样的效果
let objs = { a: 1, b: 2 };
let temp = objs;
temp.a = 3;
console.log(objs); // Object { a: 3, b: 2 }
console.log(temp); // Object { a: 3, b: 2 }
// 两个值都发生了变化
2. 深拷贝
// 当对象只有一层时,Object.assign 方法实现深拷贝
let objs = { a: 1, b: 2 };
let temp = Object.assign({}, objs);
temp.a = 3;
console.log(objs); // Object { a: 1, b: 2 }
console.log(temp); // Object { a: 3, b: 2 }
参考
彻底讲明白赋值与浅拷贝与深拷贝
信息安全学习-SQL注入
vue强制更新视图与数据
|
{
"url": "https://mewhz.com/posts/javascript-1",
"source_domain": "mewhz.com",
"snapshot_id": "CC-MAIN-2023-23",
"warc_metadata": {
"Content-Length": "62261",
"Content-Type": "application/http; msgtype=response",
"WARC-Block-Digest": "sha1:MYAKL4VJYCEGMVK2U6NTAN7NY6KQGD3T",
"WARC-Concurrent-To": "<urn:uuid:0849db0f-2fb2-441b-b9ce-9ba9e6082d35>",
"WARC-Date": "2023-06-02T15:49:55Z",
"WARC-IP-Address": "61.139.65.249",
"WARC-Identified-Payload-Type": "text/html",
"WARC-Payload-Digest": "sha1:SS7OTQ2KDEVIFW6PKULBNFH2N4GFMT4H",
"WARC-Record-ID": "<urn:uuid:816978ae-7079-4f2b-8684-7faa0654549b>",
"WARC-Target-URI": "https://mewhz.com/posts/javascript-1",
"WARC-Truncated": null,
"WARC-Type": "response",
"WARC-Warcinfo-ID": "<urn:uuid:5e188b34-c1a8-4990-b481-b7af01a3e6b0>"
},
"warc_info": "isPartOf: CC-MAIN-2023-23\r\npublisher: Common Crawl\r\ndescription: Wide crawl of the web for May/June 2023\r\noperator: Common Crawl Admin (info@commoncrawl.org)\r\nhostname: ip-10-67-67-63\r\nsoftware: Apache Nutch 1.19 (modified, https://github.com/commoncrawl/nutch/)\r\nrobots: checked via crawler-commons 1.4-SNAPSHOT (https://github.com/crawler-commons/crawler-commons)\r\nformat: WARC File Format 1.1\r\nconformsTo: https://iipc.github.io/warc-specifications/specifications/warc-format/warc-1.1/"
}
|
{
"line_start_idx": [
0,
10,
11,
16,
17,
56,
57,
83,
124,
125,
133,
134,
202,
260,
261,
270,
271,
280,
281,
315,
346,
367,
383,
431,
479,
496,
501,
510,
511,
549,
580,
620,
636,
684,
732,
737,
738,
741,
742,
758,
759,
772
],
"line_end_idx": [
10,
11,
16,
17,
56,
57,
83,
124,
125,
133,
134,
202,
260,
261,
270,
271,
280,
281,
315,
346,
367,
383,
431,
479,
496,
501,
510,
511,
549,
580,
620,
636,
684,
732,
737,
738,
741,
742,
758,
759,
772,
784
]
}
|
{
"red_pajama_v2": {
"ccnet_original_length": 784,
"ccnet_original_nlines": 41,
"rps_doc_curly_bracket": 0.01785713993012905,
"rps_doc_ldnoobw_words": 0,
"rps_doc_lorem_ipsum": 0,
"rps_doc_stop_word_fraction": 0.09574467688798904,
"rps_doc_ut1_blacklist": 0,
"rps_doc_frac_all_caps_words": 0.005319150164723396,
"rps_doc_frac_lines_end_with_ellipsis": 0,
"rps_doc_frac_no_alph_words": 0.7393617033958435,
"rps_doc_frac_unique_words": 0.45205479860305786,
"rps_doc_mean_word_length": 7.027397155761719,
"rps_doc_num_sentences": 15,
"rps_doc_symbol_to_word_ratio": 0,
"rps_doc_unigram_entropy": 3.163684129714966,
"rps_doc_word_count": 73,
"rps_doc_frac_chars_dupe_10grams": 0,
"rps_doc_frac_chars_dupe_5grams": 0.29434698820114136,
"rps_doc_frac_chars_dupe_6grams": 0.2923976480960846,
"rps_doc_frac_chars_dupe_7grams": 0.17153996229171753,
"rps_doc_frac_chars_dupe_8grams": 0.17153996229171753,
"rps_doc_frac_chars_dupe_9grams": 0,
"rps_doc_frac_chars_top_2gram": 0.023391809314489365,
"rps_doc_frac_chars_top_3gram": 0.017543859779834747,
"rps_doc_frac_chars_top_4gram": 0.023391809314489365,
"rps_doc_books_importance": -48.279666900634766,
"rps_doc_books_importance_length_correction": -48.279666900634766,
"rps_doc_openwebtext_importance": -32.13059997558594,
"rps_doc_openwebtext_importance_length_correction": -32.13056564331055,
"rps_doc_wikipedia_importance": -35.198081970214844,
"rps_doc_wikipedia_importance_length_correction": -35.198081970214844
},
"fasttext": {
"dclm": 0.9998880624771118,
"english": 0.00303093995898962,
"fineweb_edu_approx": 2.7063300609588623,
"eai_general_math": 0.9668834209442139,
"eai_open_web_math": 0.1716165542602539,
"eai_web_code": 0.008887889795005322
}
}
|
{
"free_decimal_correspondence": {
"primary": {
"code": "005.1332",
"labels": {
"level_1": "General works, books and libraries, information sciences",
"level_2": "",
"level_3": "Computer programming"
}
},
"secondary": {
"code": "005.133",
"labels": {
"level_1": "General works, books and libraries, information sciences",
"level_2": "",
"level_3": "Computer programming"
}
}
},
"bloom_cognitive_process": {
"primary": {
"code": "2",
"label": "Understand"
},
"secondary": {
"code": "3",
"label": "Apply"
}
},
"bloom_knowledge_domain": {
"primary": {
"code": "2",
"label": "Conceptual"
},
"secondary": {
"code": "3",
"label": "Procedural"
}
},
"document_type_v1": {
"primary": {
"code": "3",
"label": "Reference/Encyclopedic/Educational"
},
"secondary": {
"code": "4",
"label": "Code/Software"
}
},
"extraction_artifacts": {
"primary": {
"code": "0",
"label": "No Artifacts"
},
"secondary": {
"code": "3",
"label": "Irrelevant Content"
}
},
"missing_content": {
"primary": {
"code": "0",
"label": "No missing content"
},
"secondary": {
"code": "-1",
"label": "Abstain"
}
},
"document_type_v2": {
"primary": {
"code": "23",
"label": "Tutorial"
},
"secondary": {
"code": "8",
"label": "Documentation"
}
},
"reasoning_depth": {
"primary": {
"code": "2",
"label": "Basic Reasoning"
},
"secondary": {
"code": "3",
"label": "Intermediate Reasoning"
}
},
"technical_correctness": {
"primary": {
"code": "4",
"label": "Highly Correct"
},
"secondary": {
"code": "3",
"label": "Mostly Correct"
}
},
"education_level": {
"primary": {
"code": "2",
"label": "High School Level"
},
"secondary": {
"code": "3",
"label": "Undergraduate Level"
}
}
}
|
672f1e42c33a7f9846924a2431ea77df
|
-2,307,226,253,927,539,000
|
No script NodeJSexports.myDateTime = function(){ . . .
Exercício 1
No script NodeJS
exports.myDateTime = function(){
return Date();
};
o papel do termo exports é
A
definir o nome da biblioteca corrente como “exports”.
B
definir um método para a classe exports.
C
definir uma função externa que ficará localizada no módulo exports.
D
fazer referência a uma variável externa localizada no módulo exports.
E
permitir que a função myDataTime seja acessível para outros módulos.
Resolução
Parte 1 da resolução
No sistema de módulos do Node.js(versão v13.x), cada arquivo é tratado como um módulo.
Vamos supor que em um projeto qualquer tenha sido criado o arquivo datas.js que contenha o mesmo código javascript que está no enunciado do problema, e que também tenha sido criado o arquivo aniversarios.js. Se quisermos utilizar a função myDateTime em alguma lógica do módulo aniversarios.js, teríamos que realizar a importação do módulo para utilizar a função, como exemplificado abaixo:
• datas.js
• exports.myDateTime = function () {
return Date();
};
• aniversarios.js
• const dataCorrente = require('./datas.js');
console.log(dataCorrente.myDateTime);
O código do enunciado do exercício retorna um objeto com a data corrente, sendo que a palavra-chave exports serve para disponibilizar propriedades e funções fora do arquivo do módulo.
Este exemplo hipotético acima, serviu para demonstrar que o trecho de código Javascript exports.myDateTime serve para permitir que a função myDateTime seja acessível para outros módulos, o que nos leva a resposta correta Letra E.
Resolva também as questões relacionadas abaixo sobre Javascript.
Exercício 2
Observe a linha de código NodeJS exibida a seguir.
var http ...
Exercício 3
Considere o código Node.js apresentado a seguir:
var http = ...
Exercício 5
Considere a execução do código JavaScript abaixo, compatível com o ECMAScript 6, e a respectiva nume ...
exerciciosresolvidos.com.br
Acreditamos na educação gratuita e de qualidade. Nos ajude com sua opinião, sugestão ou crítica enviando um e-mail para: exerciciosresolvidosbr@gmail.com
Copyright © 2024. Built with ❤ Love
|
{
"url": "https://exerciciosresolvidos.com.br/exercicio/ex211/",
"source_domain": "exerciciosresolvidos.com.br",
"snapshot_id": "CC-MAIN-2024-38",
"warc_metadata": {
"Content-Length": "45133",
"Content-Type": "application/http; msgtype=response",
"WARC-Block-Digest": "sha1:4TNGO2VGLDDRKMYOZE2ERBTRCKWMUDE2",
"WARC-Concurrent-To": "<urn:uuid:7f5c9abe-1171-467c-9e7c-75a12d9d1958>",
"WARC-Date": "2024-09-09T09:00:47Z",
"WARC-IP-Address": "151.101.1.195",
"WARC-Identified-Payload-Type": "text/html",
"WARC-Payload-Digest": "sha1:BDUYCR4YSOLBPZAQM4OXXIOA236EJ4PI",
"WARC-Record-ID": "<urn:uuid:9812e06b-acb2-48eb-b969-80988f0ec136>",
"WARC-Target-URI": "https://exerciciosresolvidos.com.br/exercicio/ex211/",
"WARC-Truncated": null,
"WARC-Type": "response",
"WARC-Warcinfo-ID": "<urn:uuid:19135373-7516-4fcb-82cc-384e1ad88e63>"
},
"warc_info": "isPartOf: CC-MAIN-2024-38\r\npublisher: Common Crawl\r\ndescription: Wide crawl of the web for September 2024\r\noperator: Common Crawl Admin (info@commoncrawl.org)\r\nhostname: ip-10-67-67-228\r\nsoftware: Apache Nutch 1.20 (modified, https://github.com/commoncrawl/nutch/)\r\nrobots: checked via crawler-commons 1.5-SNAPSHOT (https://github.com/crawler-commons/crawler-commons)\r\nformat: WARC File Format 1.1\r\nconformsTo: https://iipc.github.io/warc-specifications/specifications/warc-format/warc-1.1/"
}
|
{
"line_start_idx": [
0,
57,
58,
70,
71,
72,
89,
90,
123,
141,
144,
145,
172,
173,
175,
229,
231,
272,
274,
342,
344,
414,
416,
485,
486,
496,
497,
498,
519,
520,
607,
608,
998,
999,
1012,
1053,
1077,
1086,
1106,
1156,
1200,
1201,
1385,
1386,
1616,
1617,
1682,
1683,
1695,
1696,
1747,
1748,
1761,
1762,
1774,
1775,
1824,
1825,
1840,
1841,
1853,
1854,
1959,
1960,
1961,
1989,
1990,
2144,
2145
],
"line_end_idx": [
57,
58,
70,
71,
72,
89,
90,
123,
141,
144,
145,
172,
173,
175,
229,
231,
272,
274,
342,
344,
414,
416,
485,
486,
496,
497,
498,
519,
520,
607,
608,
998,
999,
1012,
1053,
1077,
1086,
1106,
1156,
1200,
1201,
1385,
1386,
1616,
1617,
1682,
1683,
1695,
1696,
1747,
1748,
1761,
1762,
1774,
1775,
1824,
1825,
1840,
1841,
1853,
1854,
1959,
1960,
1961,
1989,
1990,
2144,
2145,
2180
]
}
|
{
"red_pajama_v2": {
"ccnet_original_length": 2180,
"ccnet_original_nlines": 68,
"rps_doc_curly_bracket": 0.0022935799788683653,
"rps_doc_ldnoobw_words": 0,
"rps_doc_lorem_ipsum": 0,
"rps_doc_stop_word_fraction": 0.1525000035762787,
"rps_doc_ut1_blacklist": 0,
"rps_doc_frac_all_caps_words": 0.017500000074505806,
"rps_doc_frac_lines_end_with_ellipsis": 0.043478261679410934,
"rps_doc_frac_no_alph_words": 0.2175000011920929,
"rps_doc_frac_unique_words": 0.5197368264198303,
"rps_doc_mean_word_length": 5.802631378173828,
"rps_doc_num_sentences": 37,
"rps_doc_symbol_to_word_ratio": 0.007499999832361937,
"rps_doc_unigram_entropy": 4.723446846008301,
"rps_doc_word_count": 304,
"rps_doc_frac_chars_dupe_10grams": 0,
"rps_doc_frac_chars_dupe_5grams": 0.08956915885210037,
"rps_doc_frac_chars_dupe_6grams": 0,
"rps_doc_frac_chars_dupe_7grams": 0,
"rps_doc_frac_chars_dupe_8grams": 0,
"rps_doc_frac_chars_dupe_9grams": 0,
"rps_doc_frac_chars_top_2gram": 0.020408159121870995,
"rps_doc_frac_chars_top_3gram": 0.03514739125967026,
"rps_doc_frac_chars_top_4gram": 0.0396825410425663,
"rps_doc_books_importance": -163.49981689453125,
"rps_doc_books_importance_length_correction": -163.49981689453125,
"rps_doc_openwebtext_importance": -89.85330963134766,
"rps_doc_openwebtext_importance_length_correction": -89.85330963134766,
"rps_doc_wikipedia_importance": -79.6026611328125,
"rps_doc_wikipedia_importance_length_correction": -79.6026611328125
},
"fasttext": {
"dclm": 0.6011818051338196,
"english": 0.006045539863407612,
"fineweb_edu_approx": 2.01210618019104,
"eai_general_math": 0.001325730001553893,
"eai_open_web_math": 0.28373265266418457,
"eai_web_code": 0.7503871917724609
}
}
|
{
"free_decimal_correspondence": {
"primary": {
"code": "005.133",
"labels": {
"level_1": "General works, books and libraries, information sciences",
"level_2": "",
"level_3": "Computer programming"
}
},
"secondary": {
"code": "005.1",
"labels": {
"level_1": "General works, books and libraries, information sciences",
"level_2": "",
"level_3": "Computer programming"
}
}
},
"bloom_cognitive_process": {
"primary": {
"code": "3",
"label": "Apply"
},
"secondary": {
"code": "2",
"label": "Understand"
}
},
"bloom_knowledge_domain": {
"primary": {
"code": "3",
"label": "Procedural"
},
"secondary": {
"code": "2",
"label": "Conceptual"
}
},
"document_type_v1": {
"primary": {
"code": "3",
"label": "Reference/Encyclopedic/Educational"
},
"secondary": {
"code": "4",
"label": "Code/Software"
}
},
"extraction_artifacts": {
"primary": {
"code": "0",
"label": "No Artifacts"
},
"secondary": {
"code": "3",
"label": "Irrelevant Content"
}
},
"missing_content": {
"primary": {
"code": "0",
"label": "No missing content"
},
"secondary": {
"code": "-1",
"label": "Abstain"
}
},
"document_type_v2": {
"primary": {
"code": "23",
"label": "Tutorial"
},
"secondary": {
"code": "8",
"label": "Documentation"
}
},
"reasoning_depth": {
"primary": {
"code": "2",
"label": "Basic Reasoning"
},
"secondary": {
"code": "3",
"label": "Intermediate Reasoning"
}
},
"technical_correctness": {
"primary": {
"code": "4",
"label": "Highly Correct"
},
"secondary": {
"code": "3",
"label": "Mostly Correct"
}
},
"education_level": {
"primary": {
"code": "2",
"label": "High School Level"
},
"secondary": {
"code": "3",
"label": "Undergraduate Level"
}
}
}
|
672f1e42c33a7f9846924a2431ea77df
|
1,796,227,380,907,688,000
|
game_object:BusStop
From Battlepedia
Jump to navigationJump to search
This asset defines a Bus Stop, which is used to switch the playable character between SpongeBob and either Patrick or Sandy.
It is very similar to a Taxi Stop, in that it creates a trigger at a Marker's position and uses a Camera and bus Simple Object to play a drive-by animation.
In the original game, levels that use Bus Stops only contain assets for either Patrick or Sandy, but not both. If, for example, you try to make a Bus Stop switch to Patrick in a level that only has Sandy's assets, nothing will happen. However, it is possible to use both Patrick and Sandy if you port the missing character's assets to the level, specifically the MODL, RWTX, ANIM, ATBL, and MINF assets.
Note that, similar to Taxi Stops, the busstop SIMP itself is completely separate from the Bus Stop game object and is not required for the Bus Stop to work.
Format
Offset Type Variable Description
0x10 AssetID (Marker) marker Position of the Bus Stop. Typically placed right next to a busstop SIMP.
0x14 int character Which character to switch to. Note that the character's assets must be present in the level for the switch to work.
• 0 = Patrick
• 1 = Sandy
0x18 AssetID (Camera) cameraID Camera to switch to for the bus drive-by animation.
0x1C AssetID (Simple Object) busID Simple Object to play the bus drive-by animation with.
0x20 float delay Time in seconds after the bus drive-by animation starts to switch the character. The animation is about 2 seconds long, so this is commonly set to 1 or 1.5 to ensure the switch is hidden behind the bus simp. The approximate range allowed is 0.09 to 1.96, any values outside of this range will cause the switch to not work.
Events
• Bus Switch Character
|
{
"url": "https://battlepedia.org/Game_object:BusStop",
"source_domain": "battlepedia.org",
"snapshot_id": "crawl=CC-MAIN-2019-51",
"warc_metadata": {
"Content-Length": "17382",
"Content-Type": "application/http; msgtype=response",
"WARC-Block-Digest": "sha1:TUEZZ47PUY4CUM5EXEEM72QCH2IERYKC",
"WARC-Concurrent-To": "<urn:uuid:319df20a-3452-4d30-bec6-5bcf57aaac86>",
"WARC-Date": "2019-12-14T07:16:12Z",
"WARC-IP-Address": "185.163.46.138",
"WARC-Identified-Payload-Type": "text/html",
"WARC-Payload-Digest": "sha1:3JNPGFB3JMH5KNV46HKI6JU2GCFRLKT7",
"WARC-Record-ID": "<urn:uuid:5f597417-91a8-42d3-ac0c-104e78f53820>",
"WARC-Target-URI": "https://battlepedia.org/Game_object:BusStop",
"WARC-Truncated": null,
"WARC-Type": "response",
"WARC-Warcinfo-ID": "<urn:uuid:aa97d60d-f5a8-44bc-bc44-ea29b37767fd>"
},
"warc_info": "isPartOf: CC-MAIN-2019-51\r\npublisher: Common Crawl\r\ndescription: Wide crawl of the web for December 2019\r\noperator: Common Crawl Admin (info@commoncrawl.org)\r\nhostname: ip-10-67-67-133.ec2.internal\r\nsoftware: Apache Nutch 1.16 (modified, https://github.com/commoncrawl/nutch/)\r\nrobots: checked via crawler-commons 1.1-SNAPSHOT (https://github.com/crawler-commons/crawler-commons)\r\nformat: WARC File Format 1.1\r\nconformsTo: http://iipc.github.io/warc-specifications/specifications/warc-format/warc-1.1/"
}
|
{
"line_start_idx": [
0,
20,
21,
38,
71,
72,
197,
198,
355,
356,
760,
761,
918,
919,
926,
927,
960,
1062,
1197,
1213,
1227,
1310,
1400,
1740,
1741,
1748,
1749
],
"line_end_idx": [
20,
21,
38,
71,
72,
197,
198,
355,
356,
760,
761,
918,
919,
926,
927,
960,
1062,
1197,
1213,
1227,
1310,
1400,
1740,
1741,
1748,
1749,
1773
]
}
|
{
"red_pajama_v2": {
"ccnet_original_length": 1773,
"ccnet_original_nlines": 26,
"rps_doc_curly_bracket": 0,
"rps_doc_ldnoobw_words": 0,
"rps_doc_lorem_ipsum": 0,
"rps_doc_stop_word_fraction": 0.37801608443260193,
"rps_doc_ut1_blacklist": 0,
"rps_doc_frac_all_caps_words": 0.01876676082611084,
"rps_doc_frac_lines_end_with_ellipsis": 0,
"rps_doc_frac_no_alph_words": 0.17426273226737976,
"rps_doc_frac_unique_words": 0.4530744254589081,
"rps_doc_mean_word_length": 4.514563083648682,
"rps_doc_num_sentences": 19,
"rps_doc_symbol_to_word_ratio": 0,
"rps_doc_unigram_entropy": 4.478321075439453,
"rps_doc_word_count": 309,
"rps_doc_frac_chars_dupe_10grams": 0,
"rps_doc_frac_chars_dupe_5grams": 0,
"rps_doc_frac_chars_dupe_6grams": 0,
"rps_doc_frac_chars_dupe_7grams": 0,
"rps_doc_frac_chars_dupe_8grams": 0,
"rps_doc_frac_chars_dupe_9grams": 0,
"rps_doc_frac_chars_top_2gram": 0.03010752983391285,
"rps_doc_frac_chars_top_3gram": 0.021505380049347878,
"rps_doc_frac_chars_top_4gram": 0.04731183126568794,
"rps_doc_books_importance": -130.69793701171875,
"rps_doc_books_importance_length_correction": -123.51598358154297,
"rps_doc_openwebtext_importance": -79.28945922851562,
"rps_doc_openwebtext_importance_length_correction": -79.28945922851562,
"rps_doc_wikipedia_importance": -12.25143051147461,
"rps_doc_wikipedia_importance_length_correction": -9.91236686706543
},
"fasttext": {
"dclm": 0.15775251388549805,
"english": 0.8942186832427979,
"fineweb_edu_approx": 2.0847394466400146,
"eai_general_math": 0.5579685568809509,
"eai_open_web_math": 0.34729260206222534,
"eai_web_code": 0.2940266728401184
}
}
|
{
"free_decimal_correspondence": {
"primary": {
"code": "004.0151",
"labels": {
"level_1": "General works, books and libraries, information sciences",
"level_2": "",
"level_3": "Computers and Computer science"
}
},
"secondary": {
"code": "794.816",
"labels": {
"level_1": "Arts",
"level_2": "Amusements and Recreation",
"level_3": ""
}
}
},
"bloom_cognitive_process": {
"primary": {
"code": "2",
"label": "Understand"
},
"secondary": {
"code": "3",
"label": "Apply"
}
},
"bloom_knowledge_domain": {
"primary": {
"code": "2",
"label": "Conceptual"
},
"secondary": {
"code": "3",
"label": "Procedural"
}
},
"document_type_v1": {
"primary": {
"code": "3",
"label": "Reference/Encyclopedic/Educational"
},
"secondary": {
"code": "-1",
"label": "Abstain"
}
},
"extraction_artifacts": {
"primary": {
"code": "0",
"label": "No Artifacts"
},
"secondary": {
"code": "3",
"label": "Irrelevant Content"
}
},
"missing_content": {
"primary": {
"code": "0",
"label": "No missing content"
},
"secondary": {
"code": "4",
"label": "Missing Images or Figures"
}
},
"document_type_v2": {
"primary": {
"code": "8",
"label": "Documentation"
},
"secondary": {
"code": "10",
"label": "Knowledge Article"
}
},
"reasoning_depth": {
"primary": {
"code": "2",
"label": "Basic Reasoning"
},
"secondary": {
"code": "3",
"label": "Intermediate Reasoning"
}
},
"technical_correctness": {
"primary": {
"code": "4",
"label": "Highly Correct"
},
"secondary": {
"code": "3",
"label": "Mostly Correct"
}
},
"education_level": {
"primary": {
"code": "3",
"label": "Undergraduate Level"
},
"secondary": {
"code": "4",
"label": "Graduate/Expert Level"
}
}
}
|
672f1e42c33a7f9846924a2431ea77df
|
-2,332,188,996,790,838,300
|
Posts Tagged ‘ squid
Setup a cache proxy with Squid
Today I’m going to explain how to setup a cache proxy within your local network. A cache proxy is a system that stores frequently accessed web objects for a fast retrieval, it works well with static contents such as html pages, css scripts, javascripts, images and even downloaded files if correctly configured.
This approach has some advantages:
• on a congested network you can still open webpages faster because some contents doesn’t need to be retrieved from the internet but from a local cache (within your local network);
• you can install a parental control and/or an antivirus to check what pages can be opened from the computers within the network (and properly configured to use the proxy).
Obviously there are some disadvantages, such as the fact that you can’t be sure that the cached objects are fresh (not changed) so you can encounter strange problems with websites; you can also encounter some problems with audio/video contents. Some of these problems can be avoided with properly configurations.
Let’s start with the installation and configuration of Squid on a home-server based on ArchLinux: the procedure is almost the same with other distributions.
First download the package using your package manager (pacman if you’re using ArchLinux):
Then you need to configure squid, to do so open /etc/squid.conf and read carefully the comments. There are a lot of options but you really need to check and change only a few of them:
• http_port: the port where squid will listen for request, usually 3128 but you can change it without problems;
• http_access: these lines defines the access permissions to the proxy, usually you want to allow access for localhost and localnet and then deny the access for everything else. To do so (it should be already into the default configuration file):
• cache_mgr: the email address for the cache_manager;
• shutdown_lifetime: defines the time to wait until the service is stopped when required;
• cache_mem: the memory (RAM) used as a buffer for requests: at least 256/512MB to have decent performance;
• visible_hostname: the hostname of your server;
• fqdncache_size: the size of the resolved domain cache, use at least 1024;
• maximum_object_size: the maximum size of objects in the cache, set this at least to 10MB otherwise you’ll only cache small files (no large images for example);
• cache_dir: the location of the cache, this parameter is quite complex. It’s defined as:
cache_dir ufs /var/cache/squid 20000 16 256: first the file system (ufs), then the location of the cache(/var/cache/squid), then the maximum size (20000MB or ~20Gb), then the number of folder at the first level (16) and finally the number of folder at the second level (256). To be honest you just have to change the maximum size to a serious amount such as 20-100GB. More cache means more files that doesn’t need to be retrieved from the internet.
After these initial configuration, where only two directly affect efficacy (cache_mem and cache_dir) there are some really important configuration that Squid uses to understand what and how the elements have to be cached.
The directives uses a pattern that matches the objects by extension and/or name, then a minimum and maximum lifetime and a % is used to statistically determine when an item is stale and needs to be discarded, for example:
• 10080 90% 43200: this means that the item is considered fresh if his time is between now and 10080 (3 hours) seconds ago, stale (discarded) if his time is older than 43200 (12 hours) second, if the time is between 10800 seconds and 43200 seconds the item is fresh with a 90% probably (high);
• 1440 20% 10080: same as above, if time is less than 1440 the item is fresh, if the time is higher than 10800 the item is stale and finally if the time is between 1440 and 10080 the item is fresh with a 20% probability (low).
High % means that an object is unlikely to change, low % should be used for items that probably will ofter change. This is not an exact science, if an element changes (such as a new css of a newer version of a javasript) you still may load is your browser the older version, then never use a too long time (a day, not more). Be sure to read the official documentation for a more in-depth explanation: http://www.squid-cache.org/Doc/config/refresh_pattern/
My configuration is:
Let’s examine it line by line:
• ftp are fresh under 1440 seconds and stale after 10080 but they are likely to change (20%)
• gopher are fresh under 1440 and then stale
• cgi-bin (scripts such as php) are never cached because you know, they change every time…
• images are fresh under 10080 and stale after 43200 and they are unlikely to change (90%)
• videos are fresh under 43200 and stale after 432000 (5 days) and they are unlikely to change (90%)
• archives are fresh under 10080 and stale after 43200 and they are unlikely to change (90%)
• index pages of some sites are fresh until 10080 seconds
• other html pages, css and javascript scripts are fresh under 1440 second and they stale after 40320
• all other things are never fresh and they stale after 40320
For strange cases, such as windows update archives, you can find on the internet the line/s that you need to add. Keep in mind that the first line that matches is used so you need to order the rules in reverse order.
Finally enable and start the daemon. On ArchLinux, that uses systemd, this can be accomplished with these two commands:
A few final considerations:
• install on your server a tool like webmin, this way you can check squid’s statistics to see the cache hit %;
• remember that browser cache may alter the statistics since the object is retrieved locally and not on the squid cache, for testing purposes disable the browser cache and then set it to a lower amount (ssd disks will benefit and you save space);
• more computers uses the caches, more the cache is fresh and more you can expect a higher cache-hit %;
• to avoid over-kill Squid should be used on networks that have at least 2-3 computer, otherwise you’ll benefit only because you can have a huge cache (gigabytes not megabytes);
• cache-hit should be at least 15-20% but don’t expect values such as 80-90% because https is never cached (and it’s better this way since to enable https you have to do things that it’s better to not do) and because not all the objects can be cached (such as php pages).
Next time I’ll show you how to configure and install an antivirus layer using clamav. As always if you have any questions feel free to contact me using the comments below :)
return top
|
{
"url": "http://www.croma25td.com/index.php/tag/squid/",
"source_domain": "www.croma25td.com",
"snapshot_id": "crawl=CC-MAIN-2017-13",
"warc_metadata": {
"Content-Length": "48652",
"Content-Type": "application/http; msgtype=response",
"WARC-Block-Digest": "sha1:PAWN7CQ2IOLMIHBG7S33G4PJ62HZMGYD",
"WARC-Concurrent-To": "<urn:uuid:a2f2ca06-7ccb-45a9-a225-beb1e410a3e3>",
"WARC-Date": "2017-03-30T06:33:44Z",
"WARC-IP-Address": "104.28.13.6",
"WARC-Identified-Payload-Type": null,
"WARC-Payload-Digest": "sha1:BNAOQXKP5MOGOKSFIB2IXMRR567ENFOO",
"WARC-Record-ID": "<urn:uuid:d85c9130-f28e-4c73-8dde-959bd1b22b56>",
"WARC-Target-URI": "http://www.croma25td.com/index.php/tag/squid/",
"WARC-Truncated": "length",
"WARC-Type": "response",
"WARC-Warcinfo-ID": "<urn:uuid:86645159-f086-42e2-b8a9-d1f1debb0d54>"
},
"warc_info": "robots: classic\r\nhostname: ip-10-233-31-227.ec2.internal\r\nsoftware: Nutch 1.6 (CC)/CC WarcExport 1.0\r\nisPartOf: CC-MAIN-2017-13\r\noperator: CommonCrawl Admin\r\ndescription: Wide crawl of the web for March 2017\r\npublisher: CommonCrawl\r\nformat: WARC File Format 1.0\r\nconformsTo: http://bibnum.bnf.fr/WARC/WARC_ISO_28500_version1_latestdraft.pdf"
}
|
{
"line_start_idx": [
0,
21,
22,
53,
54,
366,
367,
402,
403,
586,
761,
762,
1075,
1076,
1233,
1234,
1324,
1325,
1509,
1510,
1624,
1873,
1929,
2021,
2131,
2183,
2261,
2425,
2517,
2970,
2971,
3193,
3194,
3417,
3418,
3714,
3943,
3944,
4400,
4401,
4422,
4423,
4454,
4455,
4550,
4597,
4690,
4783,
4887,
4982,
5042,
5146,
5210,
5211,
5428,
5429,
5549,
5550,
5578,
5579,
5692,
5941,
6047,
6227,
6501,
6502,
6676,
6677
],
"line_end_idx": [
21,
22,
53,
54,
366,
367,
402,
403,
586,
761,
762,
1075,
1076,
1233,
1234,
1324,
1325,
1509,
1510,
1624,
1873,
1929,
2021,
2131,
2183,
2261,
2425,
2517,
2970,
2971,
3193,
3194,
3417,
3418,
3714,
3943,
3944,
4400,
4401,
4422,
4423,
4454,
4455,
4550,
4597,
4690,
4783,
4887,
4982,
5042,
5146,
5210,
5211,
5428,
5429,
5549,
5550,
5578,
5579,
5692,
5941,
6047,
6227,
6501,
6502,
6676,
6677,
6687
]
}
|
{
"red_pajama_v2": {
"ccnet_original_length": 6687,
"ccnet_original_nlines": 67,
"rps_doc_curly_bracket": 0,
"rps_doc_ldnoobw_words": 0,
"rps_doc_lorem_ipsum": 0,
"rps_doc_stop_word_fraction": 0.45068395137786865,
"rps_doc_ut1_blacklist": 0,
"rps_doc_frac_all_caps_words": 0.006479479838162661,
"rps_doc_frac_lines_end_with_ellipsis": 0.014705879613757133,
"rps_doc_frac_no_alph_words": 0.19942404329776764,
"rps_doc_frac_unique_words": 0.3513513505458832,
"rps_doc_mean_word_length": 4.559720993041992,
"rps_doc_num_sentences": 25,
"rps_doc_symbol_to_word_ratio": 0.0007199399988166988,
"rps_doc_unigram_entropy": 5.319484710693359,
"rps_doc_word_count": 1147,
"rps_doc_frac_chars_dupe_10grams": 0.024856600910425186,
"rps_doc_frac_chars_dupe_5grams": 0.07629062980413437,
"rps_doc_frac_chars_dupe_6grams": 0.060994260013103485,
"rps_doc_frac_chars_dupe_7grams": 0.045315489172935486,
"rps_doc_frac_chars_dupe_8grams": 0.045315489172935486,
"rps_doc_frac_chars_dupe_9grams": 0.024856600910425186,
"rps_doc_frac_chars_top_2gram": 0.010325049981474876,
"rps_doc_frac_chars_top_3gram": 0.014913960359990597,
"rps_doc_frac_chars_top_4gram": 0.006309750024229288,
"rps_doc_books_importance": -709.9434204101562,
"rps_doc_books_importance_length_correction": -709.9434204101562,
"rps_doc_openwebtext_importance": -458.8771667480469,
"rps_doc_openwebtext_importance_length_correction": -458.8771667480469,
"rps_doc_wikipedia_importance": -356.1468505859375,
"rps_doc_wikipedia_importance_length_correction": -356.1468505859375
},
"fasttext": {
"dclm": 0.01923317089676857,
"english": 0.8961537480354309,
"fineweb_edu_approx": 1.882380723953247,
"eai_general_math": 0.7073574066162109,
"eai_open_web_math": 0.4321424961090088,
"eai_web_code": 0.4498753547668457
}
}
|
{
"free_decimal_correspondence": {
"primary": {
"code": "004.67",
"labels": {
"level_1": "General works, books and libraries, information sciences",
"level_2": "",
"level_3": "Computers and Computer science"
}
},
"secondary": {
"code": "005.72",
"labels": {
"level_1": "General works, books and libraries, information sciences",
"level_2": "",
"level_3": "Computer programming"
}
}
},
"bloom_cognitive_process": {
"primary": {
"code": "3",
"label": "Apply"
},
"secondary": {
"code": "2",
"label": "Understand"
}
},
"bloom_knowledge_domain": {
"primary": {
"code": "3",
"label": "Procedural"
},
"secondary": {
"code": "2",
"label": "Conceptual"
}
},
"document_type_v1": {
"primary": {
"code": "3",
"label": "Reference/Encyclopedic/Educational"
},
"secondary": {
"code": "-1",
"label": "Abstain"
}
},
"extraction_artifacts": {
"primary": {
"code": "0",
"label": "No Artifacts"
},
"secondary": {
"code": "3",
"label": "Irrelevant Content"
}
},
"missing_content": {
"primary": {
"code": "0",
"label": "No missing content"
},
"secondary": {
"code": "-1",
"label": "Abstain"
}
},
"document_type_v2": {
"primary": {
"code": "23",
"label": "Tutorial"
},
"secondary": {
"code": "8",
"label": "Documentation"
}
},
"reasoning_depth": {
"primary": {
"code": "3",
"label": "Intermediate Reasoning"
},
"secondary": {
"code": "2",
"label": "Basic Reasoning"
}
},
"technical_correctness": {
"primary": {
"code": "4",
"label": "Highly Correct"
},
"secondary": {
"code": "3",
"label": "Mostly Correct"
}
},
"education_level": {
"primary": {
"code": "3",
"label": "Undergraduate Level"
},
"secondary": {
"code": "2",
"label": "High School Level"
}
}
}
|
672f1e42c33a7f9846924a2431ea77df
|
3,396,297,342,425,005,600
|
Importing RDS Server
Let’s say you have added a bunch of servers in RDS and use it quite regularly. Now you want to perform the start-stop or fondly called [;)] “Server Management” operation on these servers.
“Import RDS” lets you do this.
How do you do it?
When you add a server, if you have some servers in RDS but not in Servers view, you will be prompted with this window:
Selecting the second option imports your RDS Server as a CFServer in the Server Manager.
|
{
"url": "http://blogs.adobe.com/cfbuilder/2009/08/importing_rds_server.html",
"source_domain": "blogs.adobe.com",
"snapshot_id": "crawl=CC-MAIN-2017-17",
"warc_metadata": {
"Content-Length": "10082",
"Content-Type": "application/http; msgtype=response",
"WARC-Block-Digest": "sha1:CYJN43O3GDG4AYZO3KEQMJ5ZGV2AERH6",
"WARC-Concurrent-To": "<urn:uuid:82a86b66-3a79-4d52-b049-512a283f086d>",
"WARC-Date": "2017-04-30T05:38:23Z",
"WARC-IP-Address": "67.222.101.124",
"WARC-Identified-Payload-Type": null,
"WARC-Payload-Digest": "sha1:ZS3PM33OUAGYZBRADVFXHRFUCAIW4ZMY",
"WARC-Record-ID": "<urn:uuid:6f6ec3f9-6103-463d-931c-a2af4ff977c9>",
"WARC-Target-URI": "http://blogs.adobe.com/cfbuilder/2009/08/importing_rds_server.html",
"WARC-Truncated": "length",
"WARC-Type": "response",
"WARC-Warcinfo-ID": "<urn:uuid:11ee3d55-cc33-4087-bde9-f6c5d3c35e78>"
},
"warc_info": "robots: classic\r\nhostname: ip-10-145-167-34.ec2.internal\r\nsoftware: Nutch 1.6 (CC)/CC WarcExport 1.0\r\nisPartOf: CC-MAIN-2017-17\r\noperator: CommonCrawl Admin\r\ndescription: Wide crawl of the web for April 2017\r\npublisher: CommonCrawl\r\nformat: WARC File Format 1.0\r\nconformsTo: http://bibnum.bnf.fr/WARC/WARC_ISO_28500_version1_latestdraft.pdf"
}
|
{
"line_start_idx": [
0,
21,
22,
210,
241,
259,
378,
379,
380
],
"line_end_idx": [
21,
22,
210,
241,
259,
378,
379,
380,
468
]
}
|
{
"red_pajama_v2": {
"ccnet_original_length": 468,
"ccnet_original_nlines": 8,
"rps_doc_curly_bracket": 0,
"rps_doc_ldnoobw_words": 0,
"rps_doc_lorem_ipsum": 0,
"rps_doc_stop_word_fraction": 0.46078431606292725,
"rps_doc_ut1_blacklist": 0,
"rps_doc_frac_all_caps_words": 0.04901960864663124,
"rps_doc_frac_lines_end_with_ellipsis": 0,
"rps_doc_frac_no_alph_words": 0.14705881476402283,
"rps_doc_frac_unique_words": 0.6823529601097107,
"rps_doc_mean_word_length": 4.3176469802856445,
"rps_doc_num_sentences": 5,
"rps_doc_symbol_to_word_ratio": 0,
"rps_doc_unigram_entropy": 3.85619854927063,
"rps_doc_word_count": 85,
"rps_doc_frac_chars_dupe_10grams": 0,
"rps_doc_frac_chars_dupe_5grams": 0,
"rps_doc_frac_chars_dupe_6grams": 0,
"rps_doc_frac_chars_dupe_7grams": 0,
"rps_doc_frac_chars_dupe_8grams": 0,
"rps_doc_frac_chars_dupe_9grams": 0,
"rps_doc_frac_chars_top_2gram": 0.04904631897807121,
"rps_doc_frac_chars_top_3gram": 0.06539510190486908,
"rps_doc_frac_chars_top_4gram": 0,
"rps_doc_books_importance": -42.84864807128906,
"rps_doc_books_importance_length_correction": -46.68080139160156,
"rps_doc_openwebtext_importance": -30.74554443359375,
"rps_doc_openwebtext_importance_length_correction": -34.57769775390625,
"rps_doc_wikipedia_importance": -10.4165678024292,
"rps_doc_wikipedia_importance_length_correction": -14.248719215393066
},
"fasttext": {
"dclm": 0.15451139211654663,
"english": 0.939468264579773,
"fineweb_edu_approx": 1.9088068008422852,
"eai_general_math": 0.9876190423965454,
"eai_open_web_math": 0.6805888414382935,
"eai_web_code": 0.0810578465461731
}
}
|
{
"free_decimal_correspondence": {
"primary": {
"code": "005.4",
"labels": {
"level_1": "General works, books and libraries, information sciences",
"level_2": "",
"level_3": "Computer programming"
}
},
"secondary": {
"code": "004.67",
"labels": {
"level_1": "General works, books and libraries, information sciences",
"level_2": "",
"level_3": "Computers and Computer science"
}
}
},
"bloom_cognitive_process": {
"primary": {
"code": "3",
"label": "Apply"
},
"secondary": {
"code": "2",
"label": "Understand"
}
},
"bloom_knowledge_domain": {
"primary": {
"code": "3",
"label": "Procedural"
},
"secondary": {
"code": "2",
"label": "Conceptual"
}
},
"document_type_v1": {
"primary": {
"code": "3",
"label": "Reference/Encyclopedic/Educational"
},
"secondary": {
"code": "4",
"label": "Code/Software"
}
},
"extraction_artifacts": {
"primary": {
"code": "0",
"label": "No Artifacts"
},
"secondary": {
"code": "3",
"label": "Irrelevant Content"
}
},
"missing_content": {
"primary": {
"code": "0",
"label": "No missing content"
},
"secondary": {
"code": "4",
"label": "Missing Images or Figures"
}
},
"document_type_v2": {
"primary": {
"code": "23",
"label": "Tutorial"
},
"secondary": {
"code": "8",
"label": "Documentation"
}
},
"reasoning_depth": {
"primary": {
"code": "2",
"label": "Basic Reasoning"
},
"secondary": {
"code": "1",
"label": "No Reasoning"
}
},
"technical_correctness": {
"primary": {
"code": "4",
"label": "Highly Correct"
},
"secondary": {
"code": "3",
"label": "Mostly Correct"
}
},
"education_level": {
"primary": {
"code": "3",
"label": "Undergraduate Level"
},
"secondary": {
"code": "2",
"label": "High School Level"
}
}
}
|
672f1e42c33a7f9846924a2431ea77df
|
2,196,297,932,936,681,000
|
机器学习使计算机从研究数据和统计数据中学习机器学习是向人工智能(AI)方向迈进的一步。机器学习是一个分析数据并学习预测结果的程序。本文主要介绍Python 机器学习 多项式回归(Polynomial Regression)。
1、多项式回归(Polynomial Regression)
如果数据点显然不适合线性回归(所有数据点之间的直线),则可能是多项式回归的理想选择。
像线性回归一样,多项式回归使用变量x和y之间的关系来找到绘制数据点线的最佳方法。
httpswwwcjavapycom
2、多项式回归是如何工作的?
Python提供了一些方法来查找数据点之间的关系并绘制多项式回归线。我们将向您展示如何使用这些方法而不是通过数学公式。
在下面的示例中,我们注册了18辆经过特定收费站的汽车。
我们已经记录了汽车的速度,以及一天中经过的时间(小时)。
x轴表示一天中的小时,y轴表示速度:
例如:
首先绘制散点图:
import matplotlib.pyplot as plt
x = [1,2,3,5,6,7,8,9,10,12,13,14,15,16,18,19,21,22]
y = [100,90,80,60,60,55,60,65,70,70,75,76,78,79,90,99,99,100]
plt.scatter(x, y)
plt.show()
Result:
httpswwwcjavapycom
例如:
导入numpymatplotlib,然后画出多项式回归线:
import numpy
import matplotlib.pyplot as plt
x = [1,2,3,5,6,7,8,9,10,12,13,14,15,16,18,19,21,22]
y = [100,90,80,60,60,55,60,65,70,70,75,76,78,79,90,99,99,100]
mymodel = numpy.poly1d(numpy.polyfit(x, y, 3))
myline = numpy.linspace(1, 22, 100)
plt.scatter(x, y)
plt.plot(myline, mymodel(myline))
plt.show()
Result:
httpswwwcjavapycom
示例说明
导入所需的模块。
您可以在我们的NumPy教程中了解有关NumPy模块的信息。
您可以在我们的SciPy教程中了解SciPy模块。
import numpy
import matplotlib.pyplot as plt
创建表示x和y轴值的数组:
x = [1,2,3,5,6,7,8,9,10,12,13,14,15,16,18,19,21,22]
y = [100,90,80,60,60,55,60,65,70,70,75,76,78,79,90,99,99,100]
NumPy有一种方法可以让我们建立多项式模型:
mymodel = numpy.poly1d(numpy.polyfit(x, y, 3))
然后指定行的显示方式,我们从位置1开始,到位置22结束:
myline = numpy.linspace(1, 22, 100)
绘制原始散点图:
plt.scatter(x, y)
画出多项式回归线:
plt.plot(myline, mymodel(myline))
显示图:
plt.show()
3、R-平方
重要的是要知道x轴和y轴的值之间的关系有多好,如果没有关系,则多项式回归不能用于预测任何东西。
该关系用一个称为r平方的值测量。
r平方值的范围是0到1,其中0表示不相关,而1表示100%相关。
Python和Sklearn模块将计算该值,所要做的就是将x和y数组提供给它:
例如:
我的数据在多项式回归中的拟合度如何?
import numpy
from sklearn.metrics import r2_score
x = [1,2,3,5,6,7,8,9,10,12,13,14,15,16,18,19,21,22]
y = [100,90,80,60,60,55,60,65,70,70,75,76,78,79,90,99,99,100]
mymodel = numpy.poly1d(numpy.polyfit(x, y, 3))
print(r2_score(y, mymodel(x)))
注意:结果0.94表明存在很好的关系,我们可以在将来的预测中使用多项式回归。
4、预测未来值
现在我们可以使用收集到的信息来预测未来价值。
示例:让我们尝试预测在晚上17点左右通过收费站的汽车的速度:
为此,我们需要与上例相同的mymodel数组:
mymodel = numpy.poly1d(numpy.polyfit(x, y, 3))
例如:
预测下午17点过车的速度:
import numpy
from sklearn.metrics import r2_score
x = [1,2,3,5,6,7,8,9,10,12,13,14,15,16,18,19,21,22]
y = [100,90,80,60,60,55,60,65,70,70,75,76,78,79,90,99,99,100]
mymodel = numpy.poly1d(numpy.polyfit(x, y, 3))
speed = mymodel(17)
print(speed)
该示例预测速度为88.87,我们也可以从图中读取:
httpswwwcjavapycom
5、判断是否适合使用
让我们创建一个示例,其中多项式回归不是预测未来值的最佳方法。
例如:
x轴和y轴的这些值将导致多项式回归非常不适合:
import numpy
import matplotlib.pyplot as plt
x = [89,43,36,36,95,10,66,34,38,20,26,29,48,64,6,5,36,66,72,40]
y = [21,46,3,35,67,95,53,72,58,10,26,34,90,33,38,20,56,2,47,15]
mymodel = numpy.poly1d(numpy.polyfit(x, y, 3))
myline = numpy.linspace(2, 95, 100)
plt.scatter(x, y)
plt.plot(myline, mymodel(myline))
plt.show()
Result:
httpswwwcjavapycom
例如:
应该得到一个非常低的r平方值。
import numpy
from sklearn.metrics import r2_score
x = [89,43,36,36,95,10,66,34,38,20,26,29,48,64,6,5,36,66,72,40]
y = [21,46,3,35,67,95,53,72,58,10,26,34,90,33,38,20,56,2,47,15]
mymodel = numpy.poly1d(numpy.polyfit(x, y, 3))
print(r2_score(y, mymodel(x)))
结果:0.00995表示关系很差,并告诉我们该数据集不适合多项式回归。
推荐文档
|
{
"url": "https://www.cjavapy.com/article/1149/",
"source_domain": "www.cjavapy.com",
"snapshot_id": "CC-MAIN-2023-14",
"warc_metadata": {
"Content-Length": "39571",
"Content-Type": "application/http; msgtype=response",
"WARC-Block-Digest": "sha1:4RCLUCOZQXKKNLBMUY5GW3MID6OMUZ3E",
"WARC-Concurrent-To": "<urn:uuid:dfb904d7-a976-4c75-8585-940d96831135>",
"WARC-Date": "2023-03-26T15:57:13Z",
"WARC-IP-Address": "47.251.38.5",
"WARC-Identified-Payload-Type": "text/html",
"WARC-Payload-Digest": "sha1:OZDQYONC6CPSOERA7VEVXVLP7HENWG44",
"WARC-Record-ID": "<urn:uuid:57e14a5e-c8db-4777-9a1c-10fa7f8b6738>",
"WARC-Target-URI": "https://www.cjavapy.com/article/1149/",
"WARC-Truncated": null,
"WARC-Type": "response",
"WARC-Warcinfo-ID": "<urn:uuid:3b4c3bca-962f-4861-a217-0847dd10590d>"
},
"warc_info": "isPartOf: CC-MAIN-2023-14\r\npublisher: Common Crawl\r\ndescription: Wide crawl of the web for March/April 2023\r\noperator: Common Crawl Admin (info@commoncrawl.org)\r\nhostname: ip-10-67-67-179\r\nsoftware: Apache Nutch 1.19 (modified, https://github.com/commoncrawl/nutch/)\r\nrobots: checked via crawler-commons 1.4-SNAPSHOT (https://github.com/crawler-commons/crawler-commons)\r\nformat: WARC File Format 1.1\r\nconformsTo: https://iipc.github.io/warc-specifications/specifications/warc-format/warc-1.1/"
}
|
{
"line_start_idx": [
0,
113,
114,
145,
146,
189,
190,
231,
232,
251,
252,
267,
268,
328,
329,
357,
358,
387,
388,
407,
408,
412,
413,
422,
423,
455,
456,
508,
570,
571,
589,
600,
601,
610,
611,
630,
631,
636,
637,
667,
668,
681,
713,
714,
766,
828,
829,
876,
877,
913,
914,
932,
966,
977,
978,
986,
987,
1006,
1007,
1012,
1013,
1022,
1023,
1054,
1055,
1081,
1082,
1095,
1127,
1128,
1142,
1143,
1195,
1257,
1258,
1282,
1283,
1332,
1333,
1362,
1363,
1399,
1400,
1409,
1410,
1428,
1429,
1439,
1440,
1474,
1475,
1480,
1481,
1492,
1493,
1500,
1501,
1549,
1550,
1567,
1568,
1601,
1602,
1642,
1643,
1647,
1648,
1667,
1668,
1681,
1718,
1719,
1771,
1833,
1834,
1881,
1882,
1913,
1914,
1953,
1954,
1962,
1963,
1986,
1987,
2018,
2019,
2043,
2044,
2091,
2092,
2096,
2097,
2111,
2112,
2125,
2162,
2163,
2215,
2277,
2278,
2325,
2326,
2346,
2359,
2360,
2386,
2387,
2406,
2407,
2418,
2419,
2450,
2451,
2455,
2456,
2480,
2481,
2494,
2526,
2527,
2591,
2655,
2656,
2703,
2704,
2740,
2741,
2759,
2793,
2804,
2805,
2814,
2815,
2834,
2835,
2839,
2840,
2856,
2857,
2870,
2907,
2908,
2972,
3036,
3037,
3084,
3085,
3116,
3117,
3153,
3154
],
"line_end_idx": [
113,
114,
145,
146,
189,
190,
231,
232,
251,
252,
267,
268,
328,
329,
357,
358,
387,
388,
407,
408,
412,
413,
422,
423,
455,
456,
508,
570,
571,
589,
600,
601,
610,
611,
630,
631,
636,
637,
667,
668,
681,
713,
714,
766,
828,
829,
876,
877,
913,
914,
932,
966,
977,
978,
986,
987,
1006,
1007,
1012,
1013,
1022,
1023,
1054,
1055,
1081,
1082,
1095,
1127,
1128,
1142,
1143,
1195,
1257,
1258,
1282,
1283,
1332,
1333,
1362,
1363,
1399,
1400,
1409,
1410,
1428,
1429,
1439,
1440,
1474,
1475,
1480,
1481,
1492,
1493,
1500,
1501,
1549,
1550,
1567,
1568,
1601,
1602,
1642,
1643,
1647,
1648,
1667,
1668,
1681,
1718,
1719,
1771,
1833,
1834,
1881,
1882,
1913,
1914,
1953,
1954,
1962,
1963,
1986,
1987,
2018,
2019,
2043,
2044,
2091,
2092,
2096,
2097,
2111,
2112,
2125,
2162,
2163,
2215,
2277,
2278,
2325,
2326,
2346,
2359,
2360,
2386,
2387,
2406,
2407,
2418,
2419,
2450,
2451,
2455,
2456,
2480,
2481,
2494,
2526,
2527,
2591,
2655,
2656,
2703,
2704,
2740,
2741,
2759,
2793,
2804,
2805,
2814,
2815,
2834,
2835,
2839,
2840,
2856,
2857,
2870,
2907,
2908,
2972,
3036,
3037,
3084,
3085,
3116,
3117,
3153,
3154,
3158
]
}
|
{
"red_pajama_v2": {
"ccnet_original_length": 3158,
"ccnet_original_nlines": 191,
"rps_doc_curly_bracket": 0,
"rps_doc_ldnoobw_words": 0,
"rps_doc_lorem_ipsum": 0,
"rps_doc_stop_word_fraction": 0.044592030346393585,
"rps_doc_ut1_blacklist": 0,
"rps_doc_frac_all_caps_words": 0.0018975300481542945,
"rps_doc_frac_lines_end_with_ellipsis": 0,
"rps_doc_frac_no_alph_words": 0.8064516186714172,
"rps_doc_frac_unique_words": 0.41361257433891296,
"rps_doc_mean_word_length": 12.534031867980957,
"rps_doc_num_sentences": 40,
"rps_doc_symbol_to_word_ratio": 0,
"rps_doc_unigram_entropy": 3.954317569732666,
"rps_doc_word_count": 191,
"rps_doc_frac_chars_dupe_10grams": 0.11946532875299454,
"rps_doc_frac_chars_dupe_5grams": 0.441938191652298,
"rps_doc_frac_chars_dupe_6grams": 0.43692564964294434,
"rps_doc_frac_chars_dupe_7grams": 0.4035087823867798,
"rps_doc_frac_chars_dupe_8grams": 0.36549708247184753,
"rps_doc_frac_chars_dupe_9grams": 0.11946532875299454,
"rps_doc_frac_chars_top_2gram": 0.0906432718038559,
"rps_doc_frac_chars_top_3gram": 0.09356725215911865,
"rps_doc_frac_chars_top_4gram": 0.09649123251438141,
"rps_doc_books_importance": -543.1814575195312,
"rps_doc_books_importance_length_correction": -543.1814575195312,
"rps_doc_openwebtext_importance": -166.70018005371094,
"rps_doc_openwebtext_importance_length_correction": -166.70018005371094,
"rps_doc_wikipedia_importance": 61.30575180053711,
"rps_doc_wikipedia_importance_length_correction": 61.30575180053711
},
"fasttext": {
"dclm": 0.9999814033508301,
"english": 0.05783848091959953,
"fineweb_edu_approx": 3.566194534301758,
"eai_general_math": 0.999822199344635,
"eai_open_web_math": 0.026962760835886,
"eai_web_code": 0.9835731983184814
}
}
|
{
"free_decimal_correspondence": {
"primary": {
"code": "005.1",
"labels": {
"level_1": "General works, books and libraries, information sciences",
"level_2": "",
"level_3": "Computer programming"
}
},
"secondary": {
"code": "519.5",
"labels": {
"level_1": "Science and Natural history",
"level_2": "Mathematics",
"level_3": "Probabilities; or, Mathematical statistics"
}
}
},
"bloom_cognitive_process": {
"primary": {
"code": "3",
"label": "Apply"
},
"secondary": {
"code": "2",
"label": "Understand"
}
},
"bloom_knowledge_domain": {
"primary": {
"code": "3",
"label": "Procedural"
},
"secondary": {
"code": "2",
"label": "Conceptual"
}
},
"document_type_v1": {
"primary": {
"code": "3",
"label": "Reference/Encyclopedic/Educational"
},
"secondary": {
"code": "4",
"label": "Code/Software"
}
},
"extraction_artifacts": {
"primary": {
"code": "0",
"label": "No Artifacts"
},
"secondary": {
"code": "3",
"label": "Irrelevant Content"
}
},
"missing_content": {
"primary": {
"code": "0",
"label": "No missing content"
},
"secondary": {
"code": "4",
"label": "Missing Images or Figures"
}
},
"document_type_v2": {
"primary": {
"code": "23",
"label": "Tutorial"
},
"secondary": {
"code": "8",
"label": "Documentation"
}
},
"reasoning_depth": {
"primary": {
"code": "2",
"label": "Basic Reasoning"
},
"secondary": {
"code": "3",
"label": "Intermediate Reasoning"
}
},
"technical_correctness": {
"primary": {
"code": "4",
"label": "Highly Correct"
},
"secondary": {
"code": "3",
"label": "Mostly Correct"
}
},
"education_level": {
"primary": {
"code": "3",
"label": "Undergraduate Level"
},
"secondary": {
"code": "2",
"label": "High School Level"
}
}
}
|
672f1e42c33a7f9846924a2431ea77df
|
8,963,632,644,352,116,000
|
Interview Questions, Answers and Tutorials
Best Practices and Design Principles
Best Practices and Design Principles
Hey there! Today, we’re going to learn about some important rules and tips that make our code better. Think of these like the rules of a game. If you follow these rules, your code will be easier to understand, fix, and share with others. We’ll also see some examples in Python to make it all clear. Ready? Let’s go!
1. Write Clean and Readable Code
Imagine you wrote a story and want your friends to read it. You’d want it to be neat, right? The same goes for code. Clean and readable code means that anyone (including future you!) can understand it easily.
Example:
# Good example
def calculate_area_of_circle(radius):
pi = 3.14159
area = pi * (radius ** 2)
return area
# Bad example
def calc(r):
p = 3.14159
a = p * (r ** 2)
return a
In the good example, the function name and variable names tell us exactly what they do.
2. Use Meaningful Names
Always use names that describe what the variable or function is for. This helps anyone reading your code understand it without guessing.
Example:
# Good example
total_price = 100
discount_rate = 0.1
# Bad example
tp = 100
dr = 0.1
3. Avoid Repetition
If you find yourself writing the same code more than once, put it in a function. This is called DRY (Don’t Repeat Yourself).
Example:
# Without DRY principle
area1 = 3.14159 * (5 ** 2)
area2 = 3.14159 * (10 ** 2)
# With DRY principle
def calculate_area(radius):
pi = 3.14159
return pi * (radius ** 2)
area1 = calculate_area(5)
area2 = calculate_area(10)
4. Write Comments
Comments are notes you leave in your code to explain what it does. They are especially helpful when the code is complicated. But don’t overdo it; too many comments can make the code messy.
Example:
def calculate_area_of_rectangle(length, width):
# This function calculates the area of a rectangle
return length * width
5. Use Functions
Functions are like little machines that do a specific job. They help to break down big problems into smaller, manageable pieces.
Example:
def greet(name):
return f"Hello, {name}!"
print(greet("Alice"))
print(greet("Bob"))
6. Keep Functions Small
A function should do one thing and do it well. If it’s doing too much, break it into smaller functions.
Example:
# Too big function
def process_data(data):
clean_data = [d.strip() for d in data]
filtered_data = [d for d in clean_data if d]
result = sum([int(d) for d in filtered_data])
return result
# Smaller functions
def clean_data(data):
return [d.strip() for d in data]
def filter_data(data):
return [d for d in data if d]
def process_data(data):
clean_data = clean_data(data)
filtered_data = filter_data(clean_data)
return sum([int(d) for d in filtered_data])
7. Handle Errors Gracefully
Sometimes things go wrong. Your code should be prepared for this and handle errors in a way that doesn’t break the whole program.
Example:
try:
result = 10 / 0
except ZeroDivisionError:
result = None
print("You can't divide by zero!")
print(result)
Practice Questions
Now, let’s practice what we’ve learned!
Question 1
Write a function named multiply_numbers that takes two numbers and returns their product. Make sure the function name and variable names are meaningful.
Solution:
def multiply_numbers(a, b):
return a * b
print(multiply_numbers(3, 4)) # Output: 12
Question 2
Rewrite the following code to use a function and follow the DRY principle:
area1 = 3.14159 * (5 ** 2)
area2 = 3.14159 * (10 ** 2)
Solution:
def calculate_area(radius):
pi = 3.14159
return pi * (radius ** 2)
area1 = calculate_area(5)
area2 = calculate_area(10)
print(area1, area2)
Question 3
Write a function named safe_divide that takes two numbers and returns their division result. If the second number is zero, return None and print “You can’t divide by zero!”
Solution:
def safe_divide(a, b):
try:
return a / b
except ZeroDivisionError:
print("You can't divide by zero!")
return None
print(safe_divide(10, 2)) # Output: 5.0
print(safe_divide(10, 0)) # Output: None
Great job! Now you know some of the best practices and design principles to make your Python code clean, readable, and efficient. Keep practicing and happy coding!
|
{
"url": "https://testinganswers.com/best-practices-and-design-principles/",
"source_domain": "testinganswers.com",
"snapshot_id": "CC-MAIN-2024-38",
"warc_metadata": {
"Content-Length": "144783",
"Content-Type": "application/http; msgtype=response",
"WARC-Block-Digest": "sha1:SQZDYC6HSD5YKLRQP64WU5JT5CI2LNBL",
"WARC-Concurrent-To": "<urn:uuid:2bbf8a9d-132f-42b6-b6e6-35c2b66adb58>",
"WARC-Date": "2024-09-07T21:33:29Z",
"WARC-IP-Address": "104.21.15.245",
"WARC-Identified-Payload-Type": "text/html",
"WARC-Payload-Digest": "sha1:ROENLHAX4IA3YBBYABW72YY4XY56WJDV",
"WARC-Record-ID": "<urn:uuid:3afb6c78-5bbf-40c1-9125-59451500da72>",
"WARC-Target-URI": "https://testinganswers.com/best-practices-and-design-principles/",
"WARC-Truncated": null,
"WARC-Type": "response",
"WARC-Warcinfo-ID": "<urn:uuid:c6ea237f-53bb-46c0-a087-cbbce527ec7f>"
},
"warc_info": "isPartOf: CC-MAIN-2024-38\r\npublisher: Common Crawl\r\ndescription: Wide crawl of the web for September 2024\r\noperator: Common Crawl Admin (info@commoncrawl.org)\r\nhostname: ip-10-67-67-192\r\nsoftware: Apache Nutch 1.20 (modified, https://github.com/commoncrawl/nutch/)\r\nrobots: checked via crawler-commons 1.5-SNAPSHOT (https://github.com/crawler-commons/crawler-commons)\r\nformat: WARC File Format 1.1\r\nconformsTo: https://iipc.github.io/warc-specifications/specifications/warc-format/warc-1.1/"
}
|
{
"line_start_idx": [
0,
43,
44,
81,
82,
119,
120,
436,
437,
470,
471,
680,
681,
690,
705,
743,
760,
790,
806,
807,
821,
834,
850,
871,
884,
885,
886,
887,
888,
976,
977,
1001,
1002,
1139,
1140,
1149,
1164,
1182,
1202,
1203,
1217,
1226,
1235,
1236,
1237,
1238,
1239,
1259,
1260,
1385,
1386,
1395,
1419,
1446,
1474,
1475,
1496,
1524,
1541,
1571,
1572,
1598,
1625,
1626,
1627,
1628,
1629,
1647,
1648,
1837,
1838,
1847,
1895,
1950,
1976,
1977,
1978,
1979,
1980,
1997,
1998,
2127,
2128,
2137,
2154,
2183,
2184,
2206,
2226,
2227,
2228,
2229,
2230,
2254,
2255,
2359,
2360,
2369,
2388,
2412,
2455,
2504,
2554,
2572,
2573,
2593,
2615,
2652,
2653,
2676,
2710,
2711,
2735,
2769,
2813,
2861,
2862,
2863,
2864,
2865,
2893,
2894,
3024,
3025,
3034,
3039,
3059,
3085,
3103,
3142,
3143,
3157,
3158,
3159,
3160,
3161,
3180,
3181,
3221,
3222,
3233,
3234,
3387,
3388,
3398,
3426,
3443,
3444,
3488,
3489,
3490,
3491,
3492,
3503,
3504,
3579,
3580,
3607,
3635,
3636,
3637,
3638,
3639,
3649,
3677,
3694,
3724,
3725,
3751,
3778,
3798,
3799,
3800,
3801,
3802,
3813,
3814,
3987,
3988,
3998,
4021,
4030,
4051,
4081,
4124,
4144,
4145,
4186,
4228,
4229,
4230,
4231,
4232
],
"line_end_idx": [
43,
44,
81,
82,
119,
120,
436,
437,
470,
471,
680,
681,
690,
705,
743,
760,
790,
806,
807,
821,
834,
850,
871,
884,
885,
886,
887,
888,
976,
977,
1001,
1002,
1139,
1140,
1149,
1164,
1182,
1202,
1203,
1217,
1226,
1235,
1236,
1237,
1238,
1239,
1259,
1260,
1385,
1386,
1395,
1419,
1446,
1474,
1475,
1496,
1524,
1541,
1571,
1572,
1598,
1625,
1626,
1627,
1628,
1629,
1647,
1648,
1837,
1838,
1847,
1895,
1950,
1976,
1977,
1978,
1979,
1980,
1997,
1998,
2127,
2128,
2137,
2154,
2183,
2184,
2206,
2226,
2227,
2228,
2229,
2230,
2254,
2255,
2359,
2360,
2369,
2388,
2412,
2455,
2504,
2554,
2572,
2573,
2593,
2615,
2652,
2653,
2676,
2710,
2711,
2735,
2769,
2813,
2861,
2862,
2863,
2864,
2865,
2893,
2894,
3024,
3025,
3034,
3039,
3059,
3085,
3103,
3142,
3143,
3157,
3158,
3159,
3160,
3161,
3180,
3181,
3221,
3222,
3233,
3234,
3387,
3388,
3398,
3426,
3443,
3444,
3488,
3489,
3490,
3491,
3492,
3503,
3504,
3579,
3580,
3607,
3635,
3636,
3637,
3638,
3639,
3649,
3677,
3694,
3724,
3725,
3751,
3778,
3798,
3799,
3800,
3801,
3802,
3813,
3814,
3987,
3988,
3998,
4021,
4030,
4051,
4081,
4124,
4144,
4145,
4186,
4228,
4229,
4230,
4231,
4232,
4395
]
}
|
{
"red_pajama_v2": {
"ccnet_original_length": 4395,
"ccnet_original_nlines": 192,
"rps_doc_curly_bracket": 0.0004550600133370608,
"rps_doc_ldnoobw_words": 0,
"rps_doc_lorem_ipsum": 0,
"rps_doc_stop_word_fraction": 0.2738719880580902,
"rps_doc_ut1_blacklist": 0,
"rps_doc_frac_all_caps_words": 0.00524658989161253,
"rps_doc_frac_lines_end_with_ellipsis": 0,
"rps_doc_frac_no_alph_words": 0.3389297127723694,
"rps_doc_frac_unique_words": 0.4233226776123047,
"rps_doc_mean_word_length": 5.04632568359375,
"rps_doc_num_sentences": 57,
"rps_doc_symbol_to_word_ratio": 0.01259182021021843,
"rps_doc_unigram_entropy": 5.18767786026001,
"rps_doc_word_count": 626,
"rps_doc_frac_chars_dupe_10grams": 0.07787273824214935,
"rps_doc_frac_chars_dupe_5grams": 0.19056664407253265,
"rps_doc_frac_chars_dupe_6grams": 0.11902500689029694,
"rps_doc_frac_chars_dupe_7grams": 0.09939853847026825,
"rps_doc_frac_chars_dupe_8grams": 0.07787273824214935,
"rps_doc_frac_chars_dupe_9grams": 0.07787273824214935,
"rps_doc_frac_chars_top_2gram": 0.007597339805215597,
"rps_doc_frac_chars_top_3gram": 0.011396010406315327,
"rps_doc_frac_chars_top_4gram": 0.020892690867185593,
"rps_doc_books_importance": -405.79840087890625,
"rps_doc_books_importance_length_correction": -405.79840087890625,
"rps_doc_openwebtext_importance": -230.19772338867188,
"rps_doc_openwebtext_importance_length_correction": -230.19772338867188,
"rps_doc_wikipedia_importance": -175.3022918701172,
"rps_doc_wikipedia_importance_length_correction": -175.3022918701172
},
"fasttext": {
"dclm": 0.9977998733520508,
"english": 0.787807822227478,
"fineweb_edu_approx": 3.4753313064575195,
"eai_general_math": 0.9681981801986694,
"eai_open_web_math": 0.11443716287612915,
"eai_web_code": 0.8751102089881897
}
}
|
{
"free_decimal_correspondence": {
"primary": {
"code": "005.133",
"labels": {
"level_1": "General works, books and libraries, information sciences",
"level_2": "",
"level_3": "Computer programming"
}
},
"secondary": {
"code": "005.1",
"labels": {
"level_1": "General works, books and libraries, information sciences",
"level_2": "",
"level_3": "Computer programming"
}
}
},
"bloom_cognitive_process": {
"primary": {
"code": "3",
"label": "Apply"
},
"secondary": {
"code": "2",
"label": "Understand"
}
},
"bloom_knowledge_domain": {
"primary": {
"code": "3",
"label": "Procedural"
},
"secondary": {
"code": "2",
"label": "Conceptual"
}
},
"document_type_v1": {
"primary": {
"code": "3",
"label": "Reference/Encyclopedic/Educational"
},
"secondary": {
"code": "4",
"label": "Code/Software"
}
},
"extraction_artifacts": {
"primary": {
"code": "0",
"label": "No Artifacts"
},
"secondary": {
"code": "3",
"label": "Irrelevant Content"
}
},
"missing_content": {
"primary": {
"code": "0",
"label": "No missing content"
},
"secondary": {
"code": "-1",
"label": "Abstain"
}
},
"document_type_v2": {
"primary": {
"code": "23",
"label": "Tutorial"
},
"secondary": {
"code": "10",
"label": "Knowledge Article"
}
},
"reasoning_depth": {
"primary": {
"code": "2",
"label": "Basic Reasoning"
},
"secondary": {
"code": "3",
"label": "Intermediate Reasoning"
}
},
"technical_correctness": {
"primary": {
"code": "4",
"label": "Highly Correct"
},
"secondary": {
"code": "3",
"label": "Mostly Correct"
}
},
"education_level": {
"primary": {
"code": "2",
"label": "High School Level"
},
"secondary": {
"code": "1",
"label": "General Audience"
}
}
}
|
672f1e42c33a7f9846924a2431ea77df
|
-2,469,173,243,256,307,700
|
[[PageOutline]] = Introduction = This is a central location for users to share useful code samples for !MapGuide, be they JavaScript, .Net, PHP, Java, or something entirely new... == Code Samples == === !JavaScript === * [wiki:CodeSamples/JavaScript/AJAXViewerEventHooking Hooking to events in the AJAX viewer] * [wiki:CodeSamples/JavaScript/InvokeCommandOnStartup Initial Task to invoke command on viewer startup] * [wiki:CodeSamples/JavaScript/CustomCursors Displaying custom cursors when the zoom tool is selected] * [wiki:CodeSamples/JavaScript/WaterMark Displaying a watermark over the map in the AJAX viewer] * [wiki:CodeSamples/JavaScript/OpenlayersExample Display Mapguide Maps using OpenLayers] * [wiki:CodeSamples/JavaScript/ZoomRectangleTweak Tweak of how 'Zoom to Rectangle' works] === ASP.Net === * [wiki:CodeSamples/ASP.Net/mapagent Building your own custom mapagent handler] * [wiki:CodeSamples/ASP.Net/ScribbleApp Dennis' Scribble Application] * [wiki:CodeSamples/AspDotNet/TemporaryMarkupsDotNet Creating Temporary Markups] * [wiki:CodeSamples/AspDotNet/DevFAQ ASP.net Development FAQ] * [https://github.com/jumpinjackie/mapguide-mvc-sample Sheboygan sample ASP.net MVC 5 application] === .NET === * [wiki:CodeSamples/DotNet/TfNetMgReaderWriter TF.NET Reader/Writer for MapGuide geometries] * [wiki:maestro/MaestroAPI MapGuide Maestro, MapGuide .Net API and Administrative GUI] === PHP === * [wiki:CodeSamples/PHP/MPUCalculator Calculating meters-per-unit for a map] * [wiki:CodeSamples/PHP/InitialMapView Dynamically setting initial map position and scale] * [wiki:CodeSamples/PHP/AddLayerToInitialMap Dynamically adding a layer to the initial map] * [wiki:CodeSamples/PHP/GeneralTasks General Tasks example - Markup, Theme, and Query] * [wiki:CodeSamples/PHP/CustomAggregateFunctions Using MapGuide's Custom Aggregate Functions] * [wiki:CodeSamples/PHP/pgRoutingExample pgRouting example] * [wiki:CodeSamples/PHP/ModifyMap Modify MgMap properties] === Java === * [wiki:CodeSamples/Java/mapguide4j mapguide4j] === Fusion === * [wiki:CodeSamples/Fusion/SuperSimple Simple Fusion application to get you started] === Tiled Maps === * [wiki:CodeSamples/Tiles/ServingTilesViaHttp Serving Mapguide map Tiles directly via Apache] * [wiki:CodeSamples/Tiles/TileCacheSeeding Client side tool for Seeding all Tiles in a tiled map] === Other === * [wiki:CodeSamples/Other/ExampleStylizationFunctions Stylization function examples] * [wiki:CodeSamples/Other/KaliopaMobileMap Kaliopa Mobile Viewer] * [wiki:CodeSamples/Other/MaestroScripts Scripts for Maestro] == Creating New Pages == === Page Title === When creating a new page, please use the following convention for the page location: !CodeSamples/TechnologyType/YourPageName for example: !CodeSamples/JavaScript/AJAXViewerEventHooking This is to ensure that pages are easily found via the TitleIndex, and may allow for an automated index at some point. You can easily do this by editing the the CodeSamples page, copying another entry, and then modifying it to fit your title. Once you have saved the page, you will have a handy link to follow to edit your own sample. === Header Section === Please include the following on every Code Sample page. It allows users to easily navigate the page, and if they come in off a search engine link they can get to the code samples index more easily. {{{ [[PageOutline]] This page is one of the !MapGuide Community CodeSamples. Visit the CodeSamples page to view more! }}} === Syntax Highlighting === Trac has some really cool [wiki:WikiProcessors syntax highlighting] built into it. The !MapGuide Trac doesn't have all of these set up, but at least the text/html one works, and does a reasonable job with both HTML and JS. For example: {{{ #!text/html }}} Please use this where possible to make your inline examples more readable.
|
{
"url": "https://trac.osgeo.org/mapguide/wiki/CodeSamples?format=txt",
"source_domain": "trac.osgeo.org",
"snapshot_id": "crawl=CC-MAIN-2022-40",
"warc_metadata": {
"Content-Length": "4649",
"Content-Type": "application/http; msgtype=response",
"WARC-Block-Digest": "sha1:G5GUQRRHCSZQHE7H7MN2THDQHUC5UHEW",
"WARC-Concurrent-To": "<urn:uuid:16c3485b-e0e4-46d1-a2d0-2f7386e53310>",
"WARC-Date": "2022-10-01T08:30:02Z",
"WARC-IP-Address": "140.211.15.30",
"WARC-Identified-Payload-Type": "text/plain",
"WARC-Payload-Digest": "sha1:LH4UZCXNAMJLKXJQ43XJH7M4PWV4MTEQ",
"WARC-Record-ID": "<urn:uuid:c035ceae-987f-45e7-8a68-56a2cf0669b3>",
"WARC-Target-URI": "https://trac.osgeo.org/mapguide/wiki/CodeSamples?format=txt",
"WARC-Truncated": null,
"WARC-Type": "response",
"WARC-Warcinfo-ID": "<urn:uuid:cd6766c7-79c4-4dda-84b4-ca21866b128b>"
},
"warc_info": "isPartOf: CC-MAIN-2022-40\r\npublisher: Common Crawl\r\ndescription: Wide crawl of the web for September/October 2022\r\noperator: Common Crawl Admin (info@commoncrawl.org)\r\nhostname: ip-10-67-67-116\r\nsoftware: Apache Nutch 1.19 (modified, https://github.com/commoncrawl/nutch/)\r\nrobots: checked via crawler-commons 1.4-SNAPSHOT (https://github.com/crawler-commons/crawler-commons)\r\nformat: WARC File Format 1.1\r\nconformsTo: https://iipc.github.io/warc-specifications/specifications/warc-format/warc-1.1/"
}
|
{
"line_start_idx": [
0
],
"line_end_idx": [
3831
]
}
|
{
"red_pajama_v2": {
"ccnet_original_length": 3831,
"ccnet_original_nlines": 0,
"rps_doc_curly_bracket": 0.003132340032607317,
"rps_doc_ldnoobw_words": 0,
"rps_doc_lorem_ipsum": 0,
"rps_doc_stop_word_fraction": 0.20179949700832367,
"rps_doc_ut1_blacklist": 0,
"rps_doc_frac_all_caps_words": 0.03213367983698845,
"rps_doc_frac_lines_end_with_ellipsis": 0,
"rps_doc_frac_no_alph_words": 0.34061697125434875,
"rps_doc_frac_unique_words": 0.5811138153076172,
"rps_doc_mean_word_length": 7.336561679840088,
"rps_doc_num_sentences": 28,
"rps_doc_symbol_to_word_ratio": 0.0025706898886710405,
"rps_doc_unigram_entropy": 5.164419651031494,
"rps_doc_word_count": 413,
"rps_doc_frac_chars_dupe_10grams": 0,
"rps_doc_frac_chars_dupe_5grams": 0,
"rps_doc_frac_chars_dupe_6grams": 0,
"rps_doc_frac_chars_dupe_7grams": 0,
"rps_doc_frac_chars_dupe_8grams": 0,
"rps_doc_frac_chars_dupe_9grams": 0,
"rps_doc_frac_chars_top_2gram": 0.010891090147197247,
"rps_doc_frac_chars_top_3gram": 0.005940590053796768,
"rps_doc_frac_chars_top_4gram": 0.009900989942252636,
"rps_doc_books_importance": -275.0827331542969,
"rps_doc_books_importance_length_correction": -275.0827331542969,
"rps_doc_openwebtext_importance": -222.0685272216797,
"rps_doc_openwebtext_importance_length_correction": -222.0685272216797,
"rps_doc_wikipedia_importance": -221.63217163085938,
"rps_doc_wikipedia_importance_length_correction": -221.63217163085938
},
"fasttext": {
"dclm": 0.876226007938385,
"english": 0.6631701588630676,
"fineweb_edu_approx": 2.0793724060058594,
"eai_general_math": 0.2233426570892334,
"eai_open_web_math": 0.38710546493530273,
"eai_web_code": 0.9926978349685669
}
}
|
{
"free_decimal_correspondence": {
"primary": {
"code": "005.1",
"labels": {
"level_1": "General works, books and libraries, information sciences",
"level_2": "",
"level_3": "Computer programming"
}
},
"secondary": {
"code": "004.019",
"labels": {
"level_1": "General works, books and libraries, information sciences",
"level_2": "",
"level_3": "Computers and Computer science"
}
}
},
"bloom_cognitive_process": {
"primary": {
"code": "3",
"label": "Apply"
},
"secondary": {
"code": "2",
"label": "Understand"
}
},
"bloom_knowledge_domain": {
"primary": {
"code": "3",
"label": "Procedural"
},
"secondary": {
"code": "2",
"label": "Conceptual"
}
},
"document_type_v1": {
"primary": {
"code": "3",
"label": "Reference/Encyclopedic/Educational"
},
"secondary": {
"code": "4",
"label": "Code/Software"
}
},
"extraction_artifacts": {
"primary": {
"code": "0",
"label": "No Artifacts"
},
"secondary": {
"code": "3",
"label": "Irrelevant Content"
}
},
"missing_content": {
"primary": {
"code": "0",
"label": "No missing content"
},
"secondary": {
"code": "-1",
"label": "Abstain"
}
},
"document_type_v2": {
"primary": {
"code": "8",
"label": "Documentation"
},
"secondary": {
"code": "6",
"label": "Content Listing"
}
},
"reasoning_depth": {
"primary": {
"code": "2",
"label": "Basic Reasoning"
},
"secondary": {
"code": "1",
"label": "No Reasoning"
}
},
"technical_correctness": {
"primary": {
"code": "6",
"label": "Not Applicable/Indeterminate"
},
"secondary": {
"code": "4",
"label": "Highly Correct"
}
},
"education_level": {
"primary": {
"code": "3",
"label": "Undergraduate Level"
},
"secondary": {
"code": "2",
"label": "High School Level"
}
}
}
|
672f1e42c33a7f9846924a2431ea77df
|
8,345,872,643,030,390,000
|
SEO Tallahassee - Specialists And Newbies Alike Require This Search Engine Optimization Suggestions
In terms of delivering people to your website, there is system since successful as google. But how is it possible to increase your search-engine traffic? By enhancing your site for search engines like google! This short article shall give you the methods you'll want to place your webpages towards the top of any search-engine.
Taking advantage of the options that pbn posts presents implies using the content that is various scattered over the online. These great web sites include especially for posting posts and reaching the community's eyes. Having well crafted and targeted content published to these sites will mean the people that are right your article and much more potential sale are created.
Grab any given comments the competition supply and use it to your benefit. Often, competing sites offers information that is exact her specific keywords and phrases. There are two main typical techniques to select these details. One is to check from inside the META tag regarding the web site's homepage. Additionally, on some pages with posts, some or most of the keywords being in bold.
Persistence try an advantage browsing engine optimization. You will not read any immediate satisfaction of your own work. It may take months that are several you to definitely have the ability to look at link between your projects pay back. The newer you're towards the company, the longer it's going to be to get the concept of points.
You have to be patient when it comes to search engine optimization. You're not planning discover quick leaps in website traffic mainly because you optimized your site yesterday. It will take up to many months observe a result that is significant your pursuit system optimization process. Especially if you tend to be a new business, or need recently headed using a web site.
Publishing post try a way that is great increase the net existence. Whenever you submit content, you enhance your search-engine presence, which, in change, gives extra people to your internet site. Moreover, the reports you more buyers in the long run that you publish also help inform your consumers about your products in a way that may get.
Track where society on your own website 're going. Whenever you decide where people are going, you know the place you want to focus your time and efforts. If a restaurant is had by you, it’s likely that individuals are checking out your menu. Allowing you are aware that the try an area of your webpages you'll want to hold recent and up-to-date.
You should always write close meta classification labels for every single of one's pages. Story labels create value for money, because yahoo uses these to develop blurbs that is short news are shown under a page's concept on their search results pages. A rather great details can become beneficial to your, as it can change attract visitors to your internet site rather than the tournaments.
Every connect on an internet site leading to an site that is external feel validated frequently. Website links that point to missing content (broken website links) become bad news. Not check my blog only include damaged hyperlinks annoying to traffic, these are generally take action on by search engine indexing formulas. Repairing or deleting broken backlinks gets better a web page's position on the search engine pages.
Whenever titling your site data and setting their unique URLs, use hyphens rather than underscores to words that are separate. (e.g. "my-homepage" instead "my_homepage") utilizing hyphens lets the search engines look over split key words whenever they index your website. Underscored titles arise to look engines as you very long keyword - and this search term is not probably be a search phase.
Taking the right time for you to improve your website for the search engines will guarantee their success. Google will continually push visitors that are new your internet site, and will support draw in an audience from all over the world. If you put the guidelines in this essay to utilize, you will have your internet site internet search engine optimized very quickly.
Comments on “SEO Tallahassee - Specialists And Newbies Alike Require This Search Engine Optimization Suggestions”
Leave a Reply
Gravatar
|
{
"url": "http://seo0368.thezenweb.com/SEO-Tallahassee-Specialists-And-Newbies-Alike-Require-This-Search-Engine-Optimization-Suggestions-5424393",
"source_domain": "seo0368.thezenweb.com",
"snapshot_id": "crawl=CC-MAIN-2017-30",
"warc_metadata": {
"Content-Length": "13780",
"Content-Type": "application/http; msgtype=response",
"WARC-Block-Digest": "sha1:2YS7E664VJPSFMHIVXZT5QIPVXXARJW5",
"WARC-Concurrent-To": "<urn:uuid:83d3f07d-ca2f-4da4-8938-2fb95aa5ff2e>",
"WARC-Date": "2017-07-24T02:34:56Z",
"WARC-IP-Address": "107.172.27.88",
"WARC-Identified-Payload-Type": "text/html",
"WARC-Payload-Digest": "sha1:YQYUCUQNFL22SXDZPOCLTRFIQO66DN35",
"WARC-Record-ID": "<urn:uuid:36688d13-da0b-44d6-a5b5-058531a9a5f7>",
"WARC-Target-URI": "http://seo0368.thezenweb.com/SEO-Tallahassee-Specialists-And-Newbies-Alike-Require-This-Search-Engine-Optimization-Suggestions-5424393",
"WARC-Truncated": "length",
"WARC-Type": "response",
"WARC-Warcinfo-ID": "<urn:uuid:cb642e33-131d-4514-9dc1-9a9daaeb3dcd>"
},
"warc_info": "robots: classic\r\nhostname: ip-10-143-26-145.ec2.internal\r\nsoftware: Nutch 1.6 (CC)\r\nisPartOf: CC-MAIN-2017-30\r\noperator: Common Crawl Admin\r\ndescription: Wide crawl of the web for July 2017\r\npublisher: Common Crawl\r\nformat: WARC File Format 1.0\r\nconformsTo: http://bibnum.bnf.fr/WARC/WARC_ISO_28500_version1_latestdraft.pdf"
}
|
{
"line_start_idx": [
0,
100,
101,
429,
430,
806,
807,
1196,
1197,
1534,
1535,
1910,
1911,
2255,
2256,
2603,
2604,
2996,
2997,
3421,
3422,
3818,
3819,
4191,
4192,
4306,
4307,
4321,
4322
],
"line_end_idx": [
100,
101,
429,
430,
806,
807,
1196,
1197,
1534,
1535,
1910,
1911,
2255,
2256,
2603,
2604,
2996,
2997,
3421,
3422,
3818,
3819,
4191,
4192,
4306,
4307,
4321,
4322,
4330
]
}
|
{
"red_pajama_v2": {
"ccnet_original_length": 4330,
"ccnet_original_nlines": 28,
"rps_doc_curly_bracket": 0,
"rps_doc_ldnoobw_words": 0,
"rps_doc_lorem_ipsum": 0,
"rps_doc_stop_word_fraction": 0.44186046719551086,
"rps_doc_ut1_blacklist": 0,
"rps_doc_frac_all_caps_words": 0.004895959980785847,
"rps_doc_frac_lines_end_with_ellipsis": 0,
"rps_doc_frac_no_alph_words": 0.1113831102848053,
"rps_doc_frac_unique_words": 0.48446327447891235,
"rps_doc_mean_word_length": 4.96610164642334,
"rps_doc_num_sentences": 43,
"rps_doc_symbol_to_word_ratio": 0,
"rps_doc_unigram_entropy": 5.318506240844727,
"rps_doc_word_count": 708,
"rps_doc_frac_chars_dupe_10grams": 0.04095562919974327,
"rps_doc_frac_chars_dupe_5grams": 0.04095562919974327,
"rps_doc_frac_chars_dupe_6grams": 0.04095562919974327,
"rps_doc_frac_chars_dupe_7grams": 0.04095562919974327,
"rps_doc_frac_chars_dupe_8grams": 0.04095562919974327,
"rps_doc_frac_chars_dupe_9grams": 0.04095562919974327,
"rps_doc_frac_chars_top_2gram": 0.020477820187807083,
"rps_doc_frac_chars_top_3gram": 0.01820250041782856,
"rps_doc_frac_chars_top_4gram": 0.01820250041782856,
"rps_doc_books_importance": -340.99365234375,
"rps_doc_books_importance_length_correction": -340.99365234375,
"rps_doc_openwebtext_importance": -160.575439453125,
"rps_doc_openwebtext_importance_length_correction": -160.575439453125,
"rps_doc_wikipedia_importance": -120.28630828857422,
"rps_doc_wikipedia_importance_length_correction": -120.28630828857422
},
"fasttext": {
"dclm": 0.0454745888710022,
"english": 0.941672682762146,
"fineweb_edu_approx": 1.4214081764221191,
"eai_general_math": 0.0060292501002550125,
"eai_open_web_math": 0.07037395238876343,
"eai_web_code": 0.005385099910199642
}
}
|
{
"free_decimal_correspondence": {
"primary": {
"code": "005.8",
"labels": {
"level_1": "General works, books and libraries, information sciences",
"level_2": "",
"level_3": "Computer programming"
}
},
"secondary": {
"code": "658.8",
"labels": {
"level_1": "Industrial arts, Technology, and Engineering",
"level_2": "Business",
"level_3": "Management"
}
}
},
"bloom_cognitive_process": {
"primary": {
"code": "3",
"label": "Apply"
},
"secondary": {
"code": "2",
"label": "Understand"
}
},
"bloom_knowledge_domain": {
"primary": {
"code": "3",
"label": "Procedural"
},
"secondary": {
"code": "2",
"label": "Conceptual"
}
},
"document_type_v1": {
"primary": {
"code": "3",
"label": "Reference/Encyclopedic/Educational"
},
"secondary": {
"code": "-1",
"label": "Abstain"
}
},
"extraction_artifacts": {
"primary": {
"code": "3",
"label": "Irrelevant Content"
},
"secondary": {
"code": "0",
"label": "No Artifacts"
}
},
"missing_content": {
"primary": {
"code": "0",
"label": "No missing content"
},
"secondary": {
"code": "2",
"label": "Click Here References"
}
},
"document_type_v2": {
"primary": {
"code": "10",
"label": "Knowledge Article"
},
"secondary": {
"code": "23",
"label": "Tutorial"
}
},
"reasoning_depth": {
"primary": {
"code": "2",
"label": "Basic Reasoning"
},
"secondary": {
"code": "3",
"label": "Intermediate Reasoning"
}
},
"technical_correctness": {
"primary": {
"code": "3",
"label": "Mostly Correct"
},
"secondary": {
"code": "4",
"label": "Highly Correct"
}
},
"education_level": {
"primary": {
"code": "1",
"label": "General Audience"
},
"secondary": {
"code": "2",
"label": "High School Level"
}
}
}
|
672f1e42c33a7f9846924a2431ea77df
|
7,959,191,932,923,867,000
|
Tag: tips
So You REALLY Want to Use TikTok?
So You REALLY Want to Use TikTok?
So You Really Want to Use TikTok?
A young man looks nervously at his phone.Background:
There is something to be said for TikTok, a lot of things to be said against it as well. Let’s keep one thing in mind first. Your data is everywhere. Sorry, it just is. There have been so many data breaches over the past 10-20 years that it would be nearly impossible to have your information safely stashed away from prying eyes.
Don’t let that stop you from doing your best to protect from any more info being out there. With TT in the news, you might be wondering if it is possible to use without opening yourself up to too much of the CCP (Chinese Communist Party) data vacuum.
Here are some suggestions if you just can’t help yourself. This isn’t perfect, but it will provide a bit of a roadmap. Do with it what you will.
The Basics:
IMO, these are some of the more effective ways to maintain a higher level of anonymity on TikTok:
1. Use a Device Not Associated With Your Identity: If possible, use a device that has never been associated with your identity, such as a second-hand phone purchased with cash.
2. Use a New SIM Card: Using a new SIM card helps prevent your phone number from being linked to your TikTok account.
3. Prepaid Mobile Plan: Using a prepaid mobile plan that doesn’t require your identity can add an extra layer of anonymity.
4. Avoid Home/Work WiFi: Using mobile data and disabling WiFi can prevent your home IP address from being associated with your TikTok activity.
5. Unique Google/Apple Account: Signing into your phone with a unique Google or Apple account can help prevent cross-referencing with your other accounts.
Remember, ONLY sign-up and log in on the new device. Once you link it back to your home IP, it’s back to square one.
6. Disable Location Services: Turning off location services and denying TikTok access to your location helps protect your privacy.
7. Avoid Posting Identifying Content: Refrain from posting videos or content that could reveal your identity, such as videos with identifiable people or locations.
Figure out what sized area you are comfortable with the world knowing you are operating in and stick to it.
8. Avoid Using Your Real Name: Use a username that doesn’t reveal your real name, and avoid using your real name anywhere on the new phone or with your TikTok account.
This goes for analogs of your name or other easily identifiable usernames.
How You Ended Up Following that Questionable Account on Twitter
How You Ended Up Following that Questionable Account on Twitter
Ever look over your Twitter follows and wonder, “when in the hell did I follow that account?” The answer could be, never.
Are you being made to follow accounts by some sneaky hack or #Twitter algorithm? No. Here are some common reasons this happens.
1. You followed an account and they changed things up themselves. Some times people have older “seasoned” accounts and when they start a new venture they may use that older account and rebrand it for their current project. So you may have followed someone who was all about gardening for a few years, then they began selling used Goodyear radial tires on eBay. Or, they have moved into an online business and all of a sudden your business account is following an OnlyFans account posting samples daily.
2. People buy and sell accounts, despite the Twitter rules. What? Are the Twitter police going to nab them? No. The security checks are in the Twitter platform and they can smoke out some types of account manipulation but it is likely the secondary market will continue traffic in Twitter accounts.
3. Alternatively accounts do get hacked by bots. A cyber criminal isn’t sitting there doing a deep dive on your pet names or first home address. However, brute force hacking of accounts makes up a great deal of Twitter traffic and Twitter security’s time. – turn on secondary authentication and use an authentication app on your smart device (google auth app/etc.) Also, we have recently seen an attempt by Apple iOS and the Android OS to incorporate that functionality directly into the saved passwords feature they offer. I wouldn’t rely on that yet.
People Check Who You Follow
While it can be a drag, it makes for a better Twitter experience to occasionally prune your follows. There are automated means to look for dead accounts (haven’t posted in however long), spam accounts, non-followbacks (keep an eye out for a short blog about this shortly) , etc. These can be super effective, but they can also lead to the Twitter algorithm restricting your account from locking you out, to forcing verification or even de-emphasizing you (aka “shadow banning”).
So I recommend taking that spare time you are twiddling around doing nothing while waiting for the next thing to happen and click on your profile, click following and scroll WAAAYYYYY back in your follows and start unfollowing.
|
{
"url": "https://nosmh.com/tag/tips/",
"source_domain": "nosmh.com",
"snapshot_id": "CC-MAIN-2024-22",
"warc_metadata": {
"Content-Length": "99157",
"Content-Type": "application/http; msgtype=response",
"WARC-Block-Digest": "sha1:5Z4WYYQYZNS3RMQWXDLORO4JNJNE6MXB",
"WARC-Concurrent-To": "<urn:uuid:7953d846-91df-4ad7-8b82-105ade9520e3>",
"WARC-Date": "2024-05-29T06:15:57Z",
"WARC-IP-Address": "104.21.51.130",
"WARC-Identified-Payload-Type": "text/html",
"WARC-Payload-Digest": "sha1:2FUZMLH6MWXLNSENNKAKFPQ6XLSVTYPC",
"WARC-Record-ID": "<urn:uuid:834d6673-c4b6-48ee-9f06-e6d3f105f9f2>",
"WARC-Target-URI": "https://nosmh.com/tag/tips/",
"WARC-Truncated": null,
"WARC-Type": "response",
"WARC-Warcinfo-ID": "<urn:uuid:2d5d0cbc-0546-4370-af07-5c4ce117293d>"
},
"warc_info": "isPartOf: CC-MAIN-2024-22\r\npublisher: Common Crawl\r\ndescription: Wide crawl of the web for May 2024\r\noperator: Common Crawl Admin (info@commoncrawl.org)\r\nhostname: ip-10-67-67-204\r\nsoftware: Apache Nutch 1.19 (modified, https://github.com/commoncrawl/nutch/)\r\nrobots: checked via crawler-commons 1.5-SNAPSHOT (https://github.com/crawler-commons/crawler-commons)\r\nformat: WARC File Format 1.1\r\nconformsTo: https://iipc.github.io/warc-specifications/specifications/warc-format/warc-1.1/"
}
|
{
"line_start_idx": [
0,
10,
11,
45,
46,
80,
81,
115,
116,
169,
170,
501,
502,
754,
755,
901,
902,
914,
915,
1013,
1014,
1191,
1192,
1310,
1311,
1435,
1436,
1580,
1581,
1736,
1737,
1854,
1855,
1986,
1987,
2151,
2152,
2260,
2261,
2429,
2430,
2505,
2506,
2570,
2571,
2635,
2636,
2758,
2759,
2887,
2888,
3391,
3392,
3691,
3692,
4245,
4246,
4274,
4275,
4755,
4757,
4986,
4987
],
"line_end_idx": [
10,
11,
45,
46,
80,
81,
115,
116,
169,
170,
501,
502,
754,
755,
901,
902,
914,
915,
1013,
1014,
1191,
1192,
1310,
1311,
1435,
1436,
1580,
1581,
1736,
1737,
1854,
1855,
1986,
1987,
2151,
2152,
2260,
2261,
2429,
2430,
2505,
2506,
2570,
2571,
2635,
2636,
2758,
2759,
2887,
2888,
3391,
3392,
3691,
3692,
4245,
4246,
4274,
4275,
4755,
4757,
4986,
4987,
4988
]
}
|
{
"red_pajama_v2": {
"ccnet_original_length": 4988,
"ccnet_original_nlines": 62,
"rps_doc_curly_bracket": 0,
"rps_doc_ldnoobw_words": 0,
"rps_doc_lorem_ipsum": 0,
"rps_doc_stop_word_fraction": 0.4234592318534851,
"rps_doc_ut1_blacklist": 0,
"rps_doc_frac_all_caps_words": 0.016898609697818756,
"rps_doc_frac_lines_end_with_ellipsis": 0,
"rps_doc_frac_no_alph_words": 0.14314115047454834,
"rps_doc_frac_unique_words": 0.4538011848926544,
"rps_doc_mean_word_length": 4.651462078094482,
"rps_doc_num_sentences": 61,
"rps_doc_symbol_to_word_ratio": 0.0009940400486811996,
"rps_doc_unigram_entropy": 5.442684173583984,
"rps_doc_word_count": 855,
"rps_doc_frac_chars_dupe_10grams": 0.046768918633461,
"rps_doc_frac_chars_dupe_5grams": 0.057832539081573486,
"rps_doc_frac_chars_dupe_6grams": 0.046768918633461,
"rps_doc_frac_chars_dupe_7grams": 0.046768918633461,
"rps_doc_frac_chars_dupe_8grams": 0.046768918633461,
"rps_doc_frac_chars_dupe_9grams": 0.046768918633461,
"rps_doc_frac_chars_top_2gram": 0.01005783025175333,
"rps_doc_frac_chars_top_3gram": 0.008297709748148918,
"rps_doc_frac_chars_top_4gram": 0.01131505984812975,
"rps_doc_books_importance": -431.61114501953125,
"rps_doc_books_importance_length_correction": -431.61114501953125,
"rps_doc_openwebtext_importance": -239.55238342285156,
"rps_doc_openwebtext_importance_length_correction": -239.55238342285156,
"rps_doc_wikipedia_importance": -211.0216522216797,
"rps_doc_wikipedia_importance_length_correction": -211.0216522216797
},
"fasttext": {
"dclm": 0.10235416889190674,
"english": 0.9364607334136963,
"fineweb_edu_approx": 1.6562087535858154,
"eai_general_math": 0.001538629992865026,
"eai_open_web_math": 0.06405788660049438,
"eai_web_code": 0.006371019873768091
}
}
|
{
"free_decimal_correspondence": {
"primary": {
"code": "005.82",
"labels": {
"level_1": "General works, books and libraries, information sciences",
"level_2": "",
"level_3": "Computer programming"
}
},
"secondary": {
"code": "302.22",
"labels": {
"level_1": "Social sciences",
"level_2": "",
"level_3": "Social psychology"
}
}
},
"bloom_cognitive_process": {
"primary": {
"code": "3",
"label": "Apply"
},
"secondary": {
"code": "2",
"label": "Understand"
}
},
"bloom_knowledge_domain": {
"primary": {
"code": "3",
"label": "Procedural"
},
"secondary": {
"code": "2",
"label": "Conceptual"
}
},
"document_type_v1": {
"primary": {
"code": "3",
"label": "Reference/Encyclopedic/Educational"
},
"secondary": {
"code": "-1",
"label": "Abstain"
}
},
"extraction_artifacts": {
"primary": {
"code": "0",
"label": "No Artifacts"
},
"secondary": {
"code": "3",
"label": "Irrelevant Content"
}
},
"missing_content": {
"primary": {
"code": "0",
"label": "No missing content"
},
"secondary": {
"code": "-1",
"label": "Abstain"
}
},
"document_type_v2": {
"primary": {
"code": "16",
"label": "Personal Blog"
},
"secondary": {
"code": "10",
"label": "Knowledge Article"
}
},
"reasoning_depth": {
"primary": {
"code": "2",
"label": "Basic Reasoning"
},
"secondary": {
"code": "3",
"label": "Intermediate Reasoning"
}
},
"technical_correctness": {
"primary": {
"code": "6",
"label": "Not Applicable/Indeterminate"
},
"secondary": {
"code": "4",
"label": "Highly Correct"
}
},
"education_level": {
"primary": {
"code": "1",
"label": "General Audience"
},
"secondary": {
"code": "2",
"label": "High School Level"
}
}
}
|
672f1e42c33a7f9846924a2431ea77df
|
3,900,407,998,399,296,000
|
Support Questions
Find answers, ask questions, and share your expertise
Announcements
Alert: Welcome to the Unified Cloudera Community. Former HCC members be sure to read and learn how to activate your account here.
Hive Streaming API is 10x slower in 5.6.0 comparing with 5.4.2
Highlighted
Hive Streaming API is 10x slower in 5.6.0 comparing with 5.4.2
Explorer
I have setup a new CDH 5.6.0 cluster and migrated all my Hive data from previous CDH 5.4.2 recently.
The migration was simple:
1. copied all files from hdfs://old_hdfs/user/hive/warehouse to hdfs://new_hdfs/user/hive/warehouse
2. dumped the metadata from metadata mysql then restored them to the the new metadata mysql (and also updated the url of blocks from the old name node to the new name node)
The new cluster is more powerful than the old one in infrastructure, with more CPUs and memory. I also setup the HA for HDFS, to make sure it's ready for production usage.
Everything looked good before I found that my hive streaming program were running in really low throughput in the CDH 5.6.0 cluster, compared with the 5.4.2 one.
My streaming program reads data from Kafka, and writes them to Hive with the HCatalog Streaming API inspired by https://cwiki.apache.org/confluence/display/Hive/Streaming+Data+Ingest.
The codes look similar as below:
StreamingConnection connection2 = hiveEP.newConnection(true);
DelimitedInputWriter writer2 =
new DelimitedInputWriter(fieldNames,",", endPt);
TransactionBatch txnBatch2= connection.fetchTransactionBatch(10, writer2); // step1
///// Batch 1 - First TXN
txnBatch2.beginNextTransaction(); //step2
txnBatch2.write("21,Venkat Ranganathan".getBytes());
txnBatch2.write("22,Bowen Zhang".getBytes());
txnBatch2.commit(); //step3
For writing 10 rows in a batch:
1. In 5.4.2, the steps of beginNextTransaction, commit might take: 40ms, 11ms
2. while in 5.6.0, they took: 250ms and 174ms
Why the streaming performance is so much slow in 5.6? Does anyone have an idea how to resolve this?
1 REPLY 1
Re: Hive Streaming API is 10x slower in 5.6.0 comparing with 5.4.2
Explorer
I did some tests today, here is my test codes:
private void writeBatch(List<String> list) throws Exception {
StreamingConnection connection = hiveEP.newConnection(true, conf);
StrictJsonWriter writer = new StrictJsonWriter(hiveEP, conf);
long tsStart = System.currentTimeMillis();
TransactionBatch txnBatch = connection.fetchTransactionBatch(10, writer);
long tsFetch = System.currentTimeMillis();
txnBatch.beginNextTransaction();
long tsNextTx = System.currentTimeMillis();
for (String item : list) {
try {
txnBatch.write(item.getBytes());
} catch (Exception e) {
System.err.println(Thread.currentThread().getName()+" write item failed:" + item);
e.printStackTrace();
continue;
}
}
long tsWrite = System.currentTimeMillis();
txnBatch.commit();
long tsCmt = System.currentTimeMillis();
txnBatch.close();
long tsBtClose = System.currentTimeMillis();
long elpTotal = tsCmt - tsStart;
long elpFetch = tsFetch - tsStart;
long elpNextTx = tsNextTx - tsFetch;
long elpWrite = tsWrite - tsNextTx;
long elpCommit = tsCmt - tsWrite;
System.out.println(Thread.currentThread().getName()+" write batch, size:" + list.size() + " total:" + elpTotal
+ "ms, " +
"fetch:" + elpFetch +
"ms, " +
"nextTx:" + elpNextTx + "ms, write:" + elpWrite + "ms, commit:" + elpCommit + "ms, close:" + (tsBtClose - tsCmt) + "ms");
}
The DDL:
create table if not exists test_counter(
name string,
ts bigint,
sid string,
value int
) partitioned by (date int) clustered by (sid) into 3 buckets stored as orc tblproperties ("orc.compress"="SNAPPY", "transactional"="true");
I tests the performance with writing a list of 179491 rows to the table 'test_counter', and the result show as below:
Test result on CDH 5.4.2:
Thread-2 write batch, size:179491 total:19292ms, fetch:902ms, nextTx:12ms, write:18119ms, commit:259ms, close:52ms
Test result on CDH 5.6.0
Thread-2 write batch, size:179491 total:31428ms, fetch:700ms, nextTx:1228ms, write:28922ms, commit:578ms, close:91ms
The evidence shown that:
1. StreamingConnection.fetchTransactionBatch() is 10 times slower
2. TransactionBatch.write() is 1.5 times slower
I also compared the HDD performances where hdfs run between the new and old cluster, it shown no difference.
What can be the reason of the slowing down? could it be the HA of HDFS?
|
{
"url": "https://community.cloudera.com/t5/Support-Questions/Hive-Streaming-API-is-10x-slower-in-5-6-0-comparing-with-5-4/m-p/39164",
"source_domain": "community.cloudera.com",
"snapshot_id": "crawl=CC-MAIN-2019-43",
"warc_metadata": {
"Content-Length": "109449",
"Content-Type": "application/http; msgtype=response",
"WARC-Block-Digest": "sha1:5RSFOKGPHYFPZLMIAUIOB2J52OCQN5XY",
"WARC-Concurrent-To": "<urn:uuid:6cc2abae-faf9-4f14-b523-8f80048b0c58>",
"WARC-Date": "2019-10-18T11:01:44Z",
"WARC-IP-Address": "208.74.204.65",
"WARC-Identified-Payload-Type": "text/html",
"WARC-Payload-Digest": "sha1:SEBEZBX7MPDCPPB3Z2AY7Y6AIJQEJO5N",
"WARC-Record-ID": "<urn:uuid:0e02c878-b94c-4300-8444-a79b7d26b312>",
"WARC-Target-URI": "https://community.cloudera.com/t5/Support-Questions/Hive-Streaming-API-is-10x-slower-in-5-6-0-comparing-with-5-4/m-p/39164",
"WARC-Truncated": null,
"WARC-Type": "response",
"WARC-Warcinfo-ID": "<urn:uuid:0da02c9d-a5dc-44e3-ae26-833df4322060>"
},
"warc_info": "isPartOf: CC-MAIN-2019-43\r\npublisher: Common Crawl\r\ndescription: Wide crawl of the web for October 2019\r\noperator: Common Crawl Admin (info@commoncrawl.org)\r\nhostname: ip-10-67-67-180.ec2.internal\r\nsoftware: Apache Nutch 1.16 (modified, https://github.com/commoncrawl/nutch/)\r\nrobots: checked via crawler-commons 1.1-SNAPSHOT (https://github.com/crawler-commons/crawler-commons)\r\nformat: WARC File Format 1.1\r\nconformsTo: http://iipc.github.io/warc-specifications/specifications/warc-format/warc-1.1/"
}
|
{
"line_start_idx": [
0,
18,
72,
86,
216,
217,
280,
281,
293,
294,
357,
358,
367,
368,
370,
371,
472,
473,
499,
500,
601,
602,
775,
776,
778,
779,
781,
782,
784,
785,
957,
958,
1120,
1121,
1305,
1306,
1308,
1309,
1342,
1343,
1345,
1346,
1408,
1439,
1509,
1593,
1595,
1597,
1623,
1665,
1718,
1764,
1792,
1794,
1795,
1827,
1828,
1830,
1831,
1909,
1910,
1956,
1957,
1959,
1960,
2060,
2061,
2063,
2064,
2066,
2067,
2069,
2070,
2072,
2073,
2075,
2076,
2078,
2079,
2081,
2082,
2084,
2085,
2095,
2096,
2163,
2164,
2173,
2174,
2221,
2222,
2224,
2225,
2291,
2292,
2367,
2437,
2488,
2489,
2571,
2572,
2623,
2624,
2665,
2666,
2718,
2719,
2754,
2772,
2821,
2857,
2956,
2993,
3019,
3033,
3043,
3044,
3045,
3096,
3097,
3124,
3125,
3174,
3175,
3201,
3254,
3255,
3296,
3339,
3384,
3428,
3470,
3471,
3590,
3617,
3655,
3680,
3818,
3824,
3825,
3827,
3828,
3837,
3838,
3840,
3841,
3882,
3897,
3910,
3924,
3936,
4078,
4079,
4081,
4082,
4200,
4201,
4203,
4204,
4230,
4231,
4346,
4347,
4349,
4350,
4375,
4376,
4493,
4494,
4496,
4497,
4522,
4523,
4590,
4591,
4639,
4640,
4642,
4643,
4752,
4753,
4755,
4756,
4829,
4830
],
"line_end_idx": [
18,
72,
86,
216,
217,
280,
281,
293,
294,
357,
358,
367,
368,
370,
371,
472,
473,
499,
500,
601,
602,
775,
776,
778,
779,
781,
782,
784,
785,
957,
958,
1120,
1121,
1305,
1306,
1308,
1309,
1342,
1343,
1345,
1346,
1408,
1439,
1509,
1593,
1595,
1597,
1623,
1665,
1718,
1764,
1792,
1794,
1795,
1827,
1828,
1830,
1831,
1909,
1910,
1956,
1957,
1959,
1960,
2060,
2061,
2063,
2064,
2066,
2067,
2069,
2070,
2072,
2073,
2075,
2076,
2078,
2079,
2081,
2082,
2084,
2085,
2095,
2096,
2163,
2164,
2173,
2174,
2221,
2222,
2224,
2225,
2291,
2292,
2367,
2437,
2488,
2489,
2571,
2572,
2623,
2624,
2665,
2666,
2718,
2719,
2754,
2772,
2821,
2857,
2956,
2993,
3019,
3033,
3043,
3044,
3045,
3096,
3097,
3124,
3125,
3174,
3175,
3201,
3254,
3255,
3296,
3339,
3384,
3428,
3470,
3471,
3590,
3617,
3655,
3680,
3818,
3824,
3825,
3827,
3828,
3837,
3838,
3840,
3841,
3882,
3897,
3910,
3924,
3936,
4078,
4079,
4081,
4082,
4200,
4201,
4203,
4204,
4230,
4231,
4346,
4347,
4349,
4350,
4375,
4376,
4493,
4494,
4496,
4497,
4522,
4523,
4590,
4591,
4639,
4640,
4642,
4643,
4752,
4753,
4755,
4756,
4829,
4830,
4831
]
}
|
{
"red_pajama_v2": {
"ccnet_original_length": 4831,
"ccnet_original_nlines": 184,
"rps_doc_curly_bracket": 0.0016559700015932322,
"rps_doc_ldnoobw_words": 0,
"rps_doc_lorem_ipsum": 0,
"rps_doc_stop_word_fraction": 0.17720207571983337,
"rps_doc_ut1_blacklist": 0,
"rps_doc_frac_all_caps_words": 0.025906739756464958,
"rps_doc_frac_lines_end_with_ellipsis": 0,
"rps_doc_frac_no_alph_words": 0.39274612069129944,
"rps_doc_frac_unique_words": 0.524163544178009,
"rps_doc_mean_word_length": 6.197026252746582,
"rps_doc_num_sentences": 84,
"rps_doc_symbol_to_word_ratio": 0,
"rps_doc_unigram_entropy": 5.292303085327148,
"rps_doc_word_count": 538,
"rps_doc_frac_chars_dupe_10grams": 0.0485902801156044,
"rps_doc_frac_chars_dupe_5grams": 0.0485902801156044,
"rps_doc_frac_chars_dupe_6grams": 0.0485902801156044,
"rps_doc_frac_chars_dupe_7grams": 0.0485902801156044,
"rps_doc_frac_chars_dupe_8grams": 0.0485902801156044,
"rps_doc_frac_chars_dupe_9grams": 0.0485902801156044,
"rps_doc_frac_chars_top_2gram": 0.005998800043016672,
"rps_doc_frac_chars_top_3gram": 0.014397120103240013,
"rps_doc_frac_chars_top_4gram": 0.016196759417653084,
"rps_doc_books_importance": -440.9491882324219,
"rps_doc_books_importance_length_correction": -440.9491882324219,
"rps_doc_openwebtext_importance": -277.4114074707031,
"rps_doc_openwebtext_importance_length_correction": -277.4114074707031,
"rps_doc_wikipedia_importance": -183.04286193847656,
"rps_doc_wikipedia_importance_length_correction": -183.04286193847656
},
"fasttext": {
"dclm": 0.5159351825714111,
"english": 0.7324965596199036,
"fineweb_edu_approx": 1.8183186054229736,
"eai_general_math": 0.017000319436192513,
"eai_open_web_math": 0.1782119870185852,
"eai_web_code": 0.2279599905014038
}
}
|
{
"free_decimal_correspondence": {
"primary": {
"code": "005.44",
"labels": {
"level_1": "General works, books and libraries, information sciences",
"level_2": "",
"level_3": "Computer programming"
}
},
"secondary": {
"code": "005.72",
"labels": {
"level_1": "General works, books and libraries, information sciences",
"level_2": "",
"level_3": "Computer programming"
}
}
},
"bloom_cognitive_process": {
"primary": {
"code": "4",
"label": "Analyze"
},
"secondary": {
"code": "5",
"label": "Evaluate"
}
},
"bloom_knowledge_domain": {
"primary": {
"code": "3",
"label": "Procedural"
},
"secondary": {
"code": "2",
"label": "Conceptual"
}
},
"document_type_v1": {
"primary": {
"code": "5",
"label": "Social/Forum"
},
"secondary": {
"code": "-1",
"label": "Abstain"
}
},
"extraction_artifacts": {
"primary": {
"code": "0",
"label": "No Artifacts"
},
"secondary": {
"code": "3",
"label": "Irrelevant Content"
}
},
"missing_content": {
"primary": {
"code": "0",
"label": "No missing content"
},
"secondary": {
"code": "-1",
"label": "Abstain"
}
},
"document_type_v2": {
"primary": {
"code": "18",
"label": "Q&A Forum"
},
"secondary": {
"code": "21",
"label": "Customer Support"
}
},
"reasoning_depth": {
"primary": {
"code": "3",
"label": "Intermediate Reasoning"
},
"secondary": {
"code": "2",
"label": "Basic Reasoning"
}
},
"technical_correctness": {
"primary": {
"code": "3",
"label": "Mostly Correct"
},
"secondary": {
"code": "4",
"label": "Highly Correct"
}
},
"education_level": {
"primary": {
"code": "4",
"label": "Graduate/Expert Level"
},
"secondary": {
"code": "3",
"label": "Undergraduate Level"
}
}
}
|
672f1e42c33a7f9846924a2431ea77df
|
-509,470,824,741,220,800
|
Gray Soft / Rubies in the Rough tag:graysoftinc.com,2014-03-20:/categories/20 2014-09-05T19:11:03Z James Edward Gray II Sleepy Programs tag:graysoftinc.com,2014-08-22:/posts/125 2014-09-05T19:11:03Z Can we do modern message passing multiprocessing in Ruby across processes and thread? Sure can. <p>When we think of real multiprocessing, our thoughts probably drift more towards languages like Erlang, Go, Clojure, or Rust. Such languages really focus on getting separate "processes" to communicate via messages. This makes it a lot easier to know when one process is waiting on another, because calls to receive messages typically block until one is available.</p> <p>But what about Ruby? Can we do intelligent process coordination in Ruby?</p> <p>Yes, we can. The tools for it are more awkward though. It's easy to run into tricky edge cases and hard to code your way out of them correctly.</p> <p>Let's play with an example to see how good we can make things. Here's what we will do:</p> <ol> <li>We will start one parent process that will <code>fork()</code> a single child process</li> <li>The child will push three messages onto a RabbitMQ queue and <code>exit()</code> </li> <li>The parent will listen for three messages to arrive, then <code>exit()</code> </li> </ol><p>Here's a somewhat sloppy first attempt at solving this:</p> <div class="highlight highlight-ruby"><pre><span class="c1">#!/usr/bin/env ruby</span> <span class="nb">require</span> <span class="s2">"benchmark"</span> <span class="nb">require</span> <span class="s2">"bunny"</span> <span class="no">QUEUE_NAME</span> <span class="o">=</span> <span class="s2">"example"</span> <span class="no">MESSAGES</span> <span class="o">=</span> <span class="sx">%w[first second third]</span> <span class="k">def</span> <span class="nf">send_messages</span><span class="p">(</span><span class="o">*</span><span class="n">messages</span><span class="p">)</span> <span class="n">connection</span> <span class="o">=</span> <span class="no">Bunny</span><span class="o">.</span><span class="n">new</span><span class="o">.</span><span class="n">tap</span><span class="p">(</span><span class="o">&</span><span class="ss">:start</span><span class="p">)</span> <span class="n">exchange</span> <span class="o">=</span> <span class="n">connection</span><span class="o">.</span><span class="n">create_channel</span><span class="o">.</span><span class="n">default_exchange</span> <span class="n">messages</span><span class="o">.</span><span class="n">each</span> <span class="k">do</span> <span class="o">|</span><span class="n">message</span><span class="o">|</span> <span class="n">exchange</span><span class="o">.</span><span class="n">publish</span><span class="p">(</span><span class="n">message</span><span class="p">,</span> <span class="n">routing_key</span><span class="p">:</span> <span class="no">QUEUE_NAME</span><span class="p">)</span> <span class="k">end</span> <span class="n">connection</span><span class="o">.</span><span class="n">close</span> <span class="k">end</span> <span class="k">def</span> <span class="nf">listen_for_messages</span><span class="p">(</span><span class="n">received_messages</span><span class="p">)</span> <span class="n">connection</span> <span class="o">=</span> <span class="no">Bunny</span><span class="o">.</span><span class="n">new</span><span class="o">.</span><span class="n">tap</span><span class="p">(</span><span class="o">&</span><span class="ss">:start</span><span class="p">)</span> <span class="n">queue</span> <span class="o">=</span> <span class="n">connection</span><span class="o">.</span><span class="n">create_channel</span><span class="o">.</span><span class="n">queue</span><span class="p">(</span><span class="no">QUEUE_NAME</span><span class="p">,</span> <span class="n">auto_delete</span><span class="p">:</span> <span class="kp">true</span><span class="p">)</span> <span class="n">queue</span><span class="o">.</span><span class="n">subscribe</span> <span class="k">do</span> <span class="o">|</span><span class="n">delivery_info</span><span class="p">,</span> <span class="n">metadata</span><span class="p">,</span> <span class="n">payload</span><span class="o">|</span> <span class="n">received_messages</span> <span class="o"><<</span> <span class="n">payload</span> <span class="k">end</span> <span class="n">time_it</span><span class="p">(</span><span class="s2">"Received </span><span class="si">#{</span><span class="no">MESSAGES</span><span class="o">.</span><span class="n">size</span><span class="si">}</span><span class="s2"> messages"</span><span class="p">)</span> <span class="k">do</span> <span class="k">yield</span> <span class="k">end</span> <span class="n">connection</span><span class="o">.</span><span class="n">close</span> <span class="k">end</span> <span class="k">def</span> <span class="nf">time_it</span><span class="p">(</span><span class="nb">name</span><span class="p">)</span> <span class="n">elapsed</span> <span class="o">=</span> <span class="no">Benchmark</span><span class="o">.</span><span class="n">realtime</span> <span class="k">do</span> <span class="k">yield</span> <span class="k">end</span> <span class="nb">puts</span> <span class="s2">"%s: %.2fs"</span> <span class="o">%</span> <span class="o">[</span><span class="nb">name</span><span class="p">,</span> <span class="n">elapsed</span><span class="o">]</span> <span class="k">end</span> <span class="k">def</span> <span class="nf">wait_for_messages</span><span class="p">(</span><span class="n">received_messages</span><span class="p">)</span> <span class="k">until</span> <span class="n">received_messages</span> <span class="o">==</span> <span class="no">MESSAGES</span> <span class="nb">sleep</span> <span class="mi">0</span><span class="o">.</span><span class="mi">1</span> <span class="c1"># don't peg the CPU while we wait</span> <span class="k">end</span> <span class="k">end</span> <span class="k">def</span> <span class="nf">send_and_receive</span> <span class="n">pid</span> <span class="o">=</span> <span class="nb">fork</span> <span class="k">do</span> <span class="nb">sleep</span> <span class="mi">3</span> <span class="c1"># make sure we're receiving before they are sent</span> <span class="n">send_messages</span><span class="p">(</span><span class="o">*</span><span class="no">MESSAGES</span><span class="p">)</span> <span class="k">end</span> <span class="no">Process</span><span class="o">.</span><span class="n">detach</span><span class="p">(</span><span class="n">pid</span><span class="p">)</span> <span class="n">received_messages</span> <span class="o">=</span> <span class="o">[</span> <span class="o">]</span> <span class="n">listen_for_messages</span><span class="p">(</span><span class="n">received_messages</span><span class="p">)</span> <span class="k">do</span> <span class="n">wait_for_messages</span><span class="p">(</span><span class="n">received_messages</span><span class="p">)</span> <span class="k">end</span> <span class="k">end</span> <span class="n">send_and_receive</span> </pre></div> <p>Let's talk about each piece of this code real quick. You can mostly ignore the first two methods, <code>send_messages()</code> and <code>listen_for_messages()</code>. These are just wrappers over RabbitMQ's publish and subscribe process. The only tricky bit is that <code>listen_for_messages()</code> does a <code>yield</code> after subscribing to the queue. The reason for this is that subscribing just spins up a separate <code>Thread</code> which will call the passed block as messages arrive. That's happening in the background, which means the main <code>Thread</code> needs to find some way to wait until we have received the expected messages. The <code>yield</code> gives us a place to insert this waiting code.</p> <p>The next two methods, <code>time_it()</code> and <code>wait_for_messages()</code>, are simple helpers. I added the first mainly to give us some noticeable output. The latter performs the waiting and checking discussed above.</p> <p>The real action happens in <code>send_and_receive()</code>. This method should look a lot like the steps we defined earlier: <code>fork()</code> off a child, <code>send_messages()</code>, then <code>listen_for_messages()</code>.</p> <p>Now this code has a couple of problems. One way to see them is to run it:</p> <pre><code>$ ruby sleepy.rb Received 3 messages: 3.03s </code></pre> <p>Doesn't three seconds sound a little slow for modern hardware communicating via a super efficient queuing system? Yeah, it is.</p> <p>I actually put the sleeps in the code manually. Look for these two lines:</p> <pre><code># ... sleep 0.1 # don't peg the CPU while we wait # ... sleep 3 # make sure we're receiving before they are sent # ... </code></pre> <p>Now it's obvious where the three second delay is coming from, eh? Let's talk about why I added that second <code>sleep()</code>.</p> <p>The issue is that once we <code>fork()</code> that child process, it's off to the races. The parent process will continue running too, but we don't know who will get to what first. If the child fires off messages before the parent is listening for them, they will be missed. Instead we need the child to wail until the parent is ready to begin the experiment.</p> <p>My three second sleep is one crude way to sort of handle this. I just delay the child for a significant period of time in computerland. Odds are that the parent will be setup by the time it starts sending. It could still fail though, if my machine was under heavy load at the time and it didn't give my parent process enough attention before the child woke up. Plus, it's slowing our experiment way down. In other words, this is a bad idea all around.</p> <p>The good news is that we can fix it by making some semi-cryptic changes to just one method:</p> <div class="highlight highlight-ruby"><pre><span class="k">def</span> <span class="nf">send_and_receive</span> <span class="n">reader</span><span class="p">,</span> <span class="n">writer</span> <span class="o">=</span> <span class="no">IO</span><span class="o">.</span><span class="n">pipe</span> <span class="n">pid</span> <span class="o">=</span> <span class="nb">fork</span> <span class="k">do</span> <span class="n">writer</span><span class="o">.</span><span class="n">close</span> <span class="n">reader</span><span class="o">.</span><span class="n">read</span> <span class="n">reader</span><span class="o">.</span><span class="n">close</span> <span class="n">send_messages</span><span class="p">(</span><span class="o">*</span><span class="no">MESSAGES</span><span class="p">)</span> <span class="k">end</span> <span class="no">Process</span><span class="o">.</span><span class="n">detach</span><span class="p">(</span><span class="n">pid</span><span class="p">)</span> <span class="n">reader</span><span class="o">.</span><span class="n">close</span> <span class="n">received_messages</span> <span class="o">=</span> <span class="o">[</span> <span class="o">]</span> <span class="n">listen_for_messages</span><span class="p">(</span><span class="n">received_messages</span><span class="p">)</span> <span class="k">do</span> <span class="n">writer</span><span class="o">.</span><span class="n">puts</span> <span class="s2">"ready"</span> <span class="n">writer</span><span class="o">.</span><span class="n">close</span> <span class="n">wait_for_messages</span><span class="p">(</span><span class="n">received_messages</span><span class="p">)</span> <span class="k">end</span> <span class="k">end</span> </pre></div> <p>As you can see, I've introduced a pipe. A pipe is a one-way communication channel between processes. You get an endpoint to write to and another to read from. After you <code>fork()</code>, it's good practice to have each side <code>close()</code> the end they're not using. Then I just have the child call <code>read()</code> on the pipe. This will block until the parent sends some content that can be read. The parent completes its setup, including subscribing to the queue, and then it pushes a simple <code>"ready"</code> message down the pipe. That will get the child unblocked and sending messages.</p> <p>Does this change help? Yes, a lot:</p> <pre><code>$ ruby sleepy.rb Received 3 messages: 0.10s </code></pre> <p>We're three seconds faster.</p> <p>Unfortunately, the remaining delay looks suspiciously like my other call to <code>sleep()</code>. Here's that code to refresh your memory:</p> <div class="highlight highlight-ruby"><pre><span class="k">def</span> <span class="nf">wait_for_messages</span><span class="p">(</span><span class="n">received_messages</span><span class="p">)</span> <span class="k">until</span> <span class="n">received_messages</span> <span class="o">==</span> <span class="no">MESSAGES</span> <span class="nb">sleep</span> <span class="mi">0</span><span class="o">.</span><span class="mi">1</span> <span class="c1"># don't peg the CPU while we wait</span> <span class="k">end</span> <span class="k">end</span> </pre></div> <p>This loop just periodically checks to see if we have our three messages yet. We could technically remove the call to <code>sleep()</code> here and it would run. However, it would waste a lot of CPU time just checking these messages over and over again as fast as possible. Ironically, that bid for speed might starve the child process of resources and slow things down. So we kind of need the <code>sleep()</code>, or something like it.</p> <p>But the problem remains that we're likely getting our messages very quickly and then just waiting for a <code>sleep()</code> call to run out so we notice they have arrived. We can do better with one simple change:</p> <div class="highlight highlight-ruby"><pre><span class="k">def</span> <span class="nf">listen_for_messages</span><span class="p">(</span><span class="n">received_messages</span><span class="p">)</span> <span class="n">connection</span> <span class="o">=</span> <span class="no">Bunny</span><span class="o">.</span><span class="n">new</span><span class="o">.</span><span class="n">tap</span><span class="p">(</span><span class="o">&</span><span class="ss">:start</span><span class="p">)</span> <span class="n">queue</span> <span class="o">=</span> <span class="n">connection</span><span class="o">.</span><span class="n">create_channel</span><span class="o">.</span><span class="n">queue</span><span class="p">(</span><span class="no">QUEUE_NAME</span><span class="p">,</span> <span class="n">auto_delete</span><span class="p">:</span> <span class="kp">true</span><span class="p">)</span> <span class="n">main_thread</span> <span class="o">=</span> <span class="no">Thread</span><span class="o">.</span><span class="n">current</span> <span class="n">queue</span><span class="o">.</span><span class="n">subscribe</span> <span class="k">do</span> <span class="o">|</span><span class="n">delivery_info</span><span class="p">,</span> <span class="n">metadata</span><span class="p">,</span> <span class="n">payload</span><span class="o">|</span> <span class="n">received_messages</span> <span class="o"><<</span> <span class="n">payload</span> <span class="n">main_thread</span><span class="o">.</span><span class="n">wakeup</span> <span class="k">end</span> <span class="n">time_it</span><span class="p">(</span><span class="s2">"Received </span><span class="si">#{</span><span class="no">MESSAGES</span><span class="o">.</span><span class="n">size</span><span class="si">}</span><span class="s2"> messages"</span><span class="p">)</span> <span class="k">do</span> <span class="k">yield</span> <span class="k">end</span> <span class="n">connection</span><span class="o">.</span><span class="n">close</span> <span class="k">end</span> </pre></div> <p>The difference here is that I capture the <code>main_thread</code> before I setup my subscription. Remember, that block will be called in a different <code>Thread</code>. Then, each time I receive a message, I cancel any <code>sleep()</code> the <code>main_thread</code> is currently doing with a call to <code>wakeup()</code>. This means it will recheck, when it should, as new messages arrive.</p> <p>That gives us another significant speed boost:</p> <pre><code>$ ruby sleepy.rb Received 3 messages: 0.01s </code></pre> <p>I would probably stop here, but I should warn you that my solution isn't perfect. Some might be tempted to take this final step:</p> <div class="highlight highlight-ruby"><pre><span class="k">def</span> <span class="nf">wait_for_messages</span><span class="p">(</span><span class="n">received_messages</span><span class="p">)</span> <span class="k">until</span> <span class="n">received_messages</span> <span class="o">==</span> <span class="no">MESSAGES</span> <span class="nb">sleep</span> <span class="k">end</span> <span class="k">end</span> </pre></div> <p>Here the short <code>sleep()</code> has been changed into an indefinite one. You would think this is OK, because the other <code>Thread</code> will wake us when the time comes. Sadly, it's not because my last fix added a race condition. Consider what would happen if the <code>Thread</code>s executed code in this order:</p> <div class="highlight highlight-ruby"><pre><span class="c1"># ...</span> <span class="c1"># first the main thread checks, but finds only two of the three messages:</span> <span class="k">until</span> <span class="n">received_messages</span> <span class="o">==</span> <span class="no">MESSAGES</span> <span class="c1"># ...</span> <span class="c1"># then the listening thread queues the final message and wakes the main</span> <span class="c1"># thread (this has no effect since it isn't currently sleeping):</span> <span class="n">received_messages</span> <span class="o"><<</span> <span class="n">payload</span> <span class="n">main_thread</span><span class="o">.</span><span class="n">wakeup</span> <span class="c1"># ...</span> <span class="c1"># finally the main thread goes back to sleep, forever:</span> <span class="nb">sleep</span> </pre></div> <p>As long as you leave my short <code>sleep</code>, you'll only pay a small penalty if this edge case does kick in.</p> <p>Could we ensure it didn't happen though? Yes, with more message passing! Here's the final code:</p> <div class="highlight highlight-ruby"><pre><span class="c1">#!/usr/bin/env ruby</span> <span class="nb">require</span> <span class="s2">"benchmark"</span> <span class="nb">require</span> <span class="s2">"thread"</span> <span class="nb">require</span> <span class="s2">"bunny"</span> <span class="no">QUEUE_NAME</span> <span class="o">=</span> <span class="s2">"example"</span> <span class="no">MESSAGES</span> <span class="o">=</span> <span class="sx">%w[first second third]</span> <span class="k">def</span> <span class="nf">send_messages</span><span class="p">(</span><span class="o">*</span><span class="n">messages</span><span class="p">)</span> <span class="n">connection</span> <span class="o">=</span> <span class="no">Bunny</span><span class="o">.</span><span class="n">new</span><span class="o">.</span><span class="n">tap</span><span class="p">(</span><span class="o">&</span><span class="ss">:start</span><span class="p">)</span> <span class="n">exchange</span> <span class="o">=</span> <span class="n">connection</span><span class="o">.</span><span class="n">create_channel</span><span class="o">.</span><span class="n">default_exchange</span> <span class="n">messages</span><span class="o">.</span><span class="n">each</span> <span class="k">do</span> <span class="o">|</span><span class="n">message</span><span class="o">|</span> <span class="n">exchange</span><span class="o">.</span><span class="n">publish</span><span class="p">(</span><span class="n">message</span><span class="p">,</span> <span class="n">routing_key</span><span class="p">:</span> <span class="no">QUEUE_NAME</span><span class="p">)</span> <span class="k">end</span> <span class="n">connection</span><span class="o">.</span><span class="n">close</span> <span class="k">end</span> <span class="k">def</span> <span class="nf">listen_for_messages</span><span class="p">(</span><span class="n">received_messages</span><span class="p">,</span> <span class="n">check_queue</span><span class="p">,</span> <span class="n">listen_queue</span><span class="p">)</span> <span class="n">connection</span> <span class="o">=</span> <span class="no">Bunny</span><span class="o">.</span><span class="n">new</span><span class="o">.</span><span class="n">tap</span><span class="p">(</span><span class="o">&</span><span class="ss">:start</span><span class="p">)</span> <span class="n">queue</span> <span class="o">=</span> <span class="n">connection</span><span class="o">.</span><span class="n">create_channel</span><span class="o">.</span><span class="n">queue</span><span class="p">(</span><span class="no">QUEUE_NAME</span><span class="p">,</span> <span class="n">auto_delete</span><span class="p">:</span> <span class="kp">true</span><span class="p">)</span> <span class="n">queue</span><span class="o">.</span><span class="n">subscribe</span> <span class="k">do</span> <span class="o">|</span><span class="n">delivery_info</span><span class="p">,</span> <span class="n">metadata</span><span class="p">,</span> <span class="n">payload</span><span class="o">|</span> <span class="n">received_messages</span> <span class="o"><<</span> <span class="n">payload</span> <span class="n">check_queue</span> <span class="o"><<</span> <span class="ss">:check</span> <span class="n">listen_queue</span><span class="o">.</span><span class="n">pop</span> <span class="k">end</span> <span class="n">time_it</span><span class="p">(</span><span class="s2">"Received </span><span class="si">#{</span><span class="no">MESSAGES</span><span class="o">.</span><span class="n">size</span><span class="si">}</span><span class="s2"> messages"</span><span class="p">)</span> <span class="k">do</span> <span class="k">yield</span> <span class="k">end</span> <span class="n">connection</span><span class="o">.</span><span class="n">close</span> <span class="k">end</span> <span class="k">def</span> <span class="nf">time_it</span><span class="p">(</span><span class="nb">name</span><span class="p">)</span> <span class="n">elapsed</span> <span class="o">=</span> <span class="no">Benchmark</span><span class="o">.</span><span class="n">realtime</span> <span class="k">do</span> <span class="k">yield</span> <span class="k">end</span> <span class="nb">puts</span> <span class="s2">"%s: %.2fs"</span> <span class="o">%</span> <span class="o">[</span><span class="nb">name</span><span class="p">,</span> <span class="n">elapsed</span><span class="o">]</span> <span class="k">end</span> <span class="k">def</span> <span class="nf">wait_for_messages</span><span class="p">(</span><span class="n">received_messages</span><span class="p">,</span> <span class="n">check_queue</span><span class="p">,</span> <span class="n">listen_queue</span><span class="p">)</span> <span class="kp">loop</span> <span class="k">do</span> <span class="n">check_queue</span><span class="o">.</span><span class="n">pop</span> <span class="k">break</span> <span class="k">if</span> <span class="n">received_messages</span> <span class="o">==</span> <span class="no">MESSAGES</span> <span class="n">listen_queue</span> <span class="o"><<</span> <span class="ss">:listen</span> <span class="k">end</span> <span class="k">end</span> <span class="k">def</span> <span class="nf">send_and_receive</span> <span class="n">reader</span><span class="p">,</span> <span class="n">writer</span> <span class="o">=</span> <span class="no">IO</span><span class="o">.</span><span class="n">pipe</span> <span class="n">pid</span> <span class="o">=</span> <span class="nb">fork</span> <span class="k">do</span> <span class="n">writer</span><span class="o">.</span><span class="n">close</span> <span class="n">reader</span><span class="o">.</span><span class="n">read</span> <span class="n">reader</span><span class="o">.</span><span class="n">close</span> <span class="n">send_messages</span><span class="p">(</span><span class="o">*</span><span class="no">MESSAGES</span><span class="p">)</span> <span class="k">end</span> <span class="no">Process</span><span class="o">.</span><span class="n">detach</span><span class="p">(</span><span class="n">pid</span><span class="p">)</span> <span class="n">reader</span><span class="o">.</span><span class="n">close</span> <span class="n">received_messages</span> <span class="o">=</span> <span class="o">[</span> <span class="o">]</span> <span class="n">check_queue</span> <span class="o">=</span> <span class="no">Queue</span><span class="o">.</span><span class="n">new</span> <span class="n">listen_queue</span> <span class="o">=</span> <span class="no">Queue</span><span class="o">.</span><span class="n">new</span> <span class="n">listen_for_messages</span><span class="p">(</span><span class="n">received_messages</span><span class="p">,</span> <span class="n">check_queue</span><span class="p">,</span> <span class="n">listen_queue</span><span class="p">)</span> <span class="k">do</span> <span class="n">writer</span><span class="o">.</span><span class="n">puts</span> <span class="s2">"ready"</span> <span class="n">writer</span><span class="o">.</span><span class="n">close</span> <span class="n">wait_for_messages</span><span class="p">(</span><span class="n">received_messages</span><span class="p">,</span> <span class="n">check_queue</span><span class="p">,</span> <span class="n">listen_queue</span><span class="p">)</span> <span class="k">end</span> <span class="k">end</span> <span class="n">send_and_receive</span> </pre></div> <p>Look Ma, no <code>sleep()</code>!</p> <p>My changes here are very similar to the earlier pipe trick, only I used a <code>Thread</code>-safe <code>Queue</code>. The <code>pop()</code> method of a <code>Queue</code> will block waiting just like <code>IO</code>'s <code>read()</code> did. I also had to introduce two <code>Queue</code>s, because I needed two-way communication. The listening <code>Thread</code> now tells the main <code>Thread</code> when it's time to check and it won't resume listening again until the main <code>Thread</code> gives approval.</p> <p>I think this version is safe from race conditions and it doesn't wake up periodically to check things that haven't changed. It's also still as fast as the unsafe version.</p> <p>If you must do safe multiprocessing, in any language, just pass messages.</p> James Edward Gray II Dave's No Tests Challenge tag:graysoftinc.com,2014-07-20:/posts/122 2014-07-20T22:41:00Z An exploration of what we can learn from the recent challenge that Dave Thomas gave to the Ruby Rogues: "Stop writing tests." <p>I've mentioned before <a href="http://graysoftinc.com/non-code/ipsc-2014-postmortem">my difficulties in the 2014 IPSC</a>. But taking one beating is no reason not to try again. The first loss just showed me that the contest still had more to teach me.</p> <p>A buddy of mine has spent some time with <a href="http://ipsc.ksp.sk/2014/real/problems/k.html">the crossword problem</a> and told me that he enjoyed it. I didn't try this problem during the actual event, but I was a little familiar with it from my friend's description.</p> <p>To add to the fun, I decided this would be a great excuse to take up <a href="http://rubyrogues.com/164-rr-staying-sharp-with-dave-thomas/">the recent challenge Dave Thomas gave to the Ruby Rogues</a>: "Stop writing tests."</p> <h4>Step 1: Feedback Loops</h4> <p>Without tests to guide me, I really want to see what's going on. One of the biggest advantages of tests, in my opinion, is the feedback loop it provides. So I set out to provide my own feedback.</p> <p>Since the problem at hand involves filling in a crossword board, the easiest feedback loop I could think of was to see the board as it fills in. The final board is also the required output. Therefor, I decided a good first step would just be to read the board into some data structure and write it back out. Once I had that, I could insert code between those steps to fill it in. And constantly seeing the board evolve would let me eyeball things for obvious mistakes.</p> <p>I set out to make that happen, with the minimal amount of effort. First I created a project:</p> <pre><code>$ mkdir -p daves_no_tests_challenge/{bin,data,lib} $ cd daves_no_tests_challenge/ $ git init Initialized empty Git repository in /Users/jeg2/Desktop/daves_no_tests_challenge/.git/ </code></pre> <p>Then I built a minimal data structure:</p> <div class="highlight highlight-ruby"><pre><span class="k">module</span> <span class="nn">Crossword</span> <span class="k">class</span> <span class="nc">Board</span> <span class="k">def</span> <span class="nf">initialize</span><span class="p">(</span><span class="n">squares</span><span class="p">)</span> <span class="vi">@squares</span> <span class="o">=</span> <span class="n">squares</span> <span class="k">end</span> <span class="kp">attr_reader</span> <span class="ss">:squares</span> <span class="kp">private</span> <span class="ss">:squares</span> <span class="k">def</span> <span class="nf">to_s</span> <span class="n">squares</span><span class="o">.</span><span class="n">map</span> <span class="p">{</span> <span class="o">|</span><span class="n">row</span><span class="o">|</span> <span class="n">row</span><span class="o">.</span><span class="n">join</span> <span class="p">}</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="s2">"</span><span class="se">\n</span><span class="s2">"</span><span class="p">)</span> <span class="k">end</span> <span class="k">end</span> <span class="k">end</span> </pre></div> <p>That code just takes in and stringifies (for output) some rows of crossword squares. Eventually, this code will need to be able to add answers, but that isn't needed for this first pass.</p> <p>Next I wrapped my fledgling data structure in some reading and writing code:</p> <div class="highlight highlight-ruby"><pre><span class="n">require_relative</span> <span class="s2">"board"</span> <span class="k">module</span> <span class="nn">Crossword</span> <span class="k">class</span> <span class="nc">Solver</span> <span class="k">def</span> <span class="nf">initialize</span><span class="p">(</span><span class="n">input</span><span class="p">,</span> <span class="n">output</span><span class="p">)</span> <span class="vi">@input</span> <span class="o">=</span> <span class="n">input</span> <span class="vi">@output</span> <span class="o">=</span> <span class="n">output</span> <span class="vi">@board</span> <span class="o">=</span> <span class="kp">nil</span> <span class="k">end</span> <span class="kp">attr_reader</span> <span class="ss">:input</span><span class="p">,</span> <span class="ss">:output</span><span class="p">,</span> <span class="ss">:board</span> <span class="kp">private</span> <span class="ss">:input</span><span class="p">,</span> <span class="ss">:output</span><span class="p">,</span> <span class="ss">:board</span> <span class="k">def</span> <span class="nf">solve</span> <span class="n">parse_board</span> <span class="n">write_board</span> <span class="k">end</span> <span class="kp">private</span> <span class="k">def</span> <span class="nf">parse_board</span> <span class="n">rows</span><span class="p">,</span> <span class="n">columns</span> <span class="o">=</span> <span class="n">input</span><span class="o">.</span><span class="n">gets</span><span class="o">.</span><span class="n">scan</span><span class="p">(</span><span class="sr">/\d+/</span><span class="p">)</span><span class="o">.</span><span class="n">map</span><span class="p">(</span><span class="o">&</span><span class="ss">:to_i</span><span class="p">)</span> <span class="vi">@board</span> <span class="o">=</span> <span class="no">Board</span><span class="o">.</span><span class="n">new</span><span class="p">(</span> <span class="nb">Array</span><span class="o">.</span><span class="n">new</span><span class="p">(</span><span class="n">rows</span><span class="p">)</span> <span class="p">{</span> <span class="n">input</span><span class="o">.</span><span class="n">gets</span><span class="o">.</span><span class="n">chars</span><span class="o">.</span><span class="n">first</span><span class="p">(</span><span class="n">columns</span><span class="p">)</span> <span class="p">}</span> <span class="p">)</span> <span class="k">end</span> <span class="k">def</span> <span class="nf">write_board</span> <span class="n">output</span><span class="o">.</span><span class="n">puts</span> <span class="n">board</span> <span class="k">end</span> <span class="k">end</span> <span class="k">end</span> </pre></div> <p>That code just parses the <code>Board</code> using the dimensions in the input file and writes it back out. This class gives me a place to hang some clue solving code, when I'm ready for that.</p> <p>In preparation for adding an executable, I collapsed this process into a simple method call:</p> <div class="highlight highlight-ruby"><pre><span class="n">require_relative</span> <span class="s2">"crossword/solver"</span> <span class="k">module</span> <span class="nn">Crossword</span> <span class="kp">module_function</span> <span class="k">def</span> <span class="nf">solve</span><span class="p">(</span><span class="o">*</span><span class="n">args</span><span class="p">)</span> <span class="no">Solver</span><span class="o">.</span><span class="n">new</span><span class="p">(</span><span class="o">*</span><span class="n">args</span><span class="p">)</span><span class="o">.</span><span class="n">solve</span> <span class="k">end</span> <span class="k">end</span> </pre></div> <p>Finally, I added the minimal binary:</p> <div class="highlight highlight-ruby"><pre><span class="c1">#!/usr/bin/env ruby -w</span> <span class="n">require_relative</span> <span class="s2">"../lib/crossword"</span> <span class="no">Crossword</span><span class="o">.</span><span class="n">solve</span><span class="p">(</span><span class="no">ARGF</span><span class="p">,</span> <span class="vg">$stdout</span><span class="p">)</span> </pre></div> <p>If we make that file executable and point it at the easy input, we can see our first empty crossword:</p> <pre><code>$ chmod +x bin/solve $ bin/solve data/k1.in ........#.#...#.#.#####....... ......######..#.#..#...####... ..####..#.#..#######...#...... ....#.######..#.#..#.#.#...... ....#...#.#...#.#.######...... ....#...#.########.#.#.#####.. .#######....#...#..#.#.#...... .#..#.#.#######......#....#... .#....#.....#.#.......#...#... .#....#.########..#########... .######.#.#.#.#.#.....#...#... .#....#.#.#.#.#.#.##########.. .....########.#.#.....#...#... .#..#.#.#.#...#.#########.#... ######...####.#.......#.#.#... .#..#.#.#.#....############..# .#..########.#....#...#.#....# .#..#.#.#...#####.##########.# .#..#.#.#..#.#....#.....#.#..# ...#########.#########..#.#..# ....#.#.#..#.#....#.#.######## ......#.#..#.#########..#.#..# .#.#..#.#..#.#..#.#.#...#.#... .#.#.......#.#..#.#.#.#...#... #####.#########.#.#.#.#...#.#. .#.#..#.#..#....#..########.#. .######.#..#######..#.#...#.#. ...#..#.#.......#...#.#.....#. ....######...######...#.....#. ......#.#.............#######. </code></pre> <p>Seeing this made me realize that there are two sides to crosswords: the board and the clues. I now had some visibility into one side, but what about clues?</p> <p>For clues I wanted to know, what am I handling and what am I not. If I printed out the not yet handled stuff, I could scan such a list for similar clues and then write the code to handle them. I should then see the unhandled clue list shrink and some answers appear on the board. I could then just repeat that process until I am done.</p> <p>This requires just two changes to my <code>Solver</code>:</p> <div class="highlight highlight-ruby"><pre><span class="c1"># ...</span> <span class="k">module</span> <span class="nn">Crossword</span> <span class="k">class</span> <span class="nc">Solver</span> <span class="c1"># ...</span> <span class="k">def</span> <span class="nf">solve</span> <span class="n">parse_board</span> <span class="n">solve_clues</span> <span class="n">write_board</span> <span class="k">end</span> <span class="kp">private</span> <span class="c1"># ...</span> <span class="k">def</span> <span class="nf">solve_clues</span> <span class="o">%</span><span class="n">i</span><span class="o">[</span><span class="n">across</span> <span class="n">down</span><span class="o">].</span><span class="n">each</span> <span class="k">do</span> <span class="o">|</span><span class="n">direction</span><span class="o">|</span> <span class="n">count</span> <span class="o">=</span> <span class="nb">gets</span><span class="o">.</span><span class="n">to_i</span> <span class="n">count</span><span class="o">.</span><span class="n">times</span> <span class="k">do</span> <span class="n">row</span><span class="p">,</span> <span class="n">column</span><span class="p">,</span> <span class="n">clue</span> <span class="o">=</span> <span class="nb">gets</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s2">" "</span><span class="p">,</span> <span class="mi">3</span><span class="p">)</span><span class="o">.</span><span class="n">map</span><span class="o">.</span><span class="n">with_index</span> <span class="p">{</span> <span class="o">|</span><span class="n">str</span><span class="p">,</span> <span class="n">i</span><span class="o">|</span> <span class="n">i</span> <span class="o"><</span> <span class="mi">2</span> <span class="o">?</span> <span class="n">str</span><span class="o">.</span><span class="n">to_i</span> <span class="p">:</span> <span class="n">str</span><span class="o">.</span><span class="n">strip</span> <span class="p">}</span> <span class="k">if</span> <span class="kp">false</span> <span class="c1"># FIXME: match a clue</span> <span class="c1"># FIXME: write the answer to the board</span> <span class="k">else</span> <span class="nb">warn</span> <span class="s2">"No match: </span><span class="si">#{</span><span class="n">clue</span><span class="si">}</span><span class="s2">"</span> <span class="k">end</span> <span class="k">end</span> <span class="k">end</span> <span class="k">end</span> <span class="c1"># ...</span> <span class="k">end</span> <span class="k">end</span> </pre></div> <p>I added a <code>solve_clues()</code> step to the overall process, then fleshed out that method just enough to parse clues and consider all of them failures. Notice that I got a bit hand wavy with how the solving stuff was actually going to work. It didn't matter yet. I also put the clue warnings on <code>STDERR</code> because they aren't legally part of the output and I wanted to be able to redirect them and the board independently.</p> <p>Now I had a lot of output, but it showed me exactly what I needed to do:</p> <pre><code>No match: Pokemon which evolves from Oddish No match: Pokemon which evolves from Spearow No match: Chemical element with the symbol Au No match: Pokemon with number #63 No match: Pokemon with number #137 No match: Last name of the President of the United States who held the office in 1987 No match: Chemical element with the symbol Na No match: Chemical element with the symbol W No match: Pokemon which evolves into Arbok No match: Pokemon which evolves from Machoke … ........#.#...#.#.#####....... ......######..#.#..#...####... ..####..#.#..#######...#...... ....#.######..#.#..#.#.#...... ....#...#.#...#.#.######...... ....#...#.########.#.#.#####.. .#######....#...#..#.#.#...... .#..#.#.#######......#....#... .#....#.....#.#.......#...#... .#....#.########..#########... .######.#.#.#.#.#.....#...#... .#....#.#.#.#.#.#.##########.. .....########.#.#.....#...#... .#..#.#.#.#...#.#########.#... ######...####.#.......#.#.#... .#..#.#.#.#....############..# .#..########.#....#...#.#....# .#..#.#.#...#####.##########.# .#..#.#.#..#.#....#.....#.#..# ...#########.#########..#.#..# ....#.#.#..#.#....#.#.######## ......#.#..#.#########..#.#..# .#.#..#.#..#.#..#.#.#...#.#... .#.#.......#.#..#.#.#.#...#... #####.#########.#.#.#.#...#.#. .#.#..#.#..#....#..########.#. .######.#..#######..#.#...#.#. ...#..#.#.......#...#.#.....#. ....######...######...#.....#. ......#.#.............#######. </code></pre> <h4>Step 2: Strategies</h4> <p>Satisfied that I could now follow my process without using a test suite, it was time to make this problem easy to solve.</p> <p>I realized that different clues would need different strategies to solve and I might need to write several of those. This made me want to add a little bit of infrastructure for loading and matching strategies. I figured I could solve that problem now, then focus in entirely on clue specifics.</p> <p>I sketched out a base class for this approach:</p> <div class="highlight highlight-ruby"><pre><span class="k">module</span> <span class="nn">Crossword</span> <span class="k">class</span> <span class="nc">Strategy</span> <span class="k">def</span> <span class="nc">self</span><span class="o">.</span><span class="nf">strategies</span> <span class="vi">@strategies</span> <span class="o">||=</span> <span class="o">[</span> <span class="o">]</span> <span class="k">end</span> <span class="k">def</span> <span class="nc">self</span><span class="o">.</span><span class="nf">inherited</span><span class="p">(</span><span class="n">subclass</span><span class="p">)</span> <span class="n">strategies</span> <span class="o"><<</span> <span class="n">subclass</span> <span class="k">end</span> <span class="k">def</span> <span class="nc">self</span><span class="o">.</span><span class="nf">load</span><span class="p">(</span><span class="n">dir</span> <span class="o">=</span> <span class="no">File</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">__dir__</span><span class="p">,</span> <span class="s2">"strategies"</span><span class="p">))</span> <span class="no">Dir</span><span class="o">.</span><span class="n">glob</span><span class="p">(</span><span class="s2">"</span><span class="si">#{</span><span class="n">dir</span><span class="si">}</span><span class="s2">/*.rb"</span><span class="p">)</span> <span class="k">do</span> <span class="o">|</span><span class="n">path</span><span class="o">|</span> <span class="no">Kernel</span><span class="o">.</span><span class="n">load</span> <span class="n">path</span> <span class="k">end</span> <span class="k">end</span> <span class="k">def</span> <span class="nc">self</span><span class="o">.</span><span class="nf">match</span><span class="p">(</span><span class="n">clue</span><span class="p">)</span> <span class="n">strategies</span><span class="o">.</span><span class="n">each</span> <span class="k">do</span> <span class="o">|</span><span class="n">subclass</span><span class="o">|</span> <span class="n">strategy</span> <span class="o">=</span> <span class="n">subclass</span><span class="o">.</span><span class="n">new</span><span class="p">(</span><span class="n">clue</span><span class="p">)</span> <span class="k">return</span> <span class="n">strategy</span> <span class="k">if</span> <span class="n">strategy</span><span class="o">.</span><span class="n">match?</span> <span class="k">end</span> <span class="kp">nil</span> <span class="k">end</span> <span class="k">def</span> <span class="nf">initialize</span><span class="p">(</span><span class="n">clue</span><span class="p">)</span> <span class="vi">@clue</span> <span class="o">=</span> <span class="n">clue</span> <span class="vi">@match_data</span> <span class="o">=</span> <span class="kp">nil</span> <span class="k">end</span> <span class="kp">attr_reader</span> <span class="ss">:clue</span><span class="p">,</span> <span class="ss">:match_data</span> <span class="kp">private</span> <span class="ss">:clue</span><span class="p">,</span> <span class="ss">:match_data</span> <span class="k">def</span> <span class="nf">match?</span> <span class="vi">@match_data</span> <span class="o">=</span> <span class="nb">self</span><span class="o">.</span><span class="n">class</span><span class="o">.</span><span class="n">const_get</span><span class="p">(</span><span class="ss">:CLUE_REGEX</span><span class="p">)</span><span class="o">.</span><span class="n">match</span><span class="p">(</span><span class="n">clue</span><span class="p">)</span> <span class="k">end</span> <span class="k">def</span> <span class="nf">answer</span> <span class="nb">fail</span> <span class="no">NotImplementedError</span><span class="p">,</span> <span class="s2">"Strategies must override answer()"</span> <span class="k">end</span> <span class="k">end</span> <span class="k">end</span> </pre></div> <p>The four class methods all work together to support this simple process:</p> <ol> <li>I plan to define subclasses of <code>Strategy</code> </li> <li>And I'll throw all of them in the same directory</li> <li>So dynamically load everything in there</li> <li>Then search through all subclasses to find one that matches the current clue</li> </ol><p>The two instance methods handle matching and generating answers for clues. Originally I considered forcing subclasses to implement both. However a glance at the clues made me feel that at least some could be matched with a simple regex. I decided to make that the default behavior. Subclasses can still override <code>match?()</code> if they need more complex logic.</p> <p>My use of a constant for the regex is a little tricky. Had I used a bare constant, Ruby would have resolved it based on the current scope. Put simply, it would have searched for a constant in this class. (That's an over simplification, but true enough here.) It would not find a constant defined in a <code>Strategy</code> subclass, where I wanted to put them. Because of that, I look up the constant manually, using Ruby's reflection capabilities. This code will find a constant in the subclass. The truth is, it will fail with an error if the subclass does not define the constant, but I expect <code>match?()</code> to be overriden in those cases.</p> <p>Plugging these strategies into the <code>Solver</code> is just four lines of code, explained inline:</p> <div class="highlight highlight-ruby"><pre><span class="n">require_relative</span> <span class="s2">"board"</span> <span class="n">require_relative</span> <span class="s2">"strategy"</span> <span class="c1"># 1: load the dependency</span> <span class="k">module</span> <span class="nn">Crossword</span> <span class="k">class</span> <span class="nc">Solver</span> <span class="c1"># ...</span> <span class="kp">private</span> <span class="c1"># ...</span> <span class="k">def</span> <span class="nf">solve_clues</span> <span class="no">Strategy</span><span class="o">.</span><span class="n">load</span> <span class="c1"># 2: dynamically load all available strategies</span> <span class="o">%</span><span class="n">i</span><span class="o">[</span><span class="n">across</span> <span class="n">down</span><span class="o">].</span><span class="n">each</span> <span class="k">do</span> <span class="o">|</span><span class="n">direction</span><span class="o">|</span> <span class="n">count</span> <span class="o">=</span> <span class="nb">gets</span><span class="o">.</span><span class="n">to_i</span> <span class="n">count</span><span class="o">.</span><span class="n">times</span> <span class="k">do</span> <span class="n">row</span><span class="p">,</span> <span class="n">column</span><span class="p">,</span> <span class="n">clue</span> <span class="o">=</span> <span class="nb">gets</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s2">" "</span><span class="p">,</span> <span class="mi">3</span><span class="p">)</span><span class="o">.</span><span class="n">map</span><span class="o">.</span><span class="n">with_index</span> <span class="p">{</span> <span class="o">|</span><span class="n">str</span><span class="p">,</span> <span class="n">i</span><span class="o">|</span> <span class="n">i</span> <span class="o"><</span> <span class="mi">2</span> <span class="o">?</span> <span class="n">str</span><span class="o">.</span><span class="n">to_i</span> <span class="p">:</span> <span class="n">str</span><span class="o">.</span><span class="n">strip</span> <span class="p">}</span> <span class="k">if</span> <span class="p">(</span><span class="n">strategy</span> <span class="o">=</span> <span class="no">Strategy</span><span class="o">.</span><span class="n">match</span><span class="p">(</span><span class="n">clue</span><span class="p">))</span> <span class="c1"># 3: find a match for the clue</span> <span class="c1"># 4: record the answer on the Board:</span> <span class="n">board</span><span class="o">.</span><span class="n">send</span><span class="p">(</span><span class="s2">"record_</span><span class="si">#{</span><span class="n">direction</span><span class="si">}</span><span class="s2">"</span><span class="p">,</span> <span class="n">row</span><span class="p">,</span> <span class="n">column</span><span class="p">,</span> <span class="n">strategy</span><span class="o">.</span><span class="n">answer</span><span class="p">)</span> <span class="k">else</span> <span class="nb">warn</span> <span class="s2">"No match: </span><span class="si">#{</span><span class="n">clue</span><span class="si">}</span><span class="s2">"</span> <span class="k">end</span> <span class="k">end</span> <span class="k">end</span> <span class="k">end</span> <span class="c1"># ...</span> <span class="k">end</span> <span class="k">end</span> </pre></div> <p>As you can see, this required the <code>Board</code> to gain some new methods as well, for recording answers:</p> <div class="highlight highlight-ruby"><pre><span class="k">module</span> <span class="nn">Crossword</span> <span class="k">class</span> <span class="nc">Board</span> <span class="c1"># ...</span> <span class="k">def</span> <span class="nf">record_across</span><span class="p">(</span><span class="n">row</span><span class="p">,</span> <span class="n">column</span><span class="p">,</span> <span class="n">answer</span><span class="p">)</span> <span class="n">answer</span><span class="o">.</span><span class="n">downcase</span><span class="o">.</span><span class="n">chars</span><span class="o">.</span><span class="n">each_with_index</span> <span class="k">do</span> <span class="o">|</span><span class="n">char</span><span class="p">,</span> <span class="n">i</span><span class="o">|</span> <span class="n">record</span><span class="p">(</span><span class="n">row</span><span class="p">,</span> <span class="n">column</span> <span class="o">+</span> <span class="n">i</span><span class="p">,</span> <span class="n">char</span><span class="p">)</span> <span class="k">end</span> <span class="k">end</span> <span class="k">def</span> <span class="nf">record_down</span><span class="p">(</span><span class="n">row</span><span class="p">,</span> <span class="n">column</span><span class="p">,</span> <span class="n">answer</span><span class="p">)</span> <span class="n">answer</span><span class="o">.</span><span class="n">downcase</span><span class="o">.</span><span class="n">chars</span><span class="o">.</span><span class="n">each_with_index</span> <span class="k">do</span> <span class="o">|</span><span class="n">char</span><span class="p">,</span> <span class="n">i</span><span class="o">|</span> <span class="n">record</span><span class="p">(</span><span class="n">row</span> <span class="o">+</span> <span class="n">i</span><span class="p">,</span> <span class="n">column</span><span class="p">,</span> <span class="n">char</span><span class="p">)</span> <span class="k">end</span> <span class="k">end</span> <span class="c1"># ...</span> <span class="kp">private</span> <span class="k">def</span> <span class="nf">record</span><span class="p">(</span><span class="n">row</span><span class="p">,</span> <span class="n">column</span><span class="p">,</span> <span class="n">char</span><span class="p">)</span> <span class="n">square</span> <span class="o">=</span> <span class="n">squares</span><span class="o">[</span><span class="n">row</span><span class="o">][</span><span class="n">column</span><span class="o">]</span> <span class="nb">fail</span> <span class="s2">"Outside of board"</span> <span class="k">if</span> <span class="n">square</span><span class="o">.</span><span class="n">nil?</span> <span class="nb">fail</span> <span class="s2">"Outside of answer"</span> <span class="k">if</span> <span class="n">square</span> <span class="o">==</span> <span class="s2">"."</span> <span class="nb">fail</span> <span class="s2">"Answer mismatch"</span> <span class="k">if</span> <span class="o">![</span><span class="s2">"#"</span><span class="p">,</span> <span class="n">char</span><span class="o">].</span><span class="n">include?</span><span class="p">(</span><span class="n">char</span><span class="p">)</span> <span class="n">square</span><span class="o">.</span><span class="n">replace</span><span class="p">(</span><span class="n">char</span><span class="p">)</span> <span class="k">end</span> <span class="k">end</span> <span class="k">end</span> </pre></div> <p>I did notice that <code>record_across()</code> and <code>record_down()</code> had some duplication that could be removed with some <code>yield</code> magic. This is a pretty simple case though and I decided to let it ride.</p> <p>You'll noticed that I cranked the paranoia up a bit in <code>record()</code>. Placing letters in a crossword puzzle is a great time to notice several potential problems like overruns or answers that don't agree. I don't know if I would have added all of these guard clauses in the presence of a strong test suite, but I liked seeing them here in the end. I think the extra checks here, where they mattered most, helped me write the rest of the code with more confidence.</p> <p>This felt like enough infrastructure to start solving actual clues.</p> <p>I decided to start with the Pokémon questions. Glancing through the lists, I saw two different flavors of clues. So I went hunting for <a href="https://raw.githubusercontent.com/veekun/pokedex/master/pokedex/data/csv/pokemon.csv">a data file that could answer both types of questions in an easy-to-read format</a>. Having found that, I needed some code to parse the data and allow me to search through it:</p> <div class="highlight highlight-ruby"><pre><span class="nb">require</span> <span class="s2">"csv"</span> <span class="k">module</span> <span class="nn">Crossword</span> <span class="k">class</span> <span class="nc">PokemonList</span> <span class="k">def</span> <span class="nc">self</span><span class="o">.</span><span class="nf">loaded</span> <span class="vi">@loaded</span> <span class="o">||=</span> <span class="kp">new</span> <span class="k">end</span> <span class="k">def</span> <span class="nc">self</span><span class="o">.</span><span class="nf">method_missing</span><span class="p">(</span><span class="nb">method</span><span class="p">,</span> <span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">&</span><span class="n">block</span><span class="p">)</span> <span class="k">if</span> <span class="n">loaded</span><span class="o">.</span><span class="n">respond_to?</span><span class="p">(</span><span class="nb">method</span><span class="p">)</span> <span class="n">loaded</span><span class="o">.</span><span class="n">send</span><span class="p">(</span><span class="nb">method</span><span class="p">,</span> <span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">&</span><span class="n">block</span><span class="p">)</span> <span class="k">else</span> <span class="k">super</span> <span class="k">end</span> <span class="k">end</span> <span class="k">def</span> <span class="nf">initialize</span><span class="p">(</span><span class="n">path</span> <span class="o">=</span> <span class="no">File</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">__dir__</span><span class="p">,</span> <span class="o">*</span><span class="sx">%w[.. .. data pokemon.csv]</span><span class="p">))</span> <span class="vi">@pokemon</span> <span class="o">=</span> <span class="no">CSV</span><span class="o">.</span><span class="n">read</span><span class="p">(</span><span class="n">path</span><span class="p">,</span> <span class="ss">headers</span><span class="p">:</span> <span class="kp">true</span><span class="p">,</span> <span class="n">header_converters</span><span class="p">:</span> <span class="ss">:symbol</span><span class="p">)</span> <span class="k">end</span> <span class="kp">attr_reader</span> <span class="ss">:pokemon</span> <span class="kp">private</span> <span class="ss">:pokemon</span> <span class="k">def</span> <span class="nf">find_by_number</span><span class="p">(</span><span class="n">number</span><span class="p">)</span> <span class="n">pokemon</span><span class="o">.</span><span class="n">find</span> <span class="p">{</span> <span class="o">|</span><span class="n">record</span><span class="o">|</span> <span class="n">record</span><span class="o">[</span><span class="ss">:id</span><span class="o">]</span> <span class="o">==</span> <span class="n">number</span> <span class="p">}</span> <span class="k">end</span> <span class="k">end</span> <span class="k">end</span> </pre></div> <p>I do the actual parse in <code>initialize()</code>, just handing off to the standard <code>CSV</code> library. The class methods setup a system of fowarding to the instance methods for searching through a loaded data set. The only search I needed to drop the first set of clues was an ability to find a Pokémon by number.</p> <p>With this database ready to go, the actual strategy for solving the clue is almost a non-event:</p> <div class="highlight highlight-ruby"><pre><span class="n">require_relative</span> <span class="s2">"../pokemon_list"</span> <span class="k">module</span> <span class="nn">Crossword</span> <span class="k">class</span> <span class="nc">PokemonNumber</span> <span class="o"><</span> <span class="no">Strategy</span> <span class="no">CLUE_REGEX</span> <span class="o">=</span> <span class="sr">/\APokemon with number #(?<number>\d+)\z/</span> <span class="k">def</span> <span class="nf">answer</span> <span class="no">PokemonList</span><span class="o">.</span><span class="n">find_by_number</span><span class="p">(</span><span class="n">match_data</span><span class="o">[</span><span class="ss">:number</span><span class="o">]</span><span class="p">)</span><span class="o">[</span><span class="ss">:identifier</span><span class="o">]</span> <span class="k">end</span> <span class="k">end</span> <span class="k">end</span> </pre></div> <p>You can finally see how my stategies pay off here. I write a regex to match the clue, capturing the key bits, then use those bits to find the right answer when called upon to do so.</p> <p>It was time to check in on those feedback loops:</p> <pre><code>No match: Pokemon which evolves from Oddish No match: Pokemon which evolves from Spearow No match: Chemical element with the symbol Au … ........#.#...#.#.#####....... ......######..#.#..#...g###... ..abra..#.#..porygon...r...... ....#.######..#.#..#.d.i...... ....#...#.#...#.#.###i#m...... ....#...#.########.#.t.e####.. .m######....#...#..#.t.r...... .e..#.#.#######......o....#... .w....#.....#.#.......#...#... .t....#.##a#####..#########... .w#####.#.r.#.#.#.....#...#... .o....#.#.t.#.#.#.hitmonchan.. .....#####i##.#.#.....#...#... .m..#.#.#.c...#.#########.#... #a####...#u##.#.......#.#.#... .c..#.#.#.n....############..# .h..######o#.s....#...#.#....# .o..#.#.#...#a###.charmander.# .p..#.#.#..#.n....#.....#.#..# ...#########.dragonite..#.#..# ....#.#.#..#.s....#.#.primeape ......#.#..#.lickitung..#.#..# .#.w..#.#..#.a..#.#.#...#.#... .#.e.......#.s..#.#.#.#...#... ###e#.growlithe.#.#.#.#...#.k. .#.d..#.#..#....#..########.r. .##l###.#..#######..#.#...#.a. ...e..#.#.......#...#.#.....b. ....######...pinsir...#.....b. ......#.#.............######y. </code></pre> <p>There are two things to notice here:</p> <ul> <li>There are still plenty of unsolved clues, including another flavor of Pokémon clues</li> <li>The board is starting to fill in and we even see some clues sharing squares</li> </ul><h4>Step 3: The Real Problem</h4> <p>The rest of this puzzle was just about writing strategies to solve the various clues and it went pretty smoothly. I'm not going to show all of them. Checkout <a href="https://github.com/JEG2/daves_no_test_challenge">the repository on GitHub</a>, if you're curious.</p> <p>I'll show you the most challenging clue type though, just for fun. Check out this one:</p> <pre><code>No match: Last name of the next President of the United States after Harry S. Truman </code></pre> <p>This clue is still just a lookup in a database, but names are involved. Names can be quite a curve ball. Trust the guy named James Edward Gray II and married to Dana Ann Leslie Gray. There's not a form in the world that handles both of our names gracefully. I knew enough to fear this part, because there was very little chance of the database perfectly matching the clues. Given that, I built an object just to handle name comparisons:</p> <div class="highlight highlight-ruby"><pre><span class="k">module</span> <span class="nn">Crossword</span> <span class="k">class</span> <span class="nc">Name</span> <span class="k">def</span> <span class="nf">initialize</span><span class="p">(</span><span class="n">full_name</span><span class="p">)</span> <span class="vi">@full_name</span> <span class="o">=</span> <span class="n">full_name</span> <span class="k">end</span> <span class="kp">attr_reader</span> <span class="ss">:full_name</span> <span class="kp">private</span> <span class="ss">:full_name</span> <span class="k">def</span> <span class="nf">first_name</span> <span class="n">full_name</span><span class="o">[</span><span class="sr">/\A\w+/</span><span class="o">]</span> <span class="k">end</span> <span class="k">def</span> <span class="nf">last_name</span> <span class="n">full_name</span><span class="o">[</span><span class="sr">/\w+\z/</span><span class="o">]</span> <span class="k">end</span> <span class="k">def</span> <span class="nf">==</span><span class="p">(</span><span class="n">other</span><span class="p">)</span> <span class="n">first_name</span> <span class="o">==</span> <span class="n">other</span><span class="o">.</span><span class="n">first_name</span> <span class="o">&&</span> <span class="n">last_name</span> <span class="o">==</span> <span class="n">other</span><span class="o">.</span><span class="n">last_name</span> <span class="k">end</span> <span class="k">end</span> <span class="k">end</span> </pre></div> <p>Now I'll be honest: I cheated here. A lot. I didn't need to worry about suffixes because my database didn't include them and I didn't need to consider middle names or initials in the comparisons for these easy clues. (That's not true in the hard input!) I was lucky that both lists were small enough for me to visually scan for issues like that. It saved me a fair bit of code.</p> <p>The president database is similar to what you saw for Pokémon:</p> <div class="highlight highlight-ruby"><pre><span class="nb">require</span> <span class="s2">"csv"</span> <span class="n">require_relative</span> <span class="s2">"name"</span> <span class="k">module</span> <span class="nn">Crossword</span> <span class="k">class</span> <span class="nc">PresidentList</span> <span class="k">def</span> <span class="nc">self</span><span class="o">.</span><span class="nf">loaded</span> <span class="vi">@loaded</span> <span class="o">||=</span> <span class="kp">new</span> <span class="k">end</span> <span class="k">def</span> <span class="nc">self</span><span class="o">.</span><span class="nf">method_missing</span><span class="p">(</span><span class="nb">method</span><span class="p">,</span> <span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">&</span><span class="n">block</span><span class="p">)</span> <span class="k">if</span> <span class="n">loaded</span><span class="o">.</span><span class="n">respond_to?</span><span class="p">(</span><span class="nb">method</span><span class="p">)</span> <span class="n">loaded</span><span class="o">.</span><span class="n">send</span><span class="p">(</span><span class="nb">method</span><span class="p">,</span> <span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">&</span><span class="n">block</span><span class="p">)</span> <span class="k">else</span> <span class="k">super</span> <span class="k">end</span> <span class="k">end</span> <span class="k">def</span> <span class="nf">initialize</span><span class="p">(</span><span class="n">path</span> <span class="o">=</span> <span class="no">File</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">__dir__</span><span class="p">,</span> <span class="o">*</span><span class="sx">%w[.. .. data presidents.csv]</span><span class="p">))</span> <span class="vi">@presidents</span> <span class="o">=</span> <span class="no">CSV</span><span class="o">.</span><span class="n">read</span><span class="p">(</span> <span class="n">path</span><span class="p">,</span> <span class="ss">headers</span><span class="p">:</span> <span class="kp">true</span><span class="p">,</span> <span class="n">header_converters</span><span class="p">:</span> <span class="ss">:symbol</span><span class="p">,</span> <span class="ss">converters</span><span class="p">:</span> <span class="nb">lambda</span> <span class="p">{</span> <span class="o">|</span><span class="n">field</span><span class="p">,</span> <span class="n">field_info</span><span class="o">|</span> <span class="k">if</span> <span class="n">field_info</span><span class="o">.</span><span class="n">header</span> <span class="o">==</span> <span class="ss">:president</span> <span class="no">Name</span><span class="o">.</span><span class="n">new</span><span class="p">(</span><span class="n">field</span><span class="o">.</span><span class="n">sub</span><span class="p">(</span><span class="s2">" (2nd term)"</span><span class="p">,</span> <span class="s2">""</span><span class="p">))</span> <span class="k">else</span> <span class="n">field</span> <span class="k">end</span> <span class="p">}</span> <span class="p">)</span> <span class="k">end</span> <span class="kp">attr_reader</span> <span class="ss">:presidents</span> <span class="kp">private</span> <span class="ss">:presidents</span> <span class="k">def</span> <span class="nf">find_by_name</span><span class="p">(</span><span class="nb">name</span><span class="p">)</span> <span class="n">presidents</span><span class="o">.</span><span class="n">find</span> <span class="p">{</span> <span class="o">|</span><span class="n">record</span><span class="o">|</span> <span class="n">record</span><span class="o">[</span><span class="ss">:president</span><span class="o">]</span> <span class="o">==</span> <span class="nb">name</span> <span class="p">}</span> <span class="k">end</span> <span class="k">def</span> <span class="nf">find_by_number</span><span class="p">(</span><span class="n">number</span><span class="p">)</span> <span class="n">presidents</span><span class="o">.</span><span class="n">find</span> <span class="p">{</span> <span class="o">|</span><span class="n">record</span><span class="o">|</span> <span class="n">record</span><span class="o">[</span><span class="ss">:presidency</span><span class="o">]</span> <span class="o">==</span> <span class="n">number</span> <span class="p">}</span> <span class="k">end</span> <span class="k">end</span> <span class="k">end</span> </pre></div> <p>You can see that I used the same class method forwarding trick here. In fact, I used it in all three databases that I built to solve this problem. Were I not just playing around here, I'm pretty sure I would have felt compelled to extract the common code into a superclass, but I knew there was almost no chance I would need to change it during this exercise. Copy and paste coding turned out to be good enough for this case.</p> <p>The main difference in the load here is that I had <code>CSV</code> convert the names into <code>Name</code> objects as they were read in. This allows for easier comparisons later on.</p> <p>The two instance methods are the searches I needed to find some president by name and then look for a later president. Here's the strategy that actually does that:</p> <div class="highlight highlight-ruby"><pre><span class="n">require_relative</span> <span class="s2">"../president_list"</span> <span class="n">require_relative</span> <span class="s2">"../name"</span> <span class="k">module</span> <span class="nn">Crossword</span> <span class="k">class</span> <span class="nc">PresidentAfter</span> <span class="o"><</span> <span class="no">Strategy</span> <span class="no">CLUE_REGEX</span> <span class="o">=</span> <span class="sr">/</span> <span class="sr"> \A (?<name>First|Last) \s+ name \s+ of \s+ the \s+</span> <span class="sr"> next \s+ President \s+ of \s+ the \s+ United \s+ States \s+ after \s+</span> <span class="sr"> (?<before>.+) \z</span> <span class="sr"> /x</span> <span class="k">def</span> <span class="nf">answer</span> <span class="nb">id</span> <span class="o">=</span> <span class="no">PresidentList</span><span class="o">.</span><span class="n">find_by_name</span><span class="p">(</span> <span class="no">Name</span><span class="o">.</span><span class="n">new</span><span class="p">(</span><span class="n">match_data</span><span class="o">[</span><span class="ss">:before</span><span class="o">]</span><span class="p">)</span> <span class="p">)</span><span class="o">[</span><span class="ss">:presidency</span><span class="o">].</span><span class="n">to_i</span> <span class="o">+</span> <span class="mi">1</span> <span class="no">PresidentList</span> <span class="o">.</span><span class="n">find_by_number</span><span class="p">(</span><span class="nb">id</span><span class="o">.</span><span class="n">to_s</span><span class="p">)</span><span class="o">[</span><span class="ss">:president</span><span class="o">]</span> <span class="o">.</span><span class="n">send</span><span class="p">(</span><span class="s2">"</span><span class="si">#{</span><span class="n">match_data</span><span class="o">[</span><span class="ss">:name</span><span class="o">].</span><span class="n">downcase</span><span class="si">}</span><span class="s2">_name"</span><span class="p">)</span> <span class="k">end</span> <span class="k">end</span> <span class="k">end</span> </pre></div> <p>These queries pick up some oddities of their individual databases, that could definitely be cleaned up, if this wasn't contest code. That said, the strategy code is pretty short even for this trickier clue. I'm not feeling much pain.</p> <h4>Conclusion</h4> <p>Overall, I really liked the process I slipped into here:</p> <ol> <li>Setup feedback loops</li> <li>Make the problem easy to solve</li> <li>Solve the problem</li> </ol><p>Testing can be a viable way to handle feedback loops, but it's not the only available solution. Sure, I had a couple of times during this experiment when I introduced a bug that I found on the next run, but there weren't many of those and they were easily dealt with. I didn't feel super hindered in this approach. I need to keep exploring this idea though, so I know what the limitations are.</p> <p>In the end, solving just this easier portion of the problem took me roughly three and a half hours. That's not fair though, because I was able to do a little thinking about how I should handle it before I started.</p> James Edward Gray II Objectified Beer tag:graysoftinc.com,2014-05-30:/posts/119 2014-05-30T22:09:39Z Taking a few different approaches to a programming exercise to see what ideas I can squeeze out of it. <p>I got another thing out of my recent conversation with Katrina Owen: a will-not-let-go itch to try a programming exercise that she mentioned. I'm such a sucker for a challenge.</p> <p>Katrina spoke of an assignment that her and Sandi Metz have used in their object orientation trainings. She said that they build an OO implementation of the <em>99 Bottles of Beer</em> song, "mainly removing <code>if</code>s and such." There may be more to the actual task than this, but I ran with that brief explanation.</p> <p>As I often say, you'll probably learn more by trying the exercise for yourself before you read through my thoughts about it. Give it a go if you can spare the time.</p> <h4>Diff Driven Development</h4> <p>I decided to throw some scaffolding into <a href="https://github.com/JEG2/bottles_of_beer_song">the master branch</a> of a Git repository. I figured I could then branch off of that with each idea, to keep trying things out.</p> <p>I started by constructing a trivial framework for running and verifying the song. That consisted of an executable:</p> <div class="highlight highlight-ruby"><pre><span class="c1">#!/usr/bin/env ruby -w</span> <span class="n">require_relative</span> <span class="s2">"../lib/bottles_of_beer"</span> <span class="n">verses</span> <span class="o">=</span> <span class="no">ARGV</span><span class="o">.</span><span class="n">first</span> <span class="o">=~</span> <span class="sr">/\A\d+\z/</span> <span class="p">?</span> <span class="no">ARGV</span><span class="o">.</span><span class="n">shift</span><span class="o">.</span><span class="n">to_i</span> <span class="p">:</span> <span class="mi">99</span> <span class="no">BottlesOfBeer</span><span class="o">::</span><span class="no">Song</span><span class="o">.</span><span class="n">new</span><span class="p">(</span><span class="n">verses</span><span class="p">)</span><span class="o">.</span><span class="n">sing</span><span class="p">(</span><span class="vg">$stdout</span><span class="p">)</span> </pre></div> <p>a copy and paste implementation:</p> <div class="highlight highlight-ruby"><pre><span class="c1"># -*- coding: utf-8 -*-</span> <span class="k">module</span> <span class="nn">BottlesOfBeer</span> <span class="k">class</span> <span class="nc">Song</span> <span class="k">def</span> <span class="nf">initialize</span><span class="p">(</span><span class="n">verses</span> <span class="o">=</span> <span class="mi">99</span><span class="p">)</span> <span class="vi">@verses</span> <span class="o">=</span> <span class="n">verses</span> <span class="k">end</span> <span class="kp">attr_reader</span> <span class="ss">:verses</span> <span class="kp">private</span> <span class="ss">:verses</span> <span class="k">def</span> <span class="nf">sing</span><span class="p">(</span><span class="n">target</span> <span class="o">=</span> <span class="vg">$stdout</span><span class="p">)</span> <span class="n">target</span> <span class="o"><<</span> <span class="o"><<</span><span class="no">END_SONG</span> <span class="sh">99 bottles of beer on the wall, 99 bottles of beer.</span> <span class="sh">Take one down and pass it around, 98 bottles of beer on the wall…</span> <span class="sh">…</span> <span class="no">END_SONG</span> <span class="k">end</span> <span class="k">end</span> <span class="k">end</span> </pre></div> <p>and a <code>Rake</code> task to check the output against <a href="http://www.99-bottles-of-beer.net/lyrics.html">a static file</a> I copied from the Web as my definitive source of the lyrics:</p> <div class="highlight highlight-ruby"><pre><span class="n">desc</span> <span class="s2">"Verifies the song output."</span> <span class="n">task</span> <span class="ss">:spec</span> <span class="k">do</span> <span class="nb">print</span> <span class="s2">"</span><span class="se">\e</span><span class="s2">[31m"</span> <span class="nb">system</span> <span class="s2">"bash -c 'diff -u <(bin/bottles_of_beer) spec/full_song.txt'"</span> <span class="nb">print</span> <span class="s2">"</span><span class="se">\e</span><span class="s2">[0m"</span> <span class="k">if</span> <span class="vg">$?</span><span class="o">.</span><span class="n">success?</span> <span class="nb">puts</span> <span class="s2">"</span><span class="se">\e</span><span class="s2">[32mPerfect match.</span><span class="se">\e</span><span class="s2">[0m"</span> <span class="k">end</span> <span class="k">end</span> <span class="n">task</span> <span class="ss">default</span><span class="p">:</span> <span class="ss">:spec</span> </pre></div> <p>This system of validation was very important to me. I wanted it to be easy to see how close to correct I was and a <code>diff</code> sums that up beautifully. However, I did not want to test drive my playing around. That would add overhead to my experimentation that I just don't need for a problem that I can keep in my head like this.</p> <h4>A Swing and a Miss</h4> <p>With the setup done, I was ready to try <a href="https://github.com/JEG2/bottles_of_beer_song/tree/first_attempt">a solution</a>.</p> <p>My first idea was pretty straightforward. Build up the needed verses and then write them out:</p> <div class="highlight highlight-ruby"><pre><span class="n">require_relative</span> <span class="s2">"verse"</span> <span class="n">require_relative</span> <span class="s2">"penultimate_verse"</span> <span class="n">require_relative</span> <span class="s2">"ultimate_verse"</span> <span class="k">module</span> <span class="nn">BottlesOfBeer</span> <span class="k">class</span> <span class="nc">Song</span> <span class="k">def</span> <span class="nf">initialize</span><span class="p">(</span><span class="n">verses</span> <span class="o">=</span> <span class="mi">99</span><span class="p">)</span> <span class="vi">@verses</span> <span class="o">=</span> <span class="nb">Array</span><span class="o">.</span><span class="n">new</span><span class="p">(</span><span class="n">verses</span> <span class="o">-</span> <span class="mi">1</span><span class="p">)</span> <span class="p">{</span> <span class="o">|</span><span class="n">i</span><span class="o">|</span> <span class="no">Verse</span><span class="o">.</span><span class="n">new</span><span class="p">(</span><span class="n">verses</span> <span class="o">-</span> <span class="n">i</span><span class="p">)</span> <span class="p">}</span> <span class="vi">@verses</span> <span class="o"><<</span> <span class="no">PenultimateVerse</span><span class="o">.</span><span class="n">new</span> <span class="vi">@verses</span> <span class="o"><<</span> <span class="no">UltimateVerse</span><span class="o">.</span><span class="n">new</span><span class="p">(</span><span class="n">verses</span><span class="p">)</span> <span class="k">end</span> <span class="kp">attr_reader</span> <span class="ss">:verses</span> <span class="kp">private</span> <span class="ss">:verses</span> <span class="k">def</span> <span class="nf">sing</span><span class="p">(</span><span class="n">target</span> <span class="o">=</span> <span class="vg">$stdout</span><span class="p">)</span> <span class="n">verses</span><span class="o">.</span><span class="n">each</span> <span class="k">do</span> <span class="o">|</span><span class="n">verse</span><span class="o">|</span> <span class="n">target</span> <span class="o"><<</span> <span class="n">verse</span> <span class="k">end</span> <span class="k">end</span> <span class="k">end</span> <span class="k">end</span> </pre></div> <p>Most verses are represented by a fairly predicable object:</p> <div class="highlight highlight-ruby"><pre><span class="c1"># -*- coding: utf-8 -*-</span> <span class="k">module</span> <span class="nn">BottlesOfBeer</span> <span class="k">class</span> <span class="nc">Verse</span> <span class="k">def</span> <span class="nf">initialize</span><span class="p">(</span><span class="n">bottles</span><span class="p">)</span> <span class="vi">@bottles</span> <span class="o">=</span> <span class="n">bottles</span> <span class="k">end</span> <span class="kp">attr_reader</span> <span class="ss">:bottles</span> <span class="kp">private</span> <span class="ss">:bottles</span> <span class="k">def</span> <span class="nf">to_s</span> <span class="s2">"</span><span class="si">#{</span><span class="n">bottles</span><span class="si">}</span><span class="s2"> bottles of beer on the wall, "</span> <span class="o">+</span> <span class="s2">"</span><span class="si">#{</span><span class="n">bottles</span><span class="si">}</span><span class="s2"> bottles of beer.</span><span class="se">\n</span><span class="s2">"</span> <span class="o">+</span> <span class="s2">"Take one down and pass it around, "</span> <span class="o">+</span> <span class="s2">"</span><span class="si">#{</span><span class="n">bottles</span> <span class="o">-</span> <span class="mi">1</span><span class="si">}</span><span class="s2"> bottles of beer on the wall…</span><span class="se">\n\n</span><span class="s2">"</span> <span class="k">end</span> <span class="k">end</span> <span class="k">end</span> </pre></div> <p>However, the <em>one bottle</em> verse is an edge case:</p> <div class="highlight highlight-ruby"><pre><span class="n">require_relative</span> <span class="s2">"verse"</span> <span class="k">module</span> <span class="nn">BottlesOfBeer</span> <span class="k">class</span> <span class="nc">PenultimateVerse</span> <span class="o"><</span> <span class="no">Verse</span> <span class="k">def</span> <span class="nf">initialize</span> <span class="k">super</span><span class="p">(</span><span class="mi">1</span><span class="p">)</span> <span class="k">end</span> <span class="k">def</span> <span class="nf">to_s</span> <span class="k">super</span><span class="o">.</span><span class="n">gsub</span><span class="p">(</span><span class="s2">"1 bottles"</span><span class="p">,</span> <span class="s2">"1 bottle"</span><span class="p">)</span> <span class="k">end</span> <span class="k">end</span> <span class="k">end</span> </pre></div> <p>The last verse is also special:</p> <div class="highlight highlight-ruby"><pre><span class="c1"># -*- coding: utf-8 -*-</span> <span class="n">require_relative</span> <span class="s2">"verse"</span> <span class="k">module</span> <span class="nn">BottlesOfBeer</span> <span class="k">class</span> <span class="nc">UltimateVerse</span> <span class="o"><</span> <span class="no">Verse</span> <span class="k">def</span> <span class="nf">to_s</span> <span class="s2">"No more bottles of beer on the wall, "</span> <span class="o">+</span> <span class="s2">"no more bottles of beer.</span><span class="se">\n</span><span class="s2">"</span> <span class="o">+</span> <span class="s2">"Go to the store and buy some more, "</span> <span class="o">+</span> <span class="s2">"</span><span class="si">#{</span><span class="n">bottles</span><span class="si">}</span><span class="s2"> bottles of beer on the wall…</span><span class="se">\n</span><span class="s2">"</span> <span class="k">end</span> <span class="k">end</span> <span class="k">end</span> </pre></div> <p>This solution gets close, but it doesn't quite work:</p> <div class="highlight highlight-diff"><pre><span class="gd">--- /dev/fd/63 2014-05-30 13:21:03.000000000 -0500</span> <span class="gi">+++ spec/full_song.txt 2014-05-30 09:34:28.000000000 -0500</span> <span class="gu">@@ -290,10 +290,10 @@</span> Take one down and pass it around, 2 bottles of beer on the wall… 2 bottles of beer on the wall, 2 bottles of beer. <span class="gd">-Take one down and pass it around, 1 bottles of beer on the wall…</span> <span class="gi">+Take one down and pass it around, 1 bottle of beer on the wall…</span> 1 bottle of beer on the wall, 1 bottle of beer. <span class="gd">-Take one down and pass it around, 0 bottles of beer on the wall…</span> <span class="gi">+Take one down and pass it around, no more bottles of beer on the wall…</span> No more bottles of beer on the wall, no more bottles of beer. Go to the store and buy some more, 99 bottles of beer on the wall… </pre></div> <p>This was an interesting decision point for me in the exercise. Obviously, I'm not green. Eventually, I need to get there. But I'm really close. Only two lines are wrong and I can see what the problem is. Mainly, when I transition to new verses, I don't pick up on the edge cases. I was starting to have ideas about how I might address this issue, but I wasn't too happy with the rest of the code yet anyway. I decided to attempt to improve what I had built a little first, before I tackled the obvious bug. I feel like my <code>diff</code>-based validation gave me the confidence that I could do this, since I would notice by the line count alone if I was drifting further off track.</p> <h4>Can I get a side of objects with that?</h4> <p>OK, my first major complaint was that I didn't land on a very OO solution. Since that's the point of the exercise, I wanted to address it. More specifically I think overriding a method to call <code>gsub()</code> on its output largely misses to point of sharing an implementation, as objects do. Similarly, my <code>UltimateVerse</code> pretty much ignores everything from its superclass. I minted <a href="https://github.com/JEG2/bottles_of_beer_song/tree/more_objectified">a new branch</a> and broke out the polish.</p> <p>I began by extracting a few methods in <code>Verse</code> so I could override them in subclasses:</p> <div class="highlight highlight-ruby"><pre><span class="c1"># -*- coding: utf-8 -*-</span> <span class="k">module</span> <span class="nn">BottlesOfBeer</span> <span class="k">class</span> <span class="nc">Verse</span> <span class="k">def</span> <span class="nf">initialize</span><span class="p">(</span><span class="n">bottles</span><span class="p">)</span> <span class="vi">@bottles</span> <span class="o">=</span> <span class="n">bottles</span> <span class="k">end</span> <span class="kp">attr_reader</span> <span class="ss">:bottles</span> <span class="kp">private</span> <span class="ss">:bottles</span> <span class="k">def</span> <span class="nf">to_s</span> <span class="s2">"</span><span class="si">#{</span><span class="n">count_with_units</span><span class="si">}</span><span class="s2"> of beer on the wall, "</span> <span class="o">+</span> <span class="s2">"</span><span class="si">#{</span><span class="n">count_with_units</span><span class="o">.</span><span class="n">downcase</span><span class="si">}</span><span class="s2"> of beer.</span><span class="se">\n</span><span class="s2">"</span> <span class="o">+</span> <span class="s2">"</span><span class="si">#{</span><span class="n">action</span><span class="si">}</span><span class="s2">, "</span> <span class="o">+</span> <span class="s2">"</span><span class="si">#{</span><span class="n">bottles</span> <span class="o">-</span> <span class="mi">1</span><span class="si">}</span><span class="s2"> bottles of beer on the wall…</span><span class="se">\n\n</span><span class="s2">"</span> <span class="k">end</span> <span class="kp">private</span> <span class="k">def</span> <span class="nf">count_with_units</span> <span class="s2">"</span><span class="si">#{</span><span class="n">bottles</span><span class="si">}</span><span class="s2"> bottles"</span> <span class="k">end</span> <span class="k">def</span> <span class="nf">action</span> <span class="s2">"Take one down and pass it around"</span> <span class="k">end</span> <span class="k">end</span> <span class="k">end</span> </pre></div> <p>That allowed me to clean up the content editing in the <em>one bottle</em> verse:</p> <div class="highlight highlight-ruby"><pre><span class="n">require_relative</span> <span class="s2">"verse"</span> <span class="k">module</span> <span class="nn">BottlesOfBeer</span> <span class="k">class</span> <span class="nc">PenultimateVerse</span> <span class="o"><</span> <span class="no">Verse</span> <span class="k">def</span> <span class="nf">initialize</span> <span class="k">super</span><span class="p">(</span><span class="mi">1</span><span class="p">)</span> <span class="k">end</span> <span class="k">def</span> <span class="nf">count_with_units</span> <span class="s2">"1 bottle"</span> <span class="k">end</span> <span class="k">end</span> <span class="k">end</span> </pre></div> <p>It also allowed me to turn the <em>no more bottles</em> verse into a more proper subclass that doesn't just override the work of the superclass:</p> <div class="highlight highlight-ruby"><pre><span class="n">require_relative</span> <span class="s2">"verse"</span> <span class="k">module</span> <span class="nn">BottlesOfBeer</span> <span class="k">class</span> <span class="nc">UltimateVerse</span> <span class="o"><</span> <span class="no">Verse</span> <span class="k">def</span> <span class="nf">to_s</span> <span class="k">super</span><span class="o">.</span><span class="n">strip</span> <span class="o">+</span> <span class="s2">"</span><span class="se">\n</span><span class="s2">"</span> <span class="k">end</span> <span class="kp">private</span> <span class="k">def</span> <span class="nf">count_with_units</span> <span class="s2">"No more bottles"</span> <span class="k">end</span> <span class="k">def</span> <span class="nf">action</span> <span class="s2">"Go to the store and buy some more"</span> <span class="k">end</span> <span class="k">end</span> <span class="k">end</span> </pre></div> <p>While things are definitely more object oriented in this version, I've actually worsened the results by one more failing line:</p> <div class="highlight highlight-diff"><pre><span class="gd">--- /dev/fd/63 2014-05-30 13:36:26.000000000 -0500</span> <span class="gi">+++ spec/full_song.txt 2014-05-30 09:34:28.000000000 -0500</span> <span class="gu">@@ -290,10 +290,10 @@</span> Take one down and pass it around, 2 bottles of beer on the wall… 2 bottles of beer on the wall, 2 bottles of beer. <span class="gd">-Take one down and pass it around, 1 bottles of beer on the wall…</span> <span class="gi">+Take one down and pass it around, 1 bottle of beer on the wall…</span> 1 bottle of beer on the wall, 1 bottle of beer. <span class="gd">-Take one down and pass it around, 0 bottles of beer on the wall…</span> <span class="gi">+Take one down and pass it around, no more bottles of beer on the wall…</span> No more bottles of beer on the wall, no more bottles of beer. <span class="gd">-Go to the store and buy some more, 98 bottles of beer on the wall…</span> <span class="gi">+Go to the store and buy some more, 99 bottles of beer on the wall…</span> </pre></div> <p>I'm still quite close to correct, but I am seeing that drift I decided to watch for. This told me it was time to get serious about reaching a real solution.</p> <h4>Go Green or Go Home</h4> <p>My problems come from the fact that the verses transition into the next part of the song. That leads me to another thing that bothered me with my initial code: the need for <code>bottles - 1</code> in <code>Verse</code>. If <code>Song</code> is keeping track of the current <code>Verse</code>, it feels like they shouldn't need to peek ahead internally. This made me feel like a layer was missing and I set out to add it in <a href="https://github.com/JEG2/bottles_of_beer_song/tree/transitions">a new branch</a>.</p> <p>I decided to introduce this new concept of verses transitioning to the next verse:</p> <div class="highlight highlight-ruby"><pre><span class="c1"># -*- coding: utf-8 -*-</span> <span class="k">module</span> <span class="nn">BottlesOfBeer</span> <span class="k">class</span> <span class="nc">VerseWithTransition</span> <span class="k">def</span> <span class="nf">initialize</span><span class="p">(</span><span class="n">verse</span><span class="p">,</span> <span class="n">next_verse</span><span class="p">)</span> <span class="vi">@verse</span> <span class="o">=</span> <span class="n">verse</span> <span class="vi">@next_verse</span> <span class="o">=</span> <span class="n">next_verse</span> <span class="k">end</span> <span class="kp">attr_reader</span> <span class="ss">:verse</span><span class="p">,</span> <span class="ss">:next_verse</span> <span class="kp">private</span> <span class="ss">:verse</span><span class="p">,</span> <span class="ss">:next_verse</span> <span class="k">def</span> <span class="nf">to_s</span> <span class="s2">"</span><span class="si">#{</span><span class="n">verse</span><span class="si">}</span><span class="s2">, </span><span class="si">#{</span><span class="n">next_verse</span><span class="o">.</span><span class="n">opening</span><span class="o">.</span><span class="n">downcase</span><span class="si">}</span><span class="s2">…</span><span class="se">\n</span><span class="s2">"</span> <span class="k">end</span> <span class="k">end</span> <span class="k">end</span> </pre></div> <p>Of course, that required some changes in the <code>Song</code> to make use of these new transitions:</p> <div class="highlight highlight-ruby"><pre><span class="n">require_relative</span> <span class="s2">"verse"</span> <span class="n">require_relative</span> <span class="s2">"penultimate_verse"</span> <span class="n">require_relative</span> <span class="s2">"ultimate_verse"</span> <span class="n">require_relative</span> <span class="s2">"verse_with_transition"</span> <span class="k">module</span> <span class="nn">BottlesOfBeer</span> <span class="k">class</span> <span class="nc">Song</span> <span class="k">def</span> <span class="nf">initialize</span><span class="p">(</span><span class="n">verses</span> <span class="o">=</span> <span class="mi">99</span><span class="p">)</span> <span class="vi">@verses</span> <span class="o">=</span> <span class="nb">Array</span><span class="o">.</span><span class="n">new</span><span class="p">(</span><span class="n">verses</span> <span class="o">-</span> <span class="mi">1</span><span class="p">)</span> <span class="p">{</span> <span class="o">|</span><span class="n">i</span><span class="o">|</span> <span class="no">Verse</span><span class="o">.</span><span class="n">new</span><span class="p">(</span><span class="n">verses</span> <span class="o">-</span> <span class="n">i</span><span class="p">)</span> <span class="p">}</span> <span class="vi">@verses</span> <span class="o"><<</span> <span class="no">PenultimateVerse</span><span class="o">.</span><span class="n">new</span> <span class="vi">@verses</span> <span class="o"><<</span> <span class="no">UltimateVerse</span><span class="o">.</span><span class="n">new</span><span class="p">(</span><span class="n">verses</span><span class="p">)</span> <span class="k">end</span> <span class="kp">attr_reader</span> <span class="ss">:verses</span> <span class="kp">private</span> <span class="ss">:verses</span> <span class="k">def</span> <span class="nf">sing</span><span class="p">(</span><span class="n">target</span> <span class="o">=</span> <span class="vg">$stdout</span><span class="p">)</span> <span class="n">verses</span><span class="o">.</span><span class="n">each_cons</span><span class="p">(</span><span class="mi">2</span><span class="p">)</span> <span class="k">do</span> <span class="o">|</span><span class="n">verse</span><span class="p">,</span> <span class="n">next_verse</span><span class="o">|</span> <span class="n">target</span> <span class="o"><<</span> <span class="no">VerseWithTransition</span><span class="o">.</span><span class="n">new</span><span class="p">(</span><span class="n">verse</span><span class="p">,</span> <span class="n">next_verse</span><span class="p">)</span> <span class="o"><<</span> <span class="s2">"</span><span class="se">\n</span><span class="s2">"</span> <span class="k">end</span> <span class="n">target</span> <span class="o"><<</span> <span class="no">VerseWithTransition</span><span class="o">.</span><span class="n">new</span><span class="p">(</span><span class="n">verses</span><span class="o">.</span><span class="n">last</span><span class="p">,</span> <span class="n">verses</span><span class="o">.</span><span class="n">first</span><span class="p">)</span> <span class="k">end</span> <span class="k">end</span> <span class="k">end</span> </pre></div> <p>The base <code>Verse</code> itself could now quit worrying about the next number, as long as it made its <code>opening()</code> available for reuse:</p> <div class="highlight highlight-ruby"><pre><span class="k">module</span> <span class="nn">BottlesOfBeer</span> <span class="k">class</span> <span class="nc">Verse</span> <span class="k">def</span> <span class="nf">initialize</span><span class="p">(</span><span class="n">bottles</span><span class="p">)</span> <span class="vi">@bottles</span> <span class="o">=</span> <span class="n">bottles</span> <span class="k">end</span> <span class="kp">attr_reader</span> <span class="ss">:bottles</span> <span class="kp">private</span> <span class="ss">:bottles</span> <span class="k">def</span> <span class="nf">opening</span> <span class="s2">"</span><span class="si">#{</span><span class="n">count_with_units</span><span class="si">}</span><span class="s2"> of beer on the wall"</span> <span class="k">end</span> <span class="k">def</span> <span class="nf">to_s</span> <span class="s2">"</span><span class="si">#{</span><span class="n">opening</span><span class="si">}</span><span class="s2">, "</span> <span class="o">+</span> <span class="s2">"</span><span class="si">#{</span><span class="n">count_with_units</span><span class="o">.</span><span class="n">downcase</span><span class="si">}</span><span class="s2"> of beer.</span><span class="se">\n</span><span class="s2">"</span> <span class="o">+</span> <span class="n">action</span> <span class="k">end</span> <span class="kp">private</span> <span class="k">def</span> <span class="nf">count_with_units</span> <span class="s2">"</span><span class="si">#{</span><span class="n">bottles</span><span class="si">}</span><span class="s2"> bottles"</span> <span class="k">end</span> <span class="k">def</span> <span class="nf">action</span> <span class="s2">"Take one down and pass it around"</span> <span class="k">end</span> <span class="k">end</span> <span class="k">end</span> </pre></div> <p>The edge cases were largely unchanged in this round, save that I pulled out an override from <code>UltimateVerse</code> that twiddled whitespace. It felt more natural to handle that at the <code>Song</code> level. The low number of changes needed here made me feel like I was making better use of subclasses now.</p> <p>Also, good news, my output was finally validating.</p> <h4>Things That Bug Me</h4> <p>Now that I was green, I wanted to attack other concerns I had with the code. My biggest remaining complaint was this line in <code>Song</code>:</p> <div class="highlight highlight-ruby"><pre> <span class="vi">@verses</span> <span class="o">=</span> <span class="nb">Array</span><span class="o">.</span><span class="n">new</span><span class="p">(</span><span class="n">verses</span> <span class="o">-</span> <span class="mi">1</span><span class="p">)</span> <span class="p">{</span> <span class="o">|</span><span class="n">i</span><span class="o">|</span> <span class="no">Verse</span><span class="o">.</span><span class="n">new</span><span class="p">(</span><span class="n">verses</span> <span class="o">-</span> <span class="n">i</span><span class="p">)</span> <span class="p">}</span> </pre></div> <p>This represents multiple problems, in my opinion. First, I don't like that I'm pregenerating all of the verses. What if we want to use a huge number of verses? Why should that be memory inefficient? I would prefer to do the work as it comes in, when possible.</p> <p>Also, there's some very non-obvious index math in this code, if you ask me. I had to lower the size of the initial <code>Array</code> to make room for the edge cases and I had to reverse the indexes inside the block, because the lyrics count down.</p> <p><a href="https://github.com/JEG2/bottles_of_beer_song/tree/refactoring">Another branch</a> led to another round of fixes.</p> <p>Here's a more clean iteration through the verses, in my opinion:</p> <div class="highlight highlight-ruby"><pre><span class="n">require_relative</span> <span class="s2">"verse"</span> <span class="n">require_relative</span> <span class="s2">"penultimate_verse"</span> <span class="n">require_relative</span> <span class="s2">"ultimate_verse"</span> <span class="n">require_relative</span> <span class="s2">"verse_with_transition"</span> <span class="k">module</span> <span class="nn">BottlesOfBeer</span> <span class="k">class</span> <span class="nc">Song</span> <span class="k">def</span> <span class="nf">initialize</span><span class="p">(</span><span class="n">verses</span> <span class="o">=</span> <span class="mi">99</span><span class="p">)</span> <span class="nb">fail</span> <span class="no">ArgumentError</span><span class="p">,</span> <span class="s2">"Cannot sing negative verses"</span> <span class="k">if</span> <span class="n">verses</span> <span class="o"><</span> <span class="mi">0</span> <span class="vi">@verses</span> <span class="o">=</span> <span class="n">verses</span> <span class="k">end</span> <span class="kp">attr_reader</span> <span class="ss">:verses</span> <span class="kp">private</span> <span class="ss">:verses</span> <span class="k">def</span> <span class="nf">sing</span><span class="p">(</span><span class="n">target</span> <span class="o">=</span> <span class="vg">$stdout</span><span class="p">)</span> <span class="n">verses</span><span class="o">.</span><span class="n">downto</span><span class="p">(</span><span class="mi">2</span><span class="p">)</span><span class="o">.</span><span class="n">each_cons</span><span class="p">(</span><span class="mi">2</span><span class="p">)</span> <span class="k">do</span> <span class="o">|</span><span class="n">bottles</span><span class="p">,</span> <span class="n">next_bottles</span><span class="o">|</span> <span class="n">write_verse</span><span class="p">(</span><span class="n">target</span><span class="p">,</span> <span class="no">Verse</span><span class="o">.</span><span class="n">new</span><span class="p">(</span><span class="n">bottles</span><span class="p">),</span> <span class="no">Verse</span><span class="o">.</span><span class="n">new</span><span class="p">(</span><span class="n">next_bottles</span><span class="p">))</span> <span class="k">end</span> <span class="n">write_verse</span><span class="p">(</span><span class="n">target</span><span class="p">,</span> <span class="no">Verse</span><span class="o">.</span><span class="n">new</span><span class="p">(</span><span class="mi">2</span><span class="p">),</span> <span class="no">PenultimateVerse</span><span class="o">.</span><span class="n">new</span><span class="p">)</span> <span class="p">\</span> <span class="k">if</span> <span class="n">verses</span> <span class="o">>=</span> <span class="mi">2</span> <span class="n">write_verse</span><span class="p">(</span><span class="n">target</span><span class="p">,</span> <span class="no">PenultimateVerse</span><span class="o">.</span><span class="n">new</span><span class="p">,</span> <span class="no">UltimateVerse</span><span class="o">.</span><span class="n">new</span><span class="p">)</span> <span class="p">\</span> <span class="k">if</span> <span class="n">verses</span> <span class="o">>=</span> <span class="mi">1</span> <span class="n">write_verse</span><span class="p">(</span><span class="n">target</span><span class="p">,</span> <span class="no">UltimateVerse</span><span class="o">.</span><span class="n">new</span><span class="p">,</span> <span class="no">Verse</span><span class="o">.</span><span class="n">new</span><span class="p">(</span><span class="n">verses</span><span class="p">),</span> <span class="s2">""</span><span class="p">)</span> <span class="k">end</span> <span class="kp">private</span> <span class="k">def</span> <span class="nf">write_verse</span><span class="p">(</span><span class="n">target</span><span class="p">,</span> <span class="n">verse</span><span class="p">,</span> <span class="n">next_verse</span><span class="p">,</span> <span class="n">padding</span> <span class="o">=</span> <span class="s2">"</span><span class="se">\n</span><span class="s2">"</span><span class="p">)</span> <span class="n">target</span> <span class="o"><<</span> <span class="no">VerseWithTransition</span><span class="o">.</span><span class="n">new</span><span class="p">(</span><span class="n">verse</span><span class="p">,</span> <span class="n">next_verse</span><span class="p">)</span> <span class="o"><<</span> <span class="n">padding</span> <span class="k">end</span> <span class="k">end</span> <span class="k">end</span> </pre></div> <p>The main difference here is that I feel the iterators <code>downto()</code> and <code>each_cons()</code> make it easier to see how I am moving through the data. There's a lot more object construction in this version, but that's a concern for the garbage collector (which has improved a ton in recent releases). I try not to be afraid of using lots of objects, until I have some reason to be.</p> <p>Just for the record, there was one more tiny change that I didn't show here. I finally dropped the argument to <code>UltimateVerse</code>'s constructor, since that's now handled by transitions. This required that I override the base constructor to ignore it.</p> <h4>The Big Questions</h4> <p>Now that I had a working solution, I found myself wondering how much extra work I had done to objectify this code that could have a pretty short solution. I pulled <a href="https://github.com/JEG2/bottles_of_beer_song/tree/non_oo">a fresh branch</a> off of master and solved the problem again for comparison purposes.</p> <p>I rewrote the <code>Song</code> using the least complex proceedural code that I could dream up:</p> <div class="highlight highlight-ruby"><pre><span class="c1"># -*- coding: utf-8 -*-</span> <span class="k">module</span> <span class="nn">BottlesOfBeer</span> <span class="k">class</span> <span class="nc">Song</span> <span class="k">def</span> <span class="nf">initialize</span><span class="p">(</span><span class="n">verses</span> <span class="o">=</span> <span class="mi">99</span><span class="p">)</span> <span class="nb">fail</span> <span class="no">ArgumentError</span><span class="p">,</span> <span class="s2">"Cannot sing negative verses"</span> <span class="k">if</span> <span class="n">verses</span> <span class="o"><</span> <span class="mi">0</span> <span class="vi">@verses</span> <span class="o">=</span> <span class="n">verses</span> <span class="k">end</span> <span class="kp">attr_reader</span> <span class="ss">:verses</span> <span class="kp">private</span> <span class="ss">:verses</span> <span class="k">def</span> <span class="nf">sing</span><span class="p">(</span><span class="n">target</span> <span class="o">=</span> <span class="vg">$stdout</span><span class="p">)</span> <span class="n">verses</span><span class="o">.</span><span class="n">downto</span><span class="p">(</span><span class="mi">0</span><span class="p">)</span> <span class="k">do</span> <span class="o">|</span><span class="n">count</span><span class="o">|</span> <span class="n">action</span> <span class="o">=</span> <span class="n">count</span><span class="o">.</span><span class="n">zero?</span> <span class="p">?</span> <span class="s2">"Go to the store and buy some more"</span> <span class="p">:</span> <span class="s2">"Take one down and pass it around"</span> <span class="n">target</span> <span class="o"><<</span> <span class="s2">"</span><span class="si">#{</span><span class="n">bottles</span><span class="p">(</span><span class="n">count</span><span class="p">)</span><span class="si">}</span><span class="s2"> of beer on the wall, "</span> <span class="o">+</span> <span class="s2">"</span><span class="si">#{</span><span class="n">bottles</span><span class="p">(</span><span class="n">count</span><span class="p">)</span><span class="o">.</span><span class="n">downcase</span><span class="si">}</span><span class="s2"> of beer.</span><span class="se">\n</span><span class="s2">"</span> <span class="o">+</span> <span class="s2">"</span><span class="si">#{</span><span class="n">action</span><span class="si">}</span><span class="s2">, "</span> <span class="o">+</span> <span class="s2">"</span><span class="si">#{</span><span class="n">bottles</span><span class="p">(</span><span class="n">count</span> <span class="o">-</span> <span class="mi">1</span><span class="p">)</span><span class="o">.</span><span class="n">downcase</span><span class="si">}</span><span class="s2"> of beer on the wall…</span><span class="se">\n</span><span class="s2">"</span> <span class="n">target</span> <span class="o"><<</span> <span class="s2">"</span><span class="se">\n</span><span class="s2">"</span> <span class="k">unless</span> <span class="n">count</span><span class="o">.</span><span class="n">zero?</span> <span class="k">end</span> <span class="k">end</span> <span class="kp">private</span> <span class="k">def</span> <span class="nf">bottles</span><span class="p">(</span><span class="n">count</span><span class="p">)</span> <span class="k">if</span> <span class="n">count</span> <span class="o"><</span> <span class="mi">0</span> <span class="n">bottles</span><span class="p">(</span><span class="n">verses</span><span class="p">)</span> <span class="k">elsif</span> <span class="n">count</span><span class="o">.</span><span class="n">zero?</span> <span class="s2">"No more bottles"</span> <span class="k">else</span> <span class="s2">"</span><span class="si">#{</span><span class="n">count</span><span class="si">}</span><span class="s2"> bottle</span><span class="si">#{</span><span class="s1">'s'</span> <span class="k">unless</span> <span class="n">count</span> <span class="o">==</span> <span class="mi">1</span><span class="si">}</span><span class="s2">"</span> <span class="k">end</span> <span class="k">end</span> <span class="k">end</span> <span class="k">end</span> </pre></div> <p>I'll be honest and admit that I expected to like this code better. This is a small problem and I can keep the whole thing in my head when working at this level. I figured a short chunk of code that reflected that would be pretty digestible.</p> <p>After seeing the two solutions side-by-side though, I'm not sure I really do feel that way. Sure, this one is shorter and you can easily view the whole thing at once, but there's a ton of edge cases mashed into this small space that make it harder to reason about. At least that's what I think. Notice the three separate <code>count.zero?</code> checks and the return of <code>count - 1</code> even though the iterator is pushing us through the verses. I'm pretty sure I would rather fix bugs in the objectified code, rather than reason out which rules are in effect here at any given time.</p> <p>Thanks for the mental workout Katrina.</p> James Edward Gray II Decorators Verses the Mix-in tag:graysoftinc.com,2012-05-21:/posts/115 2014-04-30T02:31:45Z In this article I dig into a topic of recent interest to the Ruby object geeks to see if I can suss out the tradeoffs from both sides. <p>It is a neat time to be involved in the Ruby community, if you ask me. A large portion of us are currently studying the techniques for doing good object oriented development. We are looking at the ideas that have come before and trying to decide the best ways to apply those ideas to our favorite language. This leads to blog posts, forum threads, and conference talks about what we are learning. No matter what, we all gain from explorations like this. Everybody wins as our collective knowledge grows. We all deserve gold stars.</p> <p>So far, there's one point pretty much everyone agrees on: composition should typically be preferred to inheritance. The trickier part of that discussion though is deciding what composition looks like in Ruby. Generally you see Rubyists comparing the merits of <a href="http://en.wikipedia.org/wiki/Decorator_pattern">decorators</a> and mix-ins. <em>[<strong>Note</strong>: the comments correctly pointed out that this was a bad use of the word "composition" on my part, to describe mix-ins.]</em> There's <a href="https://groups.google.com/forum/?fromgroups#!topic/objects-on-rails/0-GTFdgPTLc">a very representative thread</a> on the excellent Objects on Rails mailing list.</p> <p>Much of time, decorators seem to come out ahead, but comparing the two is pretty complex. In this article I want to add my opinions to the discussion. Let's start by looking at some examples.</p> <h4>Decoration</h4> <p>Let's say that I have a simple server that just receives messages and displays what was sent:</p> <div class="highlight highlight-ruby"><pre><span class="nb">require</span> <span class="s2">"socket"</span> <span class="n">server</span> <span class="o">=</span> <span class="no">TCPServer</span><span class="o">.</span><span class="n">new</span><span class="p">(</span><span class="s2">"127.0.0.1"</span><span class="p">,</span> <span class="mi">61676</span><span class="p">)</span> <span class="no">Socket</span><span class="o">.</span><span class="n">accept_loop</span><span class="p">(</span><span class="n">server</span><span class="p">)</span> <span class="k">do</span> <span class="o">|</span><span class="n">connection</span><span class="p">,</span> <span class="n">_</span><span class="o">|</span> <span class="k">while</span> <span class="p">(</span><span class="n">object_sent</span> <span class="o">=</span> <span class="n">connection</span><span class="o">.</span><span class="n">gets</span><span class="p">)</span> <span class="nb">puts</span> <span class="s2">"Received: %p"</span> <span class="o">%</span> <span class="o">[</span><span class="n">object_sent</span><span class="o">]</span> <span class="k">end</span> <span class="k">end</span> </pre></div> <p>This is pretty crude. It doesn't even handle concurrent connections, but it will work fine for the purposes of this example.</p> <p>We also need a simple client to send some messages to our server:</p> <div class="highlight highlight-ruby"><pre><span class="nb">require</span> <span class="s2">"socket"</span> <span class="n">server</span> <span class="o">=</span> <span class="no">TCPSocket</span><span class="o">.</span><span class="n">new</span><span class="p">(</span><span class="s2">"127.0.0.1"</span><span class="p">,</span> <span class="mi">61676</span><span class="p">)</span> <span class="n">object_to_send</span> <span class="o">=</span> <span class="s2">"A message."</span> <span class="n">server</span><span class="o">.</span><span class="n">puts</span> <span class="n">object_to_send</span> </pre></div> <p>At this point I can:</p> <ol> <li>Start the server in one shell</li> <li>Run the client in a separate shell</li> <li>See output in the server's shell</li> </ol><p>The end result looks like this from the server's shell:</p> <pre><code>$ ruby server.rb Received: "A message.\n" </code></pre> <p>That's nice, but let's say it's not quite what I want. I can really just send <code>String</code> messages using this simple setup, but perhaps I would prefer to be able to send other Ruby objects, like an <code>Array</code> or <code>Hash</code>.</p> <p>Let's add that capability to our client and server. I'll start that process by creating a <code>serialization.rb</code> file and defining a couple of decorators in there:</p> <div class="highlight highlight-ruby"><pre><span class="k">class</span> <span class="nc">Serializer</span> <span class="k">def</span> <span class="nf">initialize</span><span class="p">(</span><span class="n">socket</span><span class="p">)</span> <span class="vi">@socket</span> <span class="o">=</span> <span class="n">socket</span> <span class="k">end</span> <span class="k">def</span> <span class="nf">puts</span><span class="p">(</span><span class="o">*</span><span class="n">objects</span><span class="p">)</span> <span class="n">objects</span><span class="o">.</span><span class="n">each</span> <span class="k">do</span> <span class="o">|</span><span class="n">object</span><span class="o">|</span> <span class="n">serialized</span> <span class="o">=</span> <span class="no">Marshal</span><span class="o">.</span><span class="n">dump</span><span class="p">(</span><span class="n">object</span><span class="p">)</span> <span class="vi">@socket</span><span class="o">.</span><span class="n">write</span><span class="p">(</span><span class="o">[</span><span class="n">serialized</span><span class="o">.</span><span class="n">length</span><span class="p">,</span> <span class="n">serialized</span><span class="o">].</span><span class="n">pack</span><span class="p">(</span><span class="s2">"NA*"</span><span class="p">))</span> <span class="k">end</span> <span class="k">end</span> <span class="k">end</span> <span class="k">class</span> <span class="nc">Deserializer</span> <span class="k">def</span> <span class="nf">initialize</span><span class="p">(</span><span class="n">socket</span><span class="p">)</span> <span class="vi">@socket</span> <span class="o">=</span> <span class="n">socket</span> <span class="k">end</span> <span class="k">def</span> <span class="nf">gets</span> <span class="k">if</span> <span class="p">(</span><span class="n">message</span> <span class="o">=</span> <span class="vi">@socket</span><span class="o">.</span><span class="n">read</span><span class="p">(</span><span class="mi">4</span><span class="p">))</span> <span class="n">object_size</span> <span class="o">=</span> <span class="n">message</span><span class="o">.</span><span class="n">unpack</span><span class="p">(</span><span class="s2">"N"</span><span class="p">)</span><span class="o">.</span><span class="n">first</span> <span class="no">Marshal</span><span class="o">.</span><span class="n">load</span><span class="p">(</span><span class="vi">@socket</span><span class="o">.</span><span class="n">read</span><span class="p">(</span><span class="n">object_size</span><span class="p">))</span> <span class="k">end</span> <span class="k">end</span> <span class="k">end</span> </pre></div> <p>Both of these objects take a <code>Socket</code>, store it away for later use, then wrap the simple <code>IO</code> methods that my client and server are using to communicate. The wrappers manage a very simple serialization process where we convert a Ruby object to a binary representation and then send the length in bytes followed by those bytes. The other end can peek at the length, read that many bytes, and rehydrate the object.</p> <p>I've skimped on the error handling here to keep the code simple. A more robust version of this code would need to make sure the serialized object length doesn't overflow the size of the number we're sending and handle the various networking errors that can occur.</p> <p>Now let's update the client to support serialization:</p> <div class="highlight highlight-ruby"><pre><span class="nb">require</span> <span class="s2">"socket"</span> <span class="n">require_relative</span> <span class="s2">"serialization"</span> <span class="n">server</span> <span class="o">=</span> <span class="no">TCPSocket</span><span class="o">.</span><span class="n">new</span><span class="p">(</span><span class="s2">"127.0.0.1"</span><span class="p">,</span> <span class="mi">61676</span><span class="p">)</span> <span class="n">server</span> <span class="o">=</span> <span class="no">Serializer</span><span class="o">.</span><span class="n">new</span><span class="p">(</span><span class="n">server</span><span class="p">)</span> <span class="c1"># decorate the socket</span> <span class="n">object_to_send</span> <span class="o">=</span> <span class="sx">%w[A more complex message.]</span> <span class="n">server</span><span class="o">.</span><span class="n">puts</span> <span class="n">object_to_send</span> </pre></div> <p>Notice that, aside from the added <code>require_relative()</code> call and the switch to a more complex object to show off serialization, there's really just one new line here. That line wraps the socket connection to the server in our decorator. This replaces the default <code>puts()</code> logic with our more involved process. That change actually takes effect on the last line of the client, but we didn't need to modify that code. That's the whole idea behind decoration.</p> <p>The server is just as easy to update:</p> <div class="highlight highlight-ruby"><pre><span class="nb">require</span> <span class="s2">"socket"</span> <span class="n">require_relative</span> <span class="s2">"serialization"</span> <span class="n">server</span> <span class="o">=</span> <span class="no">TCPServer</span><span class="o">.</span><span class="n">new</span><span class="p">(</span><span class="s2">"127.0.0.1"</span><span class="p">,</span> <span class="mi">61676</span><span class="p">)</span> <span class="no">Socket</span><span class="o">.</span><span class="n">accept_loop</span><span class="p">(</span><span class="n">server</span><span class="p">)</span> <span class="k">do</span> <span class="o">|</span><span class="n">connection</span><span class="p">,</span> <span class="n">_</span><span class="o">|</span> <span class="n">connection</span> <span class="o">=</span> <span class="no">Deserializer</span><span class="o">.</span><span class="n">new</span><span class="p">(</span><span class="n">connection</span><span class="p">)</span> <span class="c1"># decorate the socket</span> <span class="k">while</span> <span class="p">(</span><span class="n">object_sent</span> <span class="o">=</span> <span class="n">connection</span><span class="o">.</span><span class="n">gets</span><span class="p">)</span> <span class="nb">puts</span> <span class="s2">"Received: %p"</span> <span class="o">%</span> <span class="o">[</span><span class="n">object_sent</span><span class="o">]</span> <span class="k">end</span> <span class="k">end</span> </pre></div> <p>Again, all we need to do is wrap the connection to our client with the decorator. That replaces the <code>gets()</code> operation and we still didn't need to touch that code.</p> <p>If I run the server and client again, we can see that the <code>Array</code> does come through:</p> <pre><code>$ ruby server.rb Received: ["A", "more", "complex", "message."] </code></pre> <p>It's time to admit that I purposefully selected this example to be something decorators are just perfect for. They really excel at these layering-on-functionality tasks. <a href="http://www.javaworld.com/javaworld/jw-12-2001/jw-1214-designpatterns.html">Java's IO class hierarchy</a> is built much like the code I just showed for exactly this reason.</p> <p>For comparison's sake though, let's switch to an example where I don't think decorators are as good of a fit, at least in Ruby.</p> <h4>Mixing It Up</h4> <p>I've shown an example very similar to this next one before, in <a href="/rubies-in-the-rough/learn-to-love-mix-ins">an article about mix-ins</a>, but let me flesh it out a bit more this time so we can really discuss why I handle it the way I do.</p> <p>Let's say that I have some not-quite-CSV data in a file:</p> <pre><code>"Name (last, first)",Job "Gray, James \"JEG2\"",Developer "Gray, Dana",Full-time Mommy "Gray, Summer","\"Cutie Pie\"" </code></pre> <p>That data isn't really valid, according to the CSV standard. It should be doubling quotes to escape them (<code>""</code>), not using backslashes (<code>\"</code>).</p> <p>I would like to read that data with the standard <code>CSV</code> library so I can take advantage of the things it can do for me, like parsing out the headers. I want to use some code like the following:</p> <div class="highlight highlight-ruby"><pre><span class="nb">require</span> <span class="s2">"csv"</span> <span class="no">CSV</span><span class="o">.</span><span class="n">foreach</span><span class="p">(</span><span class="s2">"not_quite_csv.csv"</span><span class="p">,</span> <span class="ss">headers</span><span class="p">:</span> <span class="kp">true</span><span class="p">)</span> <span class="k">do</span> <span class="o">|</span><span class="n">row</span><span class="o">|</span> <span class="nb">p</span> <span class="n">row</span><span class="o">.</span><span class="n">to_hash</span> <span class="k">end</span> </pre></div> <p>But the <code>CSV</code> library doesn't recognize this format:</p> <pre><code>$ ruby read_csv.rb …: Missing or stray quote in line 2 (CSV::MalformedCSVError) … </code></pre> <p>To handle that, I would use a mix-in that fixes the data between the time when it is read and the time when <code>CSV</code> tries to parse it. Let's code that up:</p> <div class="highlight highlight-ruby"><pre><span class="nb">require</span> <span class="s2">"csv"</span> <span class="k">module</span> <span class="nn">CSVNormalizer</span> <span class="k">def</span> <span class="nf">gets</span><span class="p">(</span><span class="o">*</span><span class="n">args</span><span class="p">)</span> <span class="n">line</span> <span class="o">=</span> <span class="k">super</span> <span class="k">if</span> <span class="n">line</span> <span class="n">line</span><span class="o">.</span><span class="n">gsub!</span><span class="p">(</span><span class="sr">/"(?:\\\\|\\"|[^"])*"/</span><span class="p">)</span> <span class="p">{</span> <span class="o">|</span><span class="n">field</span><span class="o">|</span> <span class="n">field</span><span class="o">.</span><span class="n">gsub</span><span class="p">(</span><span class="sr">/(?<!\\)\\"/</span><span class="p">)</span> <span class="p">{</span> <span class="s1">'""'</span> <span class="p">}</span> <span class="p">}</span> <span class="k">end</span> <span class="n">line</span> <span class="k">end</span> <span class="k">end</span> <span class="nb">open</span><span class="p">(</span><span class="s2">"not_quite_csv.csv"</span><span class="p">)</span> <span class="k">do</span> <span class="o">|</span><span class="n">file</span><span class="o">|</span> <span class="n">file</span><span class="o">.</span><span class="n">extend</span><span class="p">(</span><span class="no">CSVNormalizer</span><span class="p">)</span> <span class="n">csv</span> <span class="o">=</span> <span class="no">CSV</span><span class="o">.</span><span class="n">new</span><span class="p">(</span><span class="n">file</span><span class="p">,</span> <span class="ss">headers</span><span class="p">:</span> <span class="kp">true</span><span class="p">)</span> <span class="n">csv</span><span class="o">.</span><span class="n">each</span> <span class="k">do</span> <span class="o">|</span><span class="n">row</span><span class="o">|</span> <span class="nb">p</span> <span class="n">row</span><span class="o">.</span><span class="n">to_hash</span> <span class="k">end</span> <span class="k">end</span> </pre></div> <p><code>CSVNormalizer</code> is pretty straight forward. It just wraps <code>gets()</code> and gives me a place to do a few simple substitutions.</p> <p>Don't lose too much sleep over understanding the regular expressions I used there. They just replace the escapes with the format CSV expects.</p> <p>In the lower chunk of code, I switched how I do the hand-off to <code>CSV</code>. This lets me get a hold of the <code>File</code> object and <code>extend()</code> it before <code>CSV</code> tries to read from it.</p> <p>This solution isn't really complete, because it doesn't yet handle the multi-line fields that real CSV data can contain. It does work for the data in my example though:</p> <pre><code>$ ruby read_csv.rb {"Name (last, first)"=>"Gray, James \"JEG2\"", "Job"=>"Developer"} {"Name (last, first)"=>"Gray, Dana", "Job"=>"Full-time Mommy"} {"Name (last, first)"=>"Gray, Summer", "Job"=>"\"Cutie Pie\""} </code></pre> <h4>The Decision</h4> <p>I said that the second example is better as a mix-in. But why?</p> <p>I mean you could choose to solve it with a decorator, right? Of course. Let's do that to see how it goes.</p> <p>At first glance, it looks like we could get away with a few minor changes:</p> <div class="highlight highlight-ruby"><pre><span class="nb">require</span> <span class="s2">"csv"</span> <span class="k">class</span> <span class="nc">CSVNormalizer</span> <span class="c1"># switch to a class</span> <span class="c1"># store the IO for later use</span> <span class="k">def</span> <span class="nf">initialize</span><span class="p">(</span><span class="n">io</span><span class="p">)</span> <span class="vi">@io</span> <span class="o">=</span> <span class="n">io</span> <span class="k">end</span> <span class="k">def</span> <span class="nf">gets</span><span class="p">(</span><span class="o">*</span><span class="n">args</span><span class="p">)</span> <span class="n">line</span> <span class="o">=</span> <span class="vi">@io</span><span class="o">.</span><span class="n">gets</span><span class="p">(</span><span class="o">*</span><span class="n">args</span><span class="p">)</span> <span class="c1"># forward to the IO</span> <span class="k">if</span> <span class="n">line</span> <span class="n">line</span><span class="o">.</span><span class="n">gsub!</span><span class="p">(</span><span class="sr">/"(?:\\\\|\\"|[^"])*"/</span><span class="p">)</span> <span class="p">{</span> <span class="o">|</span><span class="n">field</span><span class="o">|</span> <span class="n">field</span><span class="o">.</span><span class="n">gsub</span><span class="p">(</span><span class="sr">/(?<!\\)\\"/</span><span class="p">)</span> <span class="p">{</span> <span class="s1">'""'</span> <span class="p">}</span> <span class="p">}</span> <span class="k">end</span> <span class="n">line</span> <span class="k">end</span> <span class="k">end</span> <span class="nb">open</span><span class="p">(</span><span class="s2">"not_quite_csv.csv"</span><span class="p">)</span> <span class="k">do</span> <span class="o">|</span><span class="n">file</span><span class="o">|</span> <span class="n">file</span> <span class="o">=</span> <span class="no">CSVNormalizer</span><span class="o">.</span><span class="n">new</span><span class="p">(</span><span class="n">file</span><span class="p">)</span> <span class="c1"># decorate</span> <span class="n">csv</span> <span class="o">=</span> <span class="no">CSV</span><span class="o">.</span><span class="n">new</span><span class="p">(</span><span class="n">file</span><span class="p">,</span> <span class="ss">headers</span><span class="p">:</span> <span class="kp">true</span><span class="p">)</span> <span class="n">csv</span><span class="o">.</span><span class="n">each</span> <span class="k">do</span> <span class="o">|</span><span class="n">row</span><span class="o">|</span> <span class="nb">p</span> <span class="n">row</span><span class="o">.</span><span class="n">to_hash</span> <span class="k">end</span> <span class="k">end</span> </pre></div> <p>If you run that code, it will probably seem to run the same. But it's not equivalent. In order to show you why, I need to modify my data to use different line endings:</p> <pre><code>$ ruby -pi -e 'gsub "\n", "\r\n"' not_quite_csv.csv </code></pre> <p>I'm on Unix, so I've switched the line endings to something I might have received from a Windows machine. You would need to go the other way if you are on Windows, but the end result is that our decorator is now broken:</p> <pre><code>$ ruby read_csv.rb # using the decorator …: Unquoted fields do not allow \r or \n (line 1). (CSV::MalformedCSVError) … </code></pre> <p>That's interesting, because when I switch to the mix-in, it can read this data just fine:</p> <pre><code>$ ruby read_csv.rb # using the mix-in {"Name (last, first)"=>"Gray, James \"JEG2\"", "Job"=>"Developer"} {"Name (last, first)"=>"Gray, Dana", "Job"=>"Full-time Mommy"} {"Name (last, first)"=>"Gray, Summer", "Job"=>"\"Cutie Pie\""} </code></pre> <p>To know why this happens, you have to understand a little about how <code>CSV</code> works internally. As you can see, this whole line ending issue is kind of annoying. <code>CSV</code> tries to save you from needing to worry about that. By default, it will attempt to guess your line endings. You can always specify the ending manually if you need to, but a lot of times the guessing means that your program will just work without you taking any action.</p> <p>That's what's happening with the mix-in version. No matter which line endings I feed it, <code>CSV</code> correctly guesses them and adapts. It just works.</p> <p>Obviously we broke that in the decorator version, but how? Well, under the hood, <code>CSV</code> has to peek ahead at the data to guess the endings. It expects to be passed an <code>IO</code> object, so it calls on some <code>IO</code> methods to fetch some data and then reset the position pointer to where it was.</p> <p>Of course, this feature doesn't always work. Sometimes you can't skip around in a stream like this. Consider <code>STDIN</code> or a <code>Socket</code> for example. So, if <code>CSV</code> cannot guess, it just defaults to the normal line endings for the current platform. That's the best we can do with no information to go on and the user can always specify the line ending manually as needed.</p> <p>Now you can probably deduce why the decorator broken. It's not a full <code>IO</code> stand-in. We wrapped the method <code>CSV</code> needs to read data, but not the methods it uses to do the line ending guessing. That means it has to give up a go with the platform default.</p> <p>All of this leads to the question: could we fix that? Sure. One option is that we could delegate the needed methods manually. Multiple methods are needed though, and if I wasn't the guy who wrote <code>CSV</code>, I wouldn't really know what they are. Plus, they could change some day. (That has actually happened. The algorithm was changed at one point to use different methods so it would work with more <code>IO</code>-like objects.) Given that, it's probably better to just forward any messages I don't want to wrap to the underlying <code>IO</code> object. That's easy enough to do:</p> <div class="highlight highlight-ruby"><pre><span class="nb">require</span> <span class="s2">"csv"</span> <span class="k">class</span> <span class="nc">CSVNormalizer</span> <span class="o"><</span> <span class="no">BasicObject</span> <span class="c1"># make sure we delegate most calls</span> <span class="k">def</span> <span class="nf">initialize</span><span class="p">(</span><span class="n">io</span><span class="p">)</span> <span class="vi">@io</span> <span class="o">=</span> <span class="n">io</span> <span class="k">end</span> <span class="k">def</span> <span class="nf">gets</span><span class="p">(</span><span class="o">*</span><span class="n">args</span><span class="p">)</span> <span class="n">line</span> <span class="o">=</span> <span class="vi">@io</span><span class="o">.</span><span class="n">gets</span><span class="p">(</span><span class="o">*</span><span class="n">args</span><span class="p">)</span> <span class="k">if</span> <span class="n">line</span> <span class="n">line</span><span class="o">.</span><span class="n">gsub!</span><span class="p">(</span><span class="sr">/"(?:\\\\|\\"|[^"])*"/</span><span class="p">)</span> <span class="p">{</span> <span class="o">|</span><span class="n">field</span><span class="o">|</span> <span class="n">field</span><span class="o">.</span><span class="n">gsub</span><span class="p">(</span><span class="sr">/(?<!\\)\\"/</span><span class="p">)</span> <span class="p">{</span> <span class="s1">'""'</span> <span class="p">}</span> <span class="p">}</span> <span class="k">end</span> <span class="n">line</span> <span class="k">end</span> <span class="c1"># forward all other messages to the IO object</span> <span class="k">def</span> <span class="nf">method_missing</span><span class="p">(</span><span class="nb">method</span><span class="p">,</span> <span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">&</span><span class="n">block</span><span class="p">)</span> <span class="vi">@io</span><span class="o">.</span><span class="n">send</span><span class="p">(</span><span class="nb">method</span><span class="p">,</span> <span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">&</span><span class="n">block</span><span class="p">)</span> <span class="k">end</span> <span class="k">end</span> <span class="nb">open</span><span class="p">(</span><span class="s2">"not_quite_csv.csv"</span><span class="p">)</span> <span class="k">do</span> <span class="o">|</span><span class="n">file</span><span class="o">|</span> <span class="n">file</span> <span class="o">=</span> <span class="no">CSVNormalizer</span><span class="o">.</span><span class="n">new</span><span class="p">(</span><span class="n">file</span><span class="p">)</span> <span class="n">csv</span> <span class="o">=</span> <span class="no">CSV</span><span class="o">.</span><span class="n">new</span><span class="p">(</span><span class="n">file</span><span class="p">,</span> <span class="ss">headers</span><span class="p">:</span> <span class="kp">true</span><span class="p">)</span> <span class="n">csv</span><span class="o">.</span><span class="n">each</span> <span class="k">do</span> <span class="o">|</span><span class="n">row</span><span class="o">|</span> <span class="nb">p</span> <span class="n">row</span><span class="o">.</span><span class="n">to_hash</span> <span class="k">end</span> <span class="k">end</span> </pre></div> <p>As the comments show, I only made two changes. First, I explicitly inherited from <code>BasicObject</code> instead of accepting the default <code>Object</code> parent. This means that my decorator responds to very few messages. Almost all incoming messages will hit <code>method_missing()</code> because of that change. The second change was to provide that <code>method_missing()</code> and have it push everything down to the underlying <code>IO</code>. This does restore the line ending guessing functionality and get the decorator fully working:</p> <pre><code>$ ruby read_csv.rb # using the decorator again with tricky line endings {"Name (last, first)"=>"Gray, James \"JEG2\"", "Job"=>"Developer"} {"Name (last, first)"=>"Gray, Dana", "Job"=>"Full-time Mommy"} {"Name (last, first)"=>"Gray, Summer", "Job"=>"\"Cutie Pie\""} </code></pre> <p>We now know what it takes build the equivalent decorator. If we compare the two, I say the mix-in is superior in this case. Here are my reasons:</p> <ul> <li>The whole point of the <code>BasicObject</code> and <code>method_missing()</code> trick is to do our own method dispatching here. Why do that? Ruby is better at that kind of thing than we are, so I would rather leave that task to the language whenever we can. What do I mean by "better?" Well, for one thing, we can use <code>super</code> when Ruby is doing the job. For another, Ruby is going to be much faster when dispatching. Rack (another good example of decorators) has a little of this latter problem. As frameworks that use Rack, like Rails, move more and more functionality into middleware, the call stack just gets longer and longer. This is the primary reason that they filter backtraces in Rails and it has slowed things down a little as incoming requests must pass through all of the layers.</li> <li>The decorator object I ended up creating lies about what it really is. Consider methods like <code>class()</code>, <code>is_a?()</code>, and <code>ancestors()</code>. These are all going to tell me that I have a <code>File</code> object in the case above. That's only sort of accurate though. I could probably drop <code>BasicObject</code>, in this case, but then the lies just change to leave out any mention of the hidden <code>File</code> object. Compare that with the mix-in version which is fully reflection compliant. It can tell you all about its "types" no matter how many there are.</li> </ul><p>Because of this, I tend to prefer mix-ins for cases where I am going to delegate an entire API. I feel like the advantages are pretty clear for those cases.</p> <h4>Arguments for and Against Decorators</h4> <p>I'm not trying to say there's no good uses for decorators. I've already provided some in this article. Greg Brown gives an even more spirited defense of them in <a href="https://practicingruby.com/articles/disciplined-inheritance-1">Practicing Ruby 3.7</a>, which is probably the most detailed, Ruby focused discussion of these issues to date. Greg is discussing higher level inheritance concepts in that article, but his examples largely boil down to an analysis of mix-ins and decorators.</p> <p>I think Greg has some good and not-so-good points.</p> <p>The best argument in favor of decorators, by far in my opinion, is the encapsulation issue. I think we normally envision encapsulation as hiding our data from the outside world, but in this case we're talking more about hiding it from ourselves. When you have some object with several mix-ins, how do we know that none of those methods have instance variable conflicts? Heck, the methods could even be accidentally overriding each other with unrelated functionality if we're not careful with naming. This could create some maddening bugs where things like the load order matter. These are very real and tough issues.</p> <p>How often are we bitten by this encapsulation issue? I wish I knew. I think a strong test suite can help to reduce it. I also imagine it's less of a problem when most of the API is written by a single team. I'm guessing they would be more likely to catch misuses or impose naming conventions the protect themselves from these issues. But in the world where we embrace the value of sending Pull Requests on GitHub to fix most problems, I'm not sure how much of this safety we can count on.</p> <p>I am less sold on the "bloated contracts" or "too many entry points" arguments that I see in many places, including Greg's post and the Objects on Rails thread I mentioned earlier. The example everyone throws around is <code>ActiveRecord::Base</code> which does have a ton of mix-ins. However, languages, libraries, and frameworks (like ActiveRecord) have different goals than we do for our application code.</p> <p>We want to keep application code as minimal as possible and expose even less than we write whenever possible. This helps with many, many aspects of application development.</p> <p>As I mentioned though, languages, libraries, and frameworks have almost the opposite goals. They want to cast their nets far and wide. They expose a lot and let your code decide which pieces it needs to do its work.</p> <p>This makes sense when you think about it. The more a library does for us, the less application code we end up writing. That satisfies both aims.</p> <p>Even if you sympathize with the bloated contract argument, I'm not convinced that decorators do much for it. Each individual object may respond to less messages, but is that going to save you from reading the documentation of all of those decorator classes? It didn't save me a ton of memorization when I passed the Java certification, I can tell you that much. The big API is still there, even if we do a better job of hiding it.</p> <p>Testability is another complaint I often see leveled at mix-ins that I'm skeptical of. By way of example, let's test the mix-in I made earlier. I created a <code>csv_spec.rb</code> file and added this code to it to get started:</p> <div class="highlight highlight-ruby"><pre><span class="k">module</span> <span class="nn">CSVNormalizer</span> <span class="k">def</span> <span class="nf">gets</span><span class="p">(</span><span class="o">*</span><span class="n">args</span><span class="p">)</span> <span class="n">line</span> <span class="o">=</span> <span class="k">super</span> <span class="k">if</span> <span class="n">line</span> <span class="n">line</span><span class="o">.</span><span class="n">gsub!</span><span class="p">(</span><span class="sr">/"(?:\\\\|\\"|[^"])*"/</span><span class="p">)</span> <span class="p">{</span> <span class="o">|</span><span class="n">field</span><span class="o">|</span> <span class="n">field</span><span class="o">.</span><span class="n">gsub</span><span class="p">(</span><span class="sr">/(?<!\\)\\"/</span><span class="p">)</span> <span class="p">{</span> <span class="s1">'""'</span> <span class="p">}</span> <span class="p">}</span> <span class="k">end</span> <span class="n">line</span> <span class="k">end</span> <span class="k">end</span> <span class="n">describe</span> <span class="no">CSVNormalizer</span> <span class="k">do</span> <span class="n">let</span><span class="p">(</span><span class="ss">:message_queue</span><span class="p">)</span> <span class="p">{</span> <span class="o">[</span> <span class="o">]</span> <span class="p">}</span> <span class="k">def</span> <span class="nf">gets</span><span class="p">(</span><span class="o">*</span><span class="n">_</span><span class="p">)</span> <span class="n">message_queue</span><span class="o">.</span><span class="n">shift</span> <span class="k">end</span> <span class="n">before</span> <span class="k">do</span> <span class="kp">extend</span><span class="p">(</span><span class="no">CSVNormalizer</span><span class="p">)</span> <span class="k">end</span> <span class="n">it</span> <span class="s2">"translates escaped quotes as they are read"</span> <span class="k">do</span> <span class="n">message_queue</span> <span class="o"><<</span> <span class="s1">'"a \"quoted\" field"'</span> <span class="nb">gets</span><span class="o">.</span><span class="n">should</span> <span class="n">eq</span><span class="p">(</span><span class="s1">'"a ""quoted"" field"'</span><span class="p">)</span> <span class="k">end</span> <span class="c1"># ...</span> <span class="k">end</span> </pre></div> <p>As you can see, I just gave my example group the expected <code>gets()</code> method and then extended it with my <code>CSVNormalizer</code>. From there I can test normally. I don't feel like I'm jumping through a lot of extra hoops here compared to testing a normal object, but you be the judge.</p> <h4>The Winner Is…</h4> <p>I don't think we can definitively say that one approach is superior to the other in all cases. I hope given compelling use cases for both in this article.</p> <p>Mix-ins seems to be the underdog in most of these discussions, but I'm not quite ready to write them off. I hope I've shown that there are at least some things going for them.</p> <p>As with most things in programming, I think it pays to try to understand as many of these angles as we can and make the best choices we can on a case by case basis.</p> <p>The biggest question remaining for me is if we can do better at modeling large API's, like ActiveRecord, with the tools Ruby gives us. Is there a good way to use composition there without the mix-ins? I'm not sure. Hopefully some Rubyist will improve on the formula and enlighten us.</p> <h4>Further Reading</h4> <p>If you really enjoy this kind of analysis about how to build objects, there are some terrific resources out there that you might want to take a deeper look at:</p> <ul> <li> <a href="http://www.pearsonhighered.com/educator/product/Smalltalk-Best-Practice-Patterns/9780134769042.page">Smalltalk Best Practice Patterns</a> can be expensive to pick up these days and you may need to learn a new language just to read it. The truth is though that it's totally worth it. I learned more about objects from this one book than probably all others combined. While it doesn't cover these issues directly, it gave me a lot of the foundation that I use to think through these issues.</li> <li> <a href="https://groups.google.com/forum/#!forum/objects-on-rails">The Objects on Rails mailing list</a> started out as a place to give Avdi Grimm feedback for <a href="http://objectsonrails.com/">the ebook of the same name</a>. Luckily, it seems to be sticking around even now that the book is out and, better yet, growing into the go-to source for these discussions in Rubyland. Reading that list is pretty addictive for object geeks like me.</li> <li> <a href="http://designpatternsinruby.com/">Design Patterns in Ruby</a> does a great job of looking the various design patterns, like decorators, both in a traditional light and through Ruby colored glasses. This can provide quite a bit of insight when it comes to adapting patterns from other languages.</li> </ul> James Edward Gray II Delaying Decisions tag:graysoftinc.com,2012-05-11:/posts/114 2014-04-29T03:29:32Z In this article I talk about the value of delaying programming decisions and look at some ways you can implement code to do that. <p>I love playing with Ruby's <code>Hash</code>. I think it has a neat API and experimenting with it can actually help you understand how to write good Ruby. Let's dig into this idea to see what I mean.</p> <h4>The nil Problem</h4> <p>In <a href="https://www.destroyallsoftware.com/screencasts/catalog/exceptions-and-control-flow">Destroy All Software #9</a> Gary chooses to show an example in Python because, unlike Ruby's <code>Hash</code>, it will raise an error for a non-existent key. Ruby just returns <code>nil</code>, he explains.</p> <p>What Gary said isn't really true, but I'm guessing he just didn't know that at the time. He was in the process of switching to Ruby from Python and I'm guessing he just didn't have a deep enough understanding of Ruby's <code>Hash</code> yet. I bet he does know how it works now.</p> <p>But assume he was right. What's he saying and why does it matter? Consider some code like this:</p> <div class="highlight highlight-ruby"><pre><span class="k">class</span> <span class="nc">SearchesController</span> <span class="o"><</span> <span class="no">ApplicationController</span> <span class="k">def</span> <span class="nf">show</span> <span class="n">terms</span> <span class="o">=</span> <span class="n">params</span><span class="o">[</span><span class="ss">:terms</span><span class="o">]</span> <span class="no">SomeModel</span><span class="o">.</span><span class="n">search</span><span class="p">(</span><span class="n">terms</span><span class="p">)</span> <span class="c1"># ...</span> <span class="k">end</span> <span class="k">end</span> </pre></div> <p>This is what Gary doesn't like, and rightfully so. Because I indexed into <code>params</code> here with the <code>[]()</code> method, I will indeed get a <code>nil</code> if the <code>:terms</code> key wasn't in <code>params</code>.</p> <p>The problem with <code>nil</code> is that it's a ticking time bomb just waiting to go off. It has a very limited interface by design, so calling methods on it may raise errors. It's probably not the interface your code is expecting. For example, in the code above I likely intended to get a <code>String</code> in <code>terms</code>, but if I got <code>nil</code> instead and I later try to call <code>String</code> methods on it, it's going to blow up.</p> <p>This gets worse because <code>nil</code> values tend to bounce around in the code a bit. This means the error may finally manifest far from the line where I actually assigned <code>terms</code>, which is the real problem that needs fixing. For example, let's say the model code I handed off to looks something like this:</p> <div class="highlight highlight-ruby"><pre><span class="k">class</span> <span class="nc">SomeModel</span> <span class="o"><</span> <span class="no">ActiveRecord</span><span class="o">::</span><span class="no">Base</span> <span class="k">def</span> <span class="nc">self</span><span class="o">.</span><span class="nf">search</span><span class="p">(</span><span class="n">terms</span><span class="p">)</span> <span class="n">words</span> <span class="o">=</span> <span class="n">terms</span><span class="o">.</span><span class="n">scan</span><span class="p">(</span><span class="sr">/\S+/</span><span class="p">)</span> <span class="c1"># ...</span> <span class="k">end</span> <span class="k">end</span> </pre></div> <p>This is where the error would show up. The call to <code>scan()</code> would toss a <code>NoMethodError</code> since <code>nil</code> doesn't have <code>scan()</code>. The stack trace would lead us here, but, as I said before, this isn't what needs fixing.</p> <p>Now, we <em>could</em> fix it here. One way to do that would be to insert a conversion before the <code>scan()</code> call:</p> <div class="highlight highlight-ruby"><pre><span class="n">words</span> <span class="o">=</span> <span class="n">terms</span><span class="o">.</span><span class="n">to_s</span><span class="o">.</span><span class="n">scan</span><span class="p">(</span><span class="sr">/\S+/</span><span class="p">)</span> </pre></div> <p>That's probably not a good idea though. We've now said that calling <code>SomeModel.search(nil)</code> is OK and that doesn't really make much sense.</p> <p>A slightly better fix would be to add a guard before the call to <code>scan()</code></p> <div class="highlight highlight-ruby"><pre><span class="nb">fail</span> <span class="no">ArgumentError</span><span class="p">,</span> <span class="s2">"You must pass search terms"</span> <span class="k">if</span> <span class="n">terms</span><span class="o">.</span><span class="n">nil?</span> <span class="n">words</span> <span class="o">=</span> <span class="n">terms</span><span class="o">.</span><span class="n">scan</span><span class="p">(</span><span class="sr">/\S+/</span><span class="p">)</span> </pre></div> <p>This would get us a better error message that actually tells us what went wrong. But the stack trace still wouldn't be ideal. It's going to bring us here first even though the real issue is in the controller.</p> <h5>My Favorite Method to the Rescue</h5> <p>This whole problem started because I allowed the <code>Hash</code> to give me a <code>nil</code>. I didn't want a <code>nil</code>, so I shouldn't have said it was OK.</p> <p>That brings us to <code>fetch()</code>. Watch this:</p> <div class="highlight highlight-ruby"><pre><span class="o">>></span> <span class="nb">hash</span> <span class="o">=</span> <span class="p">{</span> <span class="p">}</span> <span class="o">=></span> <span class="p">{}</span> <span class="o">>></span> <span class="nb">hash</span><span class="o">[</span><span class="ss">:missing</span><span class="o">]</span> <span class="o">=></span> <span class="kp">nil</span> <span class="o">>></span> <span class="nb">hash</span><span class="o">.</span><span class="n">fetch</span><span class="p">(</span><span class="ss">:missing</span><span class="p">)</span> <span class="ss">KeyError</span><span class="p">:</span> <span class="n">key</span> <span class="ow">not</span> <span class="ss">found</span><span class="p">:</span> <span class="ss">:missing</span> <span class="n">from</span> <span class="p">(</span><span class="n">pry</span><span class="p">):</span><span class="mi">3</span><span class="ss">:in</span> <span class="sb">`fetch'</span> </pre></div> <p>You can think of <code>[]()</code> as saying give me some key, if it exists. You get a <code>nil</code> if it doesn't. Now <code>fetch()</code>, on the other hand, is more like saying I need this key, no substitutions allowed. This forces <code>fetch()</code> to raise a <code>KeyError</code> when the key is missing, since <code>nil</code> isn't allowed.</p> <p>The best fix to the problem I started with would be to replace the initial assignment in the controller with this:</p> <div class="highlight highlight-ruby"><pre><span class="n">terms</span> <span class="o">=</span> <span class="n">params</span><span class="o">.</span><span class="n">fetch</span><span class="p">(</span><span class="ss">:terms</span><span class="p">)</span> </pre></div> <p>You may also want to add some code to handle the <code>KeyError</code>, but the important thing is that the problem now triggers from the proper place. This is the most helpful error we could work with in this scenario.</p> <h4>I Don't Know What You Need</h4> <p>Let's take a step back for a moment to the overall <code>Hash</code>. What exactly is a <code>Hash</code> in your code? The only right answer is that I have no idea.</p> <p>You might be creating a typical key-to-value mapping:</p> <div class="highlight highlight-ruby"><pre><span class="o">>></span> <span class="nb">name</span> <span class="o">=</span> <span class="p">{</span><span class="ss">first</span><span class="p">:</span> <span class="s2">"James"</span><span class="p">,</span> <span class="ss">last</span><span class="p">:</span> <span class="s2">"Gray"</span><span class="p">}</span> <span class="o">=></span> <span class="p">{</span><span class="ss">:first</span><span class="o">=></span><span class="s2">"James"</span><span class="p">,</span> <span class="ss">:last</span><span class="o">=></span><span class="s2">"Gray"</span><span class="p">}</span> <span class="o">>></span> <span class="nb">name</span><span class="o">[</span><span class="ss">:last</span><span class="o">]</span> <span class="o">=></span> <span class="s2">"Gray"</span> </pre></div> <p>Alternately, you could be tracking some counts:</p> <div class="highlight highlight-ruby"><pre><span class="o">>></span> <span class="n">counts</span> <span class="o">=</span> <span class="no">Hash</span><span class="o">.</span><span class="n">new</span><span class="p">(</span><span class="mi">0</span><span class="p">)</span> <span class="o">=></span> <span class="p">{}</span> <span class="o">>></span> <span class="n">counts</span><span class="o">[</span><span class="ss">:one</span><span class="o">]</span> <span class="o">+=</span> <span class="mi">1</span> <span class="o">=></span> <span class="mi">1</span> <span class="o">>></span> <span class="mi">3</span><span class="o">.</span><span class="n">times</span> <span class="k">do</span> <span class="n">counts</span><span class="o">[</span><span class="ss">:three</span><span class="o">]</span> <span class="o">+=</span> <span class="mi">1</span> <span class="k">end</span> <span class="o">=></span> <span class="mi">3</span> <span class="o">>></span> <span class="n">counts</span><span class="o">.</span><span class="n">values_at</span><span class="p">(</span><span class="ss">:zero</span><span class="p">,</span> <span class="ss">:one</span><span class="p">,</span> <span class="ss">:three</span><span class="p">)</span> <span class="o">=></span> <span class="o">[</span><span class="mi">0</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="mi">3</span><span class="o">]</span> </pre></div> <p>Or you could be keeping some named buckets for data:</p> <div class="highlight highlight-ruby"><pre><span class="o">>></span> <span class="n">buckets</span> <span class="o">=</span> <span class="no">Hash</span><span class="o">.</span><span class="n">new</span> <span class="p">{</span> <span class="o">|</span><span class="nb">hash</span><span class="p">,</span> <span class="n">key</span><span class="o">|</span> <span class="nb">hash</span><span class="o">[</span><span class="n">key</span><span class="o">]</span> <span class="o">=</span> <span class="o">[</span> <span class="o">]</span> <span class="p">}</span> <span class="o">=></span> <span class="p">{}</span> <span class="o">>></span> <span class="n">buckets</span><span class="o">[</span><span class="ss">:one</span><span class="o">]</span> <span class="o"><<</span> <span class="mi">1</span> <span class="o">=></span> <span class="o">[</span><span class="mi">1</span><span class="o">]</span> <span class="o">>></span> <span class="n">buckets</span><span class="o">[</span><span class="ss">:three</span><span class="o">]</span> <span class="o"><<</span> <span class="mi">1</span> <span class="o"><<</span> <span class="mi">2</span> <span class="o"><<</span> <span class="mi">3</span> <span class="o">=></span> <span class="o">[</span><span class="mi">1</span><span class="p">,</span> <span class="mi">2</span><span class="p">,</span> <span class="mi">3</span><span class="o">]</span> <span class="o">>></span> <span class="n">buckets</span> <span class="o">=></span> <span class="p">{</span><span class="ss">:one</span><span class="o">=>[</span><span class="mi">1</span><span class="o">]</span><span class="p">,</span> <span class="ss">:three</span><span class="o">=>[</span><span class="mi">1</span><span class="p">,</span> <span class="mi">2</span><span class="p">,</span> <span class="mi">3</span><span class="o">]</span><span class="p">}</span> </pre></div> <p>Perhaps it's even a deeply nested structure that you wish to track:</p> <div class="highlight highlight-ruby"><pre><span class="o">>></span> <span class="n">tree</span> <span class="o">=</span> <span class="no">Hash</span><span class="o">.</span><span class="n">new</span> <span class="p">{</span> <span class="o">|</span><span class="nb">hash</span><span class="p">,</span> <span class="n">key</span><span class="o">|</span> <span class="nb">hash</span><span class="o">[</span><span class="n">key</span><span class="o">]</span> <span class="o">=</span> <span class="no">Hash</span><span class="o">.</span><span class="n">new</span><span class="p">(</span><span class="o">&</span><span class="nb">hash</span><span class="o">.</span><span class="n">default_proc</span><span class="p">)</span> <span class="p">}</span> <span class="o">=></span> <span class="p">{}</span> <span class="o">>></span> <span class="n">tree</span><span class="o">[</span><span class="ss">:deeply</span><span class="o">][</span><span class="ss">:nested</span><span class="o">][</span><span class="ss">:structure</span><span class="o">]</span> <span class="o">=</span> <span class="mi">42</span> <span class="o">=></span> <span class="mi">42</span> <span class="o">>></span> <span class="n">tree</span><span class="o">[</span><span class="ss">:deeply</span><span class="o">][</span><span class="ss">:nested</span><span class="o">][</span><span class="ss">:branch</span><span class="o">]</span> <span class="o">=</span> <span class="mi">1</span> <span class="o">=></span> <span class="mi">1</span> <span class="o">>></span> <span class="n">tree</span> <span class="o">=></span> <span class="p">{</span><span class="ss">:deeply</span><span class="o">=></span><span class="p">{</span><span class="ss">:nested</span><span class="o">=></span><span class="p">{</span><span class="ss">:structure</span><span class="o">=></span><span class="mi">42</span><span class="p">,</span> <span class="ss">:branch</span><span class="o">=></span><span class="mi">1</span><span class="p">}}}</span> </pre></div> <p>These are all very different, but valid, uses of a <code>Hash</code> in Ruby to model various data structures and there are other options too. Ruby can't know what you intend to do. But it was wisely designed so that it doesn't have to know.</p> <p>Note the progression above that makes this possible. You can create a normal <code>Hash</code>. You can pass a default object, like an initialization value for counters. Or you can go all the way to defining the default behavior with custom code inside of a block as I did in the last two examples.</p> <p>Ruby delays the decision of default behavior so that it can leave that decision to you. You know what you need better than Ruby does.</p> <p>And it doesn't stop there.</p> <h5>Back to My Favorite</h5> <p>Being able to set some default behavior at <code>Hash</code> construction time is great, but what if I don't know everything I need to know even then? What if I need to delay the decision even more, until key lookup time? What if what I actually need is different at different times? The answer is that <code>fetch()</code> can handle those cases too.</p> <div class="highlight highlight-ruby"><pre><span class="o">>></span> <span class="nb">hash</span> <span class="o">=</span> <span class="p">{</span> <span class="p">}</span> <span class="o">=></span> <span class="p">{}</span> <span class="o">>></span> <span class="nb">hash</span><span class="o">.</span><span class="n">fetch</span><span class="p">(</span><span class="ss">:missing</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span> <span class="o">=></span> <span class="mi">0</span> <span class="o">>></span> <span class="nb">hash</span><span class="o">.</span><span class="n">fetch</span><span class="p">(</span><span class="ss">:missing</span><span class="p">)</span> <span class="p">{</span> <span class="o">|</span><span class="n">key</span><span class="o">|</span> <span class="n">key</span><span class="o">.</span><span class="n">to_s</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s2">""</span><span class="p">)</span><span class="o">.</span><span class="n">sort</span><span class="o">.</span><span class="n">join</span> <span class="p">}</span> <span class="o">=></span> <span class="s2">"giimnss"</span> </pre></div> <p>You can see that <code>fetch()</code> also supports default return values for a missing keys and it will even allow you to provide custom code to handle the situation however you need to.</p> <p>If you only get one thing out of this article, make it <code>Hash#fetch()</code>. It's a powerhouse tool that enables you to do all kinds of fancy tricks. (It's worth noting that <code>Hash#delete()</code> is similarly flexible. <a href="http://ruby-doc.org/core-1.9.3/Hash.html#method-i-delete">Look it up</a>.) But that's not really why I'm showing you these methods.</p> <h4>The Pattern is the Thing</h4> <p>The real reason to play with these methods is that they represent a great tactic for Ruby programming in general. It's important to remember that you won't know exactly what the users of your code will need. Delay making that decision whenever you can.</p> <p>In fact, delay it as long as you can, ideally just pushing the decision off on the user when they finally need to make it. They will know what they need better than you do. Let them raise an error, do a conversion, or whatever else makes sense for them.</p> <p>In a lot of ways, this discussion is about Ruby's blocks. That's the great tool Ruby gives us to allow us to delay these decisions. Consider even a simple method like this:</p> <div class="highlight highlight-ruby"><pre><span class="k">def</span> <span class="nf">do_some_io_operations_for_me</span> <span class="c1"># ... IO code here...</span> <span class="k">rescue</span> <span class="no">IOError</span><span class="p">,</span> <span class="no">Errno</span><span class="o">::</span><span class="no">EACCES</span> <span class="c1">#, ...</span> <span class="nb">block_given?</span> <span class="p">?</span> <span class="k">yield</span> <span class="p">:</span> <span class="k">raise</span> <span class="k">end</span> </pre></div> <p>This is a pretty perfect setup, in my opinion. This code tries to push through some <code>IO</code> operations. Those could fail for any number of reasons, so the code intelligently traps the errors that apply. If a users gives a block, they can control what happens on error without even needing to know which errors the <code>IO</code> code could trigger. However, the decision of exactly what to do is left to the caller.</p> <p>Of course, the biggest limitation on this strategy is that we only get one block in Ruby. Once you delay one decision with it, you won't have it for other purposes. Try not to let that stop you though! Ruby doesn't.</p> <p>Consider the <code>find()</code> iterator. With <code>find()</code> the block is already tied up for the test, but Ruby wants to let you decide what happens when nothing is found. Returning <code>nil</code> is not enough for those cases, because <code>nil</code> could legitimately be what the block found. Because of that, <code>find()</code> cheats to expose kind of a second block:</p> <div class="highlight highlight-ruby"><pre><span class="o">>></span> <span class="p">(</span><span class="mi">0</span><span class="o">.</span><span class="n">.</span><span class="mi">9</span><span class="p">)</span><span class="o">.</span><span class="n">find</span><span class="p">(</span><span class="o">-></span> <span class="p">{</span> <span class="nb">fail</span> <span class="no">ArgumentError</span><span class="p">,</span> <span class="s2">"Not found"</span> <span class="p">})</span> <span class="p">{</span> <span class="o">|</span><span class="n">n</span><span class="o">|</span> <span class="n">n</span> <span class="o">>=</span> <span class="mi">10</span> <span class="p">}</span> <span class="ss">ArgumentError</span><span class="p">:</span> <span class="no">Not</span> <span class="n">found</span> <span class="n">from</span> <span class="p">(</span><span class="n">pry</span><span class="p">):</span><span class="mi">28</span><span class="ss">:in</span> <span class="sb">`block in <main>'</span> </pre></div> <p>I think these kind of tricks come out a little cleaner with the new "stabby <code>lambda()</code>" (<code>-></code>) syntax that I used above.</p> <h4>Further Investigation</h4> <p>Fully getting the hang of when and where to use blocks in Ruby seems to take almost as long to get a feel for as the rest of the language does. Here are some sources that might shave a little time off of the journey though:</p> <ul> <li>I wrote <a href="/ruby-tutorials/code-as-a-data-type">an article</a> on blocks a long time ago. I think it has aged fairly well and still provides some insight into why blocks exist and what they really are.</li> <li>Rake is a great example of the delayed decisions I am advocating in this article in many ways. When you think about it, Rakes is really just an executable dependency graph of delayed decisions. For a more concrete example though, check out Rake's <a href="http://martinfowler.com/articles/rake.html#FileTasks">FileTask</a>. It's a delayed decision about how to build a file from one or more dependencies any time the content is no longer fresh.</li> <li>The 2.10.0 release of RSpec brings with it <a href="https://github.com/rspec/rspec-expectations#yielding">some matchers for yielded control to a block</a>. This can make testing all of those block methods I'm asking you to write a little easier.</li> </ul> James Edward Gray II Single Method Classes tag:graysoftinc.com,2012-05-01:/posts/113 2014-04-29T03:10:09Z In this article I discuss one of my pet peeves and show how you can avoid it by understanding what Ruby's modules are really for. <p><em>[<strong>Update</strong>: I've changed my mind about some of the following due to <a href="http://blog.codeclimate.com/blog/2012/11/14/why-ruby-class-methods-resist-refactoring/">this excellent counter argument</a>.]</em></p> <p>In the words of Dennis Miller, "I don't want to get off on a rant here, but…"</p> <p>There's something that drives me crazy and I see it in so much Ruby code. I see it in the documentation for our key projects; I see Rubyists of all skill levels doing it; it's just everywhere.</p> <p>Let's talk about when the use of a <code>Class</code> is and is not appropriate.</p> <h4>The Chained new()</h4> <p>Here's an example of one form of code that bugs me:</p> <div class="highlight highlight-ruby"><pre><span class="k">class</span> <span class="nc">Adder</span> <span class="k">def</span> <span class="nf">add</span><span class="p">(</span><span class="n">n</span><span class="p">)</span> <span class="mi">40</span> <span class="o">+</span> <span class="n">n</span> <span class="k">end</span> <span class="k">end</span> <span class="nb">p</span> <span class="no">Adder</span><span class="o">.</span><span class="n">new</span><span class="o">.</span><span class="n">add</span><span class="p">(</span><span class="mi">2</span><span class="p">)</span> </pre></div> <p>The problem here is that a <code>Class</code> has been used, probably because as Rubyists that's always our default choice, but it's the wrong fit for this code. A <code>Class</code> is for state and behavior. The example above is just using behavior. No state is maintained.</p> <p>A handy tip for sniffing out this problem is watching for a call to <code>new()</code> in the middle of method chaining as we have here. If you always use a <code>Class</code> like that, it's not really a <code>Class</code>. Put another way, if an instance never gets assigned to a variable, something has likely gone wrong with the design.</p> <p>Here's a slightly trickier version:</p> <div class="highlight highlight-ruby"><pre><span class="k">class</span> <span class="nc">Adder</span> <span class="k">def</span> <span class="nf">initialize</span><span class="p">(</span><span class="n">n</span><span class="p">)</span> <span class="vi">@n</span> <span class="o">=</span> <span class="n">n</span> <span class="k">end</span> <span class="k">def</span> <span class="nf">add</span><span class="p">(</span><span class="n">n</span><span class="p">)</span> <span class="vi">@n</span> <span class="o">+</span> <span class="n">n</span> <span class="k">end</span> <span class="k">end</span> </pre></div> <p>Does this code have the same problem? It depends on how it gets used. If it's always used with a chained <code>new()</code> then it's the same thing we looked at above:</p> <div class="highlight highlight-ruby"><pre><span class="nb">p</span> <span class="no">Adder</span><span class="o">.</span><span class="n">new</span><span class="p">(</span><span class="mi">40</span><span class="p">)</span><span class="o">.</span><span class="n">add</span><span class="p">(</span><span class="mi">2</span><span class="p">)</span> </pre></div> <p>State isn't really being tracked here. It's just an illusion.</p> <p>However, it may be fine if the <code>Adder</code> is sometimes used like this:</p> <div class="highlight highlight-ruby"><pre><span class="n">forty</span> <span class="o">=</span> <span class="no">Adder</span><span class="o">.</span><span class="n">new</span><span class="p">(</span><span class="mi">40</span><span class="p">)</span> <span class="nb">puts</span> <span class="s2">"40 + 1 = </span><span class="si">#{</span><span class="n">forty</span><span class="o">.</span><span class="n">add</span><span class="p">(</span><span class="mi">1</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span> <span class="nb">puts</span> <span class="s2">"40 + 2 = </span><span class="si">#{</span><span class="n">forty</span><span class="o">.</span><span class="n">add</span><span class="p">(</span><span class="mi">2</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span> <span class="nb">puts</span> <span class="s2">"40 + 3 = </span><span class="si">#{</span><span class="n">forty</span><span class="o">.</span><span class="n">add</span><span class="p">(</span><span class="mi">3</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span> </pre></div> <p>Note the variable assignment. As I said before, this is our hint that things are on the up and up. In this case, some value is locked-in so we can then run some experiments on it. That initial value is state, so this is a fine use for a <code>Class</code>.</p> <p>This isn't the only form of the problem we need to watch out for though.</p> <h5>The Unused new()</h5> <p>Some programmers see my first example and think, "No problem. Let's remove the <code>new()</code>." They will often change the code to be something like this:</p> <div class="highlight highlight-ruby"><pre><span class="k">class</span> <span class="nc">Adder</span> <span class="k">def</span> <span class="nc">self</span><span class="o">.</span><span class="nf">add</span><span class="p">(</span><span class="n">n</span><span class="p">)</span> <span class="mi">40</span> <span class="o">+</span> <span class="n">n</span> <span class="k">end</span> <span class="k">end</span> <span class="nb">p</span> <span class="no">Adder</span><span class="o">.</span><span class="n">add</span><span class="p">(</span><span class="mi">2</span><span class="p">)</span> </pre></div> <p>This isn't any better. Yes, the chained call to <code>new()</code> is gone. However, now we have a new problem. What does this mean?</p> <div class="highlight highlight-ruby"><pre><span class="n">what_am_i</span> <span class="o">=</span> <span class="no">Adder</span><span class="o">.</span><span class="n">new</span> </pre></div> <p>A <code>Class</code> is a factory for manufacturing instances of some type. With this code, I am still allowed to make those instances, but they are completely pointless. There's no meaningful state or behavior for my new instance.</p> <p>We could used some Ruby tricks to make <code>new()</code> uncallable, but that's not really better. Introspection would still tell us that <code>Adder</code> is a <code>Class</code>. That's a lie. It's not for manufacturing instances.</p> <p>That's why this problem bugs me when I see it in code, by the way. Remember, the primary purpose of code is to communicate with the reader. Always. Period. Code that uses <code>Class</code>es in this way does not do that well. When I see a <code>Class</code>, I am thinking about the instances it will be used to manufacture. If that's not its purpose, I have been lead astray. We want our code to communicate better.</p> <h4>The One Word Fix</h4> <p>We have multiple choices for how to improve code like this, when we see it. The easiest is to make a one word change to my last example:</p> <div class="highlight highlight-ruby"><pre><span class="k">module</span> <span class="nn">Adder</span> <span class="k">def</span> <span class="nc">self</span><span class="o">.</span><span class="nf">add</span><span class="p">(</span><span class="n">n</span><span class="p">)</span> <span class="mi">40</span> <span class="o">+</span> <span class="n">n</span> <span class="k">end</span> <span class="k">end</span> <span class="nb">p</span> <span class="no">Adder</span><span class="o">.</span><span class="n">add</span><span class="p">(</span><span class="mi">2</span><span class="p">)</span> </pre></div> <p>Now we are working with a <code>Module</code> instead of a <code>Class</code>. The rules have changed. A <code>Module</code> is not used to manufacture instances. It can't do that. It's not really for maintaining state (though I admit that there are minor exceptions to this).</p> <p>The important point is that I won't be thinking about instances when I read this code. It communicates better.</p> <p>Is it the best we can do though?</p> <h5>Dual Natured</h5> <p>While a <code>Module</code> is not an instance factory, it does fill multiple roles in Ruby. This isn't your fault. A <code>Module</code> is a bit of an overloaded concept in the language.</p> <p>First, a <code>Module</code> is often used as a namespace in Ruby. It can group together related constants and methods. We are fine with that meaning here. It just says that the <code>add()</code> method is part of the <code>Adder</code> namespace. No problem.</p> <p>A <code>Module</code> is also a place to hang methods that don't belong on a <code>Class</code>, typically because they don't maintain any state. Conversion methods are a great example of this. Think of <code>ERB::Util.h()</code>. Again, this meaning is fine. We actually switched to a <code>Module</code> for exactly this reason.</p> <p>Finally, a <code>Module</code> can be used as a mix-in in Ruby. This essentially allows plugging it into any other scope. It will add its methods and constants to that scope. This last meaning is a bit of a problem for our "fixed" code. The reason is that it's possible to write this code using our last example:</p> <div class="highlight highlight-ruby"><pre><span class="k">class</span> <span class="nc">SomeMathyThing</span> <span class="kp">include</span> <span class="no">Adder</span> <span class="k">end</span> </pre></div> <p>This is similar to our unused <code>new()</code> problem. While we can mix this <code>Module</code> in (because you can do that with any Ruby <code>Module</code>), it has no meaning. Only instance-level methods and constants matter when mixing a <code>Module</code> in and we didn't define either of those.</p> <p>I want to stress that this isn't your fault. This is a quirk of how Ruby is designed. Switching to a <code>Module</code> is still an acceptable fix.</p> <p>The question is, could we do even better? Could we bring our code in line with all three meanings of Ruby's <code>Module</code>. If we can, it might just communicate even better. That's a noble goal, so let's try it.</p> <p>It turns out that Ruby includes a not-too-well-known tool just for this reason. A <code>Module</code> that uses this tool can be used both as a bag of methods and a mix-in. For example, take a look at the built-in <code>Math</code> <code>Module</code>:</p> <div class="highlight highlight-ruby"><pre><span class="k">module</span> <span class="nn">SomeMathyThing</span> <span class="kp">extend</span> <span class="no">Math</span> <span class="k">def</span> <span class="nc">self</span><span class="o">.</span><span class="nf">do_math</span> <span class="n">sqrt</span><span class="p">(</span><span class="mi">4</span><span class="p">)</span> <span class="k">end</span> <span class="k">end</span> <span class="nb">p</span> <span class="no">Math</span><span class="o">.</span><span class="n">sqrt</span><span class="p">(</span><span class="mi">4</span><span class="p">)</span> <span class="nb">p</span> <span class="no">SomeMathyThing</span><span class="o">.</span><span class="n">do_math</span> </pre></div> <p>As you can see we can call methods on <code>Math</code> directly and we can also add <code>Math</code> to other scopes when it makes sense. It fits all three definitions of a <code>Module</code> in Ruby.</p> <p>The <code>Kernel</code> <code>Module</code> also behaves this way. If you were in some context that defined a <code>p()</code> method, you could still get to the one in <code>Kernel</code> if you needed it. The code for that would be <code>::Kernel.p()</code>. The leading <code>::</code> forces the constant lookup to happen from the top level, where <code>Kernel</code> lives. That ensures you will get the right <code>Kernel</code>, even if another constant with the same name is available in your current scope. Then we just call <code>p()</code> on the <code>Module</code> normally.</p> <p>This is done with the help of <code>module_function()</code> and we can use it ourselves:</p> <div class="highlight highlight-ruby"><pre><span class="k">module</span> <span class="nn">Adder</span> <span class="kp">module_function</span> <span class="k">def</span> <span class="nf">add</span><span class="p">(</span><span class="n">n</span><span class="p">)</span> <span class="mi">40</span> <span class="o">+</span> <span class="n">n</span> <span class="k">end</span> <span class="k">end</span> <span class="k">module</span> <span class="nn">SomeMathyThing</span> <span class="kp">extend</span> <span class="no">Adder</span> <span class="k">def</span> <span class="nc">self</span><span class="o">.</span><span class="nf">do_add</span> <span class="n">add</span><span class="p">(</span><span class="mi">2</span><span class="p">)</span> <span class="k">end</span> <span class="k">end</span> <span class="nb">p</span> <span class="no">Adder</span><span class="o">.</span><span class="n">add</span><span class="p">(</span><span class="mi">2</span><span class="p">)</span> <span class="nb">p</span> <span class="no">SomeMathyThing</span><span class="o">.</span><span class="n">do_add</span> </pre></div> <p>Notice that I just defined normal instance-level methods after calling <code>module_function()</code>. <code>module_function()</code> is like Ruby's <code>public()</code> and <code>private()</code> in that it will affect methods that follow, when used without an argument. (It does support passing arguments to affect specific methods as well.)</p> <h5>Controlling Access</h5> <p>Transforming a method with <code>module_function()</code> does a couple of things. First, the instance level methods are copied up to the <code>Module</code> level. This is what allows for the dual interface.</p> <p>Another effect of <code>module_function()</code> is that the instance level methods are made <code>private()</code>. This prevents them from adding to any external interface when they are used as a mix-in. This is also why things like <code>Kernel</code>'s <code>p()</code> cannot be called with a receiver, except in the <code>Module</code> level access case I showed earlier. In other words, this code will throw a "private method called" error even with our last example:</p> <div class="highlight highlight-ruby"><pre><span class="no">Object</span><span class="o">.</span><span class="n">new</span><span class="o">.</span><span class="n">extend</span><span class="p">(</span><span class="no">Adder</span><span class="p">)</span><span class="o">.</span><span class="n">add</span><span class="p">(</span><span class="mi">2</span><span class="p">)</span> </pre></div> <p>This is usually desirable, but if you have a case where you would prefer to control access for the methods you define, you're probably going to lock horns with <code>module_function()</code>.</p> <p>There's a trick you can use to get around even that. Checkout this example:</p> <div class="highlight highlight-ruby"><pre><span class="k">module</span> <span class="nn">AccessControlled</span> <span class="kp">extend</span> <span class="nb">self</span> <span class="k">def</span> <span class="nf">share_me</span> <span class="n">hide_me</span><span class="o">.</span><span class="n">sub</span><span class="p">(</span><span class="s2">"private"</span><span class="p">,</span> <span class="s2">"public"</span><span class="p">)</span> <span class="k">end</span> <span class="kp">private</span> <span class="k">def</span> <span class="nf">hide_me</span> <span class="s2">"I am a private interface."</span> <span class="k">end</span> <span class="k">end</span> <span class="nb">p</span> <span class="no">AccessControlled</span><span class="o">.</span><span class="n">share_me</span> <span class="nb">p</span> <span class="no">Object</span><span class="o">.</span><span class="n">new</span><span class="o">.</span><span class="n">extend</span><span class="p">(</span><span class="no">AccessControlled</span><span class="p">)</span><span class="o">.</span><span class="n">share_me</span> </pre></div> <p>The magic line is <code>extend self</code> which mixes the <code>Module</code> into itself at the <code>Module</code> level. This gives the same kind of dual interface we had before, but it also respects the access control we have setup for the methods. You can see that <code>share_me()</code> does add to the public interface of objects it is mixed into. Also, both of the following lines are errors, assuming the code above:</p> <div class="highlight highlight-ruby"><pre><span class="no">AccessControlled</span><span class="o">.</span><span class="n">hide_me</span> <span class="no">Object</span><span class="o">.</span><span class="n">new</span><span class="o">.</span><span class="n">extend</span><span class="p">(</span><span class="no">AccessControlled</span><span class="p">)</span><span class="o">.</span><span class="n">hide_me</span> </pre></div> <p>I tend to reach for <code>module_function()</code> first, preferring to keep as much <code>private()</code> as I can get away with. If I find myself in a situation where I need more control over visibility though, I'll switch to <code>extend self</code>.</p> <h4>The One True Interface</h4> <p>I want to cover one last semi-related point.</p> <p>A lot of API's ask us to pass an object that responds to a certain method. If you are expecting just one method, make it <code>call()</code>.</p> <p>I think the downside to this approach is that programmer's worry it's not as expressive. While that's the right concern to have, I don't think it's as bad we think. It basically comes to this code <code>validater.valid?(whatever)</code> verses <code>validater.call(whatever)</code>. While the former does clearly express what is happening, the second still comes out pretty OK in plain English, "Mr. Validater I am now calling upon you to do your job."</p> <p>Plus there's just too much gain for going with <code>call()</code>. It's already been decided: <code>call()</code> is the preferred one method interface in Ruby. This makes you compatible with <code>Proc</code> (and <code>lambda()</code>) and <code>Rack</code>, just to give some key examples. That allows me to skip defining a <code>Class</code>/<code>Module</code> altogether if my needs are simple or possibly to serve whatever I am defining in a Web application. That's just because you chose to go with <code>call()</code>. Standard interfaces are handy.</p> <p>If I haven't swayed you, at least support both, with some code like this:</p> <div class="highlight highlight-ruby"><pre><span class="k">if</span> <span class="n">validater</span><span class="o">.</span><span class="n">respond_to?</span><span class="p">(</span><span class="ss">:valid?</span><span class="p">)</span> <span class="n">validater</span><span class="o">.</span><span class="n">valid?</span><span class="p">(</span><span class="n">whatever</span><span class="p">)</span> <span class="k">else</span> <span class="n">validater</span><span class="o">.</span><span class="n">call</span><span class="p">(</span><span class="n">whatever</span><span class="p">)</span> <span class="k">end</span> </pre></div> <h4>Help Me End This Bad Habit</h4> <p>You now know that every time I see these single method stateless <code>Class</code>es in the wild I die a little inside. Have pity on my aging heart! Here's what you can do to help:</p> <ul> <li>Check your code. I know you were reading this whole article thinking, "I don't do that." However, you probably do. Find code like this and improve it.</li> <li>Ignore bad documentation. Whenever a Ruby project's documentation tells you to define these silly <code>Class</code>es, try it my way first. It pretty much always works just fine.</li> <li>Fix the code and documentation of others. Start sending patches. Share a link to this article when you do. Let's make this less common. I'll live longer.</li> </ul> James Edward Gray II Let's Patch Rails tag:graysoftinc.com,2012-04-21:/posts/112 2014-04-29T01:01:08Z In this article I walk through the entire process of preparing and submitting a patch for an open source project, using Rails as my example. <p>In celebration of my first ever trip to <a href="http://railsconf2012.com/">RailsConf</a> next week I wanted to be a good open source citizen and contribute a patch.</p> <p>I'm giving <a href="https://www.youtube.com/watch?v=GRfJ9lni4QA">a presentation</a> at the conference on various random features that the framework provides. I selected features from many places like blog posts, books, and some that I just remembered from years of working with the software.</p> <p>One of the features I decided to show was an old feature that I never see anyone use. It turns out that there's a good reason for that. When I tried it on a modern Rails, it didn't work anymore. Rails has undergone some changes under the hood and this feature was likely removed in that process. I figured out a workaround so I could still show it in my presentation, but it would be nice if I contributed the fix back to Rails so others could use it.</p> <p>In this article, I will walk through the entire process of doing that.</p> <h4>What's Missing?</h4> <p>ERb has always had an under appreciated syntax tweak. Everyone knows you can write code like this:</p> <pre><code>$ erb <% %w[This is ERb].each do |w| %> * <%= w %> <% end %> ^D * This * is * ERb </code></pre> <p>If you pass the proper flag though, ERb can also understand this shorthand syntax:</p> <pre><code>$ erb -T - % %w[This is ERb].each do |w| * <%= w %> % end * This * is * ERb </code></pre> <p>As you can see, just starting a line with <code>%</code> is enough to put the entire line in Ruby mode (with the result not inserted into the document). This makes for very clean iterators and <code>if</code> statements, in my opinion.</p> <p>Rails supported this syntax in the past. You could set <code>config.action_view.erb_trim_mode</code> to a <code>String</code> containing a <code>%</code> to enable it. Rails still supports the <em>trim mode</em> setting, but now it only supports the <code>-</code> mode for trimming whitespace around ERb tags. (Confusingly, the <code>-</code> argument to the command-line program I used above does both <code>%</code> and <code>-</code>, but ERb doesn't behave that way internally.)</p> <p>I believe the main reason this feature got dropped is that Rails has switched over to using Erubis on the backend. Erubis is ERb compatible, but it looks like the Rails team only managed to support the <code>-</code> trim mode in the change and dropped the support for <code>%</code>.</p> <p>That's what I intend to restore.</p> <h4>Getting a Working Install</h4> <p>I have contributed to Rails some in the past, but that was years ago now. Because it has been so long, I don't even have a checkout of the code anymore. That seems like a good place to start.</p> <p>I know <a href="https://github.com/rails/rails">where Rails lives on GitHub</a>, but if I didn't I would have tried to find it by Googling <em>Rails GitHub</em>. I'll begin by visiting the Rails repository, forking a copy of my own to mess around with, grabbing the URL for my copy, and cloning it locally. That last step amounts to running this command:</p> <pre><code>$ git clone git@github.com:JEG2/rails.git Cloning into rails... remote: Counting objects: 296204, done. remote: Compressing objects: 100% (74450/74450), done. hooks/post-upload-pack:5:in `require': no such file to load -- /data/repositories/3/nw/39/14/config/basic (LoadError) from hooks/post-upload-pack:5 remote: Total 296204 (delta 230167), reused 283494 (delta 218965) Receiving objects: 100% (296204/296204), 40.50 MiB | 1.75 MiB/s, done. Resolving deltas: 100% (230167/230167), done. </code></pre> <p>I seem to have a copy now, but notice that there was an error reported in the process.</p> <h5>Sidetracked</h5> <p>I debated whether or not I should let this distract me from my goal, but it does seem worth a quick look since it seems to affect cloning the project and a lot of programmers do that. My goal is to be good citizen and fixing broken windows is a great way to do that.</p> <p>So I peaked inside of that hook file… well, I tried. I assumed the hook would be in the <code>.git/hooks</code> directory, but it wasn't:</p> <pre><code>$ cat .git/hooks/post-upload-pack cat: .git/hooks/post-upload-pack: No such file or directory </code></pre> <p>When it wasn't where I expected it to be, I Googled for the error: <em>from hooks/post-upload-pack</em>. <a href="https://gist.github.com/2377785">The first link</a> showed me that others have this issue with non-Rails repositories. <a href="https://github.com/mxcl/homebrew/issues/11101">The second link</a> confirmed my suspicion that this isn't related to Rails. It's actually a GitHub issue in this case.</p> <p>Good to know. I'll let that go and get back to patching now.</p> <h5>Getting it to Run</h5> <p>Now that I have the Rails source, I need to get it setup for development. Many projects include some information about how to contribute, often in their README, and that usually gives you some steps for getting started. Sure enough, the Rails README did have a section for that and it actually linked me to <a href="http://edgeguides.rubyonrails.org/contributing_to_ruby_on_rails.html">a detailed guide on how to contribute</a>.</p> <p>Though it takes a little time, you really should read through this content. It sucks to dump a bunch of effort into a patch only to have it rejected because you didn't do it the way the maintainers for that project like things done. That usually ends up wasting even more time than just reading the documentation.</p> <p>So I read it. It reminded me to search for my issue in their tracker, to make sure it wasn't there already. I tried searches for <em>erb_trim_mode</em> and just <em>erb</em> but none of the results seemed relevant.</p> <p>Next, the guide told me to get the test suite running. That sounded like a great idea to me. I started working through those steps.</p> <p>I already had Git installed and I had checked out the Rails source, so I skipped over those steps.</p> <p>The next step talks about installing some dependencies, but only gave instructions for an operating system I don't use. I thought I had some of them anyway, maybe even all though I wasn't sure. Given that, I decided to just make sure I had the latest version of Bundler, as the guide recommends, <code>bundle</code>, and try the tests to see what happens:</p> <pre><code>$ gem install bundler Successfully installed bundler-1.1.3 1 gem installed Installing ri documentation for bundler-1.1.3... Building YARD (yri) index for bundler-1.1.3... Installing RDoc documentation for bundler-1.1.3... $ gem update bundler Updating installed gems Nothing to update $ bundle install --without db … Your bundle is complete! Use `bundle show [gemname]` to see where a bundled gem is installed. … $ bundle exec rake test … </code></pre> <p>That last command dumped a metric ton of output. I saw a lot of tests flow by, some errors, and plenty of warnings. I had to decide how I should handle this.</p> <p>One option would be to start addressing these issues until I can cleanly run the entire test suite. That could take quite a bit of time though. The truth is that I only need to touch one small part of Rails and I know that part isn't the database (a complex portion of the Rails test suite that gets its own section in the guide). Because of that, I decide to focus in on the subsection of Rails I want to manipulate and try to get that section running cleanly.</p> <p>First, I need to find the right spot. I searched through the code for the broken setting:</p> <pre><code>$ ack erb_trim_mode actionpack/lib/action_view/base.rb 155: delegate :erb_trim_mode=, :to => 'ActionView::Template::Handlers::ERB' actionpack/lib/action_view/template/handlers/erb.rb 44: class_attribute :erb_trim_mode 45: self.erb_trim_mode = '-' 82: :trim => (self.class.erb_trim_mode == "-") </code></pre> <p>OK, it looks like the code I care about is in ActionPack, so I'll focus in on that. That went better, though still not perfect:</p> <pre><code>$ cd actionpack/ $ bundle exec rake test … … warning: loading in progress, circular require considered harmful - … … … warning: method redefined; discarding old blank? … warning: previous definition of blank? was here … Skipping MemCacheStoreTest tests. Start memcached and try again. … Finished tests in 22.599275s, 160.8459 tests/s, 723.3418 assertions/s. 1) Error: test_parameters(RequestTest): ArgumentError: wrong number of arguments (1 for 0) … 3635 tests, 16347 assertions, 0 failures, 1 errors, 0 skips rake aborted! … </code></pre> <p>There are a few things happening here. First, I'm seeing some warnings. I wish they weren't there, but they don't really apply to what I am doing here and I'm going to ignore them for now.</p> <p>I also noticed that some tests were skipped because I didn't have <code>memcached</code> running. That's fine. I'm not going to touch anything related to that, so skip away.</p> <p>Finally the test suite does seem to have a single error. If it were several errors I might be concerned that I don't have something setup right, but this is just one error that looks like a Ruby issue nowhere near the code I'm going to work on. I note that it's there, but try not to worry about it for now.</p> <p>I'll want to check this full suite again before I'm done to make sure I haven't made anything worse, but it would be nice if I could zero in even more on just the part I care about. The guide told me about a feature to run just one directory of tests. It also told me how to silence the warnings. I would like to try combining both of those tricks to see if I can get down to a small clean run of tests I can experiment with.</p> <p>My previous search showed that the code I need to modify is the <code>ActionView::Template::Handlers::ERB</code>. I didn't match any code in the tests though, so I think we can assume that this feature is probably untested. That would explain how it got removed in the first place. Still, I hope the handler itself is tested and I hunt for that:</p> <pre><code>$ ls test abstract assertions lib ts_isolated.rb abstract_unit.rb controller routing active_record_unit.rb dispatch template activerecord fixtures tmp </code></pre> <p>That <code>template</code> directory looks promising. I wanted to see if it was possible to get a clean run of just those tests. Unfortunately, it didn't go as well as I hoped. I was able to silence the warnings, but Rails seemed to ignore the <code>TEST_DIR</code> feature mentioned in the guide.</p> <p>I poked around some more. I couldn't find any tests for the specific feature I am interested in. I did find some semi-related tests for ERb functionality in the <code>erb</code> subdirectory. With a little fiddling around I figured out how to run one of those files individually:</p> <pre><code>$ bundle exec ruby -I test test/template/erb/tag_helper_test.rb Run options: --seed 6234 # Running tests: ..... Finished tests in 0.011093s, 450.7347 tests/s, 540.8816 assertions/s. 5 tests, 6 assertions, 0 failures, 0 errors, 0 skips </code></pre> <p>I plan to add a file in this directory for testing the handlers. I can run just that file as I work to see how things are going, then close with a full run of the of the ActionPack suite to confirm that I haven't made anything worse.</p> <h4>The Boy Scout Rule</h4> <p>I want to add another possible trim mode, but it looks like what's there isn't even tested. That's problematic because I won't know if I break that feature.</p> <p>Given that, I would like to add a super trivial set of tests just to verify the current behavior. Next, I'll add some tests for the behavior I want and then add the feature.</p> <p>This means I'll be leaving things in slightly better shape than I found them. There will be a new feature, it will be tested, and the existing feature will gain some coverage.</p> <p>To me, this is the ideal strategy for approaching any open source contribution. If we all did this, things would always improve with every commit.</p> <p>I start by adding the new test file I need as <code>test/template/erb/handlers_test.rb</code> and ape a little of the setup code I saw from other files in that directory:</p> <div class="highlight highlight-ruby"><pre><span class="nb">require</span> <span class="s2">"abstract_unit"</span> <span class="k">class</span> <span class="nc">HandlersTest</span> <span class="o"><</span> <span class="no">ActiveSupport</span><span class="o">::</span><span class="no">TestCase</span> <span class="kp">extend</span> <span class="no">ActiveSupport</span><span class="o">::</span><span class="no">Testing</span><span class="o">::</span><span class="no">Declarative</span> <span class="k">end</span> </pre></div> <p>Then I added a little code to make it easy to temporarily change the trim mode and to render some content using a handler:</p> <div class="highlight highlight-ruby"><pre><span class="nb">require</span> <span class="s2">"abstract_unit"</span> <span class="k">class</span> <span class="nc">HandlersTest</span> <span class="o"><</span> <span class="no">ActiveSupport</span><span class="o">::</span><span class="no">TestCase</span> <span class="no">HANDLER</span> <span class="o">=</span> <span class="no">ActionView</span><span class="o">::</span><span class="no">Template</span><span class="o">::</span><span class="no">Handlers</span><span class="o">::</span><span class="no">ERB</span> <span class="no">Template</span> <span class="o">=</span> <span class="no">Struct</span><span class="o">.</span><span class="n">new</span><span class="p">(</span><span class="ss">:source</span><span class="p">)</span> <span class="kp">extend</span> <span class="no">ActiveSupport</span><span class="o">::</span><span class="no">Testing</span><span class="o">::</span><span class="no">Declarative</span> <span class="kp">private</span> <span class="k">def</span> <span class="nf">with_erb_trim_mode</span><span class="p">(</span><span class="n">mode</span><span class="p">)</span> <span class="vi">@old_erb_trim_mode</span> <span class="o">=</span> <span class="no">HANDLER</span><span class="o">.</span><span class="n">erb_trim_mode</span> <span class="no">HANDLER</span><span class="o">.</span><span class="n">erb_trim_mode</span> <span class="o">=</span> <span class="n">mode</span> <span class="k">yield</span> <span class="k">ensure</span> <span class="no">HANDLER</span><span class="o">.</span><span class="n">erb_trim_mode</span> <span class="o">=</span> <span class="vi">@old_erb_trim_mode</span> <span class="k">end</span> <span class="k">def</span> <span class="nf">render</span><span class="p">(</span><span class="n">template</span><span class="p">)</span> <span class="nb">eval</span><span class="p">(</span><span class="s2">"output_buffer = nil; "</span> <span class="o">+</span> <span class="no">HANDLER</span><span class="o">.</span><span class="n">call</span><span class="p">(</span><span class="no">Template</span><span class="o">.</span><span class="n">new</span><span class="p">(</span><span class="n">template</span><span class="p">)))</span> <span class="k">end</span> <span class="k">end</span> </pre></div> <p>The <code>with_erb_trim_mode()</code> helper just sets the mode for me then runs a block of code. It wraps that block in some code to save and restore the old setting. We need to do that because this is effectively a global variable that affects all of Rails. It could break other tests if we left it on the wrong setting.</p> <p>It took me a bit to puzzle out a proper <code>render()</code> for these handlers. You can see that I had to add a <code>Template</code> just so I could put the ERb content in an expected <code>source()</code> method. I also had to set a variable before the <code>eval()</code> because the template code expects to have that from the context it gets run in. I figured these quirks out by reading the handler source and noodling with the code until I had figured out how to make it happy.</p> <p>Next I added two simple tests for the existing functionality:</p> <div class="highlight highlight-ruby"><pre><span class="nb">require</span> <span class="s2">"abstract_unit"</span> <span class="k">class</span> <span class="nc">HandlersTest</span> <span class="o"><</span> <span class="no">ActiveSupport</span><span class="o">::</span><span class="no">TestCase</span> <span class="c1"># ...</span> <span class="nb">test</span> <span class="s2">"content is not trimmed without a trim mode"</span> <span class="k">do</span> <span class="n">with_erb_trim_mode</span> <span class="kp">nil</span> <span class="k">do</span> <span class="n">assert_equal</span><span class="p">(</span><span class="s2">" </span><span class="se">\n</span><span class="s2">test"</span><span class="p">,</span> <span class="n">render</span><span class="p">(</span><span class="s2">" <% 'IGNORED' %> </span><span class="se">\n</span><span class="s2">test"</span><span class="p">))</span> <span class="k">end</span> <span class="k">end</span> <span class="nb">test</span> <span class="s2">"content around tags is trimmed if the trim mode includes a dash"</span> <span class="k">do</span> <span class="n">with_erb_trim_mode</span> <span class="s1">'-'</span> <span class="k">do</span> <span class="n">assert_equal</span><span class="p">(</span><span class="s2">"test"</span><span class="p">,</span> <span class="n">render</span><span class="p">(</span><span class="s2">" <% 'IGNORED' %> </span><span class="se">\n</span><span class="s2">test"</span><span class="p">))</span> <span class="k">end</span> <span class="k">end</span> <span class="c1"># ...</span> <span class="k">end</span> </pre></div> <p>Those are passing:</p> <pre><code>$ bundle exec ruby -I test test/template/erb/handlers_test.rb Run options: --seed 9634 # Running tests: .. Finished tests in 0.009449s, 211.6626 tests/s, 211.6626 assertions/s. 2 tests, 2 assertions, 0 failures, 0 errors, 0 skips </code></pre> <p>That gives me a touch more confidence for adding some new code, so I add some more tests for the functionality I want:</p> <div class="highlight highlight-ruby"><pre><span class="nb">require</span> <span class="s2">"abstract_unit"</span> <span class="k">class</span> <span class="nc">HandlersTest</span> <span class="o"><</span> <span class="no">ActiveSupport</span><span class="o">::</span><span class="no">TestCase</span> <span class="c1"># ...</span> <span class="nb">test</span> <span class="s2">"percent lines are normal content without a trim mode"</span> <span class="k">do</span> <span class="n">with_erb_trim_mode</span> <span class="kp">nil</span> <span class="k">do</span> <span class="n">assert_equal</span><span class="p">(</span> <span class="s2">"% if false</span><span class="se">\n</span><span class="s2">oops</span><span class="se">\n</span><span class="s2">% end</span><span class="se">\n</span><span class="s2">"</span><span class="p">,</span> <span class="n">render</span><span class="p">(</span><span class="s2">"% if false</span><span class="se">\n</span><span class="s2">oops</span><span class="se">\n</span><span class="s2">% end</span><span class="se">\n</span><span class="s2">"</span><span class="p">)</span> <span class="p">)</span> <span class="k">end</span> <span class="k">end</span> <span class="nb">test</span> <span class="s2">"percent lines count as ruby if trim mode includes a percent"</span> <span class="k">do</span> <span class="n">with_erb_trim_mode</span> <span class="s2">"%"</span> <span class="k">do</span> <span class="n">assert_equal</span><span class="p">(</span><span class="s2">""</span><span class="p">,</span> <span class="n">render</span><span class="p">(</span><span class="s2">"% if false</span><span class="se">\n</span><span class="s2">oops</span><span class="se">\n</span><span class="s2">% end</span><span class="se">\n</span><span class="s2">"</span><span class="p">))</span> <span class="k">end</span> <span class="k">end</span> <span class="nb">test</span> <span class="s2">"both trim modes can be used at the same time"</span> <span class="k">do</span> <span class="n">with_erb_trim_mode</span> <span class="s2">"%-"</span> <span class="k">do</span> <span class="n">assert_equal</span><span class="p">(</span> <span class="s2">"test"</span><span class="p">,</span> <span class="n">render</span><span class="p">(</span> <span class="s2">"% if false</span><span class="se">\n</span><span class="s2">oops</span><span class="se">\n</span><span class="s2">% end</span><span class="se">\n</span><span class="s2">"</span> <span class="o">+</span> <span class="s2">" <% 'IGNORED' %> </span><span class="se">\n</span><span class="s2">test"</span> <span class="p">)</span> <span class="p">)</span> <span class="k">end</span> <span class="k">end</span> <span class="c1"># ...</span> <span class="k">end</span> </pre></div> <p>I now have a couple of failing tests to fix:</p> <pre><code>$ bundle exec ruby -I test test/template/erb/handlers_test.rb Run options: --seed 15711 # Running tests: F...F Finished tests in 0.027155s, 184.1282 tests/s, 184.1282 assertions/s. 1) Failure: test_both…(HandlersTest) [test/template/erb/handlers_test.rb:36]: --- expected +++ actual @@ -1 +1,4 @@ -"test" +"% if false +oops +% end +test" 2) Failure: test_percent…(HandlersTest) [test/template/erb/handlers_test.rb:30]: --- expected +++ actual @@ -1 +1,4 @@ -"" +"% if false +oops +% end +" 5 tests, 5 assertions, 2 failures, 0 errors, 0 skips </code></pre> <h4>The Big Finish</h4> <p>The setup and tests were definitely the hard part. The actual code needed is tiny. First, I introduce a new handler:</p> <div class="highlight highlight-ruby"><pre><span class="nb">require</span> <span class="s1">'action_dispatch/http/mime_type'</span> <span class="nb">require</span> <span class="s1">'active_support/core_ext/class/attribute'</span> <span class="nb">require</span> <span class="s1">'erubis'</span> <span class="k">module</span> <span class="nn">ActionView</span> <span class="k">class</span> <span class="nc">Template</span> <span class="k">module</span> <span class="nn">Handlers</span> <span class="k">class</span> <span class="nc">Erubis</span> <span class="o"><</span> <span class="o">::</span><span class="no">Erubis</span><span class="o">::</span><span class="no">Eruby</span> <span class="c1"># ...</span> <span class="k">end</span> <span class="k">class</span> <span class="nc">ErubisWithPercentLine</span> <span class="o"><</span> <span class="no">Erubis</span> <span class="kp">include</span> <span class="o">::</span><span class="no">Erubis</span><span class="o">::</span><span class="no">PercentLineEnhancer</span> <span class="k">end</span> <span class="c1"># ...</span> <span class="k">end</span> <span class="k">end</span> <span class="k">end</span> </pre></div> <p>The old ERb code took its setting from a parameter to the constructor, but Erubis tells you to mix in a module that handles this feature. To do that, I just subclass the existing handler and add the module. Now we can have it either way, depending on which handler we delegate to.</p> <p>Next I edit a small chunk of implementation code for the <code>ERB</code> handler to take it from this:</p> <div class="highlight highlight-ruby"><pre><span class="nb">require</span> <span class="s1">'action_dispatch/http/mime_type'</span> <span class="nb">require</span> <span class="s1">'active_support/core_ext/class/attribute'</span> <span class="nb">require</span> <span class="s1">'erubis'</span> <span class="k">module</span> <span class="nn">ActionView</span> <span class="k">class</span> <span class="nc">Template</span> <span class="k">module</span> <span class="nn">Handlers</span> <span class="c1"># ...</span> <span class="k">class</span> <span class="nc">ERB</span> <span class="c1"># ...</span> <span class="k">def</span> <span class="nf">call</span><span class="p">(</span><span class="n">template</span><span class="p">)</span> <span class="c1"># ...</span> <span class="nb">self</span><span class="o">.</span><span class="n">class</span><span class="o">.</span><span class="n">erb_implementation</span><span class="o">.</span><span class="n">new</span><span class="p">(</span> <span class="n">erb</span><span class="p">,</span> <span class="ss">:trim</span> <span class="o">=></span> <span class="p">(</span><span class="nb">self</span><span class="o">.</span><span class="n">class</span><span class="o">.</span><span class="n">erb_trim_mode</span> <span class="o">==</span> <span class="s2">"-"</span><span class="p">)</span> <span class="p">)</span><span class="o">.</span><span class="n">src</span> <span class="k">end</span> <span class="c1"># ...</span> <span class="k">end</span> <span class="k">end</span> <span class="k">end</span> <span class="k">end</span> </pre></div> <p>to:</p> <div class="highlight highlight-ruby"><pre><span class="nb">require</span> <span class="s1">'action_dispatch/http/mime_type'</span> <span class="nb">require</span> <span class="s1">'active_support/core_ext/class/attribute'</span> <span class="nb">require</span> <span class="s1">'erubis'</span> <span class="k">module</span> <span class="nn">ActionView</span> <span class="k">class</span> <span class="nc">Template</span> <span class="k">module</span> <span class="nn">Handlers</span> <span class="c1"># ...</span> <span class="k">class</span> <span class="nc">ERB</span> <span class="c1"># ...</span> <span class="k">def</span> <span class="nf">call</span><span class="p">(</span><span class="n">template</span><span class="p">)</span> <span class="c1"># ...</span> <span class="n">mode</span> <span class="o">=</span> <span class="nb">self</span><span class="o">.</span><span class="n">class</span><span class="o">.</span><span class="n">erb_trim_mode</span><span class="o">.</span><span class="n">to_s</span> <span class="n">implementation</span> <span class="o">=</span> <span class="nb">self</span><span class="o">.</span><span class="n">class</span><span class="o">.</span><span class="n">erb_implementation</span> <span class="k">if</span> <span class="n">mode</span><span class="o">.</span><span class="n">include?</span><span class="p">(</span><span class="s2">"%"</span><span class="p">)</span> <span class="o">&&</span> <span class="n">implementation</span> <span class="o">==</span> <span class="no">Erubis</span> <span class="n">implementation</span> <span class="o">=</span> <span class="no">ErubisWithPercentLine</span> <span class="k">end</span> <span class="n">implementation</span><span class="o">.</span><span class="n">new</span><span class="p">(</span><span class="n">erb</span><span class="p">,</span> <span class="ss">:trim</span> <span class="o">=></span> <span class="n">mode</span><span class="o">.</span><span class="n">include?</span><span class="p">(</span><span class="s2">"-"</span><span class="p">))</span><span class="o">.</span><span class="n">src</span> <span class="k">end</span> <span class="c1"># ...</span> <span class="k">end</span> <span class="k">end</span> <span class="k">end</span> <span class="k">end</span> </pre></div> <p>Really all I do here is to trade out the handler if it is set to the normal <code>Erubis</code> and the trim mode includes <code>%</code>. In that case I switch to the handler that includes the extra behavior.</p> <p>I was a little worried I might be slowing down the Rails rendering pipeline with this change. That would be bad, because we know it's rare and I would hate to impact the common case to support it. However, I checked around a bit for the code that invokes this handler and it turns out that templates are only compiled once, under normal usage. That's perfect. Even if I did add a tiny penalty, we won't be paying it with every render. That's what I was worried about.</p> <p>I rerun my tests to ensure that change does the trick, then rerun the full ActionPack suite to verify that there's still just one failure. That's exactly how it goes, so the feature is restored.</p> <h4>The Polish</h4> <p>I assume this feature is never used because no one knows it exists. To increase the chances of people finding it I decide to add a CHANGELOG entry:</p> <pre><code>## Rails 4.0.0 (unreleased) ## * Restored support for the "%" ERb/Erubis _trim mode_. This can be activated with: config.action_view.erb_trim_mode = "%" # or "%-" whitespace trim With that mode active, you can use a single percent sign at the beginning of a line to engage Ruby mode (without inserting results). It allows for template code like this: % if current_user.try(:admin?) <%= render "edit_links" %> % end *James Edward Gray II* </code></pre> <p>There's other documentation that should be updated too. For example, I noticed that one of the Rails guides mentions this feature but gives the wrong default for it and claims that it supports a lot more modes than it does. I'll wait to see if the core team accepts my patch, then offer to fix that documentation to bring it inline.</p> <p>Take note that most of my work on this patch was not about adding the feature. I invested a lot of time in the tests, I worried about whether or not I was slowing Rails down, and I took time to add some documentation. A patch is more politics than code and I'm trying to make it easy for the core team to say, "Yes."</p> <h4>Sending it Up</h4> <p>The work is done, so it's time to push it up to GitHub and send a pull request. The first part is a few simple commands:</p> <pre><code>$ git add --all $ git commit -m "Restoring the '%' trim mode for ERb templates, …" [master c734294] Restoring… 3 files changed, 76 insertions(+), 4 deletions(-) create mode 100644 actionpack/test/template/erb/handlers_test.rb $ git push origin master Counting objects: 24, done. Delta compression using up to 8 threads. Compressing objects: 100% (13/13), done. Writing objects: 100% (13/13), 2.00 KiB, done. Total 13 (delta 10), reused 0 (delta 0) To git@github.com:JEG2/rails.git 99eae3f..c734294 master -> master </code></pre> <p>I went to GitHub and filled out the <a href="https://github.com/rails/rails/pull/5915">pull request</a>. Now I'll just have to wait and see if it gets accepted…</p> <h4>Get Involved</h4> <p>We should all remember to do our part. You can, and should, help out. Here are some ideas for things you could do:</p> <ul> <li>Try my patch. Whip up a little Rails application, point it at <a href="https://github.com/JEG2/rails">my fork</a> and try the new feature. If it works for you, go add a comment saying so to my pull request. This encourages the Rails team to accept the patch.</li> <li>Work on those warnings in the tests. You know I love running with warnings mode on, so it really bugs me that Rails doesn't run clean in that mode. These are usually quite easy to fix too. The message generally sends you to the exact line and you usually just need to add some parentheses, initialize a variable, or switch away from a deprecated method. If you make any pull request fixing these, drop me an email. I'm happy to advocate for you.</li> <li>If you are feeling adventurous and want to be a real hero, take a look at <a href="https://github.com/rails/rails/issues">the open Rails issues</a> and see if you can help out with any of them. There's usually some in there that aren't too much trouble if you dig a little and it's an excellent way to get comfortable with the Rails source.</li> </ul> James Edward Gray II Riding the Testrocket tag:graysoftinc.com,2012-04-11:/posts/99 2014-04-27T18:00:55Z In this article I dissect Peter Cooper's Testrocket library and show that those 18 lines of code can teach us a lot about Ruby. <p>I say it a lot, but programming is about ideas. More specifically, it's about not running out of ideas.</p> <p>Along these lines, I read the results of an interesting study recently. It was a study about how we think and solve problems. When I was in school, the belief was that we needed to cram our brain full of facts. We were pushed to memorize, memorize, memorize.</p> <p>The more modern view of learning is that facts don't matter as much. Nowadays we just try to teach children how to think. The assumption is that they can find the facts they need, because information is so universally available, and their thinking skills will allow them to work their way to other bits of knowledge.</p> <p>The study looked at people taught using both of these techniques and found some surprising results: us memorizers can often out think the thinkers. A leading theory about why that's the case is that the memorizers have more of a foundation to build their ideas off of. Thinkers may be starting closer to scratch each time. If so, they have further to go to get to the needed solution. Memorizers, on the other hand, may already have a lot of knowledge that puts them closer to the solution before they even need to start thinking.</p> <p>I think a lot of our habits in programming are about this phenomenon. We read lots of books, priming the pump with language details and sample code. We listen to conference talks about techniques other programmers have used. We program in pairs, to double our knowledge foundation before we even try anything.</p> <p>You should also be reading code. That's important because it let's you see the ideas of others, introducing external data points you might not divine on your own. It's also different from books and conference talks, which tend to stick to best practices. Some code is wild and the value of it may be hard to judge. Still, it can give you ideas and that's what counts.</p> <p>Today, I want to read some fun code together.</p> <h4>The Results of a Brawl</h4> <p>It's well known that I like code challenges, another great source of before-I-really-need-them ideas. That's why I ran the <a href="http://www.rubyquiz.com/">Ruby Quiz</a> for years.</p> <p>A more recent source of such contests is the <a href="http://codebrawl.com/">Codebrawl</a> site. They throw up a topic and programmers "fight" it out to come up with the best solution. One of the early brawls centered around <a href="http://codebrawl.com/contests/ruby-testing-libraries">testing libraries</a>. Peter Cooper won that fight by inventing a neat little library called <a href="https://github.com/peterc/testrocket">Testrocket</a>.</p> <p>The primary source of Testrocket is 18 lines of code, but there's a surprising amount of features packed in there. It also uses Ruby in some fairly surprising ways. Even the interface it achieves can be surprising. Let's pull back the curtain and see how it's done.</p> <h5>Rockets Away</h5> <p>The Testrocket library allows us to write tests for our code. It's named for the syntax used in those tests. In Ruby, we call the <code>Hash</code> pairing operator <code>=></code> the "Hashrocket." This library creates some pseudo-operators for testing, like <code>+-></code> and <code>--></code>. Those are the "Testrockets."</p> <p>Here's what a simple set of tests looks like:</p> <div class="highlight highlight-ruby"><pre><span class="nb">require</span> <span class="s2">"testrocket"</span> <span class="o">!-></span> <span class="p">{</span> <span class="s2">"Basic Math Tests"</span> <span class="p">}</span> <span class="o">+-></span> <span class="p">{</span> <span class="mi">40</span> <span class="o">+</span> <span class="mi">2</span> <span class="o">==</span> <span class="mi">42</span> <span class="p">}</span> <span class="o">--></span> <span class="p">{</span> <span class="mi">4</span> <span class="o">-</span> <span class="mi">2</span> <span class="o">==</span> <span class="mi">1</span> <span class="p">}</span> <span class="o">--></span> <span class="p">{</span> <span class="mi">5</span> <span class="o">/</span> <span class="mi">0</span> <span class="p">}</span> <span class="o">~-></span> <span class="p">{</span> <span class="s2">"test multiplication"</span> <span class="p">}</span> <span class="o">!-></span> <span class="p">{</span> <span class="s2">"A Failing Test"</span> <span class="p">}</span> <span class="o">+-></span> <span class="p">{</span> <span class="mi">2</span> <span class="o">+</span> <span class="mi">2</span> <span class="o">==</span> <span class="mi">5</span> <span class="p">}</span> </pre></div> <p>Running that code gives this output:</p> <pre><code> FIRE 'Basic Math Tests'! OK OK OK PENDING 'test multiplication' @ math_test.rb:8 FIRE 'A Failing Test'! FAIL @ math_test.rb:12 </code></pre> <p>This is obviously very simple, but it's interesting to look at just how this syntax is accomplished. Before we dive straight into the code though, let's discuss some parts of the Ruby language that will help us understand it.</p> <h5>The Arrow-to-the-Knee Operator</h5> <p>A new operator was added to Ruby 1.9 and it has a pretty interesting history. Rubyists have long complained that we wanted block arguments to be more like full method arguments. We wanted to be able to set defaults and such, but, most importantly, we wanted blocks that could take blocks.</p> <p>Metaprogramming was the main motivator here. It's common to dynamically define methods with tools like <code>define_method()</code>, which essentially turns a block into a method. If we wanted that newly created method to be able to take a block, blocks had to be able to take blocks.</p> <p>It was thought that it would be too hard to modify Ruby's parser to work this way, so a compromise was made. A new syntax for <code>lambda()</code> was introduced that could accept a normal range of arguments. You could convert that to a block, using the <code>&</code> prefix, when needed. Plus it could serve in other areas.</p> <p>In it's simplest form, the new operator looks like this:</p> <div class="highlight highlight-ruby"><pre><span class="o">>></span> <span class="o">-></span> <span class="p">{</span> <span class="p">}</span> <span class="o">=></span> <span class="c1">#<Proc:0x000001010da6b8@(pry):1 (lambda)></span> </pre></div> <p>Matz says the arrow was chosen because it kind of looks like a lambda (λ) if you lay it on it's side… and squint. Most people have taken to calling it the "stabby lambda," but it also looks like it could be someone taking an arrow to the knee, if you ask me.</p> <p>Of course, the new operator can take various arguments. That was the whole point:</p> <div class="highlight highlight-ruby"><pre><span class="o">>></span> <span class="o">-></span><span class="p">(</span><span class="n">n</span><span class="p">)</span> <span class="p">{</span> <span class="n">n</span> <span class="o">*</span> <span class="mi">2</span> <span class="p">}</span><span class="o">.</span><span class="n">call</span><span class="p">(</span><span class="mi">21</span><span class="p">)</span> <span class="o">=></span> <span class="mi">42</span> <span class="o">>></span> <span class="o">-></span><span class="p">(</span><span class="n">n</span><span class="p">,</span> <span class="n">offset</span> <span class="o">=</span> <span class="mi">2</span><span class="p">)</span> <span class="p">{</span> <span class="n">n</span> <span class="o">+</span> <span class="n">offset</span> <span class="p">}</span><span class="o">.</span><span class="n">call</span><span class="p">(</span><span class="mi">40</span><span class="p">)</span> <span class="o">=></span> <span class="mi">42</span> <span class="o">>></span> <span class="o">-></span><span class="p">(</span><span class="o">&</span><span class="n">block</span><span class="p">)</span> <span class="p">{</span> <span class="n">block</span><span class="o">[</span><span class="mi">20</span><span class="o">]</span> <span class="o">+</span> <span class="n">block</span><span class="o">[</span><span class="mi">1</span><span class="o">]</span> <span class="p">}</span><span class="o">.</span><span class="n">call</span> <span class="p">{</span> <span class="o">|</span><span class="n">n</span><span class="o">|</span> <span class="n">n</span> <span class="o">*</span> <span class="mi">2</span> <span class="p">}</span> <span class="o">=></span> <span class="mi">42</span> </pre></div> <p>This feature wasn't well liked by the community. Many people thought it looked more like messy Perl (which the idea was borrowed from) and less like beautiful Ruby. The community begged for a different solution and many ideas were offered up.</p> <p>One Rubyist even worked out a wickedly complex patch that enabled method style arguments for normal blocks. Aside from some rare edge cases, it all just worked as expected. There was a lot of debate over that patch, but it was eventually accepted. It too made it into Ruby 1.9:</p> <div class="highlight highlight-ruby"><pre><span class="o">>></span> <span class="k">def</span> <span class="nf">m</span><span class="p">(</span><span class="o">&</span><span class="n">b</span><span class="p">)</span> <span class="n">b</span><span class="o">.</span><span class="n">call</span><span class="p">(</span><span class="mi">20</span><span class="p">)</span> <span class="p">{</span> <span class="o">|</span><span class="n">n</span><span class="o">|</span> <span class="n">n</span> <span class="o">*</span> <span class="mi">2</span> <span class="p">}</span> <span class="k">end</span> <span class="o">=></span> <span class="kp">nil</span> <span class="o">>></span> <span class="n">m</span> <span class="p">{</span> <span class="o">|</span><span class="n">n</span><span class="p">,</span> <span class="n">offset</span> <span class="o">=</span> <span class="mi">1</span><span class="p">,</span> <span class="o">&</span><span class="n">bib</span><span class="o">|</span> <span class="n">bib</span><span class="o">[</span><span class="n">n</span><span class="o">]</span> <span class="o">+</span> <span class="n">bib</span><span class="o">[</span><span class="n">offset</span><span class="o">]</span> <span class="p">}</span> <span class="o">=></span> <span class="mi">42</span> </pre></div> <p>With the block problem properly solved, a lynch mob formed and went after stabby lambda's head. It was too late though. Matz was in love and the new syntax stayed.</p> <p>Given this history, I don't see the stabby lambda used in the wild much. But it was there for Peter Cooper to abuse in his testing library.</p> <p>Like it or not, I do think it holds some interesting possibilities for methods that need to take multiple blocks (especially when combined with the new <code>Hash</code> syntax). For example:</p> <div class="highlight highlight-ruby"><pre><span class="no">UserAgent</span><span class="o">.</span><span class="n">get</span> <span class="n">url</span><span class="p">,</span> <span class="ss">success</span><span class="p">:</span> <span class="o">-></span><span class="p">(</span><span class="n">response</span><span class="p">)</span> <span class="p">{</span> <span class="n">handle_response</span><span class="p">(</span><span class="n">response</span><span class="p">)</span> <span class="p">},</span> <span class="ss">failure</span><span class="p">:</span> <span class="o">-></span><span class="p">(</span><span class="n">error</span><span class="p">)</span> <span class="p">{</span> <span class="nb">fail</span> <span class="n">error</span><span class="o">.</span><span class="n">message</span> <span class="p">}</span> </pre></div> <h5>Plus the Other Half of the Puzzle</h5> <p>Stabby lambda is half of the story of how Peter created the Testrocket syntax. Remember that the library uses sequences like <code>+-></code> and <code>--></code>. The last two characters in those are the start of a stabby lambda, but the leading <code>+</code>/<code>-</code> isn't.</p> <p>Most Ruby operators are just syntactic sugar for calling certain methods on objects. Ruby allows us to define those methods to support the operators. For example, <code>Fixnum</code> has an unary minus method. It negates the following number. This is typically used to created negative numbers in our code:</p> <pre><code>$ ruby -e 'n = 13; p -n' -13 </code></pre> <p>But it doesn't have to function like that. We could be evil and make it double numbers instead:</p> <pre><code>$ ruby -e 'class Fixnum; def -@; self * 2 end end; n = 13; p -n' 26 </code></pre> <p>Note that I overrode the <code>-@</code> method there. That's the unary minus, whereas the <code>-</code> method is the binary operator that normally performs subtraction.</p> <p>Now a <code>Proc</code>, the object created by the stabby lambda, doesn't normally respond to the math operators. We can't add lambdas, for example:</p> <pre><code>$ ruby -e '-> { } + -> { }' -e:1:in `<main>': undefined method `+' for #<Proc:…> (NoMethodError) </code></pre> <p>However, if we could think up a reasonable meaning for adding two <code>Proc</code> objects together, we could make it work:</p> <pre><code>$ ruby -e 'class Proc; def +(o) self.class.new { call; o.call } end end; (-> { puts 1 } + -> { puts 2 }).call' 1 2 </code></pre> <p>Peter chose to define the unary plus and minus on <code>Proc</code>, plus other methods. This gave them new capabilities and turned them into his Testrockets.</p> <p>If you're still with me, you are finally ready to see Peter's code:</p> <h5>A Tiny Library</h5> <p>Here's all 18 lines of Peter's code:</p> <div class="highlight highlight-ruby"><pre><span class="k">module</span> <span class="nn">TestRocket</span> <span class="kp">extend</span> <span class="no">Module</span><span class="o">.</span><span class="n">new</span> <span class="p">{</span> <span class="kp">attr_accessor</span> <span class="ss">:out</span> <span class="p">}</span> <span class="k">def</span> <span class="nf">_test</span><span class="p">(</span><span class="n">a</span><span class="p">,</span> <span class="n">b</span><span class="p">);</span> <span class="nb">send</span><span class="p">((</span><span class="n">call</span> <span class="k">rescue</span><span class="p">())</span> <span class="p">?</span> <span class="n">a</span> <span class="p">:</span> <span class="n">b</span><span class="p">);</span> <span class="k">end</span> <span class="k">def</span> <span class="nf">+@</span><span class="p">;</span> <span class="n">_show</span> <span class="n">_test</span> <span class="ss">:_pass</span><span class="p">,</span> <span class="ss">:_fail</span> <span class="k">end</span> <span class="k">def</span> <span class="nf">-@</span><span class="p">;</span> <span class="n">_show</span> <span class="n">_test</span> <span class="ss">:_fail</span><span class="p">,</span> <span class="ss">:_pass</span> <span class="k">end</span> <span class="k">def</span> <span class="nf">~</span><span class="err">@</span><span class="p">;</span> <span class="n">_show</span> <span class="n">_pend</span><span class="p">;</span> <span class="k">end</span> <span class="k">def</span> <span class="o">!</span><span class="err">@</span><span class="p">;</span> <span class="n">_show</span> <span class="n">_desc</span><span class="p">;</span> <span class="k">end</span> <span class="k">def</span> <span class="nf">_show</span><span class="p">(</span><span class="n">r</span><span class="p">);</span> <span class="p">(</span><span class="no">TestRocket</span><span class="o">.</span><span class="n">out</span> <span class="o">||</span> <span class="vg">$></span><span class="p">)</span> <span class="o"><<</span> <span class="n">r</span><span class="p">;</span> <span class="n">r</span> <span class="k">end</span> <span class="k">def</span> <span class="nf">_pass</span><span class="p">;</span> <span class="s2">" OK</span><span class="se">\n</span><span class="s2">"</span><span class="p">;</span> <span class="k">end</span> <span class="k">def</span> <span class="nf">_fail</span><span class="p">;</span> <span class="s2">" FAIL @ </span><span class="si">#{</span><span class="n">source_location</span> <span class="o">*</span> <span class="s1">':'</span><span class="si">}</span><span class="se">\n</span><span class="s2">"</span><span class="p">;</span> <span class="k">end</span> <span class="k">def</span> <span class="nf">_pend</span><span class="p">;</span> <span class="s2">"PENDING '</span><span class="si">#{</span><span class="n">call</span><span class="si">}</span><span class="s2">' @ </span><span class="si">#{</span><span class="n">source_location</span> <span class="o">*</span> <span class="s1">':'</span><span class="si">}</span><span class="se">\n</span><span class="s2">"</span><span class="p">;</span> <span class="k">end</span> <span class="k">def</span> <span class="nf">_desc</span><span class="p">;</span> <span class="s2">" FIRE '</span><span class="si">#{</span><span class="n">call</span><span class="si">}</span><span class="s2">'!</span><span class="se">\n</span><span class="s2">"</span><span class="p">;</span> <span class="k">end</span> <span class="k">end</span> <span class="no">Proc</span><span class="o">.</span><span class="n">send</span> <span class="ss">:include</span><span class="p">,</span> <span class="no">TestRocket</span> </pre></div> <p>OK, so this code defines a <code>Module</code> called <code>Testrocket</code> (the first line) that is mixed into all <code>Proc</code> objects (the last line). In other words, it adds some methods to <code>Proc</code>.</p> <p>In the middle chunk of code, you'll see definitions for <code>+@</code>, <code>-@</code>, and other operators. That's how you get the Testrocket interface that we've been discussing. These methods hand their work off to various helper methods, but essentially they do some combination of <code>call()</code> to run the code in the block and printing some results.</p> <p>Those helper methods are the rest of the method definitions above and below the operators we just looked at. Peter prefixed them all with underscores as a convention to say that they are just for internal use. This should keep them from conflicting with normal methods defined on <code>Proc</code>.</p> <p>The <code>_test()</code> method is where the main action happens. It runs the block and then calls a different method based on whether or not the code returned a <code>true</code> value. It also turns any <code>StandardError</code> raised into a normal failure.</p> <p>Skip over <code>_show()</code> for now and the rest of the helpers are pretty simple stuff. They just construct the various messages that get printed to tell the tester what happened with the code. There is an interesting trick used by <code>_fail()</code> and <code>_pend()</code>. They call the <code>source_location()</code> method on <code>Proc</code> to find out where the code is. That method usually returns a two element <code>Array</code> containing the file name and line number. Peter then uses an operator alias for <code>join()</code> (<code>*</code>) to convert them to a single <code>String</code>. Here's the process spelled out:</p> <div class="highlight highlight-ruby"><pre><span class="o">>></span> <span class="o">-></span> <span class="p">{</span> <span class="p">}</span><span class="o">.</span><span class="n">source_location</span> <span class="o">=></span> <span class="o">[</span><span class="s2">"(pry)"</span><span class="p">,</span> <span class="mi">1</span><span class="o">]</span> <span class="o">>></span> <span class="n">_</span> <span class="o">*</span> <span class="s2">":"</span> <span class="o">=></span> <span class="s2">"(pry):1"</span> </pre></div> <p>The <code>extend()</code> line is the hardest thing in the whole piece to figure out, if you ask me. It's obvious that the methods <code>out()</code> and <code>out=()</code> are being defined. It took me a while to figure out where though, since this is a pretty tricky way to define them.</p> <p>When you get stuck like that, try to see where the method gets used. That will usually give you the needed hint. Peeking inside <code>_show()</code> taught me that it's just a fancy way to define a getter and setter on a <code>Module</code> or <code>Class</code>. Normally the <code>attr_accessor()</code> helper affects the instance level, not the <code>Module</code> level. So, Peter dynamically defined a mix-in using <code>Module.new()</code> and a block to define it, stuck the <code>attr_accessor()</code> in there, then mixed that in at the <code>Module</code> level with <code>extend()</code>.</p> <p>It's worth thinking about that a little more, because it has advantages. Normally, programmers will cheat the <code>attr_accessor()</code> level with code like this:</p> <div class="highlight highlight-ruby"><pre><span class="k">class</span> <span class="o"><<</span> <span class="nb">self</span> <span class="kp">attr_accessor</span> <span class="ss">:out</span> <span class="k">end</span> </pre></div> <p>But there's a difference between these two approaches. The latter technique puts the methods in the singleton class directly. Peter's technique puts the methods in a <code>Module</code> mixed into the singleton class. This means that Peter's methods are easier to override: you can just mix-in another module, or define the override in the singleton class.</p> <p>Hopefully that's enough explanation to help you make sense of the code. I recommend you keep fiddling with it until you fully understand how it works. It's worth the investment of time. It will level-up your brain.</p> <h4>Further Reading</h4> <p>Here are some other places you might want to look, if you enjoyed this exercise:</p> <ul> <li>I suspect most Rubyists have read <a href="http://pragprog.com/book/ruby3/programming-ruby-1-9">the Pickaxe</a>. But did you actually read the reference section? You might be surprised by how helpful that is. It actually goes through most of the methods present in Ruby, explaining them and showing example usage. That's a heck of a foundation for your later thinking.</li> <li>Looking through other Codebrawl competitions can expose you to some interesting new ideas. I ran one for <a href="http://codebrawl.com/contests/methods-taking-multiple-blocks">Methods Taking Multiple Blocks</a> that turned out well. There are some very interesting approaches in the submissions, including some Peter Cooper style <code>Proc</code> hacks.</li> <li>If you want to try another code reading exercise along these lines, checkout this oldie-but-goodie: <a href="https://github.com/ahoward/tagz">tagz.rb</a>. This is an HTML/XML generation library by Ara T. Howard. It's not too long, though a little more of a challenge than Peter's code, and you'll learn some crafty Ruby tricks if you figure out how it works. Watch for the tag method and "document" interplay, plus the neat use of methods like <code>globally()</code> and <code>privately()</code> to make self-evident code.</li> </ul> James Edward Gray II A Stylish Critique tag:graysoftinc.com,2012-04-01:/posts/111 2014-04-27T16:34:55Z This article takes a detailed look at very style guides for the Ruby language and attempts to divine what we can learn from them, both good and bad. <p><em>Before getting started, I feel compelled to point out that my dictionary defines a critique as "a detailed analysis and assessment of something." It seems like we often assume the worst of that word, but that's not how I intend it here.</em></p> <p>The Ruby community seems to be talking about style guides lately. So let's talk about them.</p> <p>The fact is that you will have many choices if you go looking for style guides for our favorite language. You can pick from:</p> <ul> <li><a href="http://www.zenspider.com/Languages/Ruby/QuickRef.html#general-tips">The old stuff</a></li> <li><a href="http://www.caliban.org/ruby/rubyguide.shtml#style">Google's way</a></li> <li><a href="https://github.com/styleguide/ruby">GitHub's popular guide</a></li> <li>Guides from respected Rubyists, like <a href="https://github.com/dkubb/styleguide/blob/master/RUBY-STYLE">Dan Kubb</a> </li> <li>One of the <a href="https://github.com/chneukirchen/styleguide/network">many</a> <a href="https://github.com/bbatsov/ruby-style-guide/network">forks</a> of the popular guides on GitHub</li> <li>And many <a href="http://www.google.com/search?rls=en&q=ruby+style+guide&ie=UTF-8&oe=UTF-8">more</a> </li> </ul><p>It's obvious that Rubyists care about this topic. Let's see what's out there and consider what really is and is not useful from these guides.</p> <h4>What is a style guide really, and why do we even have them?</h4> <p>Defining style guides is surprisingly tough. I suspect they started out as formatting rules for code, but they have evolved pretty far beyond that now.</p> <p>Most guides include general conventions that the author feels are important when writing the language in question. This can go all the way down to how to use certain constructs, opinions on what the author considers idiomatic, and syntax to outright avoid.</p> <p>To sum it up, a style guide is often a "How I Write Language X" opinion piece from the author.</p> <p>Style guides do exist for pretty good reasons. First, most programmers put some effort into making sure that their code looks a certain way. Generally this is to make it easier to read. However, you may not see the code as intended if you are using a different indent size or tabs instead of the spaces they intended.</p> <p>With teams, these conventions become even more important. Teams are trying to work in concert, so they need to be able to understand code not written by them. A set of conventions the team follows can really help this along.</p> <p>And when you think about it, who isn't on a team these days? Aren't open source developers a team? The entire Ruby community might even be a team with the way we interact online.</p> <p>It seems like this is a topic we should all care about, at least a little.</p> <h4>The Rules for the Rules</h4> <p>Even though we have decided this topic is important, we must never forget how careful we have to be when imposing rules on others. The goal is to make communication between us easier, not to restrict creativity.</p> <p>In my experience, one rule seems to hold sway over all other rules in life whether those rules are for parenting, laws, or programming style guides:</p> <p><strong>Use the fewest amount of rules you can possibly get away with.</strong></p> <p>If there are more rules than I can easily internalize, the entire point is defeated. Odds are that the authors don't even consistently follow their own long lists.</p> <p>Now, it is worth noting that some list size variation make sense. For example, GitHub needs to keep their rules minimal for the reasons I have just mentioned. However, <a href="http://rubyrogues.com/047-rr-coding-disciplines/">Dan Kubb talked to us on the Ruby Rogues</a> about how he uses his style guide to try and restrict himself into being more aware as a programmer. It makes sense that he would have more rules for that.</p> <p>That said, Dan's list is still probably a little long, in my opinion. It's just too much. Some of his rules actually encourage me to tune out what he's saying, like:</p> <ul> <li>Avoid bugs.</li> <li>Use common sense.</li> </ul><p>Again, if you lose your audience, the whole point is lost.</p> <p>The classic book that describes itself as a style guide, <a href="http://www.pearsonhighered.com/educator/product/Smalltalk-Best-Practice-Patterns/9780134769042.page"><em>Smalltalk Best Practice Patterns</em></a>, includes ten "Formatting" patterns. That strikes me as a pretty common sense upper limit.</p> <p>Another rule that's key is one that most parents know:</p> <p><strong>Have a good reason for the rule.</strong></p> <p>If your kid hits you with, "But why?," and you have to counter with, "Because I said so!," you lose. Rules need to be important. Important things have a reason for their existence. The reason needs to be a good one too.</p> <p>If you are just cargo culting some rules, I would recommend actively breaking them for a time. You'll figure out pretty quick if they are important or not. If they are, you'll have the reason. If they aren't, you'll be free of a useless constraint.</p> <p>For example, Ryan Davis's old rules say, "Use parens to disambiguate, otherwise avoid them." Ultimately, that leads to the <a href="http://heartmindcode.com/2013/09/05/parentheses-in-ruby/">"Seattle Style" of method definitions</a>. GitHub's newer rules say, "Use <code>def</code> with parentheses when there are arguments." Both sides will tell you that it reads better.</p> <p>I personally find that my eye seems to drift more without the parentheses, so I prefer GitHub's style in particular this case. However, the Seattle group does have a significant following.</p> <p>To me, this implies that it isn't likely worth a rule. The reason doesn't seem to hold in enough cases to be considered good. Both of these groups seem to be able to coexist in our community without creating two versions of every gem, just to rewrite the method definitions. I say let it go.</p> <p>Now, both sides do agree to leave parentheses off of argument-less definitions and calls. Perhaps that means that one is rule worthy. It's definitely gray area though.</p> <p>Finally, with style guides, I think it's critical that we remember the most important thing I learned from <em>Smalltalk Best Practice Patterns</em>:</p> <p><strong>Code's primary purpose is to communicate with the reader.</strong></p> <p>If you make a rule that violates that, it's instantly very suspect. For example, GitHub's guide has this rule:</p> <ul> <li>The <code>and</code> and <code>or</code> keywords are banned. It's just not worth it. Always use <code>&&</code> and <code>||</code> instead.</li> </ul><p>Of course, <a href="http://mislav.uniqpath.com/2012/03/unless-else/">not everyone agrees</a>. The problem with this rule is that is that it makes Ruby less expressive. Those operators actually <a href="http://devblog.avdi.org/2010/08/02/using-and-and-or-in-ruby/">have a purpose</a>. Though it's not popular, I even use them in conditionals, because I think they read better. <em>[<strong>Update</strong>: I was eventually swayed by Avdi's argument so I no longer do this.]</em></p> <p>GitHub is likely worried about how these operators interact with assignment statements. It can trip up new Rubyists. If you read Avdi's post though, you'll see that the precedence of these operators is actually why they exist. Even my usage of them in conditionals is rarely a problem, since assignments are not common in conditionals. Plus, if you do assign in a conditional, GitHub has a rule that fixes the precedence even with an <code>and</code>/<code>or</code>:</p> <ul> <li>Using the return value of <code>=</code> (an assignment) is ok, but surround the assignment with parenthesis.</li> </ul><p>That's a neat rule, if you ask me, because it allows for what I consider to be a natural programming construct in Ruby: run this code if I can assign this variable. For example:</p> <div class="highlight highlight-ruby"><pre><span class="k">if</span> <span class="p">(</span><span class="n">message</span> <span class="o">=</span> <span class="n">inbox</span><span class="o">.</span><span class="n">find</span> <span class="p">{</span> <span class="o">|</span><span class="n">m</span><span class="o">|</span> <span class="n">m</span><span class="o">.</span><span class="n">unread?</span> <span class="p">})</span> <span class="c1"># ... work with message here...</span> <span class="k">end</span> </pre></div> <p>But, the parentheses flag the reader that you haven't made the common bug of confusing <code>=</code> with <code>==</code>.</p> <p>Getting back to the <code>and</code>/<code>or</code> case, I think education about these operators beats forbidding them.</p> <h4>What's Our Style?</h4> <p>Enough blathering on about how to make rules and why they exist. Let's take a look at what's actually out there for us Rubyists.</p> <h5>We Agree About</h5> <p>I think it's safe to say that the majority of Ruby style guides agree about at least these points:</p> <ul> <li>An indent should be two spaces.</li> <li>Use spaces, not tabs.</li> <li>Keep lines at 80 characters in length or less.</li> </ul><p>A lot of communities fight pretty heavily over these points, but the Ruby community seems to pretty universally agree. The reasoning is also sound: two spaces is enough to notice, but it leaves you plenty of room on the line. Spaces make sure I see what you see, even if our editors have different settings.</p> <p>The last one surprises me a little. I strongly believe in it, but I see a lot of Ruby code that doesn't. Still almost all of the guides I checked had it in there.</p> <p>There were many more rules about spacing in the guides. While I agreed with a lot of them, I'm not sure everyone would. Are we certain sure it's <code>select { |arg| arg }</code> instead of <code>select {|arg| arg }</code>? I use the former, but I see some of the latter and it doesn't throw me into a rage. I'm just not sure I'm willing to burn a rule on stuff like that.</p> <p>We also seem to agree on how to name things:</p> <ul> <li>Use <code>snake_case</code> for variable and method names, <code>CamelCase</code> for classes and modules, and <code>ALL_CAPS_SNAKE_CASE</code> for other constants.</li> </ul><p>The reasoning is pretty obvious. This helps you tell what you are looking at right away. It makes it much easier to read code.</p> <p>What else do most of the style guides care about? How you indent your <code>case</code> statements. They definitely prefer this style:</p> <div class="highlight highlight-ruby"><pre><span class="k">case</span> <span class="n">age</span> <span class="k">when</span> <span class="mi">0</span><span class="o">.</span><span class="n">.</span><span class="mi">10</span> <span class="nb">puts</span> <span class="s2">"Too young."</span> <span class="k">when</span> <span class="mi">11</span><span class="o">.</span><span class="n">.</span><span class="mi">65</span> <span class="nb">puts</span> <span class="s2">"Access granted."</span> <span class="k">when</span> <span class="mi">66</span><span class="o">.</span><span class="n">.</span><span class="mi">110</span> <span class="nb">puts</span> <span class="s2">"Too old."</span> <span class="k">else</span> <span class="nb">puts</span> <span class="s2">"Malformed age."</span> <span class="k">end</span> </pre></div> <p>Or even:</p> <div class="highlight highlight-ruby"><pre><span class="n">response</span> <span class="o">=</span> <span class="k">case</span> <span class="n">age</span> <span class="k">when</span> <span class="mi">0</span><span class="o">.</span><span class="n">.</span><span class="mi">10</span> <span class="k">then</span> <span class="s2">"Too young."</span> <span class="k">when</span> <span class="mi">11</span><span class="o">.</span><span class="n">.</span><span class="mi">65</span> <span class="k">then</span> <span class="s2">"Access granted."</span> <span class="k">when</span> <span class="mi">66</span><span class="o">.</span><span class="n">.</span><span class="mi">110</span> <span class="k">then</span> <span class="s2">"Too old."</span> <span class="k">else</span> <span class="s2">"Malformed age."</span> <span class="k">end</span> </pre></div> <p>But never:</p> <div class="highlight highlight-ruby"><pre><span class="k">case</span> <span class="n">age</span> <span class="k">when</span> <span class="mi">0</span><span class="o">.</span><span class="n">.</span><span class="mi">10</span> <span class="nb">puts</span> <span class="s2">"Too young."</span> <span class="k">when</span> <span class="mi">11</span><span class="o">.</span><span class="n">.</span><span class="mi">65</span> <span class="nb">puts</span> <span class="s2">"Access granted."</span> <span class="k">when</span> <span class="mi">66</span><span class="o">.</span><span class="n">.</span><span class="mi">110</span> <span class="nb">puts</span> <span class="s2">"Too old."</span> <span class="k">else</span> <span class="nb">puts</span> <span class="s2">"Malformed age."</span> <span class="k">end</span> </pre></div> <p>Or:</p> <div class="highlight highlight-ruby"><pre><span class="n">response</span> <span class="o">=</span> <span class="k">case</span> <span class="n">age</span> <span class="k">when</span> <span class="mi">0</span><span class="o">.</span><span class="n">.</span><span class="mi">10</span> <span class="k">then</span> <span class="s2">"Too young."</span> <span class="k">when</span> <span class="mi">11</span><span class="o">.</span><span class="n">.</span><span class="mi">65</span> <span class="k">then</span> <span class="s2">"Access granted."</span> <span class="k">when</span> <span class="mi">66</span><span class="o">.</span><span class="n">.</span><span class="mi">110</span> <span class="k">then</span> <span class="s2">"Too old."</span> <span class="k">else</span> <span class="s2">"Malformed age."</span> <span class="k">end</span> </pre></div> <p>The <code>when</code> statements need to line up with the <code>case</code>. The reasoning? I have no idea, but it looks right to me!</p> <h5>The Parts I Found Interesting</h5> <p>The Google style guide mentioned using Ruby's block comments to hide headers and footers in your code. For example:</p> <div class="highlight highlight-ruby"><pre><span class="cm">=begin</span> <span class="cm"> * Name:</span> <span class="cm"> * Description:</span> <span class="cm"> * Author:</span> <span class="cm"> * Date:</span> <span class="cm"> * License:</span> <span class="cm">=end</span> </pre></div> <p>I'm not sure how I feel about that. I worry about programming constructs that can go off-screen. To give an example, I don't like this method of declaring class methods:</p> <div class="highlight highlight-ruby"><pre><span class="k">class</span> <span class="nc">Whatever</span> <span class="k">class</span> <span class="o"><<</span> <span class="nb">self</span> <span class="k">def</span> <span class="nf">class_method</span> <span class="c1"># ...</span> <span class="k">end</span> <span class="k">end</span> <span class="k">end</span> </pre></div> <p>The reason is that you could end up facing something line this:</p> <div class="highlight highlight-ruby"><pre><span class="k">class</span> <span class="nc">Whatever</span> <span class="k">class</span> <span class="o"><<</span> <span class="nb">self</span> <span class="c1"># a page of definitions here...</span> <span class="k">def</span> <span class="nf">what_am_i</span> <span class="c1"># ...</span> <span class="k">end</span> <span class="c1"># another page of definitions here...</span> <span class="k">end</span> <span class="k">end</span> </pre></div> <p>If you are centered on the definition of <code>what_am_i</code>, the only way you can know it's defined as a class method is if you pick up on the extra indentation. I don't think that communicates well, so I prefer the following technique, even if it does introduce some mild duplication:</p> <div class="highlight highlight-ruby"><pre><span class="k">class</span> <span class="nc">Whatever</span> <span class="k">def</span> <span class="nc">self</span><span class="o">.</span><span class="nf">class_method_1</span> <span class="c1"># ...</span> <span class="k">end</span> <span class="k">def</span> <span class="nc">self</span><span class="o">.</span><span class="nf">class_method_2</span> <span class="c1"># ...</span> <span class="k">end</span> <span class="k">end</span> </pre></div> <p>Block comments are subject to the same off-screen issue, but a smart editor is going to save you with them. It should syntax highlight the entire chunk as a comment, so you would still know what you are in the middle of.</p> <p>I doubt this is rule worthy in either case, but it's interesting to think about.</p> <p>I found the following rule from GitHub's guide interesting mainly because it nails my bad habit:</p> <ul> <li>Prefer single-quoted <code>String</code>s when you don't need string interpolation or special symbols such as <code>\t</code>, <code>\n</code>, <code>'</code>, etc.</li> </ul><p>I don't do this. Instead I use double-quoted <code>String</code>s most of the time. I switch to single-quoting only in rare cases where it reduces some escaping. Even then, I'm just as likely to switch to a special <code>String</code> form, like <code>%Q{...}</code>.</p> <p>My reasons are pretty weak. It's mainly that I too often found myself having to switch a single-quoted <code>String</code> to double-quotes so I could introduce some interpolation. It also helps in my editor, since I can have it always pair double-quotes while never pairing singles. I'll be typing the former to make <code>String</code>s but the latter for things like apostrophes, so this is generally perfect.</p> <p>The guide's rule is probably superior though, because it communicates with the reader that they are looking at a simple <code>String</code>.</p> <p>Dan Kubb's guide led me to read about a couple of interesting concepts that I hadn't thought about enough:</p> <ul> <li> <p>Try to have methods either return the state of the object and have no side effects, or return <code>self</code> and have side effects. This is otherwise known as Command-query separation (CQS):</p> <p><a href="http://en.wikipedia.org/wiki/Command-query_separation">http://en.wikipedia.org/wiki/Command-query_separation</a></p> </li> <li><p>Do not program defensively. (See <a href="http://www.erlang.se/doc/programming_rules.shtml#HDR11">http://www.erlang.se/doc/programming_rules.shtml#HDR11</a>.)</p></li> </ul><p>GitHub has a rule I doubt is common:</p> <ul> <li>Indent the <code>public</code>, <code>protected</code>, and <code>private</code> methods as much the method definitions they apply to. Leave one blank line above them.</li> </ul><p>Here's the sample code they give for that:</p> <div class="highlight highlight-ruby"><pre><span class="k">class</span> <span class="nc">SomeClass</span> <span class="k">def</span> <span class="nf">public_method</span> <span class="c1"># ...</span> <span class="k">end</span> <span class="kp">private</span> <span class="k">def</span> <span class="nf">private_method</span> <span class="c1"># ...</span> <span class="k">end</span> <span class="k">end</span> </pre></div> <p>I think it's more common to see a blank line below it as well:</p> <div class="highlight highlight-ruby"><pre><span class="k">class</span> <span class="nc">SomeClass</span> <span class="k">def</span> <span class="nf">public_method</span> <span class="c1"># ...</span> <span class="k">end</span> <span class="kp">private</span> <span class="k">def</span> <span class="nf">private_method</span> <span class="c1"># ...</span> <span class="k">end</span> <span class="k">end</span> </pre></div> <p>I have also seen it "outdented" like this:</p> <div class="highlight highlight-ruby"><pre><span class="k">class</span> <span class="nc">SomeClass</span> <span class="k">def</span> <span class="nf">public_method</span> <span class="c1"># ...</span> <span class="k">end</span> <span class="kp">private</span> <span class="k">def</span> <span class="nf">private_method</span> <span class="c1"># ...</span> <span class="k">end</span> <span class="k">end</span> </pre></div> <p>That doesn't feel right to me though, since we indent other inline class method calls. I do see how it kind of delimits a section though, much like <code>rescue</code> would inside a method definition. I think you can make the argument either way.</p> <p>There was another variant that you use to see a lot, but <a href="https://github.com/rails/rails/commit/b88a181b7f296d89237bdb727ecc15cbfdf13b65">even Rails has decided it's wrong now</a>:</p> <div class="highlight highlight-ruby"><pre><span class="k">class</span> <span class="nc">SomeClass</span> <span class="k">def</span> <span class="nf">public_method</span> <span class="c1"># ...</span> <span class="k">end</span> <span class="kp">private</span> <span class="k">def</span> <span class="nf">private_method</span> <span class="c1"># ...</span> <span class="k">end</span> <span class="k">end</span> </pre></div> <p>Aaron Patterson says this is wrong because it's not how Emacs indents it. I think he was joking at the time, but it turns out that <a href="http://www.slideshare.net/yukihiro_matz/how-emacs-changed-my-life">he may be more right</a> about that than we could have guessed.</p> <p>The first rule in Bozhidar Batsov's "Comments" section was:</p> <ul> <li>Write self-documenting code and ignore the rest of this section. Seriously!</li> </ul><p>I really like that. The more programming experience I get the less respect I have for comments. I do use annotations, like <code>TODO</code> and <code>FIXME</code> (and Bozhidar has rules for those too), but most other comments are suspect, in my opinion.</p> <p>The guides definitely disagreed heavily about which documentation scheme we should be using or if we should even be using one at all.</p> <p>I also learned a neat trick from Bozhidar's guide that I hadn't encountered before:</p> <ul> <li> <p>When using <code>class_eval</code> (or other <code>eval</code>) with <code>String</code> interpolation, add a comment block showing its appearance if interpolated (a practice I learned from the Rails code):</p> <div class="highlight highlight-ruby"><pre><span class="c1"># from activesupport/lib/active_support/core_ext/string/output_safety.rb</span> <span class="no">UNSAFE_STRING_METHODS</span><span class="o">.</span><span class="n">each</span> <span class="k">do</span> <span class="o">|</span><span class="n">unsafe_method</span><span class="o">|</span> <span class="k">if</span> <span class="s1">'String'</span><span class="o">.</span><span class="n">respond_to?</span><span class="p">(</span><span class="n">unsafe_method</span><span class="p">)</span> <span class="nb">class_eval</span> <span class="o"><<-</span><span class="no">EOT</span><span class="p">,</span> <span class="bp">__FILE__</span><span class="p">,</span> <span class="bp">__LINE__</span> <span class="o">+</span> <span class="mi">1</span> <span class="sh"> # ...</span> <span class="sh"> def #{unsafe_method}!(*args) # def capitalize!(*args)</span> <span class="sh"> @dirty = true # @dirty = true</span> <span class="sh"> super # super</span> <span class="sh"> end # end</span> <span class="no"> EOT</span> <span class="k">end</span> <span class="k">end</span> </pre></div> </li> </ul><p>But the most entertaining rule award definitely goes to Ryan Davis for this gem:</p> <ul> <li>Don’t <code>rescue Exception</code>. EVER. Or I will stab you.</li> </ul><h5>What Are They Just Wrong About?</h5> <p>I hate to say it, but some rules were just bad. Let's look at a handful that bugged me. First, I submit:</p> <ul> <li>Do not use single letter variable names. Avoid uncommunicative names.</li> </ul><p>I don't even think the first half of that rule agrees with the second half of that rule. Consider this code:</p> <div class="highlight highlight-ruby"><pre><span class="n">ary</span><span class="o">.</span><span class="n">each_index</span> <span class="k">do</span> <span class="o">|</span><span class="n">i</span><span class="o">|</span> <span class="c1"># ...</span> <span class="k">end</span> </pre></div> <p>There's nothing wrong with that code. <code>i</code> is kind of the universal variable name for an index and as such it's even more communicative than a longer name, like <code>index</code>.</p> <ul> <li>Avoid multi-line <code>?:</code> (the ternary operator), use <code>if</code>/<code>unless</code> instead.</li> </ul><p>While I understand where this rule is coming from, it's just a bad idea to draw hard lines in the sand like this. You're sure this is always wrong? I'm not.</p> <p>Ruby 1.9 even supports a nice new syntax for this:</p> <div class="highlight highlight-ruby"><pre><span class="n">result</span> <span class="o">=</span> <span class="n">o</span><span class="o">.</span><span class="n">test?</span> <span class="p">?</span> <span class="n">o</span><span class="o">.</span><span class="n">calc_true_result</span> <span class="p">:</span> <span class="n">o</span><span class="o">.</span><span class="n">calc_false_result</span> </pre></div> <p>Now that Ruby allows those operators to line up, this can be a very readable construct, in my opinion.</p> <ul> <li>Avoid using <code>$1-9</code> as it can be hard to track what they contain. Named groups can be used instead.</li> </ul><p>Almost all of the guides did contain a rule like this, but I see a lot of Ruby code and variables like <code>$1</code> are extremely common. The issue is that the <code>MatchData</code> methods aren't all that more expressive and it can be awkward to get a hold of the object to use them on.</p> <p>I do like the named variables that this rule recommends (added in Ruby 1.9), but they can make a simple regex quite a bit wordier and introduce local variables in the recommended usage. I don't think I'm comfortable saying that's always OK.</p> <p>I'm not really sure what the perceived problem is with <code>$1</code> and friends either. Programmers seem to understand them just fine. Some may worry that they are evil globals, but the fact is that they are magic <code>Thread</code> local variables that just do the right thing.</p> <p>Until I see a good reason for this rule, I'm not buying it.</p> <ul> <li>Do not use <code>inject</code> in library code. In app code it is ok.</li> </ul><p>I saw this rule on Dan Kubb's guide earlier this week, but it was already removed before I published this article. I'm glad to see he's over this one.</p> <p>I think this stems from a fear of <code>inject()</code> being a little slower. It's true that it is. Here's a benchmark that shows the problem:</p> <div class="highlight highlight-ruby"><pre><span class="nb">require</span> <span class="s2">"benchmark"</span> <span class="k">def</span> <span class="nf">each_sum</span><span class="p">(</span><span class="n">numbers</span><span class="p">)</span> <span class="n">sum</span> <span class="o">=</span> <span class="mi">0</span> <span class="n">numbers</span><span class="o">.</span><span class="n">each</span> <span class="k">do</span> <span class="o">|</span><span class="n">n</span><span class="o">|</span> <span class="n">sum</span> <span class="o">+=</span> <span class="n">n</span> <span class="k">end</span> <span class="n">sum</span> <span class="k">end</span> <span class="k">def</span> <span class="nf">inject_sum</span><span class="p">(</span><span class="n">numbers</span><span class="p">)</span> <span class="n">numbers</span><span class="o">.</span><span class="n">inject</span><span class="p">(</span><span class="mi">0</span><span class="p">)</span> <span class="p">{</span> <span class="o">|</span><span class="n">sum</span><span class="p">,</span> <span class="n">n</span><span class="o">|</span> <span class="n">sum</span> <span class="o">+</span> <span class="n">n</span> <span class="p">}</span> <span class="k">end</span> <span class="no">TESTS</span> <span class="o">=</span> <span class="mi">10_000_000</span> <span class="no">NUMBERS</span> <span class="o">=</span> <span class="mi">1</span><span class="o">.</span><span class="n">.</span><span class="mi">10</span> <span class="no">Benchmark</span><span class="o">.</span><span class="n">bmbm</span> <span class="k">do</span> <span class="o">|</span><span class="n">bench</span><span class="o">|</span> <span class="n">bench</span><span class="o">.</span><span class="n">report</span><span class="p">(</span><span class="s2">"each_sum"</span><span class="p">)</span> <span class="k">do</span> <span class="no">TESTS</span><span class="o">.</span><span class="n">times</span> <span class="k">do</span> <span class="n">each_sum</span><span class="p">(</span><span class="no">NUMBERS</span><span class="p">)</span> <span class="k">end</span> <span class="k">end</span> <span class="n">bench</span><span class="o">.</span><span class="n">report</span><span class="p">(</span><span class="s2">"inject_sum"</span><span class="p">)</span> <span class="k">do</span> <span class="no">TESTS</span><span class="o">.</span><span class="n">times</span> <span class="k">do</span> <span class="n">inject_sum</span><span class="p">(</span><span class="no">NUMBERS</span><span class="p">)</span> <span class="k">end</span> <span class="k">end</span> <span class="k">end</span> </pre></div> <p>That shows the following on Ruby 1.9.3:</p> <pre><code>Rehearsal ---------------------------------------------- each_sum 7.440000 0.000000 7.440000 ( 7.442971) inject_sum 10.170000 0.010000 10.180000 ( 10.177593) ------------------------------------ total: 17.620000sec user system total real each_sum 7.540000 0.000000 7.540000 ( 7.546324) inject_sum 10.220000 0.000000 10.220000 ( 10.217871) </code></pre> <p>As you can see, it's not that slow. Many iterators have a similar penalty. I had to use ten million iterations to get it to show up well.</p> <p>The situation use to be worse though. It's more than twice as slow as <code>each</code> on Ruby 1.8.7:</p> <pre><code>Rehearsal ---------------------------------------------- each_sum 23.340000 0.010000 23.350000 ( 23.354953) inject_sum 51.260000 0.020000 51.280000 ( 51.279145) ------------------------------------ total: 74.630000sec user system total real each_sum 23.730000 0.010000 23.740000 ( 23.734525) inject_sum 52.320000 0.010000 52.330000 ( 52.323466) </code></pre> <p>So perhaps that's where this fear came from.</p> <p>In any event, don't avoid the iterators. Use them for what they are for. Remember, expressive code is always the first goal.</p> <p>If you find something to be too slow, you can always refactor for performance. That should only be needed in extremely rare edge cases though. Go for readability first.</p> <p>Hopefully this section reminds us all that we always need to treat these style guides as suggestions, not laws. You're the programmer, so you're in charge. No exceptions.</p> <h4>Worth a Read</h4> <p>I've dropped a ton of links in this article, but it really is worth taking a little time to read through at least some of these style guides. They cover a ton of ideas, good and bad, that I didn't choose to rehash here. If nothing else, I promise that they will get you thinking.</p> <p>If you are pressed for time, start with the GitHub guide. It seems to reflect a lot of current thinking. Some of it is controversial though, as I've noted. If you have time for a second source, check out Dan Kubb's guide. It is a good representation of the various forks and it contains some neat ideas, even if it does probably go a little too far in some areas.</p> James Edward Gray II Learn to Love Mix-ins tag:graysoftinc.com,2012-03-21:/posts/110 2014-04-27T15:37:55Z In this article I distill all of my hard-won knowledge of how we should use mix-ins in Ruby code for type construction and method overriding. <p>The road to mastering Ruby is paved with understanding some key Ruby concepts. Mix-ins are one of those concepts. I'm sure everyone reading this knows the mechanics of how mix-ins work, but it pays to spend some time really thinking about all that mix-ins imply. Let's do just that.</p> <h4>Adding a Type</h4> <p>One of the primary reasons that Ruby needs mix-ins is that it does not support multiple inheritance. That leaves mix-ins as our only option for modeling hybrid objects. It's the way Ruby programmers can add another type.</p> <p>That's a good way to think about it too: adding a type.</p> <p>Take pagination, for example. Pagination methods are usually defined to return an object like this:</p> <div class="highlight highlight-ruby"><pre><span class="k">class</span> <span class="nc">PaginatedCollection</span> <span class="o"><</span> <span class="nb">Array</span> <span class="c1"># ... paginated helpers defined here ...</span> <span class="k">end</span> </pre></div> <p>That's never really felt right to me though.</p> <p>First, inheriting from Ruby's core classes can come back to bite you in some scenarios. The reason is that Ruby makes some performance tradeoffs to keep the core classes fast, but those tradeoffs mean that those classes don't always perfectly follow Ruby's rules.</p> <p>You can get around some of these issues by delegating to an <code>Array</code>, instead of inheriting from it. But that creates even more structure for this setup when it seems that Ruby has a totally workable built-in solution.</p> <p>The name of the created <code>Class</code> is another hint that it's not ideal, in my opinion: <code>PaginatedCollection</code>. <code>Collection</code> is just another way to say <code>Array</code>, right? So why can't we just say <code>Array</code>? In truth, <code>Collection</code> implies a lot more than just an <code>Array</code>, but solutions like this don't generally adapt to other types.</p> <p>That leaves just <code>Paginated</code>, which is used as an adjective here. Adjectives are generally better modeled by a <code>Module</code> than a <code>Class</code>. It's almost like Ruby is telling us the right way to model this concept, if we listen closely enough.</p> <p>To me, it's telling us to build this:</p> <div class="highlight highlight-ruby"><pre><span class="k">module</span> <span class="nn">Paginated</span> <span class="k">def</span> <span class="nf">paginate</span><span class="p">(</span><span class="n">page</span> <span class="o">=</span> <span class="mi">1</span><span class="p">,</span> <span class="n">items_per_page</span> <span class="o">=</span> <span class="n">size</span><span class="p">,</span> <span class="n">total_items</span> <span class="o">=</span> <span class="n">size</span><span class="p">)</span> <span class="vi">@page</span> <span class="o">=</span> <span class="n">page</span> <span class="vi">@items_per_page</span> <span class="o">=</span> <span class="n">items_per_page</span> <span class="vi">@total_items</span> <span class="o">=</span> <span class="n">total_items</span> <span class="k">end</span> <span class="kp">attr_reader</span> <span class="ss">:page</span><span class="p">,</span> <span class="ss">:items_per_page</span><span class="p">,</span> <span class="ss">:total_items</span> <span class="k">def</span> <span class="nf">total_pages</span> <span class="p">(</span><span class="n">total_items</span> <span class="o">/</span> <span class="n">items_per_page</span><span class="o">.</span><span class="n">to_f</span><span class="p">)</span><span class="o">.</span><span class="n">ceil</span> <span class="k">end</span> <span class="c1"># etc...</span> <span class="k">end</span> <span class="n">collection</span> <span class="o">=</span> <span class="sx">%w[first second third]</span> <span class="n">collection</span><span class="o">.</span><span class="n">extend</span><span class="p">(</span><span class="no">Paginated</span><span class="p">)</span> <span class="n">collection</span><span class="o">.</span><span class="n">paginate</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">3</span><span class="p">,</span> <span class="mi">10</span><span class="p">)</span> <span class="nb">puts</span> <span class="s2">"There are </span><span class="si">#{</span><span class="n">collection</span><span class="o">.</span><span class="n">total_pages</span><span class="si">}</span><span class="s2"> pages."</span> <span class="nb">puts</span> <span class="s2">"The collection is an Array."</span> <span class="k">if</span> <span class="n">collection</span><span class="o">.</span><span class="n">is_a?</span><span class="p">(</span><span class="nb">Array</span><span class="p">)</span> <span class="nb">puts</span> <span class="s2">"The collection is a Paginated object."</span> <span class="k">if</span> <span class="n">collection</span><span class="o">.</span><span class="n">is_a?</span><span class="p">(</span><span class="no">Paginated</span><span class="p">)</span> </pre></div> <p>That seems more natural. The item is an <code>Array</code>. It also happens to be <code>Paginated</code>. We can understand that duality and so can Ruby.</p> <p>Semantics aside though, this has actual benefits. The code works just fine if I change this line:</p> <div class="highlight highlight-ruby"><pre><span class="n">collection</span> <span class="o">=</span> <span class="sx">%w[first second third]</span> </pre></div> <p>to:</p> <div class="highlight highlight-ruby"><pre><span class="nb">require</span> <span class="s2">"set"</span> <span class="n">collection</span> <span class="o">=</span> <span class="no">Set</span><span class="o">.</span><span class="n">new</span><span class="p">(</span><span class="sx">%w[first second third]</span><span class="p">)</span> </pre></div> <p>or even:</p> <div class="highlight highlight-ruby"><pre><span class="n">collection</span> <span class="o">=</span> <span class="p">{</span><span class="ss">first</span><span class="p">:</span> <span class="mi">1</span><span class="p">,</span> <span class="ss">second</span><span class="p">:</span> <span class="mi">2</span><span class="p">,</span> <span class="ss">third</span><span class="p">:</span> <span class="mi">3</span><span class="p">}</span> </pre></div> <p>In other words, we can now paginate whatever we want, including our own classes. We can also mix <code>Paginated</code> into any result set we need to, without needing to use some special collection and a <code>replace()</code> method (as you sometimes see in Rails code using <a href="https://github.com/mislav/will_paginate">will_paginate</a>).</p> <p>There's even another plus to this approach though: you can make these type decisions as the code runs. Let's dig into what that can do for us.</p> <h4>What do I Need Now?</h4> <p>Another great aspect of using mix-ins to build up these types is that objects can be different things at different times. We'll start with a somewhat silly, but illustrative, example:</p> <div class="highlight highlight-ruby"><pre><span class="k">class</span> <span class="nc">Human</span> <span class="k">def</span> <span class="nf">initialize</span><span class="p">(</span><span class="nb">name</span><span class="p">,</span> <span class="n">strength</span><span class="p">)</span> <span class="vi">@name</span> <span class="o">=</span> <span class="nb">name</span> <span class="vi">@strength</span> <span class="o">=</span> <span class="n">strength</span> <span class="k">end</span> <span class="kp">attr_reader</span> <span class="ss">:name</span><span class="p">,</span> <span class="ss">:strength</span> <span class="k">def</span> <span class="nf">move</span> <span class="s2">"</span><span class="si">#{</span><span class="nb">name</span><span class="si">}</span><span class="s2"> walks."</span> <span class="k">end</span> <span class="k">end</span> <span class="k">module</span> <span class="nn">Werewolf</span> <span class="k">module</span> <span class="nn">HybridForm</span> <span class="k">def</span> <span class="nf">strength</span> <span class="k">super</span> <span class="o">+</span> <span class="mi">5</span> <span class="k">end</span> <span class="k">def</span> <span class="nf">move</span> <span class="k">super</span><span class="o">.</span><span class="n">sub</span><span class="p">(</span><span class="s2">"walks"</span><span class="p">,</span> <span class="s2">"lopes"</span><span class="p">)</span> <span class="k">end</span> <span class="k">end</span> <span class="k">module</span> <span class="nn">WolfForm</span> <span class="k">def</span> <span class="nf">strength</span> <span class="mi">2</span> <span class="k">end</span> <span class="k">def</span> <span class="nf">move</span> <span class="k">super</span><span class="o">.</span><span class="n">sub</span><span class="p">(</span><span class="s2">"walks"</span><span class="p">,</span> <span class="s2">"runs on all fours"</span><span class="p">)</span> <span class="k">end</span> <span class="k">end</span> <span class="k">end</span> <span class="n">human</span> <span class="o">=</span> <span class="no">Human</span><span class="o">.</span><span class="n">new</span><span class="p">(</span><span class="s2">"James"</span><span class="p">,</span> <span class="mi">3</span><span class="p">)</span> <span class="nb">puts</span> <span class="s2">"Normally, </span><span class="si">#{</span><span class="n">human</span><span class="o">.</span><span class="n">name</span><span class="si">}</span><span class="s2"> is a </span><span class="si">#{</span><span class="n">human</span><span class="o">.</span><span class="n">class</span><span class="si">}</span><span class="s2"> "</span> <span class="o">+</span> <span class="s2">"with a strength of </span><span class="si">#{</span><span class="n">human</span><span class="o">.</span><span class="n">strength</span><span class="si">}</span><span class="s2">. </span><span class="si">#{</span><span class="n">human</span><span class="o">.</span><span class="n">move</span><span class="si">}</span><span class="s2">"</span> <span class="nb">puts</span> <span class="n">werewolf</span> <span class="o">=</span> <span class="n">human</span><span class="o">.</span><span class="n">dup</span><span class="o">.</span><span class="n">extend</span><span class="p">(</span><span class="no">Werewolf</span><span class="o">::</span><span class="no">HybridForm</span><span class="p">)</span> <span class="nb">puts</span> <span class="s2">"But when there's a full moon, "</span> <span class="o">+</span> <span class="s2">"strength raises to </span><span class="si">#{</span><span class="n">werewolf</span><span class="o">.</span><span class="n">strength</span><span class="si">}</span><span class="s2"> and </span><span class="si">#{</span><span class="n">werewolf</span><span class="o">.</span><span class="n">move</span><span class="si">}</span><span class="s2">"</span> <span class="nb">puts</span> <span class="n">wolf</span> <span class="o">=</span> <span class="n">human</span><span class="o">.</span><span class="n">dup</span><span class="o">.</span><span class="n">extend</span><span class="p">(</span><span class="no">Werewolf</span><span class="o">::</span><span class="no">WolfForm</span><span class="p">)</span> <span class="nb">puts</span> <span class="s2">"Some also claim to have seen him as a normal wolf, "</span> <span class="o">+</span> <span class="s2">"with a strength of </span><span class="si">#{</span><span class="n">wolf</span><span class="o">.</span><span class="n">strength</span><span class="si">}</span><span class="s2">."</span> <span class="nb">puts</span> <span class="s2">"In this form </span><span class="si">#{</span><span class="n">wolf</span><span class="o">.</span><span class="n">move</span><span class="si">}</span><span class="s2">"</span> </pre></div> <p>That code outputs:</p> <pre><code>Normally, James is a Human with a strength of 3. James walks. But when there's a full moon, strength raises to 8 and James lopes. Some also claim to have seen him as a normal wolf, with a strength of 2. In this form James runs on all fours. </code></pre> <p>As you can see, we're able to change the <code>human</code> object as needed. We can add in the abilities of the <code>Werewolf::HybridForm</code> or the <code>Werewolf::WolfForm</code>. The object then has those behaviors.</p> <p>Believe it or not, this does have practical value outside of building fantasy games. For example, I once worked on a Rails application that had some pretty complex reporting needs. The queries used to do the reporting were a bit sluggish, so we wanted to make sure that kind of thing never got run during a normal request. Thus we had a model and a separate <code>Module</code> for the reporting code. They looked something like:</p> <div class="highlight highlight-ruby"><pre><span class="k">class</span> <span class="nc">User</span> <span class="o"><</span> <span class="no">ActiveRecord</span><span class="o">::</span><span class="no">Base</span> <span class="c1"># no generate_report method here</span> <span class="k">end</span> <span class="k">module</span> <span class="nn">Reportable</span> <span class="k">def</span> <span class="nf">generate_report</span> <span class="c1"># build and return a processing intensive report</span> <span class="k">end</span> <span class="k">end</span> </pre></div> <p>The <code>Module</code> wasn't even loaded by our normal application. Instead, we ran a nightly background process, on a different server, that used our backup dump of the database to do the reporting. That code is where the <code>Module</code> actually lived. The reporting process then used it in a loop like this:</p> <div class="highlight highlight-ruby"><pre><span class="no">User</span><span class="o">.</span><span class="n">find_each</span> <span class="k">do</span> <span class="o">|</span><span class="n">user</span><span class="o">|</span> <span class="n">user</span><span class="o">.</span><span class="n">extend</span><span class="p">(</span><span class="no">Reportable</span><span class="p">)</span> <span class="n">report</span> <span class="o">=</span> <span class="n">user</span><span class="o">.</span><span class="n">generate_report</span> <span class="c1"># report sending code here...</span> <span class="k">end</span> </pre></div> <p>This has other benefits besides safety. For example, it really helps with code organization. The reporting code was quite complex and it just didn't apply to the normal workings of the application. With this setup, we only had to dig through that code when it was relevant to what we were doing. The rest of the time we could pretty much forget it was there. (We did have tests to ensure <code>User</code> kept the contract <code>Reportable</code> counted on, so we wouldn't accidentally break it.)</p> <p>I would like to see Rails move towards supporting a system like this. I'll build a plugin at some point that lets you add various mix-ins for the models. They could be stored in the application like this:</p> <pre><code>app/models/user.rb app/models/user/authenticatible.rb app/models/user/reportable.rb … </code></pre> <p>Then I'll add a method for mixing these into the query results they apply to. For example:</p> <div class="highlight highlight-ruby"><pre><span class="n">user_logging_in</span> <span class="o">=</span> <span class="no">User</span><span class="o">.</span><span class="n">behavior</span><span class="p">(</span><span class="no">Authenticatible</span><span class="p">)</span><span class="o">.</span><span class="n">find_by_email</span><span class="p">(</span><span class="n">email</span><span class="p">)</span> </pre></div> <p>and:</p> <div class="highlight highlight-ruby"><pre><span class="no">User</span><span class="o">.</span><span class="n">behavior</span><span class="p">(</span><span class="no">Reportable</span><span class="p">)</span><span class="o">.</span><span class="n">find_each</span> <span class="k">do</span> <span class="o">|</span><span class="n">user</span><span class="o">|</span> <span class="c1"># ... generate reports...</span> <span class="k">end</span> </pre></div> <p>You get the idea.</p> <p>OK, let's consider modules in one more way to round out this exercise.</p> <h4>Monkey Patching is Generally Silly</h4> <p>We always say that we love how dynamic Ruby is. It allows us to rewrite the rules as we go. The ultimate expression of this is how we can just reopen a class and replace some of its methods wholesale. We lovingly refer to this practice as "monkey patching."</p> <p>When you think about it though, the practice is almost silly for most of the cases we use it for.</p> <p>To explain that claim, we need to take a quick detour and discuss Ruby's method lookup. Instead of explaining how it works, let's just ask Ruby to show us:</p> <div class="highlight highlight-ruby"><pre><span class="k">class</span> <span class="nc">Object</span> <span class="k">def</span> <span class="nf">show_yourself</span> <span class="nb">puts</span> <span class="s2">"In Object."</span> <span class="k">end</span> <span class="k">end</span> <span class="k">class</span> <span class="nc">Parent</span> <span class="k">def</span> <span class="nf">show_yourself</span> <span class="nb">puts</span> <span class="s2">"In Parent."</span> <span class="nb">puts</span> <span class="s2">"Handing up the line..."</span> <span class="nb">puts</span> <span class="k">super</span> <span class="k">end</span> <span class="k">end</span> <span class="k">class</span> <span class="nc">Child</span> <span class="o"><</span> <span class="no">Parent</span> <span class="k">def</span> <span class="nf">show_yourself</span> <span class="nb">puts</span> <span class="s2">"In Child."</span> <span class="nb">puts</span> <span class="s2">"Handing up the line..."</span> <span class="nb">puts</span> <span class="k">super</span> <span class="k">end</span> <span class="k">end</span> <span class="n">o</span> <span class="o">=</span> <span class="no">Child</span><span class="o">.</span><span class="n">new</span> <span class="n">o</span><span class="o">.</span><span class="n">show_yourself</span> </pre></div> <p>That code prints:</p> <pre><code>In Child. Handing up the line... In Parent. Handing up the line... In Object. </code></pre> <p>Hopefully, that's pretty straightforward. We called a method on a <code>Child</code> instance. That method then handed up to the same method defined in <code>Parent</code>, because <code>Child</code> inherits from <code>Parent</code>. That method then hands up to <code>Object</code>, because anything that doesn't declare a superclass, like <code>Parent</code>, gets <code>Object</code>.</p> <p>In Ruby though, that's not the full story. Let's change the last chunk of code to this:</p> <div class="highlight highlight-ruby"><pre><span class="c1"># ...</span> <span class="n">o</span> <span class="o">=</span> <span class="no">Child</span><span class="o">.</span><span class="n">new</span> <span class="k">class</span> <span class="o"><<</span> <span class="n">o</span> <span class="k">def</span> <span class="nf">show_yourself</span> <span class="nb">puts</span> <span class="s2">"In the hidden singleton class."</span> <span class="nb">puts</span> <span class="s2">"Handing up the line..."</span> <span class="nb">puts</span> <span class="k">super</span> <span class="k">end</span> <span class="k">end</span> <span class="n">o</span><span class="o">.</span><span class="n">show_yourself</span> </pre></div> <p>Now we get this output:</p> <pre><code>In the hidden singleton class. Handing up the line... In Child. Handing up the line... In Parent. Handing up the line... In Object. </code></pre> <p>Each instance in Ruby has its own <code>Class</code>, called the singleton class. (No, we're not talking about the Singleton design pattern here. This is a different use of the term.) This is why we can modify individual objects no matter what their <code>Class</code> is. The specializations end up in the singleton class. Ruby mostly hides this class from us as an implementation detail, which is why I had to open the object's singleton class explicitly to get it to show up above.</p> <p>We can now see that method lookup is a straight line in Ruby. You start at the bottom, with the object's singleton class and go straight up until you find a matching method.</p> <p>That leads us to a question though: how do mix-ins play into this? The answer is pretty simple: they are inserted into the call chain <strong>behind</strong> a <code>Class</code>. <em>[<strong>Update</strong>: Ruby 2's <code>prepend()</code> gives us the ability to insert mix-ins <strong>in front of</strong> a <code>Class</code> as well.]</em> To see what I mean, let's mix something into <code>Child</code>:</p> <div class="highlight highlight-ruby"><pre><span class="c1"># ...</span> <span class="k">module</span> <span class="nn">Mixin</span> <span class="k">def</span> <span class="nf">show_yourself</span> <span class="nb">puts</span> <span class="s2">"In Mixin."</span> <span class="nb">puts</span> <span class="s2">"Handing up the line..."</span> <span class="nb">puts</span> <span class="k">super</span> <span class="k">end</span> <span class="k">end</span> <span class="k">class</span> <span class="nc">Child</span> <span class="o"><</span> <span class="no">Parent</span> <span class="kp">include</span> <span class="no">Mixin</span> <span class="k">def</span> <span class="nf">show_yourself</span> <span class="nb">puts</span> <span class="s2">"In Child."</span> <span class="nb">puts</span> <span class="s2">"Handing up the line..."</span> <span class="nb">puts</span> <span class="k">super</span> <span class="k">end</span> <span class="k">end</span> <span class="c1"># ...</span> </pre></div> <p>That prints:</p> <pre><code>In the hidden singleton class. Handing up the line... In Child. Handing up the line... In Mixin. Handing up the line... In Parent. Handing up the line... In Object. </code></pre> <p>See how <code>Mixin</code> just hopped in line behind <code>Child</code>? That's what they do.</p> <p>Well, that's what <code>include()</code> does. Isn't <code>extend()</code> special? Not really. The fact is that <code>extend()</code> is just a shortcut that translates to this:</p> <div class="highlight highlight-ruby"><pre><span class="k">def</span> <span class="nf">extend</span><span class="p">(</span><span class="n">mixin</span><span class="p">)</span> <span class="n">singleton_class</span><span class="o">.</span><span class="n">class_eval</span> <span class="k">do</span> <span class="kp">include</span> <span class="n">mixin</span> <span class="k">end</span> <span class="k">end</span> </pre></div> <p>As you can see, <code>extend()</code> just does an <code>include()</code> under the hood, but it does it on the singleton class. Using that knowledge, we can modify our example one last time to show off a superior form of monkey patching:</p> <div class="highlight highlight-ruby"><pre><span class="c1"># ...</span> <span class="k">module</span> <span class="nn">SuperiorMonkeyPatch</span> <span class="k">def</span> <span class="nf">show_yourself</span> <span class="nb">puts</span> <span class="s2">"In SuperiorMonkeyPatch."</span> <span class="nb">puts</span> <span class="s2">"Handing up the line..."</span> <span class="nb">puts</span> <span class="k">super</span> <span class="k">end</span> <span class="k">end</span> <span class="n">o</span> <span class="o">=</span> <span class="no">Child</span><span class="o">.</span><span class="n">new</span> <span class="n">o</span><span class="o">.</span><span class="n">extend</span><span class="p">(</span><span class="no">SuperiorMonkeyPatch</span><span class="p">)</span> <span class="k">class</span> <span class="o"><<</span> <span class="n">o</span> <span class="k">def</span> <span class="nf">show_yourself</span> <span class="nb">puts</span> <span class="s2">"In the hidden singleton class."</span> <span class="nb">puts</span> <span class="s2">"Handing up the line..."</span> <span class="nb">puts</span> <span class="k">super</span> <span class="k">end</span> <span class="k">end</span> <span class="n">o</span><span class="o">.</span><span class="n">show_yourself</span> </pre></div> <p>Now the code prints:</p> <pre><code>In the hidden singleton class. Handing up the line... In SuperiorMonkeyPatch. Handing up the line... In Child. Handing up the line... In Mixin. Handing up the line... In Parent. Handing up the line... In Object. </code></pre> <p>Note the <code>SuperiorMonkeyPatch</code> is <strong>behind</strong> the singleton class, because mix-ins are always inserted behind a <code>Class</code>. But that puts it <strong>in front of</strong> <code>Child</code>, which is right where we need it to be if we want to override some behavior.</p> <p>To sum this up, the key insights are:</p> <ul> <li>Ruby's method lookup is just a straight line</li> <li>Using mix-ins, we can insert code at various points along that line</li> </ul><p>This is the ideal way to override behavior. Why? Well, if you monkey patch a <code>Class</code>, you have changed it for the whole world. We've already seen though that mix-ins give us the choice of when we want the changes and when we don't.</p> <p>Furthermore, you have to be very careful when monkey patching if you want to keep the old code. This involves a dance of aliasing (really copying) the old method, replacing it, and then referring to the renamed code. (That's how the infamous <code>alias_method_chain()</code> in Rails works.) With a mix-in though, <code>super</code> can be used normally.</p> <p>This makes using a <code>Module</code> safer. We're not all playing in one namespace and aliasing a bunch of names that could eventually collide.</p> <p>To give a realistic example of how you can use this technique in practice, let's talk about a support email I received recently. The programmer who wrote me was working with a database that spit out some pretty goofy CSV. It would escape quotes with <code>\"</code>, even though the CSV format calls for <code>""</code>. It also escaped other things, like null characters as <code>\0</code>. Because this created a non-standard data format, he couldn't find anything that could read it. That made him write me and ask if there were some way he could modify the <code>CSV</code> library to read it.</p> <p>"No need," I told him. CSV is a simple wrapper over a normal Ruby <code>IO</code> object and it mostly just counts on one method <code>gets()</code>. When you call <code>CSV#gets</code>, it pulls some data from <code>IO#gets</code>, then parses it and returns it to you. That gives us a familiar method lookup line:</p> <pre><code> IO#gets ^ | CSV#gets </code></pre> <p>All we need to do is get some code in the middle of that line. That code can translate from the broken CSV format to the correct format the library expects and everything else will just work. No monkey patching is required. Here's the code I sent to him:</p> <div class="highlight highlight-ruby"><pre><span class="k">module</span> <span class="nn">CSVNormalizer</span> <span class="k">def</span> <span class="nf">gets</span><span class="p">(</span><span class="o">*</span><span class="n">args</span><span class="p">)</span> <span class="n">result</span> <span class="o">=</span> <span class="k">super</span> <span class="k">if</span> <span class="n">result</span> <span class="c1"># FIXME: Improve escape handling</span> <span class="n">result</span><span class="o">.</span><span class="n">gsub!</span><span class="p">(</span><span class="sr">/\\(["0])/</span><span class="p">)</span> <span class="p">{</span> <span class="vg">$1</span> <span class="o">==</span> <span class="s2">"0"</span> <span class="p">?</span> <span class="s2">"</span><span class="se">\0</span><span class="s2">"</span> <span class="p">:</span> <span class="s1">'""'</span> <span class="p">}</span> <span class="k">end</span> <span class="n">result</span> <span class="k">end</span> <span class="k">end</span> <span class="k">if</span> <span class="bp">__FILE__</span> <span class="o">==</span> <span class="vg">$PROGRAM_NAME</span> <span class="nb">require</span> <span class="s2">"csv"</span> <span class="nb">abort</span> <span class="s2">"</span><span class="si">#{</span><span class="vg">$PROGRAM_NAME</span><span class="si">}</span><span class="s2"> FILE_PATH"</span> <span class="k">unless</span> <span class="no">ARGV</span><span class="o">.</span><span class="n">first</span> <span class="nb">open</span><span class="p">(</span><span class="no">ARGV</span><span class="o">.</span><span class="n">first</span><span class="p">)</span> <span class="k">do</span> <span class="o">|</span><span class="n">io</span><span class="o">|</span> <span class="n">io</span><span class="o">.</span><span class="n">extend</span><span class="p">(</span><span class="no">CSVNormalizer</span><span class="p">)</span> <span class="n">csv</span> <span class="o">=</span> <span class="no">CSV</span><span class="o">.</span><span class="n">new</span><span class="p">(</span><span class="n">io</span><span class="p">)</span> <span class="n">csv</span><span class="o">.</span><span class="n">each</span> <span class="k">do</span> <span class="o">|</span><span class="n">row</span><span class="o">|</span> <span class="c1"># use row here...</span> <span class="k">end</span> <span class="k">end</span> <span class="k">end</span> </pre></div> <p>My unescaping code may not be perfect, if there are other scenarios than those he described, but that's not the point. Note how easy this was to setup: I defined a module that uses <code>super</code> to get the data, transforms it, and returns the fixed data; I manually setup the <code>IO</code> object, instead of letting <code>CSV</code> do it for me; I used my mix-in to make that object return good data; then I hand the now safe-to-use object on to <code>CSV</code>. This is a clean patch job that won't affect any other code, even if we use it in a project that also processes some normal CSV data. Perfect.</p> <h4>Keep Modules in Mind</h4> <p>Ruby gives us these different ways to construct types using mix-ins. We can combine them, use them conditionally, and even build up modified behaviors with them, as needed.</p> <p>A lot of this power comes the elegance of how Ruby handles method lookup. Once you realize that message passing happens down a straight line and that you can make interceptions at points along that line, you gain a lot of control over what is happening in your programs.</p> <p>I strongly encourage to play with these techniques in your programs, or just on the side. It can take a while for all of this to click, but it really expands your understanding of Ruby when you get there.</p> <h4>Learn More About Modules</h4> <p>If you enjoyed this discussion of how to make mix-ins work for you, I'm pretty sure you would also enjoy:</p> <ul> <li> <a href="http://www.confreaks.com/videos/201-lsrc2009-module-magic">Module Magic</a> is a presentation I gave at the Lone Star Ruby Conference in 2009. I showed some of the tricks discussed above (in less detail) and some other handy tricks you can use. My <a href="http://www.slideshare.net/JamesEdwardGrayII/module-magic">slides</a> are also available.</li> <li>The book <a href="http://pragprog.com/book/jvrails/crafting-rails-applications">Crafting Rails Applications</a> is a detailed explanation of how Rails 3 works under the hood. One of the most significant changes from Rails 2 to Rails 3, was to rework the framework from using old style monkey patching (with <code>alias_method_chain()</code>) to the <code>Module</code> approach I've covered here. This had many benefits which this book covers very well. We <a href="http://rubyrogues.com/048-rr-crafting-rails-applications-with-jose-valim/">discussed this book on the Ruby Rogues podcast</a>.</li> <li>Dave Thomas did a screencast series a while back on <a href="http://pragprog.com/screencasts/v-dtrubyom/the-ruby-object-model-and-metaprogramming">The Ruby Object Model and Metaprogramming</a>. Though it uses an old version of Ruby, and misses out on some niceties added later (like the <code>singleton_class()</code> method), it's easily one of the best discussions of Ruby's method lookup system and a lot more. If you have struggled to understand the tricks we are using when metaprogramming, this is the place to get those questions answered.</li> </ul> James Edward Gray II
|
{
"url": "http://graysoftinc.com/rubies-in-the-rough/feed.xml",
"source_domain": "graysoftinc.com",
"snapshot_id": "crawl=CC-MAIN-2016-07",
"warc_metadata": {
"Content-Length": "409947",
"Content-Type": "application/http; msgtype=response",
"WARC-Block-Digest": "sha1:ZGGAQDDZCTSMPUF7Z7Q2BTDTTXSALUYS",
"WARC-Concurrent-To": "<urn:uuid:4631c9c4-ac2c-4e7a-a3ec-132bfb851900>",
"WARC-Date": "2016-02-10T04:29:49Z",
"WARC-IP-Address": "69.164.201.74",
"WARC-Identified-Payload-Type": null,
"WARC-Payload-Digest": "sha1:5VCPTEHAQKKDZW33NOBNSOYDH6RPMCRY",
"WARC-Record-ID": "<urn:uuid:dd3441f5-3354-478f-872a-488f6dcb859a>",
"WARC-Target-URI": "http://graysoftinc.com/rubies-in-the-rough/feed.xml",
"WARC-Truncated": "length",
"WARC-Type": "response",
"WARC-Warcinfo-ID": "<urn:uuid:4efdd9d2-101e-42a4-8062-c2b519b6b514>"
},
"warc_info": "robots: classic\r\nhostname: ip-10-236-182-209.ec2.internal\r\nsoftware: Nutch 1.6 (CC)/CC WarcExport 1.0\r\nisPartOf: CC-MAIN-2016-07\r\noperator: CommonCrawl Admin\r\ndescription: Wide crawl of the web for February 2016\r\npublisher: CommonCrawl\r\nformat: WARC File Format 1.0\r\nconformsTo: http://bibnum.bnf.fr/WARC/WARC_ISO_28500_version1_latestdraft.pdf"
}
|
{
"line_start_idx": [
0
],
"line_end_idx": [
310126
]
}
|
{
"red_pajama_v2": {
"ccnet_original_length": 310126,
"ccnet_original_nlines": 0,
"rps_doc_curly_bracket": 0.0008125699823722243,
"rps_doc_ldnoobw_words": 2,
"rps_doc_lorem_ipsum": 0,
"rps_doc_stop_word_fraction": 0.20367756485939026,
"rps_doc_ut1_blacklist": 0,
"rps_doc_frac_all_caps_words": 0.009899410419166088,
"rps_doc_frac_lines_end_with_ellipsis": 0,
"rps_doc_frac_no_alph_words": 0.3965113162994385,
"rps_doc_frac_unique_words": 0.15060855448246002,
"rps_doc_mean_word_length": 6.728827953338623,
"rps_doc_num_sentences": 2247,
"rps_doc_symbol_to_word_ratio": 0.019411949440836906,
"rps_doc_unigram_entropy": 6.379954814910889,
"rps_doc_word_count": 31386,
"rps_doc_frac_chars_dupe_10grams": 0.26143160462379456,
"rps_doc_frac_chars_dupe_5grams": 0.4051687717437744,
"rps_doc_frac_chars_dupe_6grams": 0.3581734001636505,
"rps_doc_frac_chars_dupe_7grams": 0.33168554306030273,
"rps_doc_frac_chars_dupe_8grams": 0.2975505590438843,
"rps_doc_frac_chars_dupe_9grams": 0.281825453042984,
"rps_doc_frac_chars_top_2gram": 0.03758683055639267,
"rps_doc_frac_chars_top_3gram": 0.028637580573558807,
"rps_doc_frac_chars_top_4gram": 0.021894870325922966,
"rps_doc_books_importance": -47668.1953125,
"rps_doc_books_importance_length_correction": -47668.1953125,
"rps_doc_openwebtext_importance": -32952.11328125,
"rps_doc_openwebtext_importance_length_correction": -32952.11328125,
"rps_doc_wikipedia_importance": -29628.716796875,
"rps_doc_wikipedia_importance_length_correction": -29628.716796875
},
"fasttext": {
"dclm": 0.4382212162017822,
"english": 0.7282205820083618,
"fineweb_edu_approx": 1.8573936223983765,
"eai_general_math": 0.09396982192993164,
"eai_open_web_math": 0.06365013122558594,
"eai_web_code": 0.17887133359909058
}
}
|
{
"free_decimal_correspondence": {
"primary": {
"code": "005.1332",
"labels": {
"level_1": "General works, books and libraries, information sciences",
"level_2": "",
"level_3": "Computer programming"
}
},
"secondary": {
"code": "005.133",
"labels": {
"level_1": "General works, books and libraries, information sciences",
"level_2": "",
"level_3": "Computer programming"
}
}
},
"bloom_cognitive_process": {
"primary": {
"code": "3",
"label": "Apply"
},
"secondary": {
"code": "4",
"label": "Analyze"
}
},
"bloom_knowledge_domain": {
"primary": {
"code": "3",
"label": "Procedural"
},
"secondary": {
"code": "2",
"label": "Conceptual"
}
},
"document_type_v1": {
"primary": {
"code": "3",
"label": "Reference/Encyclopedic/Educational"
},
"secondary": {
"code": "4",
"label": "Code/Software"
}
},
"extraction_artifacts": {
"primary": {
"code": "1",
"label": "Leftover HTML"
},
"secondary": {
"code": "3",
"label": "Irrelevant Content"
}
},
"missing_content": {
"primary": {
"code": "0",
"label": "No missing content"
},
"secondary": {
"code": "-1",
"label": "Abstain"
}
},
"document_type_v2": {
"primary": {
"code": "23",
"label": "Tutorial"
},
"secondary": {
"code": "8",
"label": "Documentation"
}
},
"reasoning_depth": {
"primary": {
"code": "3",
"label": "Intermediate Reasoning"
},
"secondary": {
"code": "4",
"label": "Advanced Reasoning"
}
},
"technical_correctness": {
"primary": {
"code": "4",
"label": "Highly Correct"
},
"secondary": {
"code": "3",
"label": "Mostly Correct"
}
},
"education_level": {
"primary": {
"code": "3",
"label": "Undergraduate Level"
},
"secondary": {
"code": "4",
"label": "Graduate/Expert Level"
}
}
}
|
672f1e42c33a7f9846924a2431ea77df
|
7,121,907,535,798,478,000
|
ExtremeWireless (WiNG)
View Only
Expand all | Collapse all
How can I download latest firmware for AP7522 without creating a request?
• 1. How can I download latest firmware for AP7522 without creating a request?
Posted 04-23-2018 09:33
Hi. When I want to download the latest firmware for AP7522, the portal does not allow me to download anything. It is also impossible to create a request, because there is no product or enterprise argeement for AP's. How can I download latest firmware for AP7522 without creating a request?
Thank's a lot.
• 2. RE: How can I download latest firmware for AP7522 without creating a request?
Posted 04-23-2018 10:52
Hi Kostya,
Here is a list of possible reasons you cannot download:
missing entitlemen / service contract incorrect ownership of service contract or serial number database mistake
Please check KB article How to Download Firmware Files for Extreme Networks Products
and if you believe that the issue is on Extreme Networks side, kindly do raise a GTAC case with us.
Regards,
Ondrej
|
{
"url": "https://community.extremenetworks.com/communities/community-home/digestviewer/viewthread?GroupId=187&MessageKey=751df314-2dd6-4bf1-9317-b921ae16997b&CommunityKey=ed4f7644-df2a-43b4-b20b-cfc3aba9834d&tab=digestviewer",
"source_domain": "community.extremenetworks.com",
"snapshot_id": "crawl=CC-MAIN-2022-33",
"warc_metadata": {
"Content-Length": "195585",
"Content-Type": "application/http; msgtype=response",
"WARC-Block-Digest": "sha1:BF7ABD3ZURARVKYOUX7ANCO4ULZS5PP7",
"WARC-Concurrent-To": "<urn:uuid:0aaa3988-cbd3-434a-9279-991beb94aa34>",
"WARC-Date": "2022-08-16T03:27:22Z",
"WARC-IP-Address": "34.193.4.92",
"WARC-Identified-Payload-Type": "text/html",
"WARC-Payload-Digest": "sha1:PG774VEDMQJZGRALUJXXOP5YQEVPAXOY",
"WARC-Record-ID": "<urn:uuid:254757c6-8538-4705-a1bd-a82dc3f43368>",
"WARC-Target-URI": "https://community.extremenetworks.com/communities/community-home/digestviewer/viewthread?GroupId=187&MessageKey=751df314-2dd6-4bf1-9317-b921ae16997b&CommunityKey=ed4f7644-df2a-43b4-b20b-cfc3aba9834d&tab=digestviewer",
"WARC-Truncated": null,
"WARC-Type": "response",
"WARC-Warcinfo-ID": "<urn:uuid:b8124bb8-068d-4cbe-8fc0-489aa7c7d557>"
},
"warc_info": "isPartOf: CC-MAIN-2022-33\r\npublisher: Common Crawl\r\ndescription: Wide crawl of the web for August 2022\r\noperator: Common Crawl Admin (info@commoncrawl.org)\r\nhostname: ip-10-67-67-171\r\nsoftware: Apache Nutch 1.18 (modified, https://github.com/commoncrawl/nutch/)\r\nrobots: checked via crawler-commons 1.4-SNAPSHOT (https://github.com/crawler-commons/crawler-commons)\r\nformat: WARC File Format 1.1\r\nconformsTo: https://iipc.github.io/warc-specifications/specifications/warc-format/warc-1.1/"
}
|
{
"line_start_idx": [
0,
23,
24,
35,
61,
62,
136,
137,
219,
220,
248,
542,
561,
562,
563,
649,
650,
678,
693,
694,
754,
755,
873,
962,
1066,
1067,
1080
],
"line_end_idx": [
23,
24,
35,
61,
62,
136,
137,
219,
220,
248,
542,
561,
562,
563,
649,
650,
678,
693,
694,
754,
755,
873,
962,
1066,
1067,
1080,
1090
]
}
|
{
"red_pajama_v2": {
"ccnet_original_length": 1090,
"ccnet_original_nlines": 26,
"rps_doc_curly_bracket": 0,
"rps_doc_ldnoobw_words": 0,
"rps_doc_lorem_ipsum": 0,
"rps_doc_stop_word_fraction": 0.30917873978614807,
"rps_doc_ut1_blacklist": 0,
"rps_doc_frac_all_caps_words": 0.06763284653425217,
"rps_doc_frac_lines_end_with_ellipsis": 0,
"rps_doc_frac_no_alph_words": 0.21256038546562195,
"rps_doc_frac_unique_words": 0.5621301531791687,
"rps_doc_mean_word_length": 4.893491268157959,
"rps_doc_num_sentences": 12,
"rps_doc_symbol_to_word_ratio": 0,
"rps_doc_unigram_entropy": 4.26873779296875,
"rps_doc_word_count": 169,
"rps_doc_frac_chars_dupe_10grams": 0.32889965176582336,
"rps_doc_frac_chars_dupe_5grams": 0.32889965176582336,
"rps_doc_frac_chars_dupe_6grams": 0.32889965176582336,
"rps_doc_frac_chars_dupe_7grams": 0.32889965176582336,
"rps_doc_frac_chars_dupe_8grams": 0.32889965176582336,
"rps_doc_frac_chars_dupe_9grams": 0.32889965176582336,
"rps_doc_frac_chars_top_2gram": 0.08464328944683075,
"rps_doc_frac_chars_top_3gram": 0.10278113931417465,
"rps_doc_frac_chars_top_4gram": 0.13905683159828186,
"rps_doc_books_importance": -88.51962280273438,
"rps_doc_books_importance_length_correction": -88.51962280273438,
"rps_doc_openwebtext_importance": -55.9510612487793,
"rps_doc_openwebtext_importance_length_correction": -46.17964172363281,
"rps_doc_wikipedia_importance": -54.92453384399414,
"rps_doc_wikipedia_importance_length_correction": -54.92453384399414
},
"fasttext": {
"dclm": 0.1259394884109497,
"english": 0.8263106346130371,
"fineweb_edu_approx": 0.9655451774597168,
"eai_general_math": 0.0006046299822628498,
"eai_open_web_math": 0.014879349619150162,
"eai_web_code": 0.00006246999691938981
}
}
|
{
"free_decimal_correspondence": {
"primary": {
"code": "004.6",
"labels": {
"level_1": "General works, books and libraries, information sciences",
"level_2": "",
"level_3": "Computers and Computer science"
}
},
"secondary": {
"code": "005.456",
"labels": {
"level_1": "General works, books and libraries, information sciences",
"level_2": "",
"level_3": "Computer programming"
}
}
},
"bloom_cognitive_process": {
"primary": {
"code": "2",
"label": "Understand"
},
"secondary": {
"code": "3",
"label": "Apply"
}
},
"bloom_knowledge_domain": {
"primary": {
"code": "2",
"label": "Conceptual"
},
"secondary": {
"code": "3",
"label": "Procedural"
}
},
"document_type_v1": {
"primary": {
"code": "5",
"label": "Social/Forum"
},
"secondary": {
"code": "3",
"label": "Reference/Encyclopedic/Educational"
}
},
"extraction_artifacts": {
"primary": {
"code": "0",
"label": "No Artifacts"
},
"secondary": {
"code": "3",
"label": "Irrelevant Content"
}
},
"missing_content": {
"primary": {
"code": "0",
"label": "No missing content"
},
"secondary": {
"code": "-1",
"label": "Abstain"
}
},
"document_type_v2": {
"primary": {
"code": "18",
"label": "Q&A Forum"
},
"secondary": {
"code": "21",
"label": "Customer Support"
}
},
"reasoning_depth": {
"primary": {
"code": "2",
"label": "Basic Reasoning"
},
"secondary": {
"code": "1",
"label": "No Reasoning"
}
},
"technical_correctness": {
"primary": {
"code": "4",
"label": "Highly Correct"
},
"secondary": {
"code": "3",
"label": "Mostly Correct"
}
},
"education_level": {
"primary": {
"code": "1",
"label": "General Audience"
},
"secondary": {
"code": "2",
"label": "High School Level"
}
}
}
|
672f1e42c33a7f9846924a2431ea77df
|
7,090,724,864,170,056,000
|
blob: 23f1387b3ef791b515b97b2ee694dd946ff712b3 [file] [log] [blame]
/*
* MMU operations common to all auto-translated physmap guests.
*
* Copyright (C) 2015 Citrix Systems R&D Ltd.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License version 2
* as published by the Free Software Foundation; or, when distributed
* separately from the Linux kernel or incorporated into other
* software packages, subject to the following license:
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this source file (the "Software"), to deal in the Software without
* restriction, including without limitation the rights to use, copy, modify,
* merge, publish, distribute, sublicense, and/or sell copies of the Software,
* and to permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
* IN THE SOFTWARE.
*/
#include <linux/kernel.h>
#include <linux/mm.h>
#include <linux/slab.h>
#include <linux/vmalloc.h>
#include <asm/xen/hypercall.h>
#include <asm/xen/hypervisor.h>
#include <xen/xen.h>
#include <xen/page.h>
#include <xen/interface/xen.h>
#include <xen/interface/memory.h>
#include <xen/balloon.h>
typedef void (*xen_gfn_fn_t)(unsigned long gfn, void *data);
/* Break down the pages in 4KB chunk and call fn for each gfn */
static void xen_for_each_gfn(struct page **pages, unsigned nr_gfn,
xen_gfn_fn_t fn, void *data)
{
unsigned long xen_pfn = 0;
struct page *page;
int i;
for (i = 0; i < nr_gfn; i++) {
if ((i % XEN_PFN_PER_PAGE) == 0) {
page = pages[i / XEN_PFN_PER_PAGE];
xen_pfn = page_to_xen_pfn(page);
}
fn(pfn_to_gfn(xen_pfn++), data);
}
}
struct remap_data {
xen_pfn_t *fgfn; /* foreign domain's gfn */
int nr_fgfn; /* Number of foreign gfn left to map */
pgprot_t prot;
domid_t domid;
struct vm_area_struct *vma;
int index;
struct page **pages;
struct xen_remap_gfn_info *info;
int *err_ptr;
int mapped;
/* Hypercall parameters */
int h_errs[XEN_PFN_PER_PAGE];
xen_ulong_t h_idxs[XEN_PFN_PER_PAGE];
xen_pfn_t h_gpfns[XEN_PFN_PER_PAGE];
int h_iter; /* Iterator */
};
static void setup_hparams(unsigned long gfn, void *data)
{
struct remap_data *info = data;
info->h_idxs[info->h_iter] = *info->fgfn;
info->h_gpfns[info->h_iter] = gfn;
info->h_errs[info->h_iter] = 0;
info->h_iter++;
info->fgfn++;
}
static int remap_pte_fn(pte_t *ptep, pgtable_t token, unsigned long addr,
void *data)
{
struct remap_data *info = data;
struct page *page = info->pages[info->index++];
pte_t pte = pte_mkspecial(pfn_pte(page_to_pfn(page), info->prot));
int rc, nr_gfn;
uint32_t i;
struct xen_add_to_physmap_range xatp = {
.domid = DOMID_SELF,
.foreign_domid = info->domid,
.space = XENMAPSPACE_gmfn_foreign,
};
nr_gfn = min_t(typeof(info->nr_fgfn), XEN_PFN_PER_PAGE, info->nr_fgfn);
info->nr_fgfn -= nr_gfn;
info->h_iter = 0;
xen_for_each_gfn(&page, nr_gfn, setup_hparams, info);
BUG_ON(info->h_iter != nr_gfn);
set_xen_guest_handle(xatp.idxs, info->h_idxs);
set_xen_guest_handle(xatp.gpfns, info->h_gpfns);
set_xen_guest_handle(xatp.errs, info->h_errs);
xatp.size = nr_gfn;
rc = HYPERVISOR_memory_op(XENMEM_add_to_physmap_range, &xatp);
/* info->err_ptr expect to have one error status per Xen PFN */
for (i = 0; i < nr_gfn; i++) {
int err = (rc < 0) ? rc : info->h_errs[i];
*(info->err_ptr++) = err;
if (!err)
info->mapped++;
}
/*
* Note: The hypercall will return 0 in most of the case if even if
* all the fgmfn are not mapped. We still have to update the pte
* as the userspace may decide to continue.
*/
if (!rc)
set_pte_at(info->vma->vm_mm, addr, ptep, pte);
return 0;
}
int xen_xlate_remap_gfn_array(struct vm_area_struct *vma,
unsigned long addr,
xen_pfn_t *gfn, int nr,
int *err_ptr, pgprot_t prot,
unsigned domid,
struct page **pages)
{
int err;
struct remap_data data;
unsigned long range = DIV_ROUND_UP(nr, XEN_PFN_PER_PAGE) << PAGE_SHIFT;
/* Kept here for the purpose of making sure code doesn't break
x86 PVOPS */
BUG_ON(!((vma->vm_flags & (VM_PFNMAP | VM_IO)) == (VM_PFNMAP | VM_IO)));
data.fgfn = gfn;
data.nr_fgfn = nr;
data.prot = prot;
data.domid = domid;
data.vma = vma;
data.pages = pages;
data.index = 0;
data.err_ptr = err_ptr;
data.mapped = 0;
err = apply_to_page_range(vma->vm_mm, addr, range,
remap_pte_fn, &data);
return err < 0 ? err : data.mapped;
}
EXPORT_SYMBOL_GPL(xen_xlate_remap_gfn_array);
static void unmap_gfn(unsigned long gfn, void *data)
{
struct xen_remove_from_physmap xrp;
xrp.domid = DOMID_SELF;
xrp.gpfn = gfn;
(void)HYPERVISOR_memory_op(XENMEM_remove_from_physmap, &xrp);
}
int xen_xlate_unmap_gfn_range(struct vm_area_struct *vma,
int nr, struct page **pages)
{
xen_for_each_gfn(pages, nr, unmap_gfn, NULL);
return 0;
}
EXPORT_SYMBOL_GPL(xen_xlate_unmap_gfn_range);
struct map_balloon_pages {
xen_pfn_t *pfns;
unsigned int idx;
};
static void setup_balloon_gfn(unsigned long gfn, void *data)
{
struct map_balloon_pages *info = data;
info->pfns[info->idx++] = gfn;
}
/**
* xen_xlate_map_ballooned_pages - map a new set of ballooned pages
* @gfns: returns the array of corresponding GFNs
* @virt: returns the virtual address of the mapped region
* @nr_grant_frames: number of GFNs
* @return 0 on success, error otherwise
*
* This allocates a set of ballooned pages and maps them into the
* kernel's address space.
*/
int __init xen_xlate_map_ballooned_pages(xen_pfn_t **gfns, void **virt,
unsigned long nr_grant_frames)
{
struct page **pages;
xen_pfn_t *pfns;
void *vaddr;
struct map_balloon_pages data;
int rc;
unsigned long nr_pages;
BUG_ON(nr_grant_frames == 0);
nr_pages = DIV_ROUND_UP(nr_grant_frames, XEN_PFN_PER_PAGE);
pages = kcalloc(nr_pages, sizeof(pages[0]), GFP_KERNEL);
if (!pages)
return -ENOMEM;
pfns = kcalloc(nr_grant_frames, sizeof(pfns[0]), GFP_KERNEL);
if (!pfns) {
kfree(pages);
return -ENOMEM;
}
rc = alloc_xenballooned_pages(nr_pages, pages);
if (rc) {
pr_warn("%s Couldn't balloon alloc %ld pages rc:%d\n", __func__,
nr_pages, rc);
kfree(pages);
kfree(pfns);
return rc;
}
data.pfns = pfns;
data.idx = 0;
xen_for_each_gfn(pages, nr_grant_frames, setup_balloon_gfn, &data);
vaddr = vmap(pages, nr_pages, 0, PAGE_KERNEL);
if (!vaddr) {
pr_warn("%s Couldn't map %ld pages rc:%d\n", __func__,
nr_pages, rc);
free_xenballooned_pages(nr_pages, pages);
kfree(pages);
kfree(pfns);
return -ENOMEM;
}
kfree(pages);
*gfns = pfns;
*virt = vaddr;
return 0;
}
EXPORT_SYMBOL_GPL(xen_xlate_map_ballooned_pages);
|
{
"url": "https://gem5.googlesource.com/arm/linux/+/38c53af853069adf87181684370d7b8866d6387b/drivers/xen/xlate_mmu.c?autodive=0%2F%2F%2F",
"source_domain": "gem5.googlesource.com",
"snapshot_id": "CC-MAIN-2024-18",
"warc_metadata": {
"Content-Length": "91126",
"Content-Type": "application/http; msgtype=response",
"WARC-Block-Digest": "sha1:24WZ5BVJIDWYB3ONKKYSVVPH35LLWH5J",
"WARC-Concurrent-To": "<urn:uuid:06247c94-4a13-4062-aaad-5212308fa355>",
"WARC-Date": "2024-04-14T10:33:33Z",
"WARC-IP-Address": "172.253.122.82",
"WARC-Identified-Payload-Type": "text/html",
"WARC-Payload-Digest": "sha1:CSJPTKS6RLOR2QCIT7OFOKIBWHRTYIQV",
"WARC-Record-ID": "<urn:uuid:a588847d-6648-43d2-8b2a-dd8201295abb>",
"WARC-Target-URI": "https://gem5.googlesource.com/arm/linux/+/38c53af853069adf87181684370d7b8866d6387b/drivers/xen/xlate_mmu.c?autodive=0%2F%2F%2F",
"WARC-Truncated": null,
"WARC-Type": "response",
"WARC-Warcinfo-ID": "<urn:uuid:cd735a08-386d-460e-a76c-a1c384df567e>"
},
"warc_info": "isPartOf: CC-MAIN-2024-18\r\npublisher: Common Crawl\r\ndescription: Wide crawl of the web for April 2024\r\noperator: Common Crawl Admin (info@commoncrawl.org)\r\nhostname: ip-10-67-67-122\r\nsoftware: Apache Nutch 1.19 (modified, https://github.com/commoncrawl/nutch/)\r\nrobots: checked via crawler-commons 1.5-SNAPSHOT (https://github.com/crawler-commons/crawler-commons)\r\nformat: WARC File Format 1.1\r\nconformsTo: https://iipc.github.io/warc-specifications/specifications/warc-format/warc-1.1/"
}
|
{
"line_start_idx": [
0,
68,
71,
134,
136,
181,
183,
247,
319,
388,
450,
505,
507,
586,
658,
735,
813,
892,
920,
922,
999,
1053,
1055,
1132,
1207,
1285,
1358,
1432,
1511,
1530,
1533,
1559,
1581,
1605,
1632,
1663,
1695,
1716,
1738,
1769,
1803,
1828,
1889,
1954,
2021,
2050,
2052,
2079,
2098,
2105,
2136,
2171,
2207,
2240,
2242,
2275,
2277,
2279,
2299,
2343,
2396,
2411,
2426,
2454,
2465,
2486,
2519,
2533,
2545,
2572,
2602,
2640,
2677,
2704,
2707,
2764,
2766,
2798,
2840,
2875,
2907,
2923,
2937,
2939,
3013,
3025,
3027,
3059,
3107,
3174,
3190,
3202,
3243,
3264,
3294,
3329,
3332,
3404,
3429,
3447,
3501,
3533,
3580,
3629,
3676,
3696,
3759,
3823,
3854,
3897,
3923,
3933,
3949,
3951,
3954,
4021,
4085,
4128,
4131,
4140,
4187,
4197,
4199,
4257,
4277,
4301,
4330,
4346,
4367,
4369,
4378,
4402,
4474,
4537,
4550,
4623,
4640,
4659,
4677,
4697,
4713,
4733,
4749,
4773,
4790,
4841,
4863,
4899,
4901,
4947,
5000,
5002,
5038,
5062,
5078,
5140,
5142,
5200,
5229,
5231,
5277,
5287,
5289,
5335,
5362,
5379,
5397,
5400,
5461,
5463,
5502,
5533,
5535,
5539,
5606,
5655,
5713,
5748,
5788,
5790,
5855,
5881,
5884,
5956,
5987,
5989,
6010,
6027,
6040,
6071,
6079,
6103,
6133,
6193,
6250,
6262,
6278,
6340,
6353,
6367,
6383,
6385,
6433,
6443,
6508,
6523,
6537,
6550,
6561,
6563,
6581,
6595,
6663,
6710,
6724,
6779,
6794,
6836,
6850,
6863,
6879,
6881,
6895,
6909,
6924,
6934,
6936
],
"line_end_idx": [
68,
71,
134,
136,
181,
183,
247,
319,
388,
450,
505,
507,
586,
658,
735,
813,
892,
920,
922,
999,
1053,
1055,
1132,
1207,
1285,
1358,
1432,
1511,
1530,
1533,
1559,
1581,
1605,
1632,
1663,
1695,
1716,
1738,
1769,
1803,
1828,
1889,
1954,
2021,
2050,
2052,
2079,
2098,
2105,
2136,
2171,
2207,
2240,
2242,
2275,
2277,
2279,
2299,
2343,
2396,
2411,
2426,
2454,
2465,
2486,
2519,
2533,
2545,
2572,
2602,
2640,
2677,
2704,
2707,
2764,
2766,
2798,
2840,
2875,
2907,
2923,
2937,
2939,
3013,
3025,
3027,
3059,
3107,
3174,
3190,
3202,
3243,
3264,
3294,
3329,
3332,
3404,
3429,
3447,
3501,
3533,
3580,
3629,
3676,
3696,
3759,
3823,
3854,
3897,
3923,
3933,
3949,
3951,
3954,
4021,
4085,
4128,
4131,
4140,
4187,
4197,
4199,
4257,
4277,
4301,
4330,
4346,
4367,
4369,
4378,
4402,
4474,
4537,
4550,
4623,
4640,
4659,
4677,
4697,
4713,
4733,
4749,
4773,
4790,
4841,
4863,
4899,
4901,
4947,
5000,
5002,
5038,
5062,
5078,
5140,
5142,
5200,
5229,
5231,
5277,
5287,
5289,
5335,
5362,
5379,
5397,
5400,
5461,
5463,
5502,
5533,
5535,
5539,
5606,
5655,
5713,
5748,
5788,
5790,
5855,
5881,
5884,
5956,
5987,
5989,
6010,
6027,
6040,
6071,
6079,
6103,
6133,
6193,
6250,
6262,
6278,
6340,
6353,
6367,
6383,
6385,
6433,
6443,
6508,
6523,
6537,
6550,
6561,
6563,
6581,
6595,
6663,
6710,
6724,
6779,
6794,
6836,
6850,
6863,
6879,
6881,
6895,
6909,
6924,
6934,
6936,
6985
]
}
|
{
"red_pajama_v2": {
"ccnet_original_length": 6985,
"ccnet_original_nlines": 226,
"rps_doc_curly_bracket": 0.004867570009082556,
"rps_doc_ldnoobw_words": 0,
"rps_doc_lorem_ipsum": 0,
"rps_doc_stop_word_fraction": 0.10381487756967545,
"rps_doc_ut1_blacklist": 0,
"rps_doc_frac_all_caps_words": 0.07129456102848053,
"rps_doc_frac_lines_end_with_ellipsis": 0,
"rps_doc_frac_no_alph_words": 0.4277673363685608,
"rps_doc_frac_unique_words": 0.4567430019378662,
"rps_doc_mean_word_length": 6.296437740325928,
"rps_doc_num_sentences": 50,
"rps_doc_symbol_to_word_ratio": 0.006879299879074097,
"rps_doc_unigram_entropy": 5.3548970222473145,
"rps_doc_word_count": 786,
"rps_doc_frac_chars_dupe_10grams": 0,
"rps_doc_frac_chars_dupe_5grams": 0.036977168172597885,
"rps_doc_frac_chars_dupe_6grams": 0.027076179161667824,
"rps_doc_frac_chars_dupe_7grams": 0,
"rps_doc_frac_chars_dupe_8grams": 0,
"rps_doc_frac_chars_dupe_9grams": 0,
"rps_doc_frac_chars_top_2gram": 0.017781369388103485,
"rps_doc_frac_chars_top_3gram": 0.00889068003743887,
"rps_doc_frac_chars_top_4gram": 0.012123660184442997,
"rps_doc_books_importance": -854.8973388671875,
"rps_doc_books_importance_length_correction": -854.8973388671875,
"rps_doc_openwebtext_importance": -485.2539367675781,
"rps_doc_openwebtext_importance_length_correction": -485.2539367675781,
"rps_doc_wikipedia_importance": -377.31591796875,
"rps_doc_wikipedia_importance_length_correction": -377.31591796875
},
"fasttext": {
"dclm": 0.9059070944786072,
"english": 0.3932645618915558,
"fineweb_edu_approx": 2.0381195545196533,
"eai_general_math": 0.5901576280593872,
"eai_open_web_math": 0.14713329076766968,
"eai_web_code": 0.40555208921432495
}
}
|
{
"free_decimal_correspondence": {
"primary": {
"code": "004.229",
"labels": {
"level_1": "General works, books and libraries, information sciences",
"level_2": "",
"level_3": "Computers and Computer science"
}
},
"secondary": {
"code": "005.452",
"labels": {
"level_1": "General works, books and libraries, information sciences",
"level_2": "",
"level_3": "Computer programming"
}
}
},
"bloom_cognitive_process": {
"primary": {
"code": "3",
"label": "Apply"
},
"secondary": {
"code": "4",
"label": "Analyze"
}
},
"bloom_knowledge_domain": {
"primary": {
"code": "3",
"label": "Procedural"
},
"secondary": {
"code": "2",
"label": "Conceptual"
}
},
"document_type_v1": {
"primary": {
"code": "4",
"label": "Code/Software"
},
"secondary": {
"code": "-1",
"label": "Abstain"
}
},
"extraction_artifacts": {
"primary": {
"code": "0",
"label": "No Artifacts"
},
"secondary": {
"code": "-1",
"label": "Abstain"
}
},
"missing_content": {
"primary": {
"code": "0",
"label": "No missing content"
},
"secondary": {
"code": "-1",
"label": "Abstain"
}
},
"document_type_v2": {
"primary": {
"code": "8",
"label": "Documentation"
},
"secondary": {
"code": "3",
"label": "Academic Writing"
}
},
"reasoning_depth": {
"primary": {
"code": "4",
"label": "Advanced Reasoning"
},
"secondary": {
"code": "3",
"label": "Intermediate Reasoning"
}
},
"technical_correctness": {
"primary": {
"code": "4",
"label": "Highly Correct"
},
"secondary": {
"code": "3",
"label": "Mostly Correct"
}
},
"education_level": {
"primary": {
"code": "4",
"label": "Graduate/Expert Level"
},
"secondary": {
"code": "3",
"label": "Undergraduate Level"
}
}
}
|
672f1e42c33a7f9846924a2431ea77df
|
-3,496,166,733,663,800,300
|
作为一名6年码农,每个人都有过迷茫和困惑。分享一篇最近的感悟给大家。 [问题点数:100分]
Bbs1
本版专家分:4
Blank
脉脉勋章 绑定脉脉第三方账户获取
Blank
GitHub 绑定GitHub第三方账户获取
Blank
领英 绑定领英第三方账户获取
结帖率 33.33%
Bbs3
本版专家分:908
Blank
脉脉勋章 绑定脉脉第三方账户获取
Blank
GitHub 绑定GitHub第三方账户获取
Blank
领英 绑定领英第三方账户获取
Bbs7
本版专家分:20242
Blank
GitHub 绑定GitHub第三方账户获取
Blank
红花 2019年7月 扩充话题大版内专家分月排行榜第一
Blank
黄花 2019年7月 Web 开发大版内专家分月排行榜第二
Bbs8
本版专家分:45516
Blank
蓝花 2019年5月 扩充话题大版内专家分月排行榜第三
Bbs1
本版专家分:4
Blank
脉脉勋章 绑定脉脉第三方账户获取
Blank
GitHub 绑定GitHub第三方账户获取
Blank
领英 绑定领英第三方账户获取
Bbs7
本版专家分:20242
Blank
GitHub 绑定GitHub第三方账户获取
Blank
红花 2019年7月 扩充话题大版内专家分月排行榜第一
Blank
黄花 2019年7月 Web 开发大版内专家分月排行榜第二
Bbs1
本版专家分:4
Blank
脉脉勋章 绑定脉脉第三方账户获取
Blank
GitHub 绑定GitHub第三方账户获取
Blank
领英 绑定领英第三方账户获取
Bbs4
本版专家分:1763
Bbs1
本版专家分:4
Blank
脉脉勋章 绑定脉脉第三方账户获取
Blank
GitHub 绑定GitHub第三方账户获取
Blank
领英 绑定领英第三方账户获取
困惑迷茫
我先把我的情况介绍一下,本人是专科,08年毕业,专业计算机软件,现在:在工作主要是做J2EE开发的。<em>最近</em>有了考研的想法,不知道我的想法,是否和一些学历低的产生共鸣呢,我想理由真的太多了,就因为学历问题,我失去很多好的工作机会,当时毕业的时候,因为家庭困难,就没升本,就工作了,当然在找工作也不是一帆风顺,经历了很多,也懂得很多,打算考研:想提高一下自己的知识,提高一下自己学历,因为当今这个社会还是认学历的,想以后有更好的发展会。<em>最近</em>才打算考研的,白天工作,晚上复习,希望<em>大家</em>能给小弟指点一下。rn
一名迷茫初学者的求救!!!!!
我是<em>一名</em>初学者,学了C还有一些基础的东西。rn我很想找一条路可以更好的发展。rn可我不知从何入手,总是再原点转,我希望各位可指<em>一名</em>路!rn建议我看一些书什么的。rn 我想的发展方向是编程。rn rnrn
一名java程序员的迷茫
各位大虾,各位前辈,我是<em>一名</em>从事java编码两年的程序员,如今,我已<em>迷茫</em>了,不知自己该怎么做,在这里想请教各位,还请愿意耐心看完我帖子的大虾前辈指导指导,请各位勿以怕误导我而以模糊不定的答案来回答我,拜托了rnrn我从事java编程工作已经两年,目前在上海,去年一年在一家公司做一个大型系统的增量开发工作,因公司所用技术比较落伍,所以本人放弃了那份工作,今年重新找了一份。rn经过一年多的工作。我技术成长了,但是自己却<em>迷茫</em>了,不知自己该走哪条路,我的上级是项目经理,他和我谈话时让我觉得他什么都懂,无论什么技术都能谈得出来,还有硬件设备,网络,当前的前沿技术,市场环境,他都懂。他很年轻,29而已,我不明白为什么他会什么都懂。反思自己,3年我不确信自己能成长到他那个样子。老实说,其实是认为自己成长不到那个样子rnrn今年我找工作遇到了很多问题,工资上一直没谈得上去。和我一起的朋友都已经有5000了。论技术,我其实是不输于他们的,但我不明白为什么我始终没法谈高工资。rnrnjava这门技术似乎可学的东西很多,这家公司用这个,那家公司用那个,我想如果你想都学好,可能学一辈子也不够,因为光是一门技术学精估计就要几个月,等你几门精了。新技术又出来了。你又得学。 似乎我们的精力会在不断的钻技术中消耗完。那么,我们又如何走上管理?如果我们不钻技术,那么,你在技术上都不够硬,又如何出去和客户谈,又如何能做项目经理呢?随便列举一些java的技术:struts,hibernate,spring,jquery,javascript,freemarke,struts2,flex,ireprot,ejb,webserveice,设计模式,然后是数据库技术oracle。然后是中间件:weblogic,webspare看看,看到这一堆东西。我真不知如何下手。我的精力有限。总不能都学了。哎。rnrn前辈们,你们是如何走出这样的<em>迷茫</em>,是如何成长为项目经理,是如何成长为技术主管的,请指导指导,我不想我30岁以后还是一无所有。n[b]问题补充:[/b]n楼下两位大虾的解答让我明白了一些东西,也许我们公司只是一个片面的,而我那位什么都懂的项目经理也许也是一个片面的例子。rn那么我现在该怎么做呢?我现在回家晚上会有2-3个小时业余时间,我该怎么做才能让我早日走向成功rn是先看技术书,把技术搞扎实然后再看项目管理书这条路rnrn还是不看技术书,直接关注项目管理rnrn人的精力有限,我想把我的精力尽量不浪费。rnrn或者具体点,如果我看技术书,我该关注哪些技术上的书籍。请指导!
作为初学者的几点感悟,与大家分享,希望交流交流
学C++到现在,我感觉C++做为一门编程语言有几个非常重要的地方要掌握,其他的语法细节当然重要,不过以下个人认为更重要rn1.函数rn (1)对于其他函数而言,函数体的内容是不可见的rn (2)要区分函数原型、函数定义和函数签名,其中函数签名最容易糊涂rn (3)函数传参的三种方式:按值传递、通过引用参数的按引用传递和通过指针的按引用传递rn (4)函数原型的重要特性。rn (5)函数调用堆栈的概念尤为重要rn2.指针rn (1)地址运算符&和间接引用运算符*的作用方式rn (2)使用const修饰指针的四种类型(要以最小特权原则为指导)rn (3)内存的动态管理rn3.类rn 由于是<em>一名</em>初学者,对类的掌握程度有限,只是感觉类里要掌握的概念好多,有时候自己会糊涂rn 希望<em>大家</em>交流一下,对于类的学习需要掌握的最重要的概念是什么rn4.算法和数据结构rn 自己并没有开始学习,也谈不上<em>感悟</em>,也想请教一下想学好算法需要具备哪些必要知识rn
大龄码农困惑
人已过30就感觉位置很尴尬,前一段时间还出现了华为不要34岁以上员工的案例,所以对于深处职场的我们来说,提前考虑一下也是很有必要的。 对于职场上来说,能够升上去的人毕竟是少数,绝大部分都得靠工资来养家糊口。对于<em>码农</em>这个群体来说,知识更新是很快的,需要不断的学习新的东西,同时面临着体力和脑力的下降,个人觉得比较合适的应对之策就是: 1.多写技术型博客,技术<em>作为</em>吃饭本领,很有必
生活感悟~一篇
逐渐感觉对生活种种格格不入~是生活抛弃了我,还是我从未涉足生活~ 有些厌恶这个万恶的金钱社会~
一位处在迷茫期的码农
不知道这样称呼自己—<em>码农</em>,是否合适?从电子信息工程到做软件开发确实是一件不容易的事,所有的东西都要自己学,但是没办法,毕竟高考时自己犯的错,该由自己承担后果,在大一大二期间只是简单的学了c,一点皮毛而已,老师课程都没有上完,特别是后面最重要的指针,完全没有编程思想但还是选择了这条路,毕竟最起码是自己喜欢的,在其期间,学了阿里云cloulder认证的所有课程,觉得老师讲的非常清晰,理论和实践相结合,
一个程序员码农迷茫
2013年毕业,工作到现在也有4年了,毕业后进入第一家公司工作,学的东西挺多的,进入公司一年后,老大就让我负责几个小项目,开发到维护,还带小弟(实习生)!期间感觉学的东西挺多的!就是工资待遇特低!后来老大也提了800块钱工资,拿到手不到5000!在当时我的这个团队了,人员相对不稳定,一年换了几批人,倒不是人不行,就是工资待遇低点!期间经过一段稳定期!没什么新项目(游戏运营),直到一个新项目立项前,
7年码农的一些人生感悟
本来是写在《C++ primer plus》总结里面的,但是想想又觉得那个是知识性总结,于是把这些内容抽出来了。 <em>感悟</em>: 一开始的时候,只是想补充一下基础,因为确实没有系统地学过C++的东西,很多细节都不清楚。 但是随着学习,发现很多地方,跟其他语言都是想通的,就连之前一直觉得其他语言有的,C++却没有的地方,也都逐渐发现和对照起来了。 看完这个,或者还有很多细节不知道,但是就像在
一名应届毕业生的困惑
很快就要毕业了,<em>一名</em>普通的本科大学毕业生,说我热爱软件开发,或者外包这个行业吗?rn其实谈不上真真正正的热爱,也许目前我会寻找这样的工作,但这并不是我一辈子的追求rn或者说是从事一辈子的职业。rn下面介绍下我自己的情况:rn我过硬的编程基础,有的只是学校里面的一些基础知识,rn很多的还是时间比较久了,忘记的差不多了。rn但是有学习的能力,大学里面获得的东西也不是凭空来的。rn没有实际的项目经验,只有学校的毕业设计之类的设计。rn本人自认为自己的沟通能力还可以,只要给我一定的时间,我有办法让我身边的男男女女都不讨厌我,rn或者说喜欢和我在一起。这一点在学校就可以证明。rn同时我应该算是头脑比较灵活的人。rn所以我不知道自己是否适合从事软件开发,或者外包之类的工作?rn或者说从事这方面工作的有什么职位适合我的吗?rn真心的希望各位哥哥姐姐给我个建议!rn谢谢!
给有困惑的同胞们推荐一篇文章
文章标题:把信送给加西亚rnrn很多时候都不知在干什么,很多时候都觉得该努力了,但一直都不觉得自己尽了全力。很多时候都觉得……rn看了这篇文章我觉得我现在该努力了,对,就是现在!rn这篇文章我以后还会读!rnrn附上下载地址:http://ruanbing.icpcn.com/A Message To Garcia.doc
作为一名莘莘学子,我求求大家了。
谁能给我一个免费下载j2se类库(主要起帮助作用)完全版(甚至更早一些的)的连接。我再网上可是找了。只找见付费的。rnrnrnrn必有重谢。毫不吝啬。
最近困惑...................
想知道到底应该通过何种方式可以锻炼编写程序时的逻辑思维能力?rn我发现我的思维跟不上别人的rn有的时候一个for循环多了,我也会晕,转不过弯rn也许是c++和数学底子不好吧(自学C++后直接工作了)rn还有,我就学看了CP3,然后就直接用MFC做一些界面设计了(因为特殊需要)rn跳过了数据结构与算法的学习rn是不是会对我的逻辑思维跟不上就是因为这部分的缺少呢?
一名奔三的程序猿的困惑
<em>一名</em>在IT行业做了3年半的程序员,在他即将奔三的时候在论坛上写了下面这段话: ”下个月就奔三了,有时在编程的时候会感到心力交瘁,失去热情。另外也担心如果一直在做技术,到了30以后会不会真的很难找到好的公司,身边也有很多朋友转行做销售和实施等工作,感觉多少有点<em>迷茫</em>了。“ 一楼看起来是<em>一名</em>资深程序员,列出了程序猿的职业发展路径。 ”程序员到了一定年龄在创造力和学习能力上都难以跟...
6年的心得与经验交流分享
小编企鹅:723318945 750876454 V心:cf93724首先楼主自己也玩了有好几年的赛车了,个人来讲也算玩得比较久了,现在在做代理,虽然我是代理,同时我也是个玩家,楼主可以教所有赛车朋友看走势,<em>分享</em>经验 很多人观察的,都是表面的走式,也建议你们先明白表面走式,在从冷热的原理上去分析,这样你们会发现,走式无非是热码的一个延伸,方法可以有很多,因为明白冷热原理,从原理去观察方法可以...
转发Javaeye的一名人生感悟
有钱就泡泡妞 没钱就跑跑步 介于两者之间就购购物 有能力就去国外 没能力就低调的在国内,不要看新闻,不要看政策,不要想着会有什么福利。 介于两者之间就在国内搞搞小爱好,但一定要低调,千万不要惹比你有钱的人。 爱护自己,好好活着,低调活着,用旁人的眼观看时代变迁! ...
一名弱校ACMer的感悟
眼看大二上期就快结束了,吓得我赶紧写<em>一篇</em>博客来警示一下自己。高中第一次接触算法竞赛是在高一结束,当时仅仅是对C语言和算法感兴趣偶然间看到一本书叫《算法竞赛入门经典》,里面说高中的五大竞赛有信息学竞赛。当时还不知道noip是什么,以为是像高数竞赛一样直接报名参加就去比赛的,于是傻里傻气地跑到负责竞赛的老师那里说了句“老师我想参加信息学竞赛”(三年之后的青岛区域赛中听到Q神说的那句”教练我想学ACM”时
分享给妈咪们减肥小感悟
说好给众多可爱的,帮助过我的及未来要帮助我的众多妈咪<em>分享</em>下减肥的经验,趁着自己还没有上班有空<em>分享</em>下。 我先谦虚一下,因为我不算很肥胖的那种,而且没有减到妊娠之前的瘦度。所以谈不上经验,只能说一些小<em>感悟</em>而已。废话不多说。(妊娠69.5kg,产后60kg,月后63.5kg,目前52.5kg) 每一件事都是 我认为,减肥最核心为“要充分利用机体的新陈代谢" 但更多减肥的口号喜欢讲些
每个人都必会的正则表达式
一、概念正则表达式用于文本内容的查找和替换。正则表达式内置于其它语言或者软件产品中,它本身不是一种语言或者软件。二、正则表达式的操作区分大小写:默认情况下, 正则表达式是区分大小写的. 这种特性可以使用 "i" 选项进行改变. 例如, 模式 i)abc 会搜索所有大小写形式的 "abc"。转义字符: \是元字符,在匹配 \.*?+[{|()^$ 这些字符则必须在其前面加上反斜线来进行匹配. 例如...
初来乍到,给大家分享一篇关于ERP实施关键点的文章!
近几年,国内中小企业发展十分迅速,其IT应用市场也慢慢走向成熟,许多中小企业对运用信息手段提升企业管理水平表现出十分渴望的心情。对ERP的关注度随之上升。rnrn但是不要以为中小企业规模小,管理的复杂度和对软件的要求就会降低,相反他们对ERP产品的需求反而更高。那么低价ERP如果做不到物美价廉,恐怕很难对中小企业信息化起到促进。一些专业的ERP公司同样开始在低价ERP上做文章。更有专业人士呼吁,要防范无理性价格战对行业的巨大伤害rnrn低价ERP,是否是真的ERP?rnrn《ERP规范》和Partner、IDC对此做出定义。《ERP规范》罗列了ERP的各项细致功能,而把最终决定权交给了用户;IDC则更为张胆地明确了ERP的定义。IDC认为,ERP应主要包括财务、库存、HR、薪水、合同管理、维护管理、项目管理、资产管理、采购订单管理、经营成绩管理、制造应用等11种基本应用,如果在某个销售合同中,如果用户采购了其中的5项或5项以上的应用,则该合同称为ERP合同。这也意味着,该综合软件是一种ERP软件。 rnrn中小企业信息化中存在很多历史问题:多次更换应用软件,导致重复投入和浪费;信息系统不能集成,导致信息孤岛;大多数高层管理者不直接操作软件,而没有亲身的体验,又造成IT应用地位受到限制等。rnrn随着国内ERP 市场的逐渐成熟,随着ERP 产品价格的日益下降,越来越多的中小企业开始将ERP 软件运用于日常的企业事务。可以说ERP 管理软件的实质就是一个实体企业在软件中的虚拟映射。ERP 管理软件可以反映出一个企业的组织架构、管理理念、客户资源、人力资源组成、企业产能、销售渠道、合作伙伴、竞争对手等方方面面的信息。rnrn这是一个复杂度和重要度都非常高的系统。这就带来了一系列的额外成本:支撑ERP正常运转所需要的IT基础设施,包括但不限于:交换机、服务器、存储、数据库、中间件等基础性软硬件,没有它们,ERP就如同镜中花、水中月,只能看看而已。但是这些基础性的软硬件,不单单购置的价格不菲,而且后续都需要各自专业人员的维护。这一笔隐形的开支,往往在考虑ERP之初是缺乏足够认识的。因此,ERP的整体成本,需要在预期的基础上,至少增加30%。rnrn我们的建议是:中小企业一方面要在充分调研、严格论证的基础上选择实用、够用、易用的ERP软件;同时需要对ERP的潜在成本充分重视,否则花费巨大的ERP性能将大打折扣,甚至直接影响到企业正常的业务运转。rn对于ERP厂商的选择,需要从企业自身业务出发,最好能选择做过同行业类似规模案例的厂商,这样在业务理解和日常沟通上,都能起到事半功倍的效果;rnrn在交换机、服务器、存储等这些硬件设备的选择上,由于这些设备都已经实现了标准化生产,所以购置设备的时候,可以多在淘宝、中关村在线之类的网上店铺里上进行比价。虽然说不一定在淘宝上购买,但是能够做到自己心中有数,不至于被当成“冤大头”;后续的服务,可以在csto、比特塔这类的网上的服务中介平台上去看看、比较。rnrn需要注意一点的是,服务报价往往比设备报价水要深,因为服务是无形的,给你承诺的东西,很多时候在具体实施的时候都会大打折扣,所以务必要明确服务内容和服务的衡量标准,能量化的指标才是可行的指标,不然就是IT公司的烟雾弹。rnrn综上所述,企业ERP 系统的安全实施,是软件、硬件和人员的高效结合,缺一不可。中小企业要充分考虑各种可行举措,适应企业的业务发展,既要讲究效率和实际效果,又必须让成本可控,让资金花在刀刃上。rn
今天给大家分享一篇网赚的经典话术
人常说“宁做创业狗,不做打工狼”,这是说,自己创业总会有出人头地、发大财的机会,但是俗话又说了“男怕入错行,女怕嫁错郎”,真正要寻找一个适合自己的创业项目谈何容易。那些各位明星代言的招商网,已经有报道说大部分是欺诈项目或不同程度的存在欺诈嫌疑,就是同样真实的赚钱项目,也还存在有同行无同利的个人素质原因。另外,个人创业还普遍存在一个资金的问题,初涉商场大多人会遇到资金瓶颈问题,比如你手里如果只有1...
JSP专家分享大家一篇关于JSF的入门文章
我看了,得到总结,受益很多!共同学习喽! rnrn摘要:JavaServer Faces<em>作为</em>一种新兴的Web表现层框架,正在受到越来越多的关注。本文描述了JSF的几大优势,以及这些优势所带来的Web开发的重大变革,从而试图说明JSF将会在众多竞争者中脱颖而出,成为Web表现层框架的主流。rnrn 1. 引子:我与JSF的第一次亲密接触rnrn 2004年3月,当我着手开发我的第一个Web程序时,我选择了JSP.<em>作为</em>一个传统的桌面程序员,而且是老程序员,向Web程序员的转变是异常痛苦的。3个月的时间,程序总算完成了,但从此对JSP恨之入骨。凌乱的书写格式,数据和界面的混杂,尤其是嵌入到页面里的Scriptlet,让我搞不清自己是编程序的还是写网页的。rnrn 因此,当接到第二版的开发任务时,我毫不犹豫地放弃了JSP,寻找一种替代技术。上网一搜,却发现框架多如牛毛,评论文章各执一词,莫衷一是,让我彻底迷失了。犹豫摇摆不定之际,sun的J2EE Tutorial文档中关于JavaServer Faces技术的介绍吸引了我:UI、component、event、listener这些在桌面程序中熟悉的字眼,让我在Web开发中找到了桌面程序员的一些感觉。rnrn 象开发桌面程序那样开发web程序,这是我选择JSF的初衷。基于这样肤浅的认识,跌跌撞撞上路了,在工期和新技术的双重压力之下,超负荷的工作令人透不过气来,但每每从JSF中发掘出令人惊喜的新特性,又给我带来极大的满足感。第二版终于完成时,日历恰好翻过一个整月。JSF带来的效率提升是显著的。rnrn 事实上,到现在为止,我对于JSF还只能说是初步了解,远未达到掌握,更谈不上精通,但这并不妨碍我视JSF为Web开发的首选框架。尤其是对于新手,如果还没有在Struts、Tiles、Spring、Tapestry等框架中走得太远,那么,集中你有限的精力踏上JSF之路吧。rnrn 2. JSF优势之一:UI组件(UI-component)rnrn UI组件(UI-component)一直是桌面程序的专利,web程序中,虽然HTML定义了基本的UI标签,但要使这些UI标签像UI组件那样工作,还需要很多代码片断来处理数据及其表现形式,而且有效地组织这些代码片断使其协调一致也是一件繁琐的工作。JSF的UI组件是真正意义上的UI组件,能极大地简化程序员的工作,例如,在页面上放置一个文本输入框,这个输入框立即具备了数据填充、界面更新、事件侦听、动作触发、有效性检查和类型转换的功能。更为重要的是,程序员只需根据业务逻辑编写核心业务代码,JSF会保证代码在合适的时候被执行,完全不用考虑代码与代码之间该如何来配合。rnrn 3. JSF优势之二:事件驱动模式rnrn 事件是面向对象方法的重要组成部分,对象之间通过事件进行沟通和交流,使得一个或多个对象能够对另一个对象的行为作出响应,共同合作去完成一项业务逻辑。通常,编写Web程序时,程序员要为对象之间的沟通设计机制,编写代码。虽然沟通的内容属于业务逻辑,但沟通的机制显然与业务没有太大关系,程序员因此为业务逻辑之外的功能浪费了时间。JSF改变了这种状况。JSF的事件和侦听模式与<em>大家</em>熟悉的Javabean的事件模式类似,有Java基础的程序员并不需要学习任何新的东西。JSF的UI组件可以产生事件,例如,当页面上一个文本输入框的内容被修改时,会发出一个“值改变事件”。另一个对象如果对“值改变事件”感兴趣,只需注册为该对象的侦听者,并编写处理例程,即可命令JSF在事件发生时自动调用处理例程。JSF做了所有该做的事,留给程序员的只有业务逻辑代码的编写。rnrn 4. JSF优势之三:用户界面到业务逻辑的直接映射rnrn 举个例子,表单提交是Web编程最常见的任务,也是最复杂的任务之一。当用户在网页上点击“确定”按钮时,浏览器将生成一个HTTP请求,发往服务器端的某个Servlet,执行该Servlet的service方法。在service方法中,HTTP请求需要经历解码、类型转换、有效性验证、状态保存、数据更新等环节,处理这些环节的所有细节,对程序员来说是沉重的负担。在JSF下,这些工作的很大一部分都由框架承担了,在程序员看来,这个过程是透明的,用户界面端的HTTP请求可以直接映射到后端的一个事件处理例程,JSF起到了承前启后的作用。rnrn 5. JSF优势之四:程序员和网页设计人员的分工rnrn 在JSP中,程序员和网页设计人员的工作有时候是互相交织、无法区分的。这是因为JSP页面中掺入了网页设计人员所不熟悉的一些JSP标签,甚至是晦涩的Java代码。要求网页设计人员理解这些标签和代码是不现实的,不符合分工合作的原则。在JSF中,框架为网页设计人员提供了一套标准的UI组件,在工具的支持下,可以通过拖放简单地添加到网页上,然后设置某些显示属性来满足视觉要求。网页设计人员不需要知道UI组件背后的复杂代码,那是程序员的事,而程序员也不需要再处理任何与视觉相关的细节,程序员所做的只是给UI组件绑定类的属性或方法。虽然程序员和网页设计人员需要修改同一份文件,但他们各司其职,各得其所,互不干扰。程序员和网页设计人员工作的明确划分,是JSF在易用性方面迈出的一大步。rnrn 6. JSF优势之五:请求处理生命周期的多阶段划分rnrn 虽然都是建立在Servlet基础之上,但JSF的生命周期要比JSP复杂得多。JSP的生命周期非常简单,页面被执行时,HTML标记立即被生成了,生命周期随即结束。而一个完整的JSF请求-处理生命周期被精心规划为6个阶段,典型的JSF请求需要经历所有阶段,某些特殊的请求也可以跳过一些阶段。阶段的细分,显然引入了更多的处理,但JSF框架会管理这一切,所以,程序员在获得更多控制能力的同时,工作量并没有增加。rnrn 7. JSF优势之六:伴随工具而生存rnrn JSF带来了Web编程的巨大变革,变革的强烈程度超出了很多工具厂商的预料,以至于现在可供JSF使用的工具非常缺乏。缺乏工具支持的JSF只会令人敬而远之,因此,JSF在设计之初就为工具厂商预留了用武之地。在为数不多的JSF工具中,sun的Java Studio Creator是一个优秀的开发环境;Borland的Jbuilder在JSF1.1时曾经是非常好用的开发工具,可惜现在对JSF1.2的支持没有跟上;Eclipse下JSF的插件很多,但真正支持所见即所得的JSF插件都是收费的,例如Bea的Workshop for JSF、Exadel的JSF Studio等等;此外,Oracle和IBM也有JSF的开发工具。随着工具的不断涌现,用JSF开发Web程序将会越来越方便和快速。rnrn 8. JSF优势之七:全面的用户自定义支持rnrn 前面提到,JSF将极大地简化Web程序的开发,<em>作为</em>一个相对复杂的框架,JSF是如何做到这点的呢?原来JSF为程序员提供了很多默认的组件和类,通常情况下,JSF的这些默认组件和类足以满足Web开发的需要了。但是,考虑到在某些应用场合,框架的默认行为也许不符合业务的要求,JSF特别允许程序员编写自己的组件和类,来满足客户的特殊需求。例如,程序员可以编写自己的UI组件,甚至可以创建自己的EL解释器,来支持非标准的EL表达语言。rnrn 9. JSF优势之八:Web开发的官方标准之一rnrn JSF的1.0版本发布于2004年2月份,当时是<em>作为</em>一项独立的Web技术推出的。经过1.1版到现在最新的1.2版,短短的两年多时间,JSF终于在200<em>6年</em>年中成为Java EE 5的组成部分,上升为Web开发的官方标准之一。Java EE 5最重要的使命就是简化Java的开发,而JSF无疑为这一使命立下了汗马功劳。在Web框架层出不穷甚至有些泛滥成灾的今天,Sun以JSF来树立标准,对Java的发展是有益的。Sun在Java领域的领袖地位不容动摇,对于Java程序员来说,始终追随业界领袖的步伐,也许是避免技术落伍的最好方法。rnrn 10. 结束语:该你了,JSF!rnrn 考察某项技术的流行程度,google的关键字搜索不失为一种简便易行的方法。为了便于说明,我们选择目前最热门的Struts与JSF进行比较。在google中分别输入关键字“Struts”和“JSF”,看看google返回的网页数量。令我们感兴趣的不是网页的绝对数量,而是JSF网页数量与Struts网页数量的比值。我们看到,对于英文网页,这个比值是0.6,日文网页是1.0,繁体中文网页是0.8,而简体中文网页只有0.4.表1列出了具体的数据和比值。rnrn 英文网页数量(万) 日文网页数量(万) 繁体网页数量(万) 简体网页数量(万)rnrn JSF Struts JSF Struts JSF Struts JSF Strutsrnrn 719 1170 145 140 10 13 59 138rnrn JSF / Struts = 0.6JSF / Struts = 1.0JSF / Struts = 0.8JSF / Struts = 0.4rnrn 虽然这样的比较方法不够严谨,但0.4的比例从一个侧面说明JSF在国内还没有流行起来,用“方兴未艾”四个字来描述JSF的这种状况,是再合适不过了。由于历史的原因,国内的软件技术一直亦步亦趋地跟着国外跑,这不是我们希望的,但我们不得不承认,因此,从国外的情况来推论,我们有理由相信,JSF必将成为国内程序员追捧的对象。正如某位哲人说的那样,JSF是早晨八、九点钟的太阳,希望寄托在JSF身上。rnrn 11. 后记:不同的声音rnrn 客观地说,JSF并非完美,业界对JSF的评价也褒贬不一。例如,由于JSF过于复杂,其学习曲线明显长于其他框架如Struts等,这在一定程度上妨碍了JSF的推广;此外,JSF的推出略显仓促,1.0版在使用中发现很多bug,以至于sun匆忙发布的1.1版主要是为了修正这些bug;还有,在JSF1.2版之前,JSP和JSF的融合有严重的缺陷,这主要是由于二者不同的生命周期造成的,不过,1.2版在这方面作出了改进,现在,JSP和JSF可以在一个项目中相安无事了。rnrn JSF的不足之处还有很多,比如UI组件不够丰富、具体实现的可选择余地过窄、使用JSF开发的实际项目不多、sun的参考实现还存在诸多bug、短期内缺乏工具支持等等,尤其是在国内,JSF的中文文档和书籍相当缺乏。但是,不管怎样,这些都是JSF成长道路上必须经历的磨难,我相信,Sun会努力的。rnrnhttp://java.chinaitlab.com/ServletJsp/533774.htmlrn
介绍一篇贴子给大家
为什么,因为见很多人都喜欢用string这个东西,但写函数的时候有些情况不注意,rn所以,rnrn看看吧,说不定你的程序效率就是因为这个。rnrnhttp://www.delphibbs.com/delphibbs/dispq.asp?LID=1411217rnrn当然还有,各位自已找找。
生活无趣,大家分享一下自己最近喜欢听的歌?
如题...
作为一名程序员
<em>作为</em><em>一名</em>开发人员,可能和非技术人员的沟通是个问题。 <em>作为</em><em>一名</em>开发人员,我们可能会对非技术人员的要求表示啰嗦。 <em>作为</em><em>一名</em>开发人员,我们确实应该满足非技术人员的合理要求,我们开发的,是要符合人们习惯的产品。 今天发现了一个,跑了两个月程序的问题。其实就是数据越界。用了atoi这个函数,导致两个月来的数据有问题。第一反应确实是,感觉挺辜负别人对我的信任的,毕竟把任务分配给我,觉得我能够做好。...
生存之道,每个人都值得尊敬
我今天要向<em>大家</em>说说我看见的三个故事,这些故事已经在我脑海中存放3天一直挥之不去,我觉得我有必要写出来<em>分享</em>给<em>大家</em>!!!第一个故事 这是一个关于动物生存的故事 前天晚上我在家看电视偶然播到“动物世界”节目,本来我不太对这种节目感兴趣,不过这次里面的内容深深的吸引了我。 在非洲大草原上,有两只流浪的母狮子误入其它狮群领地,不过幸运的是它们在前方发现了水牛群,成百上千的水牛聚集在一起吃草...
我的困惑__路在何方_迷茫
rn你们好:rnrn <em>最近</em>一个月一直在找工作,至今也没有结果,甚至连希望也越来越少了.想去大醉一场,无奈口袋里空空如也,郁闷,恐慌,只想找个地方说说话儿,找一些过来的人,能给我一点启发,一点指点.<em>大家</em>看看我的情况吧.rnrn 我的家在很远的新疆,我很爱我的家.18岁的时候,我被西安的一所二流重点学校录取,学的是硅酸盐专业,也就是做陶瓷和玻璃之类的东西.rnrn 大概我天生反骨,在学校的时候,爱上了计算机,那时什么都看,c,fortran,网络,应用,这样玩了四年,也混了个学士学位,工作找到了苏州的一家瓷砖公司,做的是所学的专业,哎,天生反骨的我又不甘于在硅酸盐专业干下去,因为工资低,工作累,尤其是前途暗淡.rnrn 毕业后的我也一直在看计算机方面的书,还是什么都看,c,c++,数据结构,操作系统,数据库,网页制作.但工作后的时间当然要少多了.在后来,我考了苏州大学的软件工程硕士,考的也很辛苦,但终于考上了,但拿到通知书,我却忧郁了,要1.1万一年,我后来去学校了解了一下,是属于成人教育,双休上课,还要上马列这样的课.我觉得学不到什么东西.rnrn 现在我的情况就是,放弃了软件工程硕士,连最后的一点精神支柱都没有了,我也去几家软件公司面试过,但是都是没有通过,我想我是差的太远了,他们的题我大部分做不了.来这里的大都是计算机专业的好手,我想问你所见的那些计算机专业毕业的学生,他们的实际能力有是怎样的呢?rnrn 各位大侠,我想如果你们有什么项目,要实际中用到的,简单一点的,不要课本上的习题,不妨给我看看,让我练习练习,最好是c或者c++方面的,或者网页制作的.rnrn rn 哎,我很<em>迷茫</em>,放弃了软件工程硕士,是不是该去考个什么证书,还是先低就在装机公司,还是彻底放弃…… <em>大家</em>给我点指点啊,谢谢了. rnrn 每次去人才市场,看见黑压压的人群,尤其是学计算机的人这么多,我真的害怕极了.
DirectShow 8.1 的迷茫困惑
各位大虾:rn 小弟有正在写一个程序(VC++),利用DirectShow 8.1 ,编写视屏捕捉卡的静态图像捕捉程序,具体是这样的:窗口中显示预览的活动图像(从视屏卡的S端子来得图像),当点击 [CAPTURE] 时,执行捕捉功能,把捕捉的图片显示到屏幕上,并保存在磁盘上(任何图形格式都行)。rn 但是,之前我从未看过关于DirectX的资料,对他一窍不通,我使用COM已经写了一个能用的捕捉程序,但是非常非常的不稳定,经常捕捉一屏黑,这也是我对DirectShow的不了解导致的。可请<em>大家</em>帮忙,解决一些问题。rnrnrn什么是 Filterrn什么是 Pinrn我创建了预览 PIN_CATEGORY_PREVIEW 模式, 还能再创建一套 PIN_CATEGORY_CAPTURE 模式么? 他们存在资源抢占么?rn我是否应该使用 PIN_CATEGORY_CAPTURE 捕捉静态视图? rn您能给我一个关于我的程序的流程么?rn使用CBase.... 的类库好用么?rnrn另外:rn能告诉小弟关于互联网上的关于DirectShow的资料么(教程、例子程序等)rnrn谢谢<em>大家</em>!rn
程序人生 迷茫困惑 进阶
<em>最近</em><em>迷茫</em>了很多,面了几家公司,虽然也是收到了几个offer,但是不是很理想,怪就怪太年轻,以后坚持写博客吧, 不过<em>最近</em>闹心的事情还是不少,今年如果额外有时间也打算写一个开源的项目,今天有一个文章之前自己写的 冲击到百度第一。。哈哈哈。。。 很开心以后还是要坚持技术,坚持学习,有好多感慨,荒废了半个月的时间,人生不易,全在演戏。。。。与君共勉
彷徨,迷茫,困惑
学了几年计算机,用了几年计算机(大学本科毕业),越来越感到彷徨,<em>迷茫</em>,<em>困惑</em>!rn 我发现各种各样的计算机软件技术总是和特定的平台捆绑在一起,Windows平台那就更rn不用说了,就连java虽然说是跨平台,实际上java本身就是一个平台.虽然现在有webservicsrn技术,但实现时还是要在某一平台上.各个平台争斗不休,何时是一个尽头?干脆由微软一通rn天下得了.我曾经对Linux给予厚望,但随着微软.net的推出及新一代操作系统longhorm的开发,Linux的发展令人怀疑.rn 也想学学j2ee,一开始是看不懂 ,现在能看懂,但我却不想再看,sun把j2ee弄的那么复杂,干嘛呢?随着.net的流行,sun的日子将越来越不好过?rn 哪位大虾知道一些与平台无关的计算机技术(偏软),请告知,我很想学学.
作为一名产品经理
一个本关于产品经理的书的诞生. 1.要解决什么问题,满足什么需求? a.很多人问”我想做产品经理,怎么入行?我”刚开始做产品经理,应该做什么,怎样提高?” b.近几年互联网,软件行业发展迅猛,产品经理的职位更加火爆,供不应求。 2.目标用户在哪里,以什么样的一句话卖点打动对方? a.-1~3岁的产品经理。分为两种。门外徘徊
wowpc.iso分享大家
添加引导菜单:用来在引导菜单上增加变色龙选项添加引导菜单:用来在引导菜单上增加变色龙选项
JDK1.8分享大家
JDK1.8,官网下载不方便 ,所以<em>分享</em>给<em>大家</em> ,方便好用
java编程思想 给大家分享
讲的主要是面向对象三大特性(继承,多态,封装),异常以及流。。。。
WdatePicker分享大家
WdatePicker一个很强大的时间选取插件,希望能够帮助到你...
最近改bug感悟
身为前端程序员,经历了三个月的开发,<em>最近</em>终于到了项目最终改bug时间了,最深刻的<em>感悟</em>就是写代码快慢不是最重要的,而是代码质量,写可维护,可复用,模块化更加重要,最好有一定的代码洁癖,写代码得考虑整体,有架构思维。...
最近人生感悟
坐在办公室的我,百无聊赖,突然想起自己曾经是<em>一名</em>深圳程序员,在CSDN论坛上还发表过技术帖子,如今去坐在单位办公室无所事事。人生就是这样,谁也不知道下一站在哪。现在的我已经在事业单位,已经工作了3个月了,工资1500/月,总共赚了4500块钱,想想都觉得搞笑。想当年在深圳的日子,月工资9000,出去生活费每月能生5000左右,而我现在3个月才能赚到那是一个月剩下的,还要不吃不喝,真不知道到底是亏了
最近学习感悟
开始进入项目期了,我发现自己一直有一个毛病,做事情没有计划,比较随意.以前学习问题还不大,但是做项目就遇到问题了,拖延了很多时间,虽然每天都忙到快12点才回宿舍睡觉,但是实现的功能并不多.八九天时间,看着MJ老师的视频做新浪微博的项目. 其实看MJ老师的新浪微博项目还是收获挺多的,很受益.在做项目的时候首先得有一个全局的架构,然后根据需求驱动代码.封装的思想让代码不仅看起来很简洁,而且
最近工作的一点感悟
<em>最近</em>很是受伤,工作没有那么快速的完成。对待仇哥的任务有一点的不满意,为什么我要做这么无聊前端的工作。首先我是<em>作为</em>一个员工,必须要按时规定的去完成领导给我任务,虽然那些任务看起来一点都没意思,根本有些就是很麻烦,毫无技术难度的。但是你必须要买单,如果不爽你就离开,脸色那么差也没有什么意义。 其实还是感谢公司的,没有公司给我这个机会我根本就没机会当上主持人,那时候也没找到工作,现在的工资也勉勉强强不
最近的一点感悟
不管怎么样,<em>作为</em><em>一名</em>程序员,身体总是要照顾好的, 尤其这几天,熬夜打游戏,眼镜竟然有些吃不消了。 还是要保护好眼镜
最近的一点感悟
好久没有写博客文章了。昨天和老婆和娟聊天,发现我的语言表达能力不好,不光是表达能力不强,主要我觉得是没有东西要说服别人,自然说的话就没有力度。从而,自己想帮助解决的事儿,最终还是实现不了。 结束聊天,心中烦闷,关掉电脑(停止当晚的学习,想着躺倒床上去思考反思一下),无意中看到柳传志的<em>一篇</em>复盘,大致意思是做事和下期一样,无心下一千盘棋不如好好下几盘棋好好反思琢磨好。想想我<em>最近</em>的下象棋也是老是输,没...
最近很是迷茫
感觉每天做的事情都是一些很繁琐的与技术无关的。但是又下定不了决心离开,哎呀,真的是经历太少,没有主见。 我只想每天好好安安静静的学习技术,抛开外事的繁琐事情。
关于黑客的最近感悟
上学的时候<em>大家</em>都有觉得黑客很酷的心理,但是实际上安全领域是一个十分枯燥的工作,也是需要经验积累的工作,更是需要绝对扎实而不是浅尝辄止的基本功。但这也只是下乘,真正的大师是做理论的,只有在理论上有突破才能真正改变一个领域的发展。别再耽误功夫在那些国内的所谓黑客技术书籍上面了,黑客不是一种技术,而是一个从业者知识的积淀。想找点东西玩玩可以试试kali linux但还是要深入基础学习啊,学校上课那点东西
最近生活感悟
1. 这世界并没有那么凄凉 2. 我不能比别人走得快多少,我所能做的只是在别人休息的时候继续走.
最近工作中的几点感悟
<em>最近</em>1个多月一直出差杭州,冲在前沿阵地,除了工作外几乎没有别的活动。1个月来感觉并没有达到预期的效果。 我的预期是这样的: 1. 将团队气氛带活跃 2. 将业务依赖摆平,各方支持到位,推进项目的发展 3. 自我学习,由于之前android开发没什么经验,到杭州也是自我学习。 4. 及时反馈,将杭州的动态告诉北京的同学。 实际怎么样呢? 1. 自我感觉对团队的驱动还是有效的,对进...
最近有点迷茫了!
2个多月拿在手里的是谭浩强的C程序设计rnrn然后看完了C++plus第五版 反复看了三遍 习题敲了不下于2遍rnrn当时明显的感觉自己内存操作和数据处理欠缺rnrn于是转头看完了8086王爽的 由于RadAsm编译器不会配置 在dos的debug下硬是rn敲完了 所有的汇编代码 收获是很大的 还看了C专家编程 C解惑 高质量的C和C++rn这三本看的很快没有回头复习 最起码现在指针 多重指针 函数指针rn空指针都能运用的很纯熟了 而且对于数据 类型 存储等方面都有了较深的了解rnrn后来接着学习windows程序设计 很累 就像天书一样 rn一个界面都要那么多行代码 看了2天 迷糊2天 于是咬牙从WinMain函数开始 一个函数一个函数的对照MSDNrn手拿词霸 然后注释 然后死记3个小时后 终于可以不看任何资料 空手也个界面了rnwindows程序设计也就看到第8章 然后去学习MFC 孙鑫的VC++看了3遍 无论是视频还是程序 或是书籍rn由于教材是VC6.0 和我用的VS2008 差别还是有的 浪费了很多时间去熟悉环境rn鄙视VC6.0没找到一个完整版带MFC头文件库的 rn现在看完了一遍primer第三版 很是迷糊 才觉得自己C++还是井底之蛙 门外汉一个rn目前努力看C++标准库 以及primer第三版的目录里的范型函数rnrn但是学的越多 越觉得自己很欠缺 越觉得<em>迷茫</em>rnTCP/IP协议也就会简单编程 rn线程与进程 的学习特别是自己用的双核CPU 教材讲的又是单核 感觉又应该去学多核多线程技术rnCOM技术 等等 rnrn所以现在很是<em>迷茫</em> 数据结构也还停留在 树的基础结构 都不知道该不该去深入下rnrn算法导论 设计模式 STL TCP/IP COM技术内幕 windows内核 都不知道该怎么去选择rn总感觉自己过于贪多了 但是又想都去学rn然后由于是自学 所以不知道优先次序 又不知道这些书相互之间的联系 以及主次之分rnrn或是路线rn而且在写代码时 设计算法时 感觉自己大学学的高数 线性 离散等以及遗忘的很多了 又想回头看rnrn英语也很欠缺 也想补 很是<em>迷茫</em> 不知道下一步到底该怎么学rnrn<em>有过</em>来人可否介绍自己的学习经验 让小菜 参考学习下 好制订下一步的学习计划rn
迷茫~~~数据结构和算法的困惑
<em>最近</em>由于学校里有一些算法比赛,我也参加了rn自我感觉除了那些搞ACM的,我的数据结构和算法的能力应该算是上游rn上次去上海比赛,有个本校搞ACM的同行,他说如果有兴趣,可以考虑来ACM队训练rn都说算法很重要,可是要学到什么程度呢?rn上次曾经看过一个帖子,说算法在以后很少用到,只是在某些特定的领域,才经常用到rn现在很<em>迷茫</em>rn我应该是努力进ACM队,钻研算法rn还是学习软件开发方面的知识呢?rn还有哪些方面会用到很强的算法知识呢?rn通常的软件开发领域算法要学到什么程度呢?rn还是去学习特定的算法?
一些困惑迷茫
我听人说,毕业三年以内一定要找准自己的方向,那将是你的一辈子,深以为然。一直以为自己的目标很清晰,就是做技术,因为很清楚自己讷于交际不善表达,也只有这类技术性的工作才适合自己。而且本来就是科班出身专业对口,最重要的是自己也很喜欢。 然而我现在在做什么呢,在一个运维部门兼职着测试,整天和excel与邮件打交道,嗯,还维护着一个运维群,伺候着一群随时随地杀过来的用户小祖宗。已经好几个月没有写过代码了
最近感悟的几句话
1、不努力让自己变优秀,连自己都会嫌弃自己,更不要怪别人了。 2、人总是在努力地去攀登,这一生本就没有顶峰,却有低谷,在低谷时并不是坏处,只要你愿意攀登,每个方向都是向上,当你达到一定的高度时,再回首低谷,成就感就会油然而生,这是你会发现所做的一切都是值得的,所有的困难、挫折、劳累,都不能阻挡你的脚步。 3、被千夫所指的困难,都是为了淘汰懦夫。 4、我才不会管十年后的我会怎样,我只在乎十年后
最近的一些感悟
很久没上CSDN了,前几个月还准备在上面坚持写博客,可码了几行字就没写下去,真够失败的。 回想自己这毕业一年多 ,绝大部分时间都被自己给荒废了,要么胡思乱想要么玩很长时间游戏,想想过去的自己真的好幼稚,自己都讨厌自己。一寸光阴一寸金,1<em>6年</em>的前几个月过的都是无意识的生活,荒废时间真是罪过,辜负了自己也辜负家人朋友对自己的期望。自己的坏习惯每次发誓要改掉可每次都失败了,以前做事三心二意 ,心猿意马
最近迷茫的问题?
小弟我想建一个比较专业的网站,以前我也做过不少个人网页,但那都是纯html的,没有什么好的功能,技术含量太低,我是一个菜鸟,对这方面不是很理解,我想做一个网页,上面能想其他网页上的一样有用户登陆啊,注册会员啊,还有一个网站后台管理系统,更新网页内容,可以到后台发布,而不用每次都要在原文件上面更新等等像这样的一些功能,需要用到哪些技术,需要学习什么,仅用dreamweaver能实现那些功能吗?谢谢各位大哥了,求各位大哥帮帮忙!
最新NPOI 动态链接库。最新的,分享大家分享大家
最新NPOI库,方便程序编程。测试过可直接用。非常方便。
最近有点迷茫
各位师兄!好!我<em>最近</em>刚刚升本过来!<em>最近</em>心情很烦!有点找不到感觉!我自学的是JAVA方面!我现在感觉JAVA没学好,我只会简单的JSP、Servlet、JavaBean框架一个都不会,我有点<em>迷茫</em>!有点感到不自信!主要是我怕以后去应聘JAVA程序员,人家不要!我想问问对应一个应届毕业生JAVA方面是不是有点难找工作。我目前最主要应该怎么办啊??谢谢了哈!
☺【现金征文】和大家分享你的多核感悟▂ ▃ ▄ ▅
[size=16px] 多核产品及技术日渐深入人心,前段时间的多核博客大赛及现在正在举行的多核代码优化大赛,都掀起了多核技术讨论的又一轮高潮。rnrn 现针对多核方面的热点话题,多核及多核相关技术,开发编程等内容的相关文章面向所有用户征集稿件,欢迎踊跃投稿,[color=#0000FF]稿件一经采用,即付相应稿费[/color]。rnrn具体要求如下:rn一、必须是原创文章rn二、与多核技术相关rn三、500-1000字左右rnrn有兴趣的朋友可以发送邮件到[url=mailto:zhaxd@csdn.net]csdnsupport@csdn.net[/url]。欢迎自由投稿,期待你的参与![/size]
最近发现一个新的国产开发平台,给大家分享
管理信息系统(MIS系统Management Information System)应该是我们这些开发者从业经历中必定经历过的开发项目,我们曾经为其昼夜奋战,与客户据理力争,改来改去。当这一切结束的时候你会发现一个和一开始设计有着千差万别的系统呈现在你眼前,你在开发的时候,客户的思路也在不断的变化,而这一过程增加了无形的成本,项目做完不仅不赚钱还有可能赔钱,你是多希望在一开始确定了需求后就直接交付...
一个回到学校码农困惑
标题真不知道起什么名字好。逃避生产一线<em>码农</em>的<em>困惑</em>?还是在二流本科即将步入it生涯大三学生的<em>困惑</em>?rnrn 还是描述下自己的经历吧。我来自广东一个偏远的农场,3岁去到深圳,在深圳某个角落长大,目睹了深圳从村落到城市的过程,儿童时期非常幸福,天天想着怎么玩,过得很开心。初中的时候玩过火了,跟着社会青年、小混混到处东搞搞西搞搞,好在没出什么大乱子,没进号子没染毒品,要提下十年前的深圳还是很乱的。结果连高中都没考到,去了一所职高,学业自然是一塌糊涂,等我反应过来以后一切已经晚了。rnrn 我记得我小时候的梦想是工程师,就是拿着尺子设计房子那种,等我意识到梦想遥不可及的时候我已经是职高二年级了。幸运的是我家在大学城附近,大二那年我遇到了一个人,他是在北大读博的学生,那时候兼职帮弟弟补习英语,他让我知道了应该多学习多看书。我职高的专业是计算机(名字叫“计算机专业”),其实充其量只是计算机兴趣班,或者连兴趣班也谈不上。上语数英,还有很多用到电脑的课,那里的专业老师也都是挂着名字混饭吃的,学校基本上电脑上能用到的软件都开了一门课。整个深圳所有的中职学校都在拼一件事情,所谓最好的职校也是如此,就是升学率,至于就业,全是水,连水分都谈不上。<em>大家</em>都在拼学生的升学率,职高、中专的学生可以参加职高高考(3+X,只需要考语数英),考广东省内的专科学校,这也就成为了各个职校和学生奋斗的目标。后来这也成为了我的目标。当时户口还在乡下,学校里面每星期一开大会都在说全世界最好的大专是深职院,所有拥有深圳户口的学生都应该去那里,那里就像天堂一样,但仅限于有户口的孩子。那时候知道了在深圳考劳动局的技工证书可以拿到深圳户口(其实如果真考到了,我也已经毕业了)。我天真地想着考到技工证,拿到户口,然后参加职高高考。但是就是这种天真的想法,让我撞了不少好运气。我参加各种坑爹的技能比赛,印象最深的是一个全国的比赛,企业网组建,配置路由器交换机,安装、配置服务器应用程序。没有理论的铺垫,对着特别编写的教材一个劲地猛敲,就这样度过了半年。在深圳市拿到了个成绩。人生或许真是非常神奇的一段旅程,我运气非常好,三年级的时候广东省出了个政策,广东省内中专、职高的学生只要是拿到了市级的技能证书或者是比赛前三名的证书可以参加大专院校的对口自主招生。我就成了深职院第一批中职对口自主招生的学生,运气很好,考了个前三名。rn 就这样我顺利进入了深职院(专科),计算机应用专业,学制两年。你知道我当时的心情吗?我去到了一个本来没机会去的学校,那个学校是当时群体里面同龄人梦寐以求的。我兴奋了整个暑假。rnrn去到学校以后,一切没有想象地那么完美。职高三年级那一年虽然每天做着机械的事情,但是那一年我想的事情很多。熄灭了的梦想在另外一处草垛燃烧起来,我想当<em>一名</em>软件工程师,虽然我不知道是干嘛的,但是听上去很牛逼,不是吗?工程师,这跟我小时候的梦想多少扯上点关系了。那段时间也看了很多文章,喜欢韩寒,喜欢李敖,喜欢老罗和陈丹青(排名是没有先后的哦!),特别是韩寒的文章,很钦佩他的文笔和逻辑思维。去到深职院以后有一件事是让我比较<em>困惑</em>的,就是周围的学生并不开心,至少大多数人是那样的,去到那里打游戏、混日子,跟我的心情形成强烈的反差。后来才知道对他们来说,本科才是真正的大学,专科意味着高考失败,人生失败。然后就自暴自弃了。rnrn在那里我居然碰到了不少初中非常优秀的同学,三年不见,变化太大,他们不再是当时看上去那么渴望知识和学习了。但是那都是他们,我有我的想法和目的。软件工程师。rnrn 开学一段时间以后才知道原来<em>作为</em>这个学校第一批单招学生,其实并不是那么幸运,学校为了应付上面的政策才开的这个班。两年制,在校时间是一年半,比起三年制的学生,我们的课程缩短了不少,剪掉了很多专业课,虽然专业偏硬件,但是远远达不到做嵌入式的要求,或许那些知识做不了任何事情,仅仅是真正的兴趣班,但至少大多数老师是非常优秀的。一入学没多就我就意识到了这点,所以我有了新的目标,我了解到专科可以参加本科插班生考试,到真正的大学(本科)去读书,<em>作为</em>插班生,跟普高考上去的同学一起学习,一起生活。本科是大多数专科学生的天堂,为什么我不去呢?所以我第一年在了解了政策以后就着手准备,我找来了普高的数学书,补上我职高没学过的数学知识,找来了考试的教材,看视频、自学,顺便说一句,我们这代人确实是非常幸运的一代,互联网给我们提供了丰富的资源,让我们能非常容易地学习。学了《高等数学》、《数据结构》《离散数学》,虽然学得并不扎实,但是这三门课后面对我影响很大。至少我间接知道了很多基础学科是干嘛的,知道读书上学有什么用!(当然也是从职高三年级自己会思考开始的)2012年我参加了本科插班生考试,考深大的软件工程,这次没那么幸运,我没能如愿。跟其他同学一样很快面临了就业问题。rnrn 我记得我面试了3次,第一次是康佳集团的销售员,卖电视的,卖了两个星期,其实在插班生考试落榜以后一直在学习java,卖电视那两个星期每天都在看书,蹲在马路边吃盒饭,吃完转身继续看书,当时觉得挺狼狈的,也没办法周围没坐的地方,现在想起来也要感谢我那两个星期的经历,让我后面一直觉得自己很幸运。第二次是大学城那边中科院一个刚建立的公司,他们在招工人级别的测试员,因为那里离家近,我去面试了。第一次面试老板问会干什么,就说了在学校上课学的一些东西,我一直比较诚实,会的就是会,会一点不算会,从来不装X的,也没有提职高做过的那些听上去好像比较厉害的比赛,也没提在学校拿的一些乱七八糟的奖。简历上除了身份信息以外社会实践就“世界大学生运动会志愿者”,获奖情况就“校级组织XXC语言大赛一等奖”,这两个是我觉得值得写的。后来来了一个高材生模样的人,看到我简历一个劲地笑,后面问我会不会装电脑。。。我傻傻地回答会,然后那人有继续笑,当时有种被羞辱了的感觉。后面叫第二次去面试的时候也就没去了。第三次面试是一个做自助旅游和户外运动平台的公司,算不上是互联网公司,只不过他们在做互联网项目。面试的是安卓的程序员,我觉得自己运气挺好的,比想象中的要容易通过了面试。rnrn 当时公司才开始组建技术团队,在我之前有4个应届毕业生刚去没多久,我去了以后团队才陆续到齐人,管理的人也是在我之后才来的,后面整个团队技术人员有30个左右。我在那里工作了14个月,一直觉得是自己的幸运,遇到了好多人,目睹了整个团队建立的过程,接触了移动互联网。第一个项目跟其他人一起完成,后面一个项目是自己一个人实现的。当然,产品做成什么样子,不是自己说的算的。新团队磨合不够,总出现了一大堆蛋疼的问题,其实也就是沟通不够,甚至有人不愿意沟通,浪费了老板好多钱。在公司的时候一直觉得是带头的那个老家伙有问题,他做事情不认真,导致好多事情没做好,好多次都希望老板把他炒了,请一个负责的人来管理。但是老板很信任他,估计炒掉一半人也不会炒他的,现在想想,问题出在老板那里。团队里面好几个有经验的人年龄都稍微有点大,都比较贪玩,他们来这个公司估计想着也是冲着旅游和户外来的,每周总想着出去活动。后面的很长一段时间,我总觉得看不到团队好的地方,下面的人都在抱怨,上面几个总是站着说话不腰疼的样子,做一个产品,总想着等下面开发了再修改,总是留一些空白,当时觉得留空白没什么,等到产品做得差不多了才知道产品最大的问题出在最初留的那点空白上面。不了解团队成员的战斗力,却总是“需求永远都在变”,还是开发出身呢。让我最愤怒的事情是需求模型出来了,UI出了效果图,一层层审核以后我实现了代码,到了测试那里,测试居然说有问题,弄了老半天蹦出来个需求有问题,现在想起来也很不爽,真后悔当时没说“你TM需求有问题你早说呀!”。这是大团队的氛围。移动端小组加上我总共是四个人,leader是个很厉害的人,也很负责,也有想法,我到现在还跟他有联系,他教我技术,还跟我聊了很多他自己的想法、他的故事,我很感激他。另外两个人跟我一样是应届毕业生,他们是重本毕业,同班同学。虽然是重本,但是没想象中的那么强,后来知道他们大学打了四年的游戏。对我来说这份工作非常难得,所以我每天都重视自己的工作,经常在公司下班以后在家继续干活。时间长了,知道的就比别人多一点点。半年以后小组的leader告诉我公司准备做一个功能少一点的项目,打算让我来做,我很开心就答应了。项目开始没多久发生了一件事情。小组有个人碰到问题喊我过去看看,这之前他经常有问题我都会耐心跟他解释的,这点没有谁教谁,我一直认为是共同学习,一起成长。就在我看他代码的时候qq窗口弹出来了,他跟另外一个人在聊天,聊天的内容是在骂我。当时非常愤怒,有那么几分钟大脑抽空了似的。想着时不时请他们吃过饭,有问题每次喊一声我就放下工作过去了,对他们没什么不好的看法,也从来没有抱着目的他们相处。当时刚好那个人被X总叫去讲需求了,回来以后我让他出门,问他是不是自己做了什么事情让他们误会了。虽然心里非常不爽,但还是抑制住了。他支支吾吾说了一些有的没的,后来我知道这个人并不是善人,总是在后面说坏话。他过年回家的前一天非常兴奋,跟我面对面说一些以为我听不懂的话骂我,其实我心里知道,只是没想跟他计较。rnrn 今年3月份又参加了一次本科插班生考试,这次是考广州大学,二本,其实能考的学校非常少,这是里面分数最高的一个。这次运气比较好,录取了,计算机科学与技术专业。知道录取的那段时间没想去报到,一个是听很多人说中国的大学不怎么样,更别提二本,还一个是在公司成长得比在学校快,不少人是这么说的。但是随着时间推移,慢慢地转变了想法。在公司觉得不会有太大的成长,即便是有靠的也是自己。公司本身不是好的技术公司,而且氛围比较糟糕,就像上面说的那样,项目也让人看不到希望。而且工作过程中深刻地体会到要做好一个产品绝对不仅仅是技术问题,沟通和管理非常地重要。我非常幸运地接触到移动互联网,看了一些文章,知道用户体验、市场、推广、模式、沟通、管理。。。这些是非常重要的。有种强烈的感觉,一个人的成功取决于这个人知识的宽度,那些成功的人不会是纯技术人才。就是这种感觉,让我选择回到了学校。决定的那一个月还没向公司正式提出辞职,公司的<em>每个人</em>无论老小地都反对我回学校,认为会是浪费时间。周围的朋友也是超过一半地建议我别回学校。这一点,我非常感谢自己父母,他们从小到大没给我过约束,他们只是尊重我的选择。工作的时候我每个月除了解决自己生活开销,坐车吃饭周末活动什么的,还可以上缴3000块钱,如果我去读书,某种程度上对他们来说是一种无形的压力。当然我对自己说如果要读书,决不会向家里要一分钱。工作那一年我帮弟弟妹妹买了新手机,自己买了部mac pro和iphone,还有一台美利达的勇士560,除此之外几乎没存什么钱。rnrn 不管怎么样,我已经来到学校了。现在已经开学一个多月了。过去的一个多月,我逃了好多课,老师抽查点名都抽到我,有3门是没被点到名的,其他的都点到了。我的<em>困惑</em>和忧虑也在这几天达到一个让自己觉得必须解决的程度。rnrn 说现在的情况。我来到这边的第一件事情就是找一份兼职,来这边之前存了一个月的钱,刚好够交这边一年的学费和住宿费、第一个月的生活费,很巧在学校不远的地方找到一个创业团队。他们在做一个目前还没有人做的项目,定位和盈利模式比较清晰。第一次见面跟我谈了他们成员和项目的情况,我很感兴趣,承诺需要一个星期的时间考虑再答复,那个星期我在创业还是兼职之间摇摆不定。他们是几个非常有激情和活力的年轻人,年纪最大的比我大两岁。第一次见面跟我提过股权的事情。那一个星期我想了挺多的事情,我原本打算大三多学习多看书,大四找一个创业团队,或者是找几个有激情的人一起做一个属于自己的产品,遇到他们也算是惊喜,只是太快了,我需要考虑。 一个星期以后正式答复他们,对方突然告诉我因为还不熟悉彼此所以不能谈股权的事情,那时候条件反射地在基本工资上要求再加一点。其实我并不在意钱,只是<em>作为</em>一种“反击”罢了。之前做过外包,接一个外包大概是10-20k之间,找3个人(UI、后台)2个月左右的时间就能完成项目,分到手里可以拿到7k。这件事情也让我更加认真考虑自己是创业还是兼职。rnrn 现在每个周末和周三的晚上要到工作室去工作,每个月能拿到基本的生活费。星期一到五都要上课,只是偶尔下午没课,但是因为是大三的插班生,课都排得比较满。说起课程,真的特别失望,讲java的老师跟混饭碗似的,用的教材烂透了,实践课的文档一大堆错误,也没说清楚内容,就让学生把代码复制粘贴到eclipse里面然后改改语法错误直接运行截图就行了,老师也没看过题目,问他问题他居然扯某个函数是干什么的,连题都不愿意读。有个教网络的老师也老是不备课,一上课就是照着ppt一直念,有时候停顿好久又继续念。工作的时候在家看过一些网络公开课的视频,差距真的太大了。老师讲一个编程语言的排名,David会打开网站直接看。这里的老师居然说“java语言2012年好像是世界排名第三,嗯,没错,排名第三”,擦!有你这样的老师!同学碰到classnofound的错误问老师,他打开百度,看到有人说是javac跟java的版本不同导致的,他立马转身跟人如是说。我电脑却运行正常,虽然我直接跟他提了,他只是摸摸头敷衍过去。但是这里也有好的老师,一个教linux的女老师非常不错,是我觉得最棒的一个老师,视野很广,总会跟我们讲国外的事情,也会谈谈大学生最需要的东西(想法和思想)。还有一个教PSP和汇编的男老师,这个老师是非常负责的,就是课程本身太过枯燥了。rnrn 现在旷不少课,自己看书。但是学校这边老师动不动要点名,说要是6次被点到就不让考试,不能毕业。虽然我一直不看重毕业证(擦,我现在怀疑自己了),但是我总比较担心。rnrn 最忧虑的事情其实的学习的内容,原以为到了学校,认认真真好好上课就能把该学的知识学了。但是现在看来一切没有自己想象的那么理想。过去的一年虽然一直在写代码,但是我知道自己是名符其实的“<em>码农</em>”,我拼命加班。碰到问题就google,用到很多优秀的代码和自定义组件都是老外写的,很多源码看着都是一知半解。实在碰到不懂的问题能到stackoverflow上提,虽然英语特别蹩脚,但是总能跟老外接上几句,得到自己想要的答案。我很庆幸自己踏进了it行业,在中国这个行业算是跟国际接上一点点轨的,虽然外国人几乎没人用中国的软件,但是<em>作为</em>程序员却获益匪浅,因为我们站在一个可以看到世界的地方,进了一个伟大的行业(我一直认为互联网行业是伟大的,它跟传统行业不同,<em>分享</em>和传播精神是传统行业不具备的),我想我们这些人是幸福的。我知道很多程序员的状态跟我一样,基础不牢,却一直做着重复的工作,遇到问题不是找源码就是上技术论坛请教大牛。但是我知道这里有很多大牛的。所以我希望在这里能得到答案。我想成为一个优秀的程序员,我并不担心自己毕业找不到工作,其实我一直觉得任何人只要有想法会坚持就绝对不会找不到工作的,任何专业都一样。我知道想成为一个优秀程序员需要学很多知识,数据结构、算法分析、操作系统、设计模式。。。数学很重要,但是数学是我的硬伤,我数学基础糟糕透了。现在一边兼职一边学习,兼职的时候有问题搞不定我会加班解决,有次加到3点钟第二天六点半就起床了,我一直对自己说即便只是兼职也不能耽误别人的项目,要对得起别人付的薪水,对得起别人的理想。写到这里我有点乱了。我不能平衡好自己的时间,有时候很慌。我总结了下学习时间要么是周1245晚上,要么是旷课去图书馆,如果工作室不用开会或者加班的话。我<em>最近</em>特么的还犯贱对口琴产生很大的兴趣,六点半起来吹口琴。。。 我觉得要学的东西很多,却列不出优先级,写不出计划,我来这里一个月多做了5次计划,总是因为工作或者其他什么事情就死在半路上了。所以我总希望能看到某段文字找到一个解决办法,如果你看了这篇文章,非常感谢!你居然看完了,我的写作水平很糟糕,或许我只是借此发泄一下。
大家分享一下最近开发遇到的一些坑
1、获取音频文件的时长;2、CALayer position contains NaN:[182.5 nan];3、Can't add self as subview;4、iOS中修改WebView默认的User Agent(用户代理);5、The certificate used to sign "XXX" has either expired or has been revoked;6、右滑p
第一次作为面试官的感悟
这几天有幸跟着老员工经历了一场校园招聘。遥想去年还是一个小小求职者,现在就要坐在桌子的对面,角色的转变,还是感触良多,就简单记下来。<em>最近</em>半年绝少写博客了,第一个原因当然是工作太忙了~ 显然,明白人都知道,这只是一句多么空洞敷衍的话。真实的原因恐怕是我懒了。。。第二个原因呢,是<em>最近</em>确实写了很多笔记,但是确实还没有整理成体系,安卓系统实在太大。第三,工作与在学校确实相差很大,不仅仅是角色的一个简单转变
最近一篇读书感
书读多了便会上瘾,那是一种难以言表的感觉。我之前是不太喜欢读书的,后来不知怎的,就像看电视剧一样,读了一本书,便很想去继续读完,甚至去读另一本。 就像读《一个人的朝圣》,有一段时间我很忙,但过了这段忙的时间我就迫不及待的去捧起那本书朝圣般的读起来了,你会很担心书中的人物是否坚持完了“朝圣”,以及“朝圣”过程中遇到的人和事情,很想听听他的人生<em>感悟</em>,也会去认真的想想是否自
成为一名函数式码农系列之五
本文为本人参与的前端早读课公众号《成为函数式<em>码农</em>》系列翻译的第五篇,第六篇仍在翻译中,以下为其它五篇的地址。 成为<em>一名</em>函数式<em>码农</em>系列之一 成为<em>一名</em>函数式<em>码农</em>系列之二 成为<em>一名</em>函数式<em>码农</em>系列之三 成为<em>一名</em>函数式<em>码农</em>系列之四 成为<em>一名</em>函数式<em>码农</em>系列之六 原文地址 译者:墨白 校对:野草 刚开始学习函数式编程时,理解函数式编程的核心概念是最重...
发现一篇好文章跟大家分享下呵呵
软件测试,想说爱你不容易 (2012-10-08 21:47:41)rn标签: 软件测试 职业发展 前途 it rn 一不留神,毕业后在软件公司里已经工作七年多了。期间经历了民企、国企、美国硅谷小外企和大型外企,做过正规软件开发(团队规模10人以上,有产品经理、开发人员、测试人员、文档工程师,客户为Cisco,出过2个以上的版本,代码量在20万行以上),功能测试、性能测试、测试自动化、测试辅助工具开发、国际化测试、本地化测试、兼容性测试、第三方测试、测试团队管理,对软件测试的理解也逐渐深入。特写下以下文字与<em>大家</em><em>分享</em>。rnl.软件测试的前途rn 软件测试在整个软件生命周期中是必不可少的重要一环,但是其在研发体系中的重要性要弱于软件开发和基础技术研究(如搜索引擎的搜索算法,图像的识别算法,统计分析模型等),要高于大多数外围工作(如安装部署、环境搭建等),很难拿高薪,工作强度适中。rn 做软件测试的同学们看了这个结论可能会很不爽,难以接受,但确确实实是我在工作多年、经历了多家公司后总结出来的切身体会。重要性不是某个人或者公司领导决定的,而是尤其工作自身的特点决定的。为什么测试工程师则经常抱怨自己的工作不受重视,而很少有架构师抱怨呢?因为他们的工作内容门槛高,可替代性低,一般人把他放到那个位置上也干不了。rn 拿大多数软件公司来说,软件开发和软件测试是两个最常见的工种,拥有最庞大的工程师群体。一般来说,开发工程师比测试工程师可以拿到更高的薪水。核心开发工程师的工作内容技术门槛比较高,可替代性比较低。一个明星产品的原型,或者内核,往往也就是一两个人写出来的,Linux内核,JBoss,Struts,Spring,Hibernate...太多太多这样的例子。虽然说一个技术原型和成功商业化的产品之间还有很大的距离,还需要不同工种的人互相协作,但是谁在扮演更重要的角色不言而喻。毕竟,软件是开发出来的,不是测试出来的。核心开发工程师做的工作,初中级工程师根本无法染指。rn 大多数测试工程师拿到的都是行业平均薪水,差距不大。对一个产品进行测试,80%的工作量是功能测试,性能、可靠性、国际化、易用性等等加一起一般也就占20%。道理很简单,如果一个产品的主要功能跑不起来,其他东西都白搭。由于种种原因(如需求变化大导致界面变化大),功能测试又以手工测试为主。这部分是技术含量最低,替代性最强,个人知识积累最少的测试工作了。今天测试产品A,明天测试产品B,就好比今天当力工搬砖头,明天搬木头,只要力气在,搬就是了,管他搬的是什么。甲做也可以,乙做也可以,经验丰富、耐心细致的可以发现更多、隐藏更深的bug,但是不存在做不做的了的问题。3年下来,<em>一名</em>开发工程师可以掌握一门编程语言,懂点设计、架构、框架、UML,或者一个人前台后台持久层全部拿下。而<em>一名</em>手工功能测试工程师,只能成为某个被测试产品的使用专家,不用去懂J2EE或者.Net,Flex或者Html5,MVC或者SSH。被测产品一换,一切重头再来。rn 测试中比较有技术含量和门槛的是测试自动化开发和性能测试。rn 先说说测试自动化开发。测试自动化开发主要有两种,一种是用现成的工具如QTP、WinRunner编写测试脚本。还有一种是自己用Java或者C#编写辅助测试工具。现成的工具都基于某种语言,如QTP基于VBScript,WinRunner基于自己独有的类C语言,Selenium基于Java。自己编写的工具大多用于批量数据生成、导入、处理等。而这两者归根到底还是软件开发,而且大多数是比较简单的开发。rn 测试脚本很多不需要界面,是命令行程序,这样GUI开发中的很多难点就不会遇到了。rn 大多数是单线程运行,因为是脚本,即使是上千个脚本,只要按照顺序跑就可以了,这样多线程的麻烦就不用去处理了。rn 不需要访问数据库,因为测试结果一般记到文件中如html文件,并以表格或者简易报表的形式显示就可以了。这样,在软件开发中的一块重头戏-持久层开发和数据库设计就不用考虑了。rn 如此这般,对于一般的测试脚本或者工具开发,专业的软件开发人员即使没有什么测试经验,也可以轻松上手,做得游刃有余。rnrn 再说性能测试。rn 性能测试的主要目的就是验证一个软件产品可以允许多少用户并发访问,性能指标如响应时间、CPU和内存占用率是多少。一般来说这种测试无法手工做,需要借助于工具,如LoadRunner, QALoad,JMeter等等。首先,在录制的脚本基础上做一些编程是必不可少的。其次,在获取到基本的性能指标值后,如何去分析并解决问题,比如调整操作系统、数据库、中间件的参数,做个集群啦啥的,或者对程序做代码级的优化,又远远超出了测试的范畴,是一般的性能测试工程师根本做不了的,需要架构、IT工程师、开发人员协同攻关。可以看出,一位性能测试工程师所作的脚本开发工作,对于专业开发人员来说,没有什么门槛。而复杂的测试环境搭建的工作,又需要网络工程师、数据库工程师的强有力支持,个人难以独自应付。rnrn 国际化测试的门槛一般。核心的东西,挤干了水分,也就两三个月,包括字符集、编码、字体、Bidirectional language、时间日期货币小数点排序布局等。换句话说,一位功能测试工程师,在经过好的导师三个月的专业培训和学习后,就可以基本胜任国际化测试的工作了。这里的门槛在于,市面上介绍国际化测试的书不多,很多东西需要在工作中去一个个知识点地学习,需要老员工来带。不像对java、数据库开发进行系统介绍的书那样满大街都是。rn rn 兼容性测试是典型的没什么技术含量的人力密集型工作。本人曾经做过一个月的打印机兼容性测试,上百台打印机,一个接一个放入打印纸打印,看看对被测试的国产Linux的支持程度。或者一个产品,测试对不同数据库的支持。让我想起在上大学的假期里给人发传单时,发一次挣30元钱,谁干都可以,卖卖苦力。后来改行写游戏外挂,一个月轻松挣3000多块,让室友们羡慕得不得了。rn 手机/平板电脑应用的测试。手机或者平板电脑上的应用要么是单机应用如雷电游戏,要么是客户端程序如新浪微博客户端,特点是输入少,以浏览为主。客户端程序的开发难度要低于服务器端程序,其测试难度也相应得低一些。rnrn 测试的另一大不利因素是缺乏成就感。设计人员、开发人员可以出去和人说,<em>大家</em>用的某某杀毒软件的小狮子是我的idea,某某输入法是我开发的,某某网站是我写的,里面存在只有我知道的某某漏洞。测试人员与之相比则会比较尴尬。rn 说了这么多,绝对没有轻视测试或者刻意抬高开发的意思。每一个工种都是不可或缺和重要的。但是,他们带给工程师本身的价值增值不一样,工作时间越长越明显。打个不太恰当的比方,开发与测试工程师,就好比医生与护士,会计和出纳。医生越老经验越丰富,价值越高,每个年代都名医辈出,受人敬仰。而护士,除了开创者南丁格尔外,没有几个能被<em>大家</em>所熟知和记住的。rnrn 工作内容杂、重复性高是低价值工作的一个共同特点。而这是想在职业上有所发展的同学必须要注意的一点。rn 说了这么多测试工作的局限性,下面接着说说从事软件测试这个行当的好处。毕竟,包括我在内的很大一个群体都在靠这个行当吃饭,全是缺点的话,谁还愿意干这行。而且,想干好测试的话,还是需要花费一番心思的。rn 劳动强度和工作压力适中。开发人员的一大压力是到了deadline能否做完分配的模块。技术难点是不可避免的,没有人能百分百地保证一个全新项目能按时开发完,能解决所有的技术难题。测试要好很多,测试工作主要是量的问题,大不了加加班,不存在完不成的问题。rn 技术更新周期长。不管是Flex、Html5还是Jsp写的软件界面,对功能测试人员来说区别不大。而对于开发人员来说,技术的切换则是一件比较痛苦的事情。就像被人从一个热被窝里面揪出来,再从新捂一个冷被窝。其中的辛苦,经历过的人都知道。rn 技术面、适用面比较广。开发人员讲究的是深度,测试人员讲究的是广度。测试人员在换工作时,从测试 .net 产品转向测试Java产品问题不大,而对开发人员来说则是个大问题。rn 开发人员比测试人员 ‘轴’的更多。很多牛人技术很好,但是沟通能力很差,朋友少,这和工作性质有很大关系。长期的编程造成了不少开发人员呆板的思维方式。生活是丰富多彩的,远不是只有技术。rnrn2.测试团队管理rn1)谁在做软件测试?rn计算机专业毕业的女同学:软件测试的劳动强度和压力比软件开发小很多,还要求耐心和细致,很适合希望干本行的科班出身的女同学rn非计算机专业毕业的同学:软件测试的入行门槛比开发要低一些,很多学与计算机相关的理工科专业(如信息系统、数学、物理、电子)毕业,甚至是当年因为几分之差与计算机专业失之交臂,同时又对此行业很感兴趣的同学转行过来rn软件开发、售前、售后技术支持工程师转行做测试:部分软件开发工程师在工作若干年后,不太喜欢太大的工作压力和强度,希望能够保持工作和生活的平衡,多一些时间陪陪家人。他们强大的开发背景很快就能在测试组里显山漏水,鹤立鸡群,即便开发能力在开发组中只是一般般的;部分售前、售后工程师在结婚生子后不希望太多的时间在外地出差,希望能多照顾家庭,他们的行业知识和沟通能力对测试工作也大有裨益。rnrn2)测试工程师的心里在想什么?rn<em>每个人</em>的需求不一样,这就需要管理人员根据<em>每个人</em>的需求来做工作,因人而异,才能达到最好的效果。rn有的人冲劲很足,渴望挑战技术难点,提升技术水平,就让他多做核心工作,获得成就感。rn有的人求安稳,不求职业有多大发展,但求多照顾家庭,少加班;或者阶段性的,比如家里刚要了小孩儿,希望能多照顾家庭,就分配一些没难度的工作给他rn有的在工作若干年后对测试逐渐失去兴趣,会转行做开发或者技术支持。只要有心的话,在日常工作中都可以觉察的到。rnrnrn3)测试的技能要求rn编程:编程能力是一切IT相关行业的基础,尤其对于软件测试来说,编程能力和功底越高越好。这样他就可以知道开发过程中哪些地方容易出问题,发现很多纯黑盒测试人员发现不到的深层次bug。rnrn数据库、中间件、操作系统:被测试的系统千差万别,测试人员很多情况下需要自己搭建测试环境,在测试过程中发现问题后需要甄别是测试环境的问题还是被测系统存在bug,所以常见的数据库、中间件、操作系统都要会装会用,至少要熟练使用一种。rnrn行业背景知识:如果被测试的软件是QQ,Office这类通用软件,那不需要什么行业知识。如果测试一个复杂的财务软件或者ERP软件,没有基本的背景知识的话,很多流程会走不到,或者根本就走不通,测试覆盖率会出现严重的问题。全指望产品使用说明文档或者客户现场支持是不现实的。rnrn测试工具的使用:最常用的如QTP,LoadRunner。这个没有难度,就是个熟练度。rnrn沟通:各个工种都需要rn英语:IT的各个工种都需要rnrn4)FAQrnQ:在做测试的时候,发现并记录bug后,是否提倡由测试人员分析并修复呢?rnA:我在做测试时,和我所在的团队成员曾经这样尝试过,最后发现费时费力,事倍功半。因为对于一个大型软件系统来说,代码结构比较复杂,即使是这个产品的开发人员,让他调试不是自己所编写的模块的代码,都需要花好大一番功夫。而对于某个模块的开发人员来说,对自己编写的模块了如指掌,调试并修复bug事半功倍。而且对于开发人员来说,写前台的不懂后台,或者写中间层的不懂持久层都很常见,在开发过程中都需要相互配合联合调试。如果测试人员真想提高技能的话,不如自己多动手写一些程序,或者精读一些代码更有益一些。当然,愿意多钻研是一件非常好的事情。rn rnQ:如何尽量规避测试覆盖率不足的风险?rnA:测试的最大风险在于测试覆盖率不够导致漏报,最终被漏掉的问题在产品发布后被客户在使用中发现。而实践又证明,没有开发人员的帮助,测试人员100%会漏掉一些重要的bug。所以,需要在制度设计上有所考虑。如有兴趣,具体方法可联系本人。当然,所有方法都只能尽量提高测试覆盖率,对于一个几十万行代码量的中大型系统,没有完美的方法能保证100%的覆盖率。rnrnQ:测试组和开发组的关系就像猫和狗一样天生不和么?如何理顺?rnA:在很多软件公司,测试组和开发组的关系都比较紧张,不好调和。开发组认为测试组发现不了多少重要的bug,就会在一些边角问题上吹毛求疵,鸡蛋里挑骨头,在领导面前说坏话,在开发进度已经很紧张的情况下还要来挤占宝贵的时间问这问那;测试组认为开发组做的东西太烂了,报的bug没有引起足够的重视,得不到足够的开发状态更新和支持配合。这些矛盾是由多方面的原因引起的。rn1)评价体系rn 测试组没有有效发现bug,等产品上线后被客户发现了,导致投诉甚至经济上的损失,是测试组的责任;测试组发现的bug,开发组无法按时修复,是开发组的责任。测试人员心中大骂:因为开发人员做得东西烂,才导致自己没有发现全部的bug;如果开发做得好,自己怎么会漏掉bug进而影响了年终奖。开发人员也极其不爽:都怪测试人员临到最后才发现了一个致命的bug,导致自己没有时间修复,让产品带着问题发布了。rn 于是乎,为了各自的饭碗和声誉,悲剧开始了。rn 测试组会竭尽全力提高测试覆盖率,报bug,宁可有少量误报,也不敢遗漏;而要提高测试覆盖率,测试组需要开发组的大力支持和配合。实践证明,没有开发人员的帮助,比如介绍哪个模块有潜在问题和复杂的逻辑分支,测试组无法独自发现很多重要的bug。rn 而开发组在项目后期压力会比较大,一边拼命修复bug,一边看着新bug一个个先仆后继地冒出来,感觉bug就如同苍蝇般轰都轰不走。遇到比较严重又不好修复的bug,更是倍感压力,茶不思饭不香。突然间,开发人员自己发现了一个比较严重又不好修复的bug,第二天就要交付产品,时间来不及了,而测试组还没有发现。该如何抉择呢?rn a. 主动报告bug,自己承担全部责任;为了这个bug,可能需要专门给产品开发一个patch,在公司上下都造成了负面影响rn b. 隐瞒bug,测试组最终也没有发现,产品交付使用后被客户发现了,测试组承担全部责任rn c. 隐瞒bug,测试组最终也没有发现,产品交付使用后客户也没有发现,皆大欢喜,在下一个版本里自己悄悄修复rn 公司不同,企业文化不同,奖惩激励制度评价体系不同,最终会使开发人员在一番权衡之后做出截然不同的决定,进而影响这个产品甚至整个公司。rn rn2)组织架构rn 在很多大公司里,部门会按照职能来划分。测试部下辖若干测试小组,每个小组负责测试一个或者一类产品;开发部下辖若干开发小组,每个小组负责开发一个或者一类产品。测试部经理和开发部经理都直接向研发中心的经理汇报。当测试部经理和开发部经理在一些工作上意见不一致时,没有人来直接做裁决,导致互相扯皮。一个中大型研发中心同时会有至少几十个项目在运作,研发中心的经理在宏观层面上掌控全局,根本无暇顾及每个项目的细节,很多时候就任由测试组和开发组的人来互相角力了。项目经理和产品经理在不同的公司里话语权差异很大,经常无法有效调和这些矛盾。rn 在有些公司里,部门会根据事业部/产品线来划分。部门甲负责一个或者一类产品,下辖开发组,测试组,项目经理,产品经理,UI设计人员等。当开发组和测试组意见不一致时,由部门经理最终拿主意,对项目的成败负全部责任。这种架构下情况会好很多。rn rnQ: 如何评价测试人员的工作?rnA: 需要bug数量和经理的主观感受相结合。单纯依赖bug数量,就如同单纯依赖代码行数来评价开发人员一样片面。其一,Bug的数量可以掺水;其二,做性能测试的人员所报bug数要远远小于做功能测试的人员,做测试开发的人员就根本没有bug可报。rn rnQ:在从事若干年测试工作后,<em>大家</em>都向哪些方向发展了?rnA:根据我和身边同事们所经历过的各类公司的经验,大致有如下几种出路。rn1)测试管理。管理职位是稀缺的,不是想做管理的人都能有机会去做,即使各方面能力都具备了。rn2)转开发。测试转开发 比 开发转测试 的难度要大得多,越早越好,转失败的不在少数。rn3)转售前售后技术支持、顾问、培训。测试的好处在于对产品的整理理解和把握,同时研发的背景对于这几个工种非常有益。rn4)在测试的道路上长期走下去,做技术专家。这是大部分人的选择,不管是主动的还是无奈被动的。rnrn附注:多年的心得浓缩成此文,如转载,还望注明出处,谢谢!rn热烈欢迎评论或者和我邮件联系:rnemail: jjggww2002@sina.com rnMSN: jiangguowei2000@hotmail.comrnrn嘿嘿,我的邮箱 ccg890811@163.com QQ: 2412 2059 希望能和<em>大家</em>一起学习测试! 呵呵!!
分享感悟
今日我的演讲主题为《jQuery学习》。化繁为简,大道至简。对于jQuery的学习并没有那么难。简单分析一下: 基本语法: $ ().方法名(); 一、获取操作对象——使用 “ $ ( ) ” “ $( ) ”中的小括号内可以是——字符串、变量、function功能函数。 function功能函数时: HTML页面加载完后,执行的任务(功能)。不常用。 变量时:常常表示获取整个文档对象。如$(d...
10年手工测试的迷茫,值得每个人深思
引子请准备好我要开始装逼了!!!!!NO,今天不装逼。。。实实在在的和<em>大家</em><em>分享</em>下。为什么会写这篇文章呢?纯属是因为前段时间有个朋友在QQ上和我交流,说他干了10年的手工测试了,现在还能不能转型。说实在的,当时我听的一脸懵逼,于是就诞生了这篇文章!以下内容纯属个人观点,不喜勿喷,有可能都是错的,如果对你有帮助欢迎转发,如果对你没帮助就当看了个笑话逗你一乐吧!规划比努力更重要咦,不是应该是选择比努力更...
怎样成为一名优秀的码农,求指导!
鄙人做java開發一年,這一年在外包服務公司,讓我很煩惱的是,外包對技術要求不是非常高,同時,你能從裏面學得到的東西也不是很多。 我認為要成為<em>一名</em>優秀的碼農,應該技術過硬。我的想法是往底層探索,或者往架構設計方向,奈何一個人總是找不到方向,<em>大家</em>有什麽好的建議,求高手指點,推薦,明確學習路徑,有推薦資料或帖子、文章等,萬分感謝!...
迷茫中,,希望有过来人指点.
本菜鸟已做.net两年左右时间,总觉得自己像什么都不会的,看书也不知道再去看些什么,也不知道从何下手.rn希望<em>有过</em>来人指导一二.
每个人都比你厉害吗?
总是要成为你所在的那个乐队中最差的乐手。如果你是乐队中最好的乐手,就需要重新选择乐队了。我认为这也适用于乐队之外的其他事情。 --爵士吉他手Pat Methany 1、沉舟侧畔千帆过,病树前头万木春。要果断丢弃旧习惯,一味遵循过时的旧习惯会危害你的职业生涯。 2、不是完全忘记旧习惯,而是只在使用适当的支术时才使用它。 3、对于所使用的语言,要总结熟悉的语言特性,并且比较这些特性在...
java感悟之继承和封装(不要做码农
这几天项目用ibatis规范sql语句,这样所有的sql语句都要自己手动输入.特别是遇到一张表是有三十多个字段的,更新,插入语句写的简直让人烦死.这时候感觉程序员真的是<em>码农</em>,或者就是砌砖头的,而且还没人家工资高.但是回想一下这种机械的输入其实是可以避免的,然后我就去琢磨了一下写了一些工具类,直接生成ibatis的实体类和xml的映射文件,这个生成的过程只用了一分钟.只怪自己太蠢,然后有了点<em>感悟</em>
给本版码农的一封信
现在的年轻<em>码农</em>普遍存在一下问题、rn1、缺乏上进心,懒散,习惯安逸。rn2、缺乏团队精神。rn3、学习力不够,成长较慢。下班之后基本上就是玩了。rn4、没有清晰的职业生涯规划。rnrn<em>码农</em>这个工作不下点功夫是做不好的。必然会被淘汰rn本版<em>码农</em>普遍水平低下,基本都在行业淘汰的边缘上。rnrn在行业淘汰的边缘上 混的<em>码农</em> 有以下特征rnrn1、总在抱怨,抱怨公司、领导、同事rn2、总是被离职,凡是离职的时候和公司谈赔偿的都是 水平很差(濒临行业淘汰)的<em>码农</em>,优秀的<em>码农</em>是不愁工作的,另外跟公司走劳动仲裁,基本上就把以后的升职道路封死了, 因为在一家正规的公司做到高管,背景调查是必须的。跟以前的公司搞好关系,别为了几个月的赔偿,搭上自己的未来。 如果被离职,就给公司提一个要求,给一个月时间找公司,然后在这一个月内把工作交接好。rnrn什么卸磨杀驴、什么解聘理由好苍白、什么奇葩公司rn归根结底,是你的水平不够。rnrn努力提升自己吧!rnrn
码农分享wow.js上下滚动加载动画
由小<em>码农</em>整理<em>分享</em> 网址:http://www.xmn-xdm.com 有的页面在上下滚动的时候,有些元素会产生细小的动画效果。虽然动画比较小,但却能吸引你的注意。
作为一名程序员的情感语句
路人 我只在你身边路过 清风 我只在你耳边掠过 眼泪 我只在你脸颊划过 雪花 落在手掌也只是融化
作为一名java程序员的必修课
java基础》设计模式》spring框架(方向) 》开源框架(如fescar)的代码构建的方式 》并发、网络编程 》JVM 》常用数据结构 》分布式系统设计、SOA、消息队列、缓存 》linux的应用...
码农上海工作2年感悟
不知不觉间已经毕业快2年了,想起2014年大学的最后一段时间,每天就是吃吃喝喝,宣泄着大学最后的时光。在大学的最后一个学期,得知自己保研了,心里面既高兴又很惆怅。高兴的是能够保研,说明自己大学4年确实好好学习过,至少在最后还是能够得到学院的肯定,曾经别人打游戏的时候自己在学习,别人陪女朋友散步的时候,自己还是在学习;遗憾的是大学4年自己从来就没拿过国家奖学金,也没有拿过1等奖学金,每次都只能那个三
一个和每个人都有关的问题
为什么我现在的级别还是两个三角形,请问如何升级快些。我真的想为<em>大家</em>服务,也希望<em>大家</em>帮我
每个人都可以说几句】模块化编程
[img=http://hi.csdn.net/attachment/201004/25/27617_1272169928Kn88.jpg.thumb.jpg][/img]rn准备实现这种效果。rn事先定义好各种模块,rn每种模块用UIBox表示。rn[img=http://hi.csdn.net/attachment/201004/25/27617_1272163885nrsS.jpg.thumb.jpg][/img]rn模块的每个public属性对应一个box的slot。rnrn用户通过连接模块可以快速生成一个场景。有点可视化编程意味了。rn现在是一点思路都没有,大伙给点建议吧~
Jake Wharton 最近一篇技术分享:Java Hidden Costs
Jake Wharton 大神举例分析了几个典型的场景,剖析 java 源代码与运行时代码的差别,以及带来的性能影响,这些问题对于底层认知不深的同学很容易出现,分析思路抽丝剥茧,相信<em>大家</em>读后会有收获 观看地址
作为一名程序员情感语句
我多希望 能在春天遇见你 你站在柳树下 你的发梢和柳絮随风飘动 对我微微一笑 我多希望 能在夏天遇见你 你躲在树荫下 你手里拿着快化的冰激凌 手足无措 我多希望 能在秋天遇见你 你坐在枫叶树下 困意绵绵的样子 对我眨了眨眼 我多希望 能在冬天遇见你 你站在鹅毛大雪中 手里暖着水杯 哆哆嗦嗦对我说 等你好久噢,快回家啦 我多希望 遇见你 至少能在春天 看你第一眼 而已 ...
作为一名程序猿的心得day1
应该从昨天写起,学的第一课是关于HTML这一门语言,今天的感受分两部分,前部分很好接受,一些比较易记的词汇,比较好理解,小试了下牛刀感觉很有成就感,恩不错,这个没有想象中的枯燥,只是前期就比较有吸引力,相信自己学到后面会爱上编程的。后面一部分的感受,说实话让自己又停下了学习的脚步,感觉并不是那么容易,对新手而言中间的课程还是比较不友好的,不过没关系,一定要坚持,我桃花浪子周大少岂是那么容易就放弃的
最近的一些困惑
写一下<em>最近</em>一些<em>困惑</em> <em>最近</em>一直很<em>困惑</em>,到底我以后要从事什么,要做什么样的人,想做什么事情,20几岁的年纪了,虽然目前工作的公司很棒,但是实在对java没什么好感,还是希望以后能从事更加高端的开发,多学习一些东西。我还是希望能够做自己喜欢的事情,学习自己想学习的,工作忙一点也没啥,好担心浑浑噩噩地就这样度过一生。目前我很想学习机器学习,以及android开发,我想做好多事情,想学好多东西,但不知道学了...
最近困惑,求解!!!
我是从5月底开始正式接触C++的,目标是从事软件开发方面的工作。rn之前没有任何语言的基础,也就是说,5月底之前,我的电脑只是我的游戏机或聊天室。rn至于为什么在一个没有任何电脑知识背景的情况下却想去从事软件开发的工作的原因,那太戏剧性了,呵呵,这里就不说了。rn我知道这之间有很多路要走,可没关系,我有兴趣和大量的时间去走。rn现在我目前的状况是,看完了CP的第三版,大致了解了C++。把控件的所有基本都熟悉了一下。rn接下来,<em>大家</em>说,未来我是想从事软件开发的,那下面是应该读关于什么样的书呢?rn算法?MFC?汇编语言?线程?还是其他的?rn其实我知道,这些我都要去学,但我只是想知道哪个最好先学,慢慢来。rnrn请<em>大家</em>不要笑我把软件开发这个工作想的那么简单容易,我知道不是这样的。但因为还没有形成这方面足够的概念,所以难免有点幼稚说的话。rn谢谢<em>大家</em>了!!!rn
最近一点小困惑
前几天搜索资料,无意看到了咱们的论坛,看了分类,再看了里边的一些内容,真正觉得这是一支很强大的队伍,当然自己也愿意赶紧进入进来,深入向各个前辈们学习。 <em>最近</em>工作上出现一点点小的<em>困惑</em>,希望<em>有过</em>相关经验的,能予以我一些比较好的参考意见进行学习。刚入职新的公司一个月,整个项目组都在做关于C的程序,唯独我一个人在为小组内部,做一个内部测试管理系统,接触新的业务知识,压力很大。前几天领导又...
不是每个人都适合linux
开源特性 Copyleft意味着,linux用户要学会一定程度的DIY。这不仅仅是说,你需要一些预备知识才可以开始。这包含的另一层意思是,在出现了问题的时候,用户很可能并不会得到及时有效的外来援助。 开源社区发布的内容通常是主题比较集中的一组信息。这些信息很可能和用户正在linux中遇到的问题完全不相关。因此,依赖开源社区的信息解决问题,必然要求用户有耐心动脑子地阅读信息。
根据输入的是那个字符然后数字响铃下载
统计输入的数字键,以响铃的方式表明是输入的是多少。 相关下载链接:[url=//download.csdn.net/download/HU1033/2923293?utm_source=bbsseo]//download.csdn.net/download/HU1033/2923293?utm_source=bbsseo[/url]
mongodb PHP驱动程序,含实例下载
mongodb PHP驱动程序,含实例。他们的官方网站是在速度太慢,我下载了给大家分享下。 相关下载链接:[url=//download.csdn.net/download/hardapollo/3690870?utm_source=bbsseo]//download.csdn.net/download/hardapollo/3690870?utm_source=bbsseo[/url]
Radmin3.4破解版下载
Radmin 是一款屡获殊荣的安全远程控制软件,帮助您在远程电脑上工作,如同您坐在那台电脑前一样。 该软件是理想的远程访问解决方案。 您可以从多个地点访问同一台电脑,并使用高级文件传输、远程关机、Telnet、操作系统集成的 NT 安全性系统支持,以及其它功能。 Radmin 在速度、可靠性及安全性方面的表现超过了所有其它远程控制软件! 相关下载链接:[url=//download.csdn.net/download/wvwking/4518998?utm_source=bbsseo]//download.csdn.net/download/wvwking/4518998?utm_source=bbsseo[/url]
相关热词 c# gdi 占用内存 c#中遍历字典 c#控制台模拟dos c# 斜率 最小二乘法 c#进程延迟 c# mysql完整项目 c# grid 总行数 c# web浏览器插件 c# xml 生成xsd c# 操作sql视图
我们是很有底线的
|
{
"url": "https://bbs.csdn.net/topics/393082421",
"source_domain": "bbs.csdn.net",
"snapshot_id": "crawl=CC-MAIN-2019-35",
"warc_metadata": {
"Content-Length": "251926",
"Content-Type": "application/http; msgtype=response",
"WARC-Block-Digest": "sha1:NLENUTVL2XUHUCWJUEXHWVHFOCDPG5TP",
"WARC-Concurrent-To": "<urn:uuid:bbaa02de-beb2-4050-bd58-4ac5cd4a2492>",
"WARC-Date": "2019-08-24T05:45:30Z",
"WARC-IP-Address": "39.96.126.153",
"WARC-Identified-Payload-Type": "text/html",
"WARC-Payload-Digest": "sha1:XGT3X5EWL6YOA2N5K6NE3VDRZ6FFAIKD",
"WARC-Record-ID": "<urn:uuid:75a37b6b-861f-4706-b106-d409f8f39baa>",
"WARC-Target-URI": "https://bbs.csdn.net/topics/393082421",
"WARC-Truncated": null,
"WARC-Type": "response",
"WARC-Warcinfo-ID": "<urn:uuid:8550a888-ff85-4841-86fc-cd13f9bf0f65>"
},
"warc_info": "isPartOf: CC-MAIN-2019-35\r\npublisher: Common Crawl\r\ndescription: Wide crawl of the web for August 2019\r\noperator: Common Crawl Admin (info@commoncrawl.org)\r\nhostname: ip-10-67-67-109.ec2.internal\r\nsoftware: Apache Nutch 1.15 (modified, https://github.com/commoncrawl/nutch/)\r\nrobots: checked via crawler-commons 1.1-SNAPSHOT (https://github.com/crawler-commons/crawler-commons)\r\nformat: WARC File Format 1.1\r\nconformsTo: http://iipc.github.io/warc-specifications/specifications/warc-format/warc-1.1/"
}
|
{
"line_start_idx": [
0,
47,
48,
53,
61,
67,
84,
90,
113,
119,
134,
145,
150,
160,
166,
183,
189,
212,
218,
233,
238,
250,
256,
279,
285,
313,
319,
349,
354,
366,
372,
400,
405,
413,
419,
436,
442,
465,
471,
486,
491,
503,
509,
532,
538,
566,
572,
602,
607,
615,
621,
638,
644,
667,
673,
688,
693,
704,
709,
717,
723,
740,
746,
769,
775,
790,
795,
1072,
1088,
1208,
1221,
2340,
2364,
2813,
2820,
3037,
3045,
3093,
3104,
3314,
3324,
3525,
3537,
3739,
3750,
4143,
4158,
4321,
4338,
4414,
4438,
4620,
4632,
4851,
4864,
5077,
5094,
5230,
5243,
5454,
5466,
5683,
5696,
5920,
5947,
7421,
7438,
7641,
7663,
12169,
12179,
12325,
12347,
12353,
12361,
12615,
12629,
12860,
12874,
13714,
13735,
14251,
14264,
14464,
14473,
14850,
14859,
15022,
15036,
15081,
15092,
15140,
15155,
15189,
15205,
15241,
15250,
15378,
15385,
15595,
15602,
15802,
15812,
16030,
16038,
16114,
16122,
16343,
16350,
16430,
16440,
16650,
16657,
16706,
16717,
16922,
16931,
17928,
17944,
18216,
18223,
18423,
18432,
18630,
18638,
18847,
18856,
19071,
19097,
19126,
19133,
19337,
19363,
19670,
19691,
19895,
19906,
26600,
26617,
26818,
26830,
27049,
27057,
27258,
27272,
27544,
27560,
34577,
34582,
34785,
34804,
35026,
35043,
35229,
35244,
35318,
35329,
35526,
35545,
35762,
35772,
36249,
36268,
36368,
36381,
36430,
36446,
36650,
36661,
36862,
36875,
36937,
36953,
37249,
37289,
37403,
37415,
37604,
37619,
37820,
37828,
38068,
38079,
38491,
38499,
38721,
38735,
38928,
38947,
39115,
39137,
39333,
39348,
39662,
39778
],
"line_end_idx": [
47,
48,
53,
61,
67,
84,
90,
113,
119,
134,
145,
150,
160,
166,
183,
189,
212,
218,
233,
238,
250,
256,
279,
285,
313,
319,
349,
354,
366,
372,
400,
405,
413,
419,
436,
442,
465,
471,
486,
491,
503,
509,
532,
538,
566,
572,
602,
607,
615,
621,
638,
644,
667,
673,
688,
693,
704,
709,
717,
723,
740,
746,
769,
775,
790,
795,
1072,
1088,
1208,
1221,
2340,
2364,
2813,
2820,
3037,
3045,
3093,
3104,
3314,
3324,
3525,
3537,
3739,
3750,
4143,
4158,
4321,
4338,
4414,
4438,
4620,
4632,
4851,
4864,
5077,
5094,
5230,
5243,
5454,
5466,
5683,
5696,
5920,
5947,
7421,
7438,
7641,
7663,
12169,
12179,
12325,
12347,
12353,
12361,
12615,
12629,
12860,
12874,
13714,
13735,
14251,
14264,
14464,
14473,
14850,
14859,
15022,
15036,
15081,
15092,
15140,
15155,
15189,
15205,
15241,
15250,
15378,
15385,
15595,
15602,
15802,
15812,
16030,
16038,
16114,
16122,
16343,
16350,
16430,
16440,
16650,
16657,
16706,
16717,
16922,
16931,
17928,
17944,
18216,
18223,
18423,
18432,
18630,
18638,
18847,
18856,
19071,
19097,
19126,
19133,
19337,
19363,
19670,
19691,
19895,
19906,
26600,
26617,
26818,
26830,
27049,
27057,
27258,
27272,
27544,
27560,
34577,
34582,
34785,
34804,
35026,
35043,
35229,
35244,
35318,
35329,
35526,
35545,
35762,
35772,
36249,
36268,
36368,
36381,
36430,
36446,
36650,
36661,
36862,
36875,
36937,
36953,
37249,
37289,
37403,
37415,
37604,
37619,
37820,
37828,
38068,
38079,
38491,
38499,
38721,
38735,
38928,
38947,
39115,
39137,
39333,
39348,
39662,
39778,
39786
]
}
|
{
"red_pajama_v2": {
"ccnet_original_length": 39786,
"ccnet_original_nlines": 234,
"rps_doc_curly_bracket": 0.000025130000722128898,
"rps_doc_ldnoobw_words": 1,
"rps_doc_lorem_ipsum": 0,
"rps_doc_stop_word_fraction": 0.005968249868601561,
"rps_doc_ut1_blacklist": 0,
"rps_doc_frac_all_caps_words": 0.028063489124178886,
"rps_doc_frac_lines_end_with_ellipsis": 0.09787233918905258,
"rps_doc_frac_no_alph_words": 0.8353015780448914,
"rps_doc_frac_unique_words": 0.8575031757354736,
"rps_doc_mean_word_length": 47.16771697998047,
"rps_doc_num_sentences": 192,
"rps_doc_symbol_to_word_ratio": 0.005841270089149475,
"rps_doc_unigram_entropy": 6.371441841125488,
"rps_doc_word_count": 793,
"rps_doc_frac_chars_dupe_10grams": 0.015185539610683918,
"rps_doc_frac_chars_dupe_5grams": 0.015987589955329895,
"rps_doc_frac_chars_dupe_6grams": 0.015185539610683918,
"rps_doc_frac_chars_dupe_7grams": 0.015185539610683918,
"rps_doc_frac_chars_dupe_8grams": 0.015185539610683918,
"rps_doc_frac_chars_dupe_9grams": 0.015185539610683918,
"rps_doc_frac_chars_top_2gram": 0.002058600075542927,
"rps_doc_frac_chars_top_3gram": 0.004865789785981178,
"rps_doc_frac_chars_top_4gram": 0.0058015198446810246,
"rps_doc_books_importance": -3334.794189453125,
"rps_doc_books_importance_length_correction": -3334.794189453125,
"rps_doc_openwebtext_importance": -1716.3519287109375,
"rps_doc_openwebtext_importance_length_correction": -1716.3519287109375,
"rps_doc_wikipedia_importance": -955.3052368164062,
"rps_doc_wikipedia_importance_length_correction": -955.3052368164062
},
"fasttext": {
"dclm": 0.2635282278060913,
"english": 0.0036206499207764864,
"fineweb_edu_approx": 2.0343170166015625,
"eai_general_math": 0.00029075000202283263,
"eai_open_web_math": 0.23445039987564087,
"eai_web_code": 0.7280494570732117
}
}
|
{
"free_decimal_correspondence": {
"primary": {
"code": "005.1",
"labels": {
"level_1": "General works, books and libraries, information sciences",
"level_2": "",
"level_3": "Computer programming"
}
},
"secondary": {
"code": "378.1",
"labels": {
"level_1": "Social sciences",
"level_2": "Education",
"level_3": "Education, Higher and Universities and colleges"
}
}
},
"bloom_cognitive_process": {
"primary": {
"code": "4",
"label": "Analyze"
},
"secondary": {
"code": "3",
"label": "Apply"
}
},
"bloom_knowledge_domain": {
"primary": {
"code": "2",
"label": "Conceptual"
},
"secondary": {
"code": "3",
"label": "Procedural"
}
},
"document_type_v1": {
"primary": {
"code": "5",
"label": "Social/Forum"
},
"secondary": {
"code": "-1",
"label": "Abstain"
}
},
"extraction_artifacts": {
"primary": {
"code": "3",
"label": "Irrelevant Content"
},
"secondary": {
"code": "0",
"label": "No Artifacts"
}
},
"missing_content": {
"primary": {
"code": "0",
"label": "No missing content"
},
"secondary": {
"code": "-1",
"label": "Abstain"
}
},
"document_type_v2": {
"primary": {
"code": "16",
"label": "Personal Blog"
},
"secondary": {
"code": "18",
"label": "Q&A Forum"
}
},
"reasoning_depth": {
"primary": {
"code": "3",
"label": "Intermediate Reasoning"
},
"secondary": {
"code": "2",
"label": "Basic Reasoning"
}
},
"technical_correctness": {
"primary": {
"code": "6",
"label": "Not Applicable/Indeterminate"
},
"secondary": {
"code": "3",
"label": "Mostly Correct"
}
},
"education_level": {
"primary": {
"code": "2",
"label": "High School Level"
},
"secondary": {
"code": "3",
"label": "Undergraduate Level"
}
}
}
|
672f1e42c33a7f9846924a2431ea77df
|
123,959,901,814,963,820
|
The Best PC Configuration For Programming
Software developers need a good platform to program. A PC for programmers should have a number of features to increase productivity. Taking into account that creating a program is basically writing source code and that you will spend long hours in front of the screen, in addition to the demand for hardware resources when compiling the program, you can get a good idea of what you need.
In addition, the operating system is also another important point, since the applications that you have to develop can be for different architectures and operating systems, so doing it natively in the right one will allow you to perform better tests. To satisfy all the needs I have included the three main operating systems.
What should I take into account to choose the best PC to program?
To make you feel with your development team and you can program without problems, these are the keys to choose the best team.
Screen size
You will spend a great deal of time looking at a screen while writing code, as well as looking for possible syntax or typing errors in your IDE or text editor where you usually write the code. Therefore, having a large screen with a good resolution is not only more comfortable, but your eyes will thank you. Also, if you have multiple windows open on the screen at once, it can be beneficial if it’s not too ridiculous a work surface.
In case of being a desktop PC, it is best that you have a screen of at least 23 ″ and FullHD. If you opt for a larger screen with a higher resolution, such as 4K, much better.
If you go for a laptop to develop, then the size options are much more limited. But I do not recommend the 13 ″ equipment, it is preferable that it has at least 15.6 ″ or 17.3 ″. It seems very “cool” to have a small ultrabook, but it can be a hassle when you write large source code or need to have many items in view at once.
Processor
To run any IDE or text editor environment to write in, even an old processor can do the trick. They are not overly demanding software. The problem comes when you try to compile the source code and generate the binary. In that case, the processing power will determine whether it takes minutes or hours. And having a good CPU can make a difference.
You can choose any current Intel or AMD microprocessor, although if you are interested in optimizing the software for a specific microarchitecture you may need one or the other specifically. For example, if you need to use some instructions from a specific set, like the AVX512, etc.
In the case of cross compilation, it certainly wouldn’t matter too much, since you are compiling for a different architecture than yours and you simply need speed so it doesn’t take too long. For example, when you use Android Studio to create mobile apps with ARM.
In case you create programs using parallel programming, you may be interested in an Intel Xeon, an Intel Core i7 / i9, an AMD EPYC, or an AMD Threadripper (now Ryzen 9). These processors have a higher core count and therefore better than the other series for testing your parallel programs.
Check Also: How much RAM do I need?
Memory
Something similar to the microprocessor happens. For the IDE or the text editor with which you enter the code, a minimum capacity of RAM would be worth, but not when compiling or executing certain emulators (eg in Android Studio), or virtual machines where to test (if you need them). In those cases, the demand would be higher.
Here it may depend a little on what you need in each case. Some 8GB might be enough for some who create simple programs, and for other programmers they would need more. To be useful in most cases, I would recommend at least 32GB of RAM. Even more so if you plan to use graphics engines to create video games.
Check Also: What is Cache Memory & How to Remove it
GPU
The GPU can seem like practically nothing or nothing matters to program. And it is true in some cases. But if you want to develop video games and you have to work with graphic design and graphics engines, the graphics card becomes somewhat more critical. So in case you want to develop and test video games, you should mount a decent graphics card for gaming.
Another case where graphics becomes important is if you are going to develop code for GPGPU, that is, to use the GPU for general purposes using OpenCL, CUDA,…, or for AI, etc. In those cases, you should look at AMD and NVIDIA cards for professionals or accelerators in case you want to create specific code for these types of products. I mean models like AMD Radeon Instinct, AMD FirePro, NVIDIA Quadro or Titan or Tesla, Intel XeonPhi, etc.
Keyboard
The keyboard is the tool that you will use to enter all the hundreds or thousands of lines of code that you need for your projects. Therefore, choosing a comfortable and reliable keyboard is essential. Gaming keyboards are usually good options, so you can opt for these types of models even if you opt for a laptop, you can buy a gaming model or use an external keyboard.
Some examples of good keyboards for entering text are the Corsair K83, Filco Majestouch-2, Logitech Craft, Roccat Vulcan 120 Aimo, etc. And remember that ergonomics can prevent you from going through times of pain or problems with your health by straining your joints….
OS
The operating system must be a secure, reliable, robust, stable platform and, if possible, be the native platform for which you are developing, and thus avoid using virtual machines or emulators to test the software. Obviously, the three options you have are GNU / Linux, Windows and macOS. Although if you develop for another operating system, you can choose the one you want: ChromeOS, FreeBSD, Solaris, etc.
In this aspect it is a question of needs. It depends on what platform you are creating for and maybe you are interested in one OS or another…
Check Also: How to split screen in Windows 10
Autonomy
In the case that it is a desktop PC, this section would not make sense. But if you have opted for a laptop, although to me personally they do not seem like the best development platforms, it may be that for any particular reason or need you have to use it, then it should have a good autonomy so that it does not leave you half-way at the least moment indicated. Look for models with a large battery capacity and that last the longer the better.
The best settings for programmers
Here you have some good PCs for programming according to the type of programming that you are going to develop, taking into account the most widespread requirements without going into too specific configurations such as GPGPU, etc.
Leave a Comment
|
{
"url": "https://www.wikipluck.com/best-pc-configuration-for-programming/",
"source_domain": "www.wikipluck.com",
"snapshot_id": "crawl=CC-MAIN-2022-49",
"warc_metadata": {
"Content-Length": "138493",
"Content-Type": "application/http; msgtype=response",
"WARC-Block-Digest": "sha1:GCIJBY7GJEJW4ID3PXFIRRL6GRI5JEHY",
"WARC-Concurrent-To": "<urn:uuid:674fe28e-3a3f-4018-b90a-e83c70206972>",
"WARC-Date": "2022-12-01T17:40:08Z",
"WARC-IP-Address": "198.54.125.159",
"WARC-Identified-Payload-Type": "text/html",
"WARC-Payload-Digest": "sha1:JEQRBP6NWJGA225AF3LIFDIKWNVYBM4W",
"WARC-Record-ID": "<urn:uuid:a7fe6d78-b59e-4beb-9519-28e9b4a3cf6e>",
"WARC-Target-URI": "https://www.wikipluck.com/best-pc-configuration-for-programming/",
"WARC-Truncated": null,
"WARC-Type": "response",
"WARC-Warcinfo-ID": "<urn:uuid:e379bb87-6d3f-451b-a089-c7a4b4d423cd>"
},
"warc_info": "isPartOf: CC-MAIN-2022-49\r\npublisher: Common Crawl\r\ndescription: Wide crawl of the web for November/December 2022\r\noperator: Common Crawl Admin (info@commoncrawl.org)\r\nhostname: ip-10-67-67-177\r\nsoftware: Apache Nutch 1.19 (modified, https://github.com/commoncrawl/nutch/)\r\nrobots: checked via crawler-commons 1.4-SNAPSHOT (https://github.com/crawler-commons/crawler-commons)\r\nformat: WARC File Format 1.1\r\nconformsTo: https://iipc.github.io/warc-specifications/specifications/warc-format/warc-1.1/"
}
|
{
"line_start_idx": [
0,
42,
43,
433,
434,
760,
761,
827,
828,
954,
955,
967,
968,
1404,
1405,
1581,
1582,
1909,
1910,
1920,
1921,
2269,
2270,
2554,
2555,
2820,
2821,
3112,
3113,
3149,
3150,
3157,
3158,
3487,
3488,
3797,
3798,
3850,
3851,
3855,
3856,
4216,
4217,
4659,
4660,
4669,
4670,
5042,
5043,
5313,
5314,
5317,
5318,
5729,
5730,
5872,
5873,
5919,
5920,
5929,
5930,
6376,
6377,
6411,
6412,
6644,
6645
],
"line_end_idx": [
42,
43,
433,
434,
760,
761,
827,
828,
954,
955,
967,
968,
1404,
1405,
1581,
1582,
1909,
1910,
1920,
1921,
2269,
2270,
2554,
2555,
2820,
2821,
3112,
3113,
3149,
3150,
3157,
3158,
3487,
3488,
3797,
3798,
3850,
3851,
3855,
3856,
4216,
4217,
4659,
4660,
4669,
4670,
5042,
5043,
5313,
5314,
5317,
5318,
5729,
5730,
5872,
5873,
5919,
5920,
5929,
5930,
6376,
6377,
6411,
6412,
6644,
6645,
6660
]
}
|
{
"red_pajama_v2": {
"ccnet_original_length": 6660,
"ccnet_original_nlines": 66,
"rps_doc_curly_bracket": 0,
"rps_doc_ldnoobw_words": 0,
"rps_doc_lorem_ipsum": 0,
"rps_doc_stop_word_fraction": 0.4925484359264374,
"rps_doc_ut1_blacklist": 0,
"rps_doc_frac_all_caps_words": 0.03278689086437225,
"rps_doc_frac_lines_end_with_ellipsis": 0.014925369992852211,
"rps_doc_frac_no_alph_words": 0.11997018754482269,
"rps_doc_frac_unique_words": 0.35101011395454407,
"rps_doc_mean_word_length": 4.454545497894287,
"rps_doc_num_sentences": 57,
"rps_doc_symbol_to_word_ratio": 0.0022354701068252325,
"rps_doc_unigram_entropy": 5.327474594116211,
"rps_doc_word_count": 1188,
"rps_doc_frac_chars_dupe_10grams": 0,
"rps_doc_frac_chars_dupe_5grams": 0.01776265911757946,
"rps_doc_frac_chars_dupe_6grams": 0,
"rps_doc_frac_chars_dupe_7grams": 0,
"rps_doc_frac_chars_dupe_8grams": 0,
"rps_doc_frac_chars_dupe_9grams": 0,
"rps_doc_frac_chars_top_2gram": 0.011337869800627232,
"rps_doc_frac_chars_top_3gram": 0.005102039780467749,
"rps_doc_frac_chars_top_4gram": 0.005668929778039455,
"rps_doc_books_importance": -513.5927734375,
"rps_doc_books_importance_length_correction": -513.5927734375,
"rps_doc_openwebtext_importance": -343.646728515625,
"rps_doc_openwebtext_importance_length_correction": -343.646728515625,
"rps_doc_wikipedia_importance": -209.1419219970703,
"rps_doc_wikipedia_importance_length_correction": -209.1419219970703
},
"fasttext": {
"dclm": 0.09226000308990479,
"english": 0.9338502287864685,
"fineweb_edu_approx": 2.277137517929077,
"eai_general_math": 0.7314876914024353,
"eai_open_web_math": 0.27239251136779785,
"eai_web_code": 0.5997021198272705
}
}
|
{
"free_decimal_correspondence": {
"primary": {
"code": "004.16",
"labels": {
"level_1": "General works, books and libraries, information sciences",
"level_2": "",
"level_3": "Computers and Computer science"
}
},
"secondary": {
"code": "005.1",
"labels": {
"level_1": "General works, books and libraries, information sciences",
"level_2": "",
"level_3": "Computer programming"
}
}
},
"bloom_cognitive_process": {
"primary": {
"code": "2",
"label": "Understand"
},
"secondary": {
"code": "3",
"label": "Apply"
}
},
"bloom_knowledge_domain": {
"primary": {
"code": "2",
"label": "Conceptual"
},
"secondary": {
"code": "3",
"label": "Procedural"
}
},
"document_type_v1": {
"primary": {
"code": "3",
"label": "Reference/Encyclopedic/Educational"
},
"secondary": {
"code": "-1",
"label": "Abstain"
}
},
"extraction_artifacts": {
"primary": {
"code": "0",
"label": "No Artifacts"
},
"secondary": {
"code": "3",
"label": "Irrelevant Content"
}
},
"missing_content": {
"primary": {
"code": "0",
"label": "No missing content"
},
"secondary": {
"code": "-1",
"label": "Abstain"
}
},
"document_type_v2": {
"primary": {
"code": "10",
"label": "Knowledge Article"
},
"secondary": {
"code": "23",
"label": "Tutorial"
}
},
"reasoning_depth": {
"primary": {
"code": "2",
"label": "Basic Reasoning"
},
"secondary": {
"code": "3",
"label": "Intermediate Reasoning"
}
},
"technical_correctness": {
"primary": {
"code": "3",
"label": "Mostly Correct"
},
"secondary": {
"code": "4",
"label": "Highly Correct"
}
},
"education_level": {
"primary": {
"code": "2",
"label": "High School Level"
},
"secondary": {
"code": "3",
"label": "Undergraduate Level"
}
}
}
|
672f1e42c33a7f9846924a2431ea77df
|
-5,356,089,270,164,236,000
|
Cooldown / Timer
This forum is currently in read-only mode.
• Complete programming noob here. This is actually a bit of a logic problem, and I'm sure I'm overlooking something really simple, but:
I've got a special power for my spaceship that can be fired once every 10 seconds (or longer, we'll see).
Condition: On key X pressed
For Loop 0 - 100 (making plenty of bullets)
Set each bullet to random angles
It works perfectly, and inflicts the carnage I like. But like I said, for whatever reason I can't get a cooldown working. I know I have to reinitialize the timer object to 10,000ms at the end of the bullet explosion, and wrap the whole thing in a while loop to evaluate whether times up or not...but getting that work is another thing entirely
On a more positive note, having never done any scripting before I've already created something fun in a few hours - so thanks for such a great program!
-A
• Hi. There are several ways to do that. I made an example of a simple one, here:
http://dl.dropbox.com/u/5868916/cooldown.cap
The text object is just there for a visual cue as to what is going on. For example, try removing the Trigger Once and see what it does. I use this method quite often to ensure that I know what is being executed, when.
• Perfect. Got it working, Thanks so much for the help!
-A
• One last question in regards to delays / cooldowns:
I'm trying to add a delay in a for loop, but what looks logical, only spawns 1 object (instead of 10 over 10 seconds)
For "AINum" from 0 to global('MaxAI')
spawn 1 AI
Wait 1 second
resume
Either they all show up at the same time, or just the one. I'm sure it's a simple order thing, but so far I've yet to figure it out.
-A
• For loops all occur in the same frame.
What you probably want is to set up a counter variable and initialize it to the number of objects you intend to spawn (10, in your case). Then, just do a check each frame to see if a second has passed, and also if the counter is above zero. If so, decrement the counter and spawn an object.
This has the added benefit of allowing you to seamlessly start spawning more objects simply by setting the counter to a higher number again.
• Try Construct 3
Develop games in your browser. Powerful, performant & highly capable.
Try Now Construct 3 users don't see these ads
• How about something like this:
+ System: Is global variable 'EnemyBatch' Greater than 0
+ System: Every 1000 milliseconds
-> System: Create object Enemy on layer 1 at (random(DisplayWidth), random(DisplayHeight))
-> System: Subtract 1 from global variable 'EnemyBatch'
Works like this: as long as EnemyBatch is more than 0, it will repeat once every second. Spawn an enemy, decrement EnemyBatch. Tested and working nicely.
• How about something like this:
+ System: Is global variable 'EnemyBatch' Greater than 0
+ System: Every 1000 milliseconds
-> System: Create object Enemy on layer 1 at (random(DisplayWidth), random(DisplayHeight))
-> System: Subtract 1 from global variable 'EnemyBatch'
Works like this: as long as EnemyBatch is more than 0, it will repeat once every second. Spawn an enemy, decrement EnemyBatch. Tested and working nicely.
That's pretty much exactly what I said, isn't it?
Seriously though, that's more intuitive than the way I put it. I really should just stick to writing pseudocode instead of over-explaining
• Awesome, thanks again for the help guys. I appreciate both explanations
-A
• I used a similar cooldown variable in a game of mine.
It's one of the first things I actually got working properly in Construct.
(I use 10 ms and multiples of 10 because of that warning that the milisecond rate isn't accurate
so cool_down = 100 means 1,000 ms.)
Trigger (eg Left mouse is down):
[subevent]
spaceship.value('cool_down') equals 0: fire BFG (or a loop subevent to fire 100)
Set spaceship.value('cool_down') to 10
Every 10 miliseconds
spaceship.value('cool_down') greater than 0: Subtract 1 from spaceship.value('cool_down')
If you hold the mouse button (or whichever condition you set), then each tick it checks the cool_down. If it is not zero, then nothing happens.
Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)
|
{
"url": "https://www.construct.net/en/forum/construct-classic/help-support-using-construct-38/cooldown-timer-36346",
"source_domain": "www.construct.net",
"snapshot_id": "crawl=CC-MAIN-2020-45",
"warc_metadata": {
"Content-Length": "93144",
"Content-Type": "application/http; msgtype=response",
"WARC-Block-Digest": "sha1:DZ2FOXWXQ2KFQQDK62FE2V4QIOE6WW2A",
"WARC-Concurrent-To": "<urn:uuid:d173588c-f25f-4fef-b379-0d5c56c6d960>",
"WARC-Date": "2020-10-28T14:26:20Z",
"WARC-IP-Address": "104.22.2.122",
"WARC-Identified-Payload-Type": "text/html",
"WARC-Payload-Digest": "sha1:K4SOCFM6ISP6VAQAR7QPZGPZNQBGNACD",
"WARC-Record-ID": "<urn:uuid:d234b0fc-4cac-4620-bc6d-2725a4078164>",
"WARC-Target-URI": "https://www.construct.net/en/forum/construct-classic/help-support-using-construct-38/cooldown-timer-36346",
"WARC-Truncated": null,
"WARC-Type": "response",
"WARC-Warcinfo-ID": "<urn:uuid:1605f1ec-c2d4-405d-9b3f-52553eb931e1>"
},
"warc_info": "isPartOf: CC-MAIN-2020-45\r\npublisher: Common Crawl\r\ndescription: Wide crawl of the web for October 2020\r\noperator: Common Crawl Admin (info@commoncrawl.org)\r\nhostname: ip-10-67-67-30.ec2.internal\r\nsoftware: Apache Nutch 1.17 (modified, https://github.com/commoncrawl/nutch/)\r\nrobots: checked via crawler-commons 1.2-SNAPSHOT (https://github.com/crawler-commons/crawler-commons)\r\nformat: WARC File Format 1.1\r\nconformsTo: http://iipc.github.io/warc-specifications/specifications/warc-format/warc-1.1/"
}
|
{
"line_start_idx": [
0,
17,
18,
61,
199,
200,
310,
311,
343,
344,
392,
393,
430,
431,
779,
780,
936,
937,
944,
945,
1029,
1030,
1079,
1080,
1302,
1303,
1361,
1362,
1369,
1370,
1426,
1427,
1549,
1550,
1592,
1593,
1608,
1609,
1627,
1628,
1639,
1640,
1777,
1778,
1785,
1786,
1829,
1830,
2125,
2126,
2271,
2272,
2292,
2293,
2367,
2368,
2418,
2453,
2454,
2515,
2516,
2554,
2555,
2650,
2651,
2711,
2712,
2870,
2871,
2906,
2907,
2968,
2969,
3007,
3008,
3103,
3104,
3164,
3165,
3323,
3324,
3378,
3379,
3522,
3523,
3599,
3600,
3607,
3608,
3666,
3667,
3746,
3747,
3848,
3849,
3889,
3890,
3927,
3928,
3943,
3944,
4029,
4030,
4073,
4074,
4099,
4100,
4194,
4195,
4343,
4344,
4353,
4366
],
"line_end_idx": [
17,
18,
61,
199,
200,
310,
311,
343,
344,
392,
393,
430,
431,
779,
780,
936,
937,
944,
945,
1029,
1030,
1079,
1080,
1302,
1303,
1361,
1362,
1369,
1370,
1426,
1427,
1549,
1550,
1592,
1593,
1608,
1609,
1627,
1628,
1639,
1640,
1777,
1778,
1785,
1786,
1829,
1830,
2125,
2126,
2271,
2272,
2292,
2293,
2367,
2368,
2418,
2453,
2454,
2515,
2516,
2554,
2555,
2650,
2651,
2711,
2712,
2870,
2871,
2906,
2907,
2968,
2969,
3007,
3008,
3103,
3104,
3164,
3165,
3323,
3324,
3378,
3379,
3522,
3523,
3599,
3600,
3607,
3608,
3666,
3667,
3746,
3747,
3848,
3849,
3889,
3890,
3927,
3928,
3943,
3944,
4029,
4030,
4073,
4074,
4099,
4100,
4194,
4195,
4343,
4344,
4353,
4366,
4429
]
}
|
{
"red_pajama_v2": {
"ccnet_original_length": 4429,
"ccnet_original_nlines": 112,
"rps_doc_curly_bracket": 0,
"rps_doc_ldnoobw_words": 0,
"rps_doc_lorem_ipsum": 0,
"rps_doc_stop_word_fraction": 0.3869935870170593,
"rps_doc_ut1_blacklist": 0,
"rps_doc_frac_all_caps_words": 0.030916839838027954,
"rps_doc_frac_lines_end_with_ellipsis": 0,
"rps_doc_frac_no_alph_words": 0.24307036399841309,
"rps_doc_frac_unique_words": 0.4351464509963989,
"rps_doc_mean_word_length": 4.51324987411499,
"rps_doc_num_sentences": 45,
"rps_doc_symbol_to_word_ratio": 0.001066099968738854,
"rps_doc_unigram_entropy": 5.281160831451416,
"rps_doc_word_count": 717,
"rps_doc_frac_chars_dupe_10grams": 0.20519159734249115,
"rps_doc_frac_chars_dupe_5grams": 0.20519159734249115,
"rps_doc_frac_chars_dupe_6grams": 0.20519159734249115,
"rps_doc_frac_chars_dupe_7grams": 0.20519159734249115,
"rps_doc_frac_chars_dupe_8grams": 0.20519159734249115,
"rps_doc_frac_chars_dupe_9grams": 0.20519159734249115,
"rps_doc_frac_chars_top_2gram": 0.007725589908659458,
"rps_doc_frac_chars_top_3gram": 0.029666250571608543,
"rps_doc_frac_chars_top_4gram": 0.011124850250780582,
"rps_doc_books_importance": -479.9400634765625,
"rps_doc_books_importance_length_correction": -479.9400634765625,
"rps_doc_openwebtext_importance": -240.04293823242188,
"rps_doc_openwebtext_importance_length_correction": -240.04293823242188,
"rps_doc_wikipedia_importance": -197.4660186767578,
"rps_doc_wikipedia_importance_length_correction": -197.4660186767578
},
"fasttext": {
"dclm": 0.4625222086906433,
"english": 0.9063045978546143,
"fineweb_edu_approx": 2.00498628616333,
"eai_general_math": 0.9380578398704529,
"eai_open_web_math": 0.39357203245162964,
"eai_web_code": 0.6257549524307251
}
}
|
{
"free_decimal_correspondence": {
"primary": {
"code": "005.1",
"labels": {
"level_1": "General works, books and libraries, information sciences",
"level_2": "",
"level_3": "Computer programming"
}
},
"secondary": {
"code": "794.8",
"labels": {
"level_1": "Arts",
"level_2": "Amusements and Recreation",
"level_3": ""
}
}
},
"bloom_cognitive_process": {
"primary": {
"code": "3",
"label": "Apply"
},
"secondary": {
"code": "2",
"label": "Understand"
}
},
"bloom_knowledge_domain": {
"primary": {
"code": "3",
"label": "Procedural"
},
"secondary": {
"code": "2",
"label": "Conceptual"
}
},
"document_type_v1": {
"primary": {
"code": "5",
"label": "Social/Forum"
},
"secondary": {
"code": "4",
"label": "Code/Software"
}
},
"extraction_artifacts": {
"primary": {
"code": "3",
"label": "Irrelevant Content"
},
"secondary": {
"code": "-1",
"label": "Abstain"
}
},
"missing_content": {
"primary": {
"code": "4",
"label": "Missing Images or Figures"
},
"secondary": {
"code": "-1",
"label": "Abstain"
}
},
"document_type_v2": {
"primary": {
"code": "18",
"label": "Q&A Forum"
},
"secondary": {
"code": "23",
"label": "Tutorial"
}
},
"reasoning_depth": {
"primary": {
"code": "2",
"label": "Basic Reasoning"
},
"secondary": {
"code": "3",
"label": "Intermediate Reasoning"
}
},
"technical_correctness": {
"primary": {
"code": "3",
"label": "Mostly Correct"
},
"secondary": {
"code": "4",
"label": "Highly Correct"
}
},
"education_level": {
"primary": {
"code": "2",
"label": "High School Level"
},
"secondary": {
"code": "1",
"label": "General Audience"
}
}
}
|
672f1e42c33a7f9846924a2431ea77df
|
-2,321,344,439,457,952,000
|
Update form field values in WPForms
In the GenesisWP Slack, Dan asked a great question about WPForms:
How can I add two WPForms fields together to display the result in the form’s notification?
Dan Brubaker
I would create a hidden field named “Total” and set it to the sum of the two other fields. We can then use a smart tag for displaying the total field’s value in the notification and confirmation message.
wpforms_process_filter
We can use the wpforms_process_filter filter to customize field values right after the form has been submitted, but before it is saved in the database and emails are sent.
This filter includes three parameters
• $fields(array) Sanitized entry field values/properties.
• $entry(array) Original $_POST global.
• $form_data(array) Form settings/data
Example
My form uses number fields for Red Shirts and Blue Shirts. I also have a hidden field called “Total Shirts”.
We can then update the Total Shirts field value on submission.
I’m using the form ID and field IDs to target the appropriate fields. Alternatively, you could target custom CSS classes added to the form and fields.
/**
* WPForms, update total field
* @link https://www.billerickson.net/dynamically-update-fields-in-wpforms/
*
* @param array $fields Sanitized entry field values/properties.
* @param array $entry Original $_POST global.
* @param array $form_data Form settings/data
* @return array $fields
*/
function be_wpforms_update_total_field( $fields, $entry, $form_data ) {
// Only run on my form with ID = 7785
if( 7785 != $form_data['id'] )
return $fields;
// Add red shirts (field ID 3) and blue shirts (field ID 4) into total (field ID 5)
$fields[5]['value'] = intval( $fields[3]['value'] ) + intval( $fields[4]['value'] );
return $fields;
}
add_filter( 'wpforms_process_filter', 'be_wpforms_update_total_field', 10, 3 );
Once the form is submitted, it shows the confirmation message including the total.
Bill Erickson
Bill Erickson is a freelance WordPress developer and a contributing developer to the Genesis framework. For the past 14 years he has worked with attorneys, publishers, corporations, and non-profits, building custom websites tailored to their needs and goals.
Ready to upgrade your website?
I build custom WordPress websites that look great and are easy to manage.
Let's Talk
Reader Interactions
Comments
1. Paul says
This filter is not listed on WPForms and is EXACTLY what I needed!!! Thank you VERY MUCH, you just made my life a lot easier! 🙂
Leave A Reply
|
{
"url": "https://www.billerickson.net/update-form-field-values-in-wpforms/",
"source_domain": "www.billerickson.net",
"snapshot_id": "crawl=CC-MAIN-2020-16",
"warc_metadata": {
"Content-Length": "73571",
"Content-Type": "application/http; msgtype=response",
"WARC-Block-Digest": "sha1:2DNY7NMMKTOTLKFR2IFXS5O6AIGOBKU5",
"WARC-Concurrent-To": "<urn:uuid:58dfea09-ff8c-4db7-b3ee-241eb457ab89>",
"WARC-Date": "2020-04-03T23:32:44Z",
"WARC-IP-Address": "104.24.124.155",
"WARC-Identified-Payload-Type": "text/html",
"WARC-Payload-Digest": "sha1:BW323SJDBWOVUSDPVCFRHIYPOV7UGV63",
"WARC-Record-ID": "<urn:uuid:5a345313-5ea8-4f72-add1-070dd83d8247>",
"WARC-Target-URI": "https://www.billerickson.net/update-form-field-values-in-wpforms/",
"WARC-Truncated": null,
"WARC-Type": "response",
"WARC-Warcinfo-ID": "<urn:uuid:2bcd10f3-6eb3-4d88-b111-4091a8b4dce7>"
},
"warc_info": "isPartOf: CC-MAIN-2020-16\r\npublisher: Common Crawl\r\ndescription: Wide crawl of the web for March/April 2020\r\noperator: Common Crawl Admin (info@commoncrawl.org)\r\nhostname: ip-10-67-67-152.ec2.internal\r\nsoftware: Apache Nutch 1.16 (modified, https://github.com/commoncrawl/nutch/)\r\nrobots: checked via crawler-commons 1.1-SNAPSHOT (https://github.com/crawler-commons/crawler-commons)\r\nformat: WARC File Format 1.1\r\nconformsTo: http://iipc.github.io/warc-specifications/specifications/warc-format/warc-1.1/"
}
|
{
"line_start_idx": [
0,
36,
37,
103,
104,
196,
197,
210,
211,
415,
416,
439,
440,
612,
613,
651,
652,
712,
754,
795,
796,
804,
805,
914,
915,
978,
979,
1130,
1131,
1135,
1166,
1242,
1245,
1310,
1357,
1403,
1428,
1432,
1504,
1505,
1544,
1576,
1594,
1595,
1680,
1766,
1767,
1784,
1786,
1866,
1867,
1950,
1951,
1965,
1966,
2225,
2226,
2257,
2258,
2332,
2333,
2344,
2345,
2365,
2366,
2375,
2376,
2391,
2392,
2524,
2525
],
"line_end_idx": [
36,
37,
103,
104,
196,
197,
210,
211,
415,
416,
439,
440,
612,
613,
651,
652,
712,
754,
795,
796,
804,
805,
914,
915,
978,
979,
1130,
1131,
1135,
1166,
1242,
1245,
1310,
1357,
1403,
1428,
1432,
1504,
1505,
1544,
1576,
1594,
1595,
1680,
1766,
1767,
1784,
1786,
1866,
1867,
1950,
1951,
1965,
1966,
2225,
2226,
2257,
2258,
2332,
2333,
2344,
2345,
2365,
2366,
2375,
2376,
2391,
2392,
2524,
2525,
2538
]
}
|
{
"red_pajama_v2": {
"ccnet_original_length": 2538,
"ccnet_original_nlines": 70,
"rps_doc_curly_bracket": 0.0007880200282670557,
"rps_doc_ldnoobw_words": 0,
"rps_doc_lorem_ipsum": 0,
"rps_doc_stop_word_fraction": 0.23999999463558197,
"rps_doc_ut1_blacklist": 0,
"rps_doc_frac_all_caps_words": 0.034285709261894226,
"rps_doc_frac_lines_end_with_ellipsis": 0,
"rps_doc_frac_no_alph_words": 0.28761905431747437,
"rps_doc_frac_unique_words": 0.5289255976676941,
"rps_doc_mean_word_length": 5.303030490875244,
"rps_doc_num_sentences": 25,
"rps_doc_symbol_to_word_ratio": 0,
"rps_doc_unigram_entropy": 4.901257038116455,
"rps_doc_word_count": 363,
"rps_doc_frac_chars_dupe_10grams": 0,
"rps_doc_frac_chars_dupe_5grams": 0,
"rps_doc_frac_chars_dupe_6grams": 0,
"rps_doc_frac_chars_dupe_7grams": 0,
"rps_doc_frac_chars_dupe_8grams": 0,
"rps_doc_frac_chars_dupe_9grams": 0,
"rps_doc_frac_chars_top_2gram": 0.010389610193669796,
"rps_doc_frac_chars_top_3gram": 0.012467529624700546,
"rps_doc_frac_chars_top_4gram": 0.0363636389374733,
"rps_doc_books_importance": -257.7982177734375,
"rps_doc_books_importance_length_correction": -257.7982177734375,
"rps_doc_openwebtext_importance": -141.67037963867188,
"rps_doc_openwebtext_importance_length_correction": -141.67037963867188,
"rps_doc_wikipedia_importance": -106.1079330444336,
"rps_doc_wikipedia_importance_length_correction": -106.1079330444336
},
"fasttext": {
"dclm": 0.06593441963195801,
"english": 0.7971460223197937,
"fineweb_edu_approx": 1.0080854892730713,
"eai_general_math": 0.17212015390396118,
"eai_open_web_math": 0.24577432870864868,
"eai_web_code": 0.033779799938201904
}
}
|
{
"free_decimal_correspondence": {
"primary": {
"code": "005.1",
"labels": {
"level_1": "General works, books and libraries, information sciences",
"level_2": "",
"level_3": "Computer programming"
}
},
"secondary": {
"code": "006.31",
"labels": {
"level_1": "General works, books and libraries, information sciences",
"level_2": "",
"level_3": "Cognitive science"
}
}
},
"bloom_cognitive_process": {
"primary": {
"code": "3",
"label": "Apply"
},
"secondary": {
"code": "2",
"label": "Understand"
}
},
"bloom_knowledge_domain": {
"primary": {
"code": "3",
"label": "Procedural"
},
"secondary": {
"code": "2",
"label": "Conceptual"
}
},
"document_type_v1": {
"primary": {
"code": "3",
"label": "Reference/Encyclopedic/Educational"
},
"secondary": {
"code": "4",
"label": "Code/Software"
}
},
"extraction_artifacts": {
"primary": {
"code": "0",
"label": "No Artifacts"
},
"secondary": {
"code": "3",
"label": "Irrelevant Content"
}
},
"missing_content": {
"primary": {
"code": "0",
"label": "No missing content"
},
"secondary": {
"code": "-1",
"label": "Abstain"
}
},
"document_type_v2": {
"primary": {
"code": "23",
"label": "Tutorial"
},
"secondary": {
"code": "8",
"label": "Documentation"
}
},
"reasoning_depth": {
"primary": {
"code": "2",
"label": "Basic Reasoning"
},
"secondary": {
"code": "3",
"label": "Intermediate Reasoning"
}
},
"technical_correctness": {
"primary": {
"code": "4",
"label": "Highly Correct"
},
"secondary": {
"code": "3",
"label": "Mostly Correct"
}
},
"education_level": {
"primary": {
"code": "3",
"label": "Undergraduate Level"
},
"secondary": {
"code": "2",
"label": "High School Level"
}
}
}
|
672f1e42c33a7f9846924a2431ea77df
|
-5,171,732,652,380,452,000
|
Keyword Overview looks at the entered term on its own and addresses expected searches per month, the difficulty of competing against Page 1 results for the same term, a rough estimate of organic click-through opportunities (versus paid ads and non-organic positions on the search engine results page), and the perceived priority that the user should assign to optimization for this term, where the higher the score, the higher the demand and a lowered level of competition.
Am I worried that my keyword research might not be effective since I only look at the KC score? No. Not really. Because I tend to target only the longer tail keywords these days. I don’t go after the huge main keywords anymore. They’re too hard to rank for. But long tail keywords are really easy to find with Long Tail Pro and they are usually much easier to rank for.
As a new customer trying to evaluate the software, I asked if my trial period could be extended once this fundamental issue was fixed, on the basis I couldn’t actually evaluate its requirements against my criteria. I was told this was not possible, which frankly, is very poor customer service. What’s the point of offering a trial period when customers are unable to fully test the software?
Here is the part of this post that we’ve all been waiting for. How to make Long Tail Pro pay for itself! I can tell you with absolute certainty that all of this isn’t just fluff designed to try to get you to buy the product. I’ve actually done all 4 of these things – and I continue to do the top 3 to this day! This stuff really works and I make WAY more than enough money, as a result of using Long Tail Pro, to pay for itself.
This is slightly more complicated than it used to be, because you have to actually create a live AdWords Campaign as part of the process! This puts many people off, as it looks as if you have to actually advertise in order to use the tool. You don’t — you can just setup the campaign and then pause it before it runs so you don’t have to spend a penny.
Tax implications vary by country and type of business sale, and more. I did an asset sale to try and take advantage of the lower capital gains tax rate as much as possible. Honestly, the reason we don’t talk about these things much is because I don’t want to give bad advice…I’m not an attorney or accountant, so everyone should seek out their own advice.
This is a rather crude metric because it presumes one can monetize all the traffic they receive AND one can generate as much profit per visitor as Google does. Anyone who could do both of those would likely displace Google as the first consumer destination in their market (like how many people in the United States start ecommerce searches on Amazon.com rather than Google.com).
2) SpyFu: I suggest to have paid account on SpyFu. I just need to find my competitors who using Adwords and review them using this tool. It will show me what ads and keywords they are using. Note that my competitor who paid for that particular keyword knows exactly that it is important for his business including recent trends. Also using SEO feature you can input any URL and find our which keywords they are ranking for.
Google's AdWords Keyword Planner tool is another common starting point for SEO keyword research. It not only suggests keywords and provides estimated search volume, but also predicts the cost of running paid campaigns for these terms. To determine volume for a particular keyword, be sure to set the Match Type to [Exact] and look under Local Monthly Searches. Remember that these represent total searches. Depending on your ranking and click-through rate, the actual number of visitors you achieve for these keywords will usually be much lower.
Do you want to learn how to perform stealth competitor research, find profitable keywords, audit paid ad campaigns, dissect your competitor's content strategies, perform backlink analysis, keyword rank tracking and identify site monetization opportunities? Download "The Ultimate SEMrush Playbook" below and get access to 34 stealth competitor research strategies...
1) SEMrush - I believe that among all the 3rd party software, SEMrush has the largest keyword database. Their search volume data is pretty accurate and aligns with the Google keyword planner. Also, based on the type of content that needs to be produced (i.e. informational, transactional, etc.), one can utilize different filtering options available in it.
Analyzing the current top 10 search results in Google is the most important part of keyword research. This is where you determine whether or not you can produce a webpage that can beat any or all of those results. The process is known as first page analysis – and it is by far the hardest process to understand and really figure out (especially when you first start out). Don’t worry though – Long Tail Pro has detailed and in-depth instructional videos available that show you exactly how to do this.
What are people looking for on your site? These terms are keywords in the vocabulary of your actual audience and should definitely be added to your keyword list. Do not forget to look at the keywords people filled in that didn’t get any results: this was stuff people were expecting but didn’t find. You can look into the results of your internal search in Google Analytics at Behavior → Site Search → Search Terms.
Long Tail Pro is a very useful piece of software for long tail keyword research. One of its best features is that you can carry out heavy analysis on the keywords of your choice, without being limited to only working with one or two at a time. It can provide you also with vast numbers of longtail keywords, or you can apply filters to find the precise keywords to fit your bill. And you can check your rankings at the same time!
This makes Google Suggest a relevant source for keyword research, it contains a large amount of organic keywords very closely related to a full or partial keyword and can be used to find additional most searched appending keywords that make the whole keyword less competitive. Google Suggest can be researched through the Google Search website or through a compatible browser for a small amount of keywords but also in large scale using free scraper tools.
Keyword Discovery is a paid subscription service that offers marketers the ability to see keyword data across multiple search engines. They maintain one of the largest databases of searches, (nearly 38 billion) which are compiled from over 50 different search engines. The search data shown is a record of the number of times the exact keyword or phrase has been searched over the last 12 months across all 50+ search engines. You would assume that the search volumes would be much larger than any other tool because of Keyword Discovery’s access to data from over 50 search engines, but the fact that the keyword matching option is set to exact, greatly reduces the total volume. Unlike Google’s tools, Keyword Discovery does not collect or show data relating to paid search, such as Suggested Bid, Cost per Click, and Competition. Data is collected daily, but updated monthly. Although you must pay the subscription to have access to all the features, Keyword Discovery does provide a free alternative.
As you can see, LongTailPro is pulling data from Google Adwords. WHAT?! So LTP uses a mix of their own massive data (launched in 2011) and data pulled via API from Majestic.com, Moz.com, and Google Adwords (http://adwords.google.com). Once you input your seed keywords, LongTailPro outputs suggested keywords related to your seed keywords, search volume, Adwords suggested bid, Adwords competition, total words, rank value, average keyword competition, language searched, and location searched.
Wordstream is a free keyword tool that makes it easy and fast to get those keywords that your business needs most in order to drive traffic through paid and organic search. All you need to do is enter a website URL or keyword and you will get hundreds of relevant keyword results that are tailored to your country or industry. Every keyword has an estimated CPC, competition score, and a proprietary opportunity score that will assist you in budgeting for your online campaigns. You can download your list in a CSV format and upload it in AdWords directly and begin to work on your new campaigns.
* Please note our tool currently assumes Google having ~ 83% of the market, with Bing + Yahoo! splitting the remaining 17% of the market. Actual market conditions may vary significantly from that due to a variety of factors including: search location, search market demographics, how much marketshare mobile search has relative to desktop in that particular vertical, etc.
Given you have a good idea of where to start and are fairly confident you are speaking the same language as your client, jump start research by generating related keyphrases and long tail variants with the ever so easy to use Google Autocomplete. This tool makes predictions based on what you are typing that are a reflection of Google search activity.
How do you figure out what keywords your competitors are ranking for, you ask? Aside from manually searching for keywords in an incognito browser and seeing what positions your competitors are in, SEMrush allows you to run a number of free reports that show you the top keywords for the domain you enter. This is a quick way to get a sense of the types of terms your competitors are ranking for.
As for the history of the company, as I explained, I created Long Tail Pro back in 2011. At the time, I was creating tons of niche sites and was doing alot of keyword research and content creation. I was trying to figure out what types of keywords would rank quickly in the search engines, specifically Google, and I was frustrated with the other keyword research tools (in particular Market Samurai) out there.
×
|
{
"url": "https://www.ninjatb.com/howtofindkeywordsforawebsite/how-to-find-keywords-on-macbook-2019-how-to-find-how-many-words-in-google-docs-2019.html",
"source_domain": "www.ninjatb.com",
"snapshot_id": "crawl=CC-MAIN-2019-47",
"warc_metadata": {
"Content-Length": "14276",
"Content-Type": "application/http; msgtype=response",
"WARC-Block-Digest": "sha1:7LYEXBD4TBM4KDAJKGPYHZGM7TPF5DTX",
"WARC-Concurrent-To": "<urn:uuid:89273765-a271-470f-8435-6ce0852ae2bd>",
"WARC-Date": "2019-11-20T19:20:04Z",
"WARC-IP-Address": "199.241.186.126",
"WARC-Identified-Payload-Type": "text/html",
"WARC-Payload-Digest": "sha1:DWIFT4JJ6P6U224TXB5OG347IXTHKRZO",
"WARC-Record-ID": "<urn:uuid:8d7d8c9e-4caf-4d9a-8fd7-877ad60333f5>",
"WARC-Target-URI": "https://www.ninjatb.com/howtofindkeywordsforawebsite/how-to-find-keywords-on-macbook-2019-how-to-find-how-many-words-in-google-docs-2019.html",
"WARC-Truncated": null,
"WARC-Type": "response",
"WARC-Warcinfo-ID": "<urn:uuid:6ba6baf9-4946-4d46-9fe9-eb0a7536af75>"
},
"warc_info": "isPartOf: CC-MAIN-2019-47\r\npublisher: Common Crawl\r\ndescription: Wide crawl of the web for November 2019\r\noperator: Common Crawl Admin (info@commoncrawl.org)\r\nhostname: ip-10-67-67-187.ec2.internal\r\nsoftware: Apache Nutch 1.16 (modified, https://github.com/commoncrawl/nutch/)\r\nrobots: checked via crawler-commons 1.1-SNAPSHOT (https://github.com/crawler-commons/crawler-commons)\r\nformat: WARC File Format 1.1\r\nconformsTo: http://iipc.github.io/warc-specifications/specifications/warc-format/warc-1.1/"
}
|
{
"line_start_idx": [
0,
1,
475,
845,
1238,
1239,
1669,
2022,
2378,
2758,
3182,
3728,
3729,
4096,
4453,
4955,
5371,
5372,
5804,
5805,
6262,
6263,
6264,
7269,
7270,
7765,
8363,
8364,
8737,
8738,
8739,
9092,
9488,
9902
],
"line_end_idx": [
1,
475,
845,
1238,
1239,
1669,
2022,
2378,
2758,
3182,
3728,
3729,
4096,
4453,
4955,
5371,
5372,
5804,
5805,
6262,
6263,
6264,
7269,
7270,
7765,
8363,
8364,
8737,
8738,
8739,
9092,
9488,
9902,
9903
]
}
|
{
"red_pajama_v2": {
"ccnet_original_length": 9903,
"ccnet_original_nlines": 33,
"rps_doc_curly_bracket": 0,
"rps_doc_ldnoobw_words": 0,
"rps_doc_lorem_ipsum": 0,
"rps_doc_stop_word_fraction": 0.4431818127632141,
"rps_doc_ut1_blacklist": 0,
"rps_doc_frac_all_caps_words": 0.017561979591846466,
"rps_doc_frac_lines_end_with_ellipsis": 0.029411759227514267,
"rps_doc_frac_no_alph_words": 0.11828511953353882,
"rps_doc_frac_unique_words": 0.3674911558628082,
"rps_doc_mean_word_length": 4.703769207000732,
"rps_doc_num_sentences": 88,
"rps_doc_symbol_to_word_ratio": 0.0010330600198358297,
"rps_doc_unigram_entropy": 5.662530899047852,
"rps_doc_word_count": 1698,
"rps_doc_frac_chars_dupe_10grams": 0,
"rps_doc_frac_chars_dupe_5grams": 0.007011389825493097,
"rps_doc_frac_chars_dupe_6grams": 0,
"rps_doc_frac_chars_dupe_7grams": 0,
"rps_doc_frac_chars_dupe_8grams": 0,
"rps_doc_frac_chars_dupe_9grams": 0,
"rps_doc_frac_chars_top_2gram": 0.009014650247991085,
"rps_doc_frac_chars_top_3gram": 0.008263429626822472,
"rps_doc_frac_chars_top_4gram": 0.0042569199576973915,
"rps_doc_books_importance": -868.5645751953125,
"rps_doc_books_importance_length_correction": -868.5645751953125,
"rps_doc_openwebtext_importance": -525.4464111328125,
"rps_doc_openwebtext_importance_length_correction": -525.4464111328125,
"rps_doc_wikipedia_importance": -415.9560241699219,
"rps_doc_wikipedia_importance_length_correction": -415.9560241699219
},
"fasttext": {
"dclm": 0.18743515014648438,
"english": 0.9418482780456543,
"fineweb_edu_approx": 1.2923578023910522,
"eai_general_math": 0.32750266790390015,
"eai_open_web_math": 0.16177576780319214,
"eai_web_code": 0.13566148281097412
}
}
|
{
"free_decimal_correspondence": {
"primary": {
"code": "005.4",
"labels": {
"level_1": "General works, books and libraries, information sciences",
"level_2": "",
"level_3": "Computer programming"
}
},
"secondary": {
"code": "658.87",
"labels": {
"level_1": "Industrial arts, Technology, and Engineering",
"level_2": "Business",
"level_3": "Management"
}
}
},
"bloom_cognitive_process": {
"primary": {
"code": "3",
"label": "Apply"
},
"secondary": {
"code": "4",
"label": "Analyze"
}
},
"bloom_knowledge_domain": {
"primary": {
"code": "3",
"label": "Procedural"
},
"secondary": {
"code": "2",
"label": "Conceptual"
}
},
"document_type_v1": {
"primary": {
"code": "3",
"label": "Reference/Encyclopedic/Educational"
},
"secondary": {
"code": "6",
"label": "Promotional/Advertisement"
}
},
"extraction_artifacts": {
"primary": {
"code": "3",
"label": "Irrelevant Content"
},
"secondary": {
"code": "0",
"label": "No Artifacts"
}
},
"missing_content": {
"primary": {
"code": "1",
"label": "Truncated Snippets"
},
"secondary": {
"code": "4",
"label": "Missing Images or Figures"
}
},
"document_type_v2": {
"primary": {
"code": "16",
"label": "Personal Blog"
},
"secondary": {
"code": "10",
"label": "Knowledge Article"
}
},
"reasoning_depth": {
"primary": {
"code": "3",
"label": "Intermediate Reasoning"
},
"secondary": {
"code": "2",
"label": "Basic Reasoning"
}
},
"technical_correctness": {
"primary": {
"code": "3",
"label": "Mostly Correct"
},
"secondary": {
"code": "4",
"label": "Highly Correct"
}
},
"education_level": {
"primary": {
"code": "2",
"label": "High School Level"
},
"secondary": {
"code": "1",
"label": "General Audience"
}
}
}
|
672f1e42c33a7f9846924a2431ea77df
|
-7,604,608,645,540,383,000
|
mailto: blog -at- heyrick -dot- eu
!ESP32Cam application for RISC OS
Thursday was a public holiday, and we "fait un pont" on Friday, which means we took that day off to have a long weekend. Since the weather was unpleasant those two days, I decided to put together a little application for RISC OS to interface with the default firmware of the ESP32-CAM module.
ESP32Cam screenshot
Example of !ESP32Cam.
The problem is that the new (and capable) Iris browser is not currently widely available (without purchasing something else). The Otter and QupZilla browsers are massive (you won't get these running on an original 256MiB Pi1. I suspect Iris will be equally massive as it is based on WebKit which is not small.
None of the older browsers (namely NetSurf or anything from the 26 bit era) aren't up to the scripting required to implement the UI offered by the camera.
Thankfully the device itself uses standard HTTP requests, so creating a RISC OS application basically meant recreating the UI and an image viewer. This wasn't difficult, just fiddly because the full toolbar has loads of options (as does the camera's web UI).
What you see in the above picture is the mini toolbar. A much larger one opens when the application starts. Click on Capture whilst holding Alt and the program will switch between the large and small toolbars.
Actually, if you only need access to the Capture button, you don't need the toolbar at all, clicking the viewer will fetch a new image.
In the course of writing this, I discovered a few quirks in the camera's default firmware.
• What "Raw GMA" means is gamma correction applied to the raw pixel data (before it has been converted to, say, YUV). This is to attempt to provide a correction to the non-linear response of the imager.
• The camera seems to, from time to time, get stuck in a mode where everything is overly bright and washed out. This happens when fiddling with the settings. I'm not sure what exactly triggers it, but I've noticed that turning the colour bars on and off a few times (with at least fifteen seconds between states) often nudges the camera to return images that look better and aren't washed out.
• High contrast images in UXGA mode (full resolution) with a high quality setting may result in corrupt (incomplete) images being returned. This is because the camera allocates 384,000 bytes for the image buffer, and if the image data is larger, anything more is discarded. There is a fix for this, but it means modifying and rebuilding the camera's firmware.
While the my software will permit quality settings down to 5, it is recommended to stick to 10 (as does the web UI) unless you know the image will fit. The difference is... minimal. Setting the quality to five will give a much larger file than setting it to ten, and you'll likely find there's little visible difference. Certainly, other deficiencies of the imager (especially related to bright light) will be more important than anything the extra '5' in the quality setting would gain.
• Sometimes fetching an image will cause some random junk to be suffixed to the end of the image data. My program will detect this and adjust the image data size so the image is saved without the junk.
• The DCW option, when on causes images to be returned in the selected size (such as, for example, VGA 640×480). If DCW is off, then the images will be returned in the raw size as read from the imager. There are three sizes - 1600×1200 when every pixel is read, 800×600 when every other pixel is read, and 400×296 when every fourth pixel is read.
So what is happening here is that if you choose VGA, it will read SVGA (800×600) and rescale that to 640×480 to be the selected VGA size. It does not scale everything down from 1600×1200.
However, if DCW is off, the the rescaling is not done. If you ask for a VGA image, you'll get an SVGA one.
Now, the bug is that choosing a new image frame size implicitly enables the DCW option so that you get the size you asked for. However this is not reflected in the UI or indeed in the camera settings. My software will flag the option as having been turned on, but it only does this locally. Resyncing the camera with the toolbar (as in clicking on the iconbar icon) will flip this setting off if it was previously off, even if it's actually on...
It's a firmware bug.
• There is a bright "flash" LED on the board, but there's no UI element to turn this LED on or off. Worse, it seems that this LED shares an I/O pin with the SD card, so it'll blink should you add in the ability to access the SD card interface.
• Face recognition is not supported in my software. I have two different ESP32-CAM modules, neither appears to support face recognition.
Soon an amplifier
I made myself a lemon cake. I know I have a little electric oven, but I don't expect a 15-20 minute bake (as mentioned on the pack) to take around 50 minutes, and still the cake turned out sad.
While I was waiting, I took a look on Amazon for an oven thermometer, because I'm not convinced that putting the setting between 150 and 200 to get 175°C means that the actual oven temperature is anything close to 175°C.
So I got a cheap little thermometer to put into the oven. It's going from China, so...
While I was standing in the kitchen, and listening to Polly on the CD player, I decided to see how I felt about the amplifier that I mentioned in the previous b.log entry.
What I really wanted was one with an equaliser, but they were expensive, so I'd have to stick with something simpler that only had controls for bass and treble.
I happened to stumble across a similar model with two line inputs for just two euros more. The model number is BT-309A, and interestingly searching for that reference shows people trying to flog these for around €75. The one I was looking at was €32.
BT-309A amplifier
BT-309A amplifier front and back.
Thankfully the blurb doesn't lie. Quite often you'll see these little Chinese amplifiers promoted as "800W!". That figure is derived from the peak maximum output power multiplied by two (because stereo). In reality, the actual sustained output power is something much more sedate. The blurb says 60W RMS into 4Ω. However since my speakers are 8Ω, that'll be ~30W RMS. However these ratings will be when cranking out on max.
Bear in mind, my current setup is a CD player outputting 1W RMS, so anything will be an improvement.
Furthermore, audio "loudness" is a logarithmic thing. Ten times as many watts means twice as loud (not ten times as loud). So 10W will be twice as loud as the CD player. 30W will be... taking a guess as I can't be bothered doing the maths, about 21/3 times as loud. Which ought to be plenty. I want to appreciate the bass, not scare the wildlife!
There's an SD card slot, a USB interface, an FM radio, a Bluetooth receiver (for phones), and two line level inputs. It was the latter that sold me on this amplifier. I can build myself a second NetRadio to plug into the amplifier (maybe power it from the USB socket?), and have an input for something else (the CD player? the record player?).
I'm not an audiophile by any means, so I'm just looking for something to drive the speakers properly, with the ability to adjust the audio profile, and of course a useful selection of inputs.
Amazon promises it'll be here on Tuesday...
...but, damn, that was one expensive cake! ☺
Let them eat cake
Let them eat brioche cake.
Melons and potatoes
Well, the melons have not come up yet. The weather hasn't been great, but it's not that bad. A quick poke around, it looks like there are roots, so I'll just have to be patient.
Unfortunately I suffered a sunflower disaster. Several poked their heads up, and then there were pieces... I rather suspect a bird saw them and was like "oh, free food!".
I've kept the little dirt-filled dish, but I'm not entirely sure there are any seeds still in it.
The potatoes, on the other hand, are growing vigorously. Today I earthed them up for a second time. Now they really look like elongated burial mounds. When people talked about earthing up, they neglected to mention the part about shifting half the garden from here to there.
This time...
Earthing up
Earthing up.
It took three fills per row. And of course, the furries weren't interested in helping out.
FEED ME!
FEED ME!
I'm regretting calling her Wawa. The number of times she shouts FEED ME! (including right after having been fed), I reckon I should have called her Audrey.
Thunderstorms
We've had a number of thunderstorms forecast recently. When I'm not here, I switch the computers off and throw the breakers, and unplug the Livebox.
A recent comment section in The Guardian when talking about peeves in TV and films, somebody pointed out that they got annoyed by "constant lightning instead of the one flash every minute or 5 you get in real life".
The thing is, compared to the sorts of storms that have passed over here, those in the south of England are tame. The storms I remember from the UK were usually cloud to cloud lighting, very few ground strikes, and maybe one flash every few minutes.
By comparison, over here can be some spectacular thunderstorms. The big storm that flooded Boscastle in 2004 passed overhead like a wild strobe light. One flash every minute? Try one every second. The thunder literally did not stop. These storms come with torrential rain.
I have noticed that the storms that are preceded by violent winds often bring a number of ground strikes (those that roll in with only small gusts or even little wind seem to be more cloud-based lightning).
Of all of the thunderstorms that have been forecast, only two have actually passed over. There seems to be a geographical oddity where they seem to build and follow the Mayenne river (about 35-40km to the east) heading northwards.
This is quite a common sight.
Storms up the Mayenne
Storms up the Mayenne.
Yes, that storm raged. I'm glad it didn't pass overhead!
Guess what, the sky has gone suspiciously dark in the past five minutes. Okay, it's gusting strongly and has turned into a downpour. It was sunny just a few minutes ago!
Hopefully it'll just be rain, and not a thunderstorm, although those are forecast too.
Kind of glad I got the potatoes done earlier!
And... by the time I've written this, the sun is out and there's water pouring off of everything.
Residency permit
I finally have my appointment to go up to the prefecture in Rennes to sort out my residency permit, a necessity now because of Bloody Brexit.
It's just before 2pm on Tuesday 25th of May.
Now, I don't want to drive to Rennes because... let's just say that I've been up to the hospital (Pontchaillou) a number of times with mom, and even the professional taxi drivers would swear at the amount of stupid. A little toy car with a driver who has never handled anything more complicated than Châteaubriant during relatively calm weekends? It would be like a young child in a lagoon full of hungry sharks...
I had originally looked at the local train line. Well, I'd have to drive half way to Rennes because they've torn up a lot of the railing because it was in such a poor state. If they have any brains at all, they would strip it all out and replace it with the rails necessary for the Nantes Tram-Train (I believe it's a different width) and run a regular service directly between Rennes and Nantes. The tram train currently only comes as far north as Châteaubriant - mom and I went on it with Mick (ye gods, six years ago!).
Anyway, the local line seemed to be a schools train. Early morning, lunchtime, and evening. Not so useful.
My former line manager (I don't work in production any more) asked why I was looking at that route? Wouldn't it be simpler to get a train in Vitré?
Uh... yeah.
I had planned to go to Vitré and catch the TER to Rennes. However, with a bit of shuffling (and making it an all day expedition), I think I might have found a solution where I can leave my car at work (I'll have to ask, but I don't think they'll have a problem with it) and do the rest on public transport.
I'll need to wake at 6am to leave here at 7am. Because I'm not sure about the availability of toilets, I'll needs to do this without tea in me. Oh boy.
Get to work for around half seven, to walk across town (it's not a big town) to catch a bus to Vitré at 8am.
It will get there just before 9am. Ther are two trains to Rennes. A stopping service that leaves at 9.02am. I don't know if I'll make that, the timing will be tight.
Failing that, there's a straight-through service at 9.41am.
I'll need to check (tomorrow?) if the bus is actually running. Nothing on the internet indicated it wasn't, but given Covid... The "plan B" if the train isn't running is a train that leaves Vitré at 11.41am. I don't really want to drive into Vitré, so fingers crossed for the bus.
The trains will get into Rennes at 9.33am/10am/12pm (depending which I take) which will leave plenty of time to head into the bowels of the planet to catch the Metro to Pontchaillou. Everybody tells me I should go on to Villejean (the university) and get a bus to the prefecture, however when mom went up for her driving licence, it coincided with something at the hospital, so we simply cut through a path that goes through a sports centre that seems attached to a rather ugly senior school. Up a hill, across a road, and the prefecture is the big concrete monstrosity on the left. It's about 800 metres walk. Should take about ten minutes (allow 15 as it's uphill and no tea!).
Either way, I ought to be there for about 1pm. Best to be early as we had a pretty intensive bag search the last time we went.
I'm not sure how long this will take. For mom's driving licence, they were seriously behind, and it wasn't helped by some twat shouting at them, or the fact of mom's nationality which caused some confusion until a boss said "British passport, she's British, the end".
I have a return (straight) train leaving Rennes at 2.57pm (arriving at 3.17pm), which might be a bit optimistic. The next one is a stopping service leaving at 4.18pm and arriving at 4.53pm. There's another literally three minutes later, and yet another eighteen minutes later.
The problem here is the earliest of the three arrives in Vitré at 4.53pm and the bus back leaves at 4.55pm. I will be blown away if I actually make that bus! The timing is way too tight. At least, in my favour, the train ought to be on the left rail, so on the right side of the station. So if I leg it out of the train and through the station, I can watch the bus leaving the car park......
The bus, should I manage to catch it, will arrive at the town I work in at around half five. I think on my walk back, I'll swing by the supermarket to pick up something special for dinner, then drive home, collapse in a heap, etc.
Should I miss the bus, the next one leaves at 6.20pm, to get to where I want to be at 7pm. Thankfully curfew will be (as of Monday) 9pm rather than 7pm. I doubt I'll be able to swing by the supermarket. It closes at 7.30pm, so by the time I get there, there would be literally minutes. Instead, go get my car, go home, collapse in a heap, etc.
It'll be a long day, for sure, however assuming everything goes to plan (always a phrase to cause everything to go wrong!), it looks like I'd only need to drive to work...and spend a lot of time watching Netflix on my phone while waiting...waiting...waiting... I'd better remember to pack the backup battery, I may need it. ☺
I won't eat anything the night before either. Don't want anything to risk messing with my stomach. This appointment is a one-off and cannot be changed.
So... I rather suspect I'll come home, feed the cats, one-shot a cuppa, then go straight to bed.
I'm not sure what would mess me up the most. The early morning start, the lack of tea, or all the people. 😱
Still, at least I now have an appointment so my application has made it through the system and been accepted. It looks like I'll need to hand over my passport for checking (yes, I'm really British but if you ask I'll say I'm Scottish!) and a recent identity photo; and then they will take more photos and fingerprints and... I'll get my "permanent" 10 year residency permit. Probably by post, not there and then.
Next year, I will need to renew my passport. That will be fun, too. I wanted to do it a couple of years ago but mom vetoed that because she didn't have the money to apply for hers early. So I'm going to get some "rule Brittania" blue piece of crap. Lovely.
Your comments:
Please note that while I check this page every so often, I am not able to control what users write; therefore I disclaim all liability for unpleasant and/or infringing and/or defamatory material. Undesired content will be removed as soon as it is noticed. By leaving a comment, you agree not to post material that is illegal or in bad taste, and you should be aware that the time and your IP address are both recorded, should it be necessary to find out who you are. Oh, and don't bother trying to inline HTML. I'm not that stupid! ☺ ADDING COMMENTS DOES NOT WORK IF READING TRANSLATED VERSIONS.
You can now follow comment additions with the comment RSS feed. This is distinct from the b.log RSS feed, so you can subscribe to one or both as you wish.
No comments yet...
Add a comment (v0.10b) [help?] . . . try the comment feed!
Your name
Your email (optional)
Validation Are you real? Please type 73230 backwards.
Your comment
French flagSpanish flagJapanese flag
Calendar
« May 2021 »
MonTueWedThuFriSatSun
1
34568
101112131415
171819
242526272930
(Felicity? Marte? Find out!)
Last 5 entries
List all b.log entries
Return to the site index
Geekery
Search
Search Rick's b.log!
PS: Don't try to be clever.
It's a simple substring match.
Etc...
Thank you:
• Fred
• Bernard
• Michael
• David
Last read at 04:50 on 2022/07/05.
QR code
Valid HTML 4.01 Transitional
Valid CSS
Valid RSS 2.0
© 2021 Rick Murray
This web page is licenced for your personal, private, non-commercial use only. No automated processing by advertising systems is permitted.
RIPA notice: No consent is given for interception of page transmission.
Have you noticed the watermarks on pictures?
Next entry - 2021/05/20
Return to top of page
|
{
"url": "https://heyrick.eu/blog/index.php?diary=20210516",
"source_domain": "heyrick.eu",
"snapshot_id": "crawl=CC-MAIN-2022-27",
"warc_metadata": {
"Content-Length": "42345",
"Content-Type": "application/http; msgtype=response",
"WARC-Block-Digest": "sha1:SOM7SJLVU6OS6UVRYJ6G4RSAWKMER5P3",
"WARC-Concurrent-To": "<urn:uuid:88f46fe2-7677-4878-88c1-bb7f6d203a1e>",
"WARC-Date": "2022-07-05T02:50:47Z",
"WARC-IP-Address": "193.33.179.237",
"WARC-Identified-Payload-Type": "text/html",
"WARC-Payload-Digest": "sha1:LPSITFNPHUNFJX65L5HHUL5CJ6HJNMOK",
"WARC-Record-ID": "<urn:uuid:65812c1d-ae2d-47e4-9bc4-dd9d138f723e>",
"WARC-Target-URI": "https://heyrick.eu/blog/index.php?diary=20210516",
"WARC-Truncated": null,
"WARC-Type": "response",
"WARC-Warcinfo-ID": "<urn:uuid:219b893e-347d-49c5-993c-7ee49aed593f>"
},
"warc_info": "isPartOf: CC-MAIN-2022-27\r\npublisher: Common Crawl\r\ndescription: Wide crawl of the web for June/July 2022\r\noperator: Common Crawl Admin (info@commoncrawl.org)\r\nhostname: ip-10-67-67-153\r\nsoftware: Apache Nutch 1.18 (modified, https://github.com/commoncrawl/nutch/)\r\nrobots: checked via crawler-commons 1.3-SNAPSHOT (https://github.com/crawler-commons/crawler-commons)\r\nformat: WARC File Format 1.1\r\nconformsTo: https://iipc.github.io/warc-specifications/specifications/warc-format/warc-1.1/"
}
|
{
"line_start_idx": [
0,
35,
36,
70,
71,
364,
365,
385,
407,
408,
718,
873,
874,
1133,
1134,
1344,
1480,
1481,
1483,
1484,
1575,
1576,
1781,
2177,
2539,
3031,
3235,
3584,
3776,
3887,
4338,
4363,
4609,
4748,
4749,
4751,
4752,
4770,
4771,
4965,
5186,
5273,
5274,
5446,
5607,
5608,
5859,
5860,
5878,
5912,
5913,
6337,
6438,
6785,
6786,
7130,
7131,
7323,
7324,
7368,
7369,
7414,
7415,
7433,
7460,
7461,
7463,
7464,
7484,
7485,
7663,
7664,
7835,
7933,
7934,
8209,
8222,
8223,
8235,
8248,
8249,
8340,
8341,
8350,
8359,
8360,
8516,
8517,
8519,
8520,
8534,
8535,
8684,
8685,
8901,
9151,
9152,
9425,
9426,
9633,
9634,
9865,
9895,
9896,
9918,
9941,
9942,
9999,
10000,
10170,
10171,
10258,
10304,
10305,
10403,
10404,
10406,
10407,
10424,
10425,
10567,
10568,
10613,
10614,
11029,
11030,
11553,
11554,
11556,
11557,
11664,
11812,
11813,
11825,
11826,
12133,
12134,
12286,
12287,
12396,
12562,
12622,
12623,
12904,
12905,
13585,
13586,
13713,
13714,
13982,
13983,
14260,
14652,
14653,
14884,
14885,
15229,
15230,
15232,
15233,
15559,
15560,
15712,
15809,
15917,
15918,
15920,
15921,
16334,
16335,
16592,
16593,
16595,
16596,
16598,
16599,
16614,
16615,
17211,
17213,
17368,
17369,
17388,
17389,
17448,
17458,
17480,
17534,
17547,
17584,
17593,
17610,
17632,
17639,
17645,
17658,
17665,
17678,
17685,
17686,
17715,
17716,
17731,
17732,
17755,
17756,
17781,
17782,
17790,
17791,
17798,
17799,
17820,
17821,
17849,
17880,
17881,
17888,
17889,
17900,
17909,
17921,
17933,
17943,
17944,
17978,
17979,
17987,
17988,
17989,
18018,
18028,
18042,
18043,
18045,
18046,
18065,
18205,
18277,
18278,
18280,
18281,
18326,
18350
],
"line_end_idx": [
35,
36,
70,
71,
364,
365,
385,
407,
408,
718,
873,
874,
1133,
1134,
1344,
1480,
1481,
1483,
1484,
1575,
1576,
1781,
2177,
2539,
3031,
3235,
3584,
3776,
3887,
4338,
4363,
4609,
4748,
4749,
4751,
4752,
4770,
4771,
4965,
5186,
5273,
5274,
5446,
5607,
5608,
5859,
5860,
5878,
5912,
5913,
6337,
6438,
6785,
6786,
7130,
7131,
7323,
7324,
7368,
7369,
7414,
7415,
7433,
7460,
7461,
7463,
7464,
7484,
7485,
7663,
7664,
7835,
7933,
7934,
8209,
8222,
8223,
8235,
8248,
8249,
8340,
8341,
8350,
8359,
8360,
8516,
8517,
8519,
8520,
8534,
8535,
8684,
8685,
8901,
9151,
9152,
9425,
9426,
9633,
9634,
9865,
9895,
9896,
9918,
9941,
9942,
9999,
10000,
10170,
10171,
10258,
10304,
10305,
10403,
10404,
10406,
10407,
10424,
10425,
10567,
10568,
10613,
10614,
11029,
11030,
11553,
11554,
11556,
11557,
11664,
11812,
11813,
11825,
11826,
12133,
12134,
12286,
12287,
12396,
12562,
12622,
12623,
12904,
12905,
13585,
13586,
13713,
13714,
13982,
13983,
14260,
14652,
14653,
14884,
14885,
15229,
15230,
15232,
15233,
15559,
15560,
15712,
15809,
15917,
15918,
15920,
15921,
16334,
16335,
16592,
16593,
16595,
16596,
16598,
16599,
16614,
16615,
17211,
17213,
17368,
17369,
17388,
17389,
17448,
17458,
17480,
17534,
17547,
17584,
17593,
17610,
17632,
17639,
17645,
17658,
17665,
17678,
17685,
17686,
17715,
17716,
17731,
17732,
17755,
17756,
17781,
17782,
17790,
17791,
17798,
17799,
17820,
17821,
17849,
17880,
17881,
17888,
17889,
17900,
17909,
17921,
17933,
17943,
17944,
17978,
17979,
17987,
17988,
17989,
18018,
18028,
18042,
18043,
18045,
18046,
18065,
18205,
18277,
18278,
18280,
18281,
18326,
18350,
18371
]
}
|
{
"red_pajama_v2": {
"ccnet_original_length": 18371,
"ccnet_original_nlines": 243,
"rps_doc_curly_bracket": 0,
"rps_doc_ldnoobw_words": 1,
"rps_doc_lorem_ipsum": 0,
"rps_doc_stop_word_fraction": 0.4302808344364166,
"rps_doc_ut1_blacklist": 0,
"rps_doc_frac_all_caps_words": 0.04908424988389015,
"rps_doc_frac_lines_end_with_ellipsis": 0.03278689086437225,
"rps_doc_frac_no_alph_words": 0.1804639846086502,
"rps_doc_frac_unique_words": 0.3420413136482239,
"rps_doc_mean_word_length": 4.310753345489502,
"rps_doc_num_sentences": 252,
"rps_doc_symbol_to_word_ratio": 0.005616609938442707,
"rps_doc_unigram_entropy": 6.05588436126709,
"rps_doc_word_count": 3292,
"rps_doc_frac_chars_dupe_10grams": 0,
"rps_doc_frac_chars_dupe_5grams": 0.0031005600467324257,
"rps_doc_frac_chars_dupe_6grams": 0.0031005600467324257,
"rps_doc_frac_chars_dupe_7grams": 0,
"rps_doc_frac_chars_dupe_8grams": 0,
"rps_doc_frac_chars_dupe_9grams": 0,
"rps_doc_frac_chars_top_2gram": 0.00493270019069314,
"rps_doc_frac_chars_top_3gram": 0.002536820014938712,
"rps_doc_frac_chars_top_4gram": 0.002818689914420247,
"rps_doc_books_importance": -2229.63720703125,
"rps_doc_books_importance_length_correction": -2229.63720703125,
"rps_doc_openwebtext_importance": -998.198974609375,
"rps_doc_openwebtext_importance_length_correction": -998.198974609375,
"rps_doc_wikipedia_importance": -896.8903198242188,
"rps_doc_wikipedia_importance_length_correction": -896.8903198242188
},
"fasttext": {
"dclm": 0.12317317724227905,
"english": 0.9659255743026733,
"fineweb_edu_approx": 1.2734763622283936,
"eai_general_math": 0.2713070511817932,
"eai_open_web_math": 0.3565712571144104,
"eai_web_code": 0.0631791427731514
}
}
|
{
"free_decimal_correspondence": {
"primary": {
"code": "004.028563",
"labels": {
"level_1": "General works, books and libraries, information sciences",
"level_2": "",
"level_3": "Computers and Computer science"
}
},
"secondary": {
"code": "621.392",
"labels": {
"level_1": "Industrial arts, Technology, and Engineering",
"level_2": "Engineering",
"level_3": "Mechanical engineering and Machinery"
}
}
},
"bloom_cognitive_process": {
"primary": {
"code": "3",
"label": "Apply"
},
"secondary": {
"code": "2",
"label": "Understand"
}
},
"bloom_knowledge_domain": {
"primary": {
"code": "3",
"label": "Procedural"
},
"secondary": {
"code": "2",
"label": "Conceptual"
}
},
"document_type_v1": {
"primary": {
"code": "9",
"label": "Personal/Misc"
},
"secondary": {
"code": "-1",
"label": "Abstain"
}
},
"extraction_artifacts": {
"primary": {
"code": "3",
"label": "Irrelevant Content"
},
"secondary": {
"code": "0",
"label": "No Artifacts"
}
},
"missing_content": {
"primary": {
"code": "0",
"label": "No missing content"
},
"secondary": {
"code": "4",
"label": "Missing Images or Figures"
}
},
"document_type_v2": {
"primary": {
"code": "16",
"label": "Personal Blog"
},
"secondary": {
"code": "8",
"label": "Documentation"
}
},
"reasoning_depth": {
"primary": {
"code": "2",
"label": "Basic Reasoning"
},
"secondary": {
"code": "3",
"label": "Intermediate Reasoning"
}
},
"technical_correctness": {
"primary": {
"code": "3",
"label": "Mostly Correct"
},
"secondary": {
"code": "4",
"label": "Highly Correct"
}
},
"education_level": {
"primary": {
"code": "2",
"label": "High School Level"
},
"secondary": {
"code": "1",
"label": "General Audience"
}
}
}
|
672f1e42c33a7f9846924a2431ea77df
|
-7,523,045,454,851,138,000
|
Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
0 votes
751 views
in Q2A Core by
edited by
Which php file retrieves the posted content?
In my case, I want to see how the content is sanitized and modified.
My goal: I like to remove stuff from HTML that is posted. E.g. style tags such as "line-height" that get into the question/answer when copied from another site.
For now, I am using regex in the ckeditor's javascript to remove some of the style attributes, and yes, you should not do that (thousand times said on stackoverflow...)
Q2A version: 1.5.1
1 Answer
0 votes
by
In qa-base.php I found function qa_sanitize_html that "returns $html after ensuring it is safe, i.e. removing Javascripts and the like - uses htmLawed library"
just a test post to add some html + js code, hope it gets cleaned by q2a. I copied the html directly:
... to the left is html with the class qa-waiting
new line:
red background with pseudo class
now comes a javascript alert:
that's it for now!
---
source from above:
<SPAN ID="qa-waiting-template" CLASS="qa-waiting">...</SPAN> to the left is html with the class qa-waiting
<br >new line:<br /><br />
<p class="" style="background-color:#FFAAAA">red background with pseudo class</p>
<br />
now comes a javascript alert:
<script type="text/javascript">alert("javascript injection")</script>
<br />
that's it for now!
...
|
{
"url": "https://www.question2answer.org/qa/17780/is-posted-html-content-sanitized-what-file-is-doing-it?show=17800",
"source_domain": "www.question2answer.org",
"snapshot_id": "crawl=CC-MAIN-2022-27",
"warc_metadata": {
"Content-Length": "28236",
"Content-Type": "application/http; msgtype=response",
"WARC-Block-Digest": "sha1:KY662RLA4UQOENY5CZ37PQGQNNOTEQIY",
"WARC-Concurrent-To": "<urn:uuid:f193c1da-1fa0-42bd-aceb-a333b21112e8>",
"WARC-Date": "2022-07-06T20:20:20Z",
"WARC-IP-Address": "185.14.187.28",
"WARC-Identified-Payload-Type": "text/html",
"WARC-Payload-Digest": "sha1:X3OOJ3GWAML6EOEUDYUOAZS5RQSIJOD5",
"WARC-Record-ID": "<urn:uuid:514d07ec-afdd-48e5-9e0d-e92611936f42>",
"WARC-Target-URI": "https://www.question2answer.org/qa/17780/is-posted-html-content-sanitized-what-file-is-doing-it?show=17800",
"WARC-Truncated": null,
"WARC-Type": "response",
"WARC-Warcinfo-ID": "<urn:uuid:90407a14-48dc-459c-98de-0e0e551c7b04>"
},
"warc_info": "isPartOf: CC-MAIN-2022-27\r\npublisher: Common Crawl\r\ndescription: Wide crawl of the web for June/July 2022\r\noperator: Common Crawl Admin (info@commoncrawl.org)\r\nhostname: ip-10-67-67-49\r\nsoftware: Apache Nutch 1.18 (modified, https://github.com/commoncrawl/nutch/)\r\nrobots: checked via crawler-commons 1.3-SNAPSHOT (https://github.com/crawler-commons/crawler-commons)\r\nformat: WARC File Format 1.1\r\nconformsTo: https://iipc.github.io/warc-specifications/specifications/warc-format/warc-1.1/"
}
|
{
"line_start_idx": [
0,
88,
96,
106,
121,
131,
132,
177,
178,
247,
248,
409,
410,
579,
580,
582,
583,
602,
603,
612,
613,
621,
624,
625,
786,
788,
789,
790,
892,
893,
943,
953,
955,
956,
989,
990,
991,
1021,
1040,
1041,
1045,
1046,
1065,
1066,
1173,
1200,
1282,
1289,
1319,
1389,
1396,
1415,
1416
],
"line_end_idx": [
88,
96,
106,
121,
131,
132,
177,
178,
247,
248,
409,
410,
579,
580,
582,
583,
602,
603,
612,
613,
621,
624,
625,
786,
788,
789,
790,
892,
893,
943,
953,
955,
956,
989,
990,
991,
1021,
1040,
1041,
1045,
1046,
1065,
1066,
1173,
1200,
1282,
1289,
1319,
1389,
1396,
1415,
1416,
1419
]
}
|
{
"red_pajama_v2": {
"ccnet_original_length": 1419,
"ccnet_original_nlines": 52,
"rps_doc_curly_bracket": 0,
"rps_doc_ldnoobw_words": 0,
"rps_doc_lorem_ipsum": 0,
"rps_doc_stop_word_fraction": 0.33136093616485596,
"rps_doc_ut1_blacklist": 0,
"rps_doc_frac_all_caps_words": 0.047337278723716736,
"rps_doc_frac_lines_end_with_ellipsis": 0.018867919221520424,
"rps_doc_frac_no_alph_words": 0.26923078298568726,
"rps_doc_frac_unique_words": 0.5900900959968567,
"rps_doc_mean_word_length": 4.698198318481445,
"rps_doc_num_sentences": 19,
"rps_doc_symbol_to_word_ratio": 0.01479289960116148,
"rps_doc_unigram_entropy": 4.619788646697998,
"rps_doc_word_count": 222,
"rps_doc_frac_chars_dupe_10grams": 0,
"rps_doc_frac_chars_dupe_5grams": 0.115052729845047,
"rps_doc_frac_chars_dupe_6grams": 0.06903164088726044,
"rps_doc_frac_chars_dupe_7grams": 0.06903164088726044,
"rps_doc_frac_chars_dupe_8grams": 0.06903164088726044,
"rps_doc_frac_chars_dupe_9grams": 0.06903164088726044,
"rps_doc_frac_chars_top_2gram": 0.0143815902993083,
"rps_doc_frac_chars_top_3gram": 0.01725791022181511,
"rps_doc_frac_chars_top_4gram": 0.02109299972653389,
"rps_doc_books_importance": -131.18946838378906,
"rps_doc_books_importance_length_correction": -130.3485565185547,
"rps_doc_openwebtext_importance": -82.20966339111328,
"rps_doc_openwebtext_importance_length_correction": -82.20966339111328,
"rps_doc_wikipedia_importance": -57.112117767333984,
"rps_doc_wikipedia_importance_length_correction": -51.575828552246094
},
"fasttext": {
"dclm": 0.0285374503582716,
"english": 0.8677625060081482,
"fineweb_edu_approx": 1.0735114812850952,
"eai_general_math": 0.03818302974104881,
"eai_open_web_math": 0.14095252752304077,
"eai_web_code": 0.0018721800297498703
}
}
|
{
"free_decimal_correspondence": {
"primary": {
"code": "005.1",
"labels": {
"level_1": "General works, books and libraries, information sciences",
"level_2": "",
"level_3": "Computer programming"
}
},
"secondary": {
"code": "004.678",
"labels": {
"level_1": "General works, books and libraries, information sciences",
"level_2": "",
"level_3": "Computers and Computer science"
}
}
},
"bloom_cognitive_process": {
"primary": {
"code": "3",
"label": "Apply"
},
"secondary": {
"code": "2",
"label": "Understand"
}
},
"bloom_knowledge_domain": {
"primary": {
"code": "3",
"label": "Procedural"
},
"secondary": {
"code": "2",
"label": "Conceptual"
}
},
"document_type_v1": {
"primary": {
"code": "5",
"label": "Social/Forum"
},
"secondary": {
"code": "4",
"label": "Code/Software"
}
},
"extraction_artifacts": {
"primary": {
"code": "0",
"label": "No Artifacts"
},
"secondary": {
"code": "3",
"label": "Irrelevant Content"
}
},
"missing_content": {
"primary": {
"code": "0",
"label": "No missing content"
},
"secondary": {
"code": "-1",
"label": "Abstain"
}
},
"document_type_v2": {
"primary": {
"code": "18",
"label": "Q&A Forum"
},
"secondary": {
"code": "8",
"label": "Documentation"
}
},
"reasoning_depth": {
"primary": {
"code": "2",
"label": "Basic Reasoning"
},
"secondary": {
"code": "3",
"label": "Intermediate Reasoning"
}
},
"technical_correctness": {
"primary": {
"code": "3",
"label": "Mostly Correct"
},
"secondary": {
"code": "4",
"label": "Highly Correct"
}
},
"education_level": {
"primary": {
"code": "3",
"label": "Undergraduate Level"
},
"secondary": {
"code": "4",
"label": "Graduate/Expert Level"
}
}
}
|
672f1e42c33a7f9846924a2431ea77df
|
2,960,166,849,021,293,000
|
Main Content
Create and Adjust VAR Model Using Shorthand Syntax
This example shows how to create a three-dimensional VAR(4) model with unknown parameters using varm and the shorthand syntax. Then, this example shows how to adjust parameters of the created model using dot notation.
Create a VAR(4) model for a three-dimensional response series using the shorthand syntax.
numseries = 3;
p = 4;
Mdl = varm(3,4)
Mdl =
varm with properties:
Description: "3-Dimensional VAR(4) Model"
SeriesNames: "Y1" "Y2" "Y3"
NumSeries: 3
P: 4
Constant: [3×1 vector of NaNs]
AR: {3×3 matrices of NaNs} at lags [1 2 3 ... and 1 more]
Trend: [3×1 vector of zeros]
Beta: [3×0 matrix]
Covariance: [3×3 matrix of NaNs]
Mdl is a varm model object. The properties of the model display at the command line. Observe that:
• The default value of some of the parameters are NaN values, which indicates their presence in the model. In particular, each lag from 1 through 4 has an unknown, nonzero autoregressive coefficient matrix.
• You created the model without using response data. That is, Mdl is agnostic about data.
Suppose that you want lags 1 and 4 in the model to be unknown and nonzero, but all other lags are zero. Using dot notation, remove the other lags from the model object by placing 3-by-3 matrices of zeros the corresponding cells.
Mdl.AR{2} = zeros(3);
Mdl.AR{3} = zeros(3)
Mdl =
varm with properties:
Description: "3-Dimensional VAR(4) Model"
SeriesNames: "Y1" "Y2" "Y3"
NumSeries: 3
P: 4
Constant: [3×1 vector of NaNs]
AR: {3×3 matrices} at lags [1 4]
Trend: [3×1 vector of zeros]
Beta: [3×0 matrix]
Covariance: [3×3 matrix of NaNs]
Observe that the model degree p is still 4, but there are unknown, nonzero coefficients at lags 1 and 4 only.
See Also
Objects
Related Topics
|
{
"url": "https://it.mathworks.com/help/econ/create-and-adjust-var-model-using-shorthand-syntax.html",
"source_domain": "it.mathworks.com",
"snapshot_id": "crawl=CC-MAIN-2022-40",
"warc_metadata": {
"Content-Length": "76605",
"Content-Type": "application/http; msgtype=response",
"WARC-Block-Digest": "sha1:YVLQVRLETOMU5JLHNIVXROROFLOH3WSY",
"WARC-Concurrent-To": "<urn:uuid:0cbc19ea-31db-41ea-a75a-a08892a01a2e>",
"WARC-Date": "2022-09-25T11:45:28Z",
"WARC-IP-Address": "104.68.243.15",
"WARC-Identified-Payload-Type": "text/html",
"WARC-Payload-Digest": "sha1:N7OPMR2GZWUBDUC2Q67EL6D365FISIJU",
"WARC-Record-ID": "<urn:uuid:167dd880-79da-4245-ad41-2f30ed6dde8d>",
"WARC-Target-URI": "https://it.mathworks.com/help/econ/create-and-adjust-var-model-using-shorthand-syntax.html",
"WARC-Truncated": null,
"WARC-Type": "response",
"WARC-Warcinfo-ID": "<urn:uuid:11cc599b-77a9-4147-88b5-f7c143d127e9>"
},
"warc_info": "isPartOf: CC-MAIN-2022-40\r\npublisher: Common Crawl\r\ndescription: Wide crawl of the web for September/October 2022\r\noperator: Common Crawl Admin (info@commoncrawl.org)\r\nhostname: ip-10-67-67-12\r\nsoftware: Apache Nutch 1.19 (modified, https://github.com/commoncrawl/nutch/)\r\nrobots: checked via crawler-commons 1.4-SNAPSHOT (https://github.com/crawler-commons/crawler-commons)\r\nformat: WARC File Format 1.1\r\nconformsTo: https://iipc.github.io/warc-specifications/specifications/warc-format/warc-1.1/"
}
|
{
"line_start_idx": [
0,
13,
14,
65,
66,
284,
285,
375,
376,
391,
398,
414,
421,
445,
446,
493,
529,
549,
569,
608,
680,
720,
751,
790,
791,
890,
891,
1100,
1101,
1193,
1194,
1423,
1424,
1446,
1467,
1474,
1498,
1499,
1546,
1582,
1602,
1622,
1661,
1708,
1748,
1779,
1818,
1819,
1929,
1930,
1939,
1940,
1948,
1949
],
"line_end_idx": [
13,
14,
65,
66,
284,
285,
375,
376,
391,
398,
414,
421,
445,
446,
493,
529,
549,
569,
608,
680,
720,
751,
790,
791,
890,
891,
1100,
1101,
1193,
1194,
1423,
1424,
1446,
1467,
1474,
1498,
1499,
1546,
1582,
1602,
1622,
1661,
1708,
1748,
1779,
1818,
1819,
1929,
1930,
1939,
1940,
1948,
1949,
1963
]
}
|
{
"red_pajama_v2": {
"ccnet_original_length": 1963,
"ccnet_original_nlines": 53,
"rps_doc_curly_bracket": 0.004075389821082354,
"rps_doc_ldnoobw_words": 0,
"rps_doc_lorem_ipsum": 0,
"rps_doc_stop_word_fraction": 0.2254464328289032,
"rps_doc_ut1_blacklist": 0,
"rps_doc_frac_all_caps_words": 0.0379464291036129,
"rps_doc_frac_lines_end_with_ellipsis": 0,
"rps_doc_frac_no_alph_words": 0.4107142984867096,
"rps_doc_frac_unique_words": 0.4192439913749695,
"rps_doc_mean_word_length": 4.625429630279541,
"rps_doc_num_sentences": 16,
"rps_doc_symbol_to_word_ratio": 0.002232139930129051,
"rps_doc_unigram_entropy": 4.505191326141357,
"rps_doc_word_count": 291,
"rps_doc_frac_chars_dupe_10grams": 0.2630015015602112,
"rps_doc_frac_chars_dupe_5grams": 0.29420503973960876,
"rps_doc_frac_chars_dupe_6grams": 0.2630015015602112,
"rps_doc_frac_chars_dupe_7grams": 0.2630015015602112,
"rps_doc_frac_chars_dupe_8grams": 0.2630015015602112,
"rps_doc_frac_chars_dupe_9grams": 0.2630015015602112,
"rps_doc_frac_chars_top_2gram": 0.03566122055053711,
"rps_doc_frac_chars_top_3gram": 0.032689448446035385,
"rps_doc_frac_chars_top_4gram": 0.026745909824967384,
"rps_doc_books_importance": -174.15878295898438,
"rps_doc_books_importance_length_correction": -174.15878295898438,
"rps_doc_openwebtext_importance": -107.300048828125,
"rps_doc_openwebtext_importance_length_correction": -107.300048828125,
"rps_doc_wikipedia_importance": -66.97309875488281,
"rps_doc_wikipedia_importance_length_correction": -66.97309875488281
},
"fasttext": {
"dclm": 0.0662306472659111,
"english": 0.8132994771003723,
"fineweb_edu_approx": 2.2763419151306152,
"eai_general_math": 0.9959097504615784,
"eai_open_web_math": 0.7112851142883301,
"eai_web_code": 0.9543927311897278
}
}
|
{
"free_decimal_correspondence": {
"primary": {
"code": "519.5",
"labels": {
"level_1": "Science and Natural history",
"level_2": "Mathematics",
"level_3": "Probabilities; or, Mathematical statistics"
}
},
"secondary": {
"code": "005.1",
"labels": {
"level_1": "General works, books and libraries, information sciences",
"level_2": "",
"level_3": "Computer programming"
}
}
},
"bloom_cognitive_process": {
"primary": {
"code": "3",
"label": "Apply"
},
"secondary": {
"code": "2",
"label": "Understand"
}
},
"bloom_knowledge_domain": {
"primary": {
"code": "3",
"label": "Procedural"
},
"secondary": {
"code": "2",
"label": "Conceptual"
}
},
"document_type_v1": {
"primary": {
"code": "3",
"label": "Reference/Encyclopedic/Educational"
},
"secondary": {
"code": "4",
"label": "Code/Software"
}
},
"extraction_artifacts": {
"primary": {
"code": "0",
"label": "No Artifacts"
},
"secondary": {
"code": "3",
"label": "Irrelevant Content"
}
},
"missing_content": {
"primary": {
"code": "0",
"label": "No missing content"
},
"secondary": {
"code": "-1",
"label": "Abstain"
}
},
"document_type_v2": {
"primary": {
"code": "8",
"label": "Documentation"
},
"secondary": {
"code": "23",
"label": "Tutorial"
}
},
"reasoning_depth": {
"primary": {
"code": "2",
"label": "Basic Reasoning"
},
"secondary": {
"code": "3",
"label": "Intermediate Reasoning"
}
},
"technical_correctness": {
"primary": {
"code": "4",
"label": "Highly Correct"
},
"secondary": {
"code": "5",
"label": "Exceptionally Correct"
}
},
"education_level": {
"primary": {
"code": "3",
"label": "Undergraduate Level"
},
"secondary": {
"code": "4",
"label": "Graduate/Expert Level"
}
}
}
|
672f1e42c33a7f9846924a2431ea77df
|
-7,608,278,427,307,064,000
|
5 Tips on how to secure your computer
computer-security-signpost21As opposed to a decade ago, computers are integral to almost everyone’s life. We use them to store vital information both at workplace and at home. The fact that many people use the computer on a daily basis means they are becoming more vulnerable to hackers and cybercrimes. Making your computer secure is therefore very important to ensure that unauthorized persons don’t get access to into it. So the big question is; how can you secure your computer? Below are 5 tips to make your computer safe and secure.
1. Make sure your computer has a password
The first way to protect your computer from hackers and unauthorized persons by ensuring that it has password. Every time you turn your computer on, you need to ensure that someone has to type the correct password in order to log in. In order to make your computer even more secure, experts recommend that you should create decently long password that incorporates numbers, letters and symbol to make it difficult for unauthorized person to gain access.
2. Install antivirus software
Antiviruses are very important because they help to protect your computer against malware. Most people have installed antiviruses on their computers but they are not effective when it comes to detecting and eliminating computer viruses because they are not updated constantly. If you want to get the best results from your antivirus, you need to ensure that is updated on a regular basis. Viruses can erase your hard drive or even delete data on your computer. By using an effective antivirus software you will not only detect potential virus but you it prevent it from interfering with normal functioning of your computer.
Another thing in addition to an antivirus program that you might want to consider is an anti malware program. These programs act on malware that sometimes masqerades as a legitimate program. One great malware removal tool is Spyhunter 4 which is a safe and effective software tool designed to protect against strains of malware that an antivirus software program will miss. Lots of people ask me if Spyhunter 4 is safe, and I let them know that I have used it myself with great results.
3. Install a firewall
Firewall is available both in the form of hardware or software and their purpose to help protect your computer from hackers as well as viruses. It works by filtering information that it allowed into the computer. Most computers usually come with an in build firewall. However, if your computer does not have a built in firewall, then you have nothing to worry because you can install a hardware firewall.
4. Install an anti-spyware
Spyware is actually a software that is installed on your computer without your consent. This software is very dangerous and can interfere with the normal functioning of your computer besides corrupting vital data that you have stored in your computer. In addition to that, spyware software can monitor your behavior in order to collect your personal information, force unwanted pop ups or even reconfigure your computer. By installing an anti-spyware, you will help protect your computer against spyware that can compromise the security of your computer.
5. Install spam blocker
Do you know that spam content also compromises the security of your computer? Although the best way to secure your computer is by being vigilant when downloading files or opening attachments, using a spam blocker can really help to prevent you from becoming a spam victim. As soon as you start using the internet from your computer, you put it at risk for scammers who want to steal from you. By installing a spam blocker, you will be able to detect and block people who don’t have good intentions.
What Is A DDoS Attack
What is a DDoS attack? It seems that a lot of people are asking this question because roughly half the internet went down on Friday, October 21 as a massive DDoS attack was aimed at Dyn, a DNS provider. Here’s a great YouTube video that explains DDoS attacks and how they can affect you:
Computer Literacy As A New Requirement
commodorecomputerBack in the 1980’s kids didn’t grow up with computers. Only the most affluent or tech savvy households had computers. But it was obvious that the growing importance of computers was requiring schools to ensure that their students had at least a basic aptitude in computers. This is a very interesting article from the 1984 Science publication and talks about how schools began to implement computer science programs.
Computer literacy embodies a set of skills, variously defined. In general, a computer literate person knows the parts of a computer and what they do, has learned to operate a few of the more popular programs, and can write some elementary programs, usually in the language called Basic.
Courses offering to teach these skills have popped up everywhere. In the San Francisco Bay area alone there are more than 500, not including the public schools. Local business institutes offer night classes to ambitious workers; museums promote hands-on computer projects for kids; four-year-olds at private preschools receive computerized tutoring. Major computer manufacturers encourage the busy march toward self-improvement. Tandy, which makes Raido Shack computers, runs a national program to introduce teachers to computers. Atari has a chain of summer computer camps. Apple has gotten a state tax break by donating a computer to every public and private school in California.
Similar proposals at the national level would cost hundreds of millions of dollars in federal tax breaks.
What the computer literacy movement seems to be mostly enriching is it backers: sellers of computers and computer programs; promoters of retraining courses for workers and teachers; and writers and publishers of the industry’s books and magazines. Last year, for example, U.S. schools spent nearly $500 million on personal computers and programs.
“I see computer literacy as the New Math of the 1980s,” says Daniel McCracken, professor of computer science at the City College of New York, author of well over a dozen textbooks on computer languages and former president of the Association for Computing Machinery, a professional organization for computer scientists. “I suggest that we might save a lot of wasted opportunity to do more useful things if we were to pinch this one off before it has a chance to get well rooted.”
Pinching it off won’t be easy.
In a catchy ad by Program Design, Inc. for “Baby’s First Software,” for example, a confident toddler stares out at the reader and his future. “Your child becomes part of the action, while acquiring new skills,” the ad proclaims. The Children’s Television Workshop, which created Sesame Street, now is pushing Enter, a new computer magazine for children 10 to 16. “The computer is as basic to your child’s life and lifestyle as paper was to yours and mine,” states a letter to parents. “And learning computer skills is (not will be) as fundamental as learning to read and write was to you and me…you can consider these to be overstatements, but only at your youngster’s peril.” In a commercial for Commodore computers a college freshman returns home in disgrace. If his parents had bought a Commodore in the first place, suggests the voice-over, this never could have happened. Out of school? It’s not too late. “Learn: computer programming or computer operations. Take the First Step…Now!” reads a newspaper ad for the Computer LEarning Center, a business institute in the Washington, D.C., suburbs.”
Menosky, Joseph A., and Geoffrey Moss. “Computer worship.” Science ’84 5 (1984): 40+.
It’s very interesting, isn’t it? It’s crazy to see how far technology has come, and it’s also very exciting to think about what computers of the future will be like.
© 2017 Python9
Theme by Anders NorénUp ↑
|
{
"url": "http://www.python9.com/",
"source_domain": "www.python9.com",
"snapshot_id": "crawl=CC-MAIN-2017-17",
"warc_metadata": {
"Content-Length": "20765",
"Content-Type": "application/http; msgtype=response",
"WARC-Block-Digest": "sha1:ZEXQGM3JPBLAQTDGQEK2T7MB3AEVIFXE",
"WARC-Concurrent-To": "<urn:uuid:f14ad28a-5965-482a-a0dd-3d25243a4c44>",
"WARC-Date": "2017-04-30T10:44:43Z",
"WARC-IP-Address": "144.217.16.173",
"WARC-Identified-Payload-Type": null,
"WARC-Payload-Digest": "sha1:76MF5CB3GD3HPMWHI4QRIPSH2BPQD67A",
"WARC-Record-ID": "<urn:uuid:70532ccc-1691-4f9d-951d-64093f04db48>",
"WARC-Target-URI": "http://www.python9.com/",
"WARC-Truncated": null,
"WARC-Type": "response",
"WARC-Warcinfo-ID": "<urn:uuid:0ae20e5e-917a-47c4-9191-e9a2bfea5cac>"
},
"warc_info": "robots: classic\r\nhostname: ip-10-145-167-34.ec2.internal\r\nsoftware: Nutch 1.6 (CC)/CC WarcExport 1.0\r\nisPartOf: CC-MAIN-2017-17\r\noperator: CommonCrawl Admin\r\ndescription: Wide crawl of the web for April 2017\r\npublisher: CommonCrawl\r\nformat: WARC File Format 1.0\r\nconformsTo: http://bibnum.bnf.fr/WARC/WARC_ISO_28500_version1_latestdraft.pdf"
}
|
{
"line_start_idx": [
0,
38,
39,
578,
579,
621,
622,
1076,
1077,
1107,
1108,
1732,
1733,
2223,
2224,
2246,
2247,
2652,
2653,
2680,
2681,
3236,
3237,
3261,
3262,
3761,
3762,
3784,
3785,
4075,
4076,
4078,
4079,
4118,
4119,
4556,
4557,
4844,
4845,
5528,
5529,
5635,
5636,
5983,
5984,
6464,
6465,
6496,
6497,
7598,
7599,
7685,
7686,
7688,
7689,
7856,
7857,
7872,
7873
],
"line_end_idx": [
38,
39,
578,
579,
621,
622,
1076,
1077,
1107,
1108,
1732,
1733,
2223,
2224,
2246,
2247,
2652,
2653,
2680,
2681,
3236,
3237,
3261,
3262,
3761,
3762,
3784,
3785,
4075,
4076,
4078,
4079,
4118,
4119,
4556,
4557,
4844,
4845,
5528,
5529,
5635,
5636,
5983,
5984,
6464,
6465,
6496,
6497,
7598,
7599,
7685,
7686,
7688,
7689,
7856,
7857,
7872,
7873,
7898
]
}
|
{
"red_pajama_v2": {
"ccnet_original_length": 7898,
"ccnet_original_nlines": 58,
"rps_doc_curly_bracket": 0,
"rps_doc_ldnoobw_words": 0,
"rps_doc_lorem_ipsum": 0,
"rps_doc_stop_word_fraction": 0.4319840669631958,
"rps_doc_ut1_blacklist": 0,
"rps_doc_frac_all_caps_words": 0.007962839677929878,
"rps_doc_frac_lines_end_with_ellipsis": 0,
"rps_doc_frac_no_alph_words": 0.13205042481422424,
"rps_doc_frac_unique_words": 0.42505764961242676,
"rps_doc_mean_word_length": 4.923136234283447,
"rps_doc_num_sentences": 80,
"rps_doc_symbol_to_word_ratio": 0.001327140023931861,
"rps_doc_unigram_entropy": 5.585214138031006,
"rps_doc_word_count": 1301,
"rps_doc_frac_chars_dupe_10grams": 0,
"rps_doc_frac_chars_dupe_5grams": 0.03809523954987526,
"rps_doc_frac_chars_dupe_6grams": 0,
"rps_doc_frac_chars_dupe_7grams": 0,
"rps_doc_frac_chars_dupe_8grams": 0,
"rps_doc_frac_chars_dupe_9grams": 0,
"rps_doc_frac_chars_top_2gram": 0.04121780022978783,
"rps_doc_frac_chars_top_3gram": 0.007494150195270777,
"rps_doc_frac_chars_top_4gram": 0.006245119962841272,
"rps_doc_books_importance": -557.3303833007812,
"rps_doc_books_importance_length_correction": -557.3303833007812,
"rps_doc_openwebtext_importance": -359.4595947265625,
"rps_doc_openwebtext_importance_length_correction": -359.4595947265625,
"rps_doc_wikipedia_importance": -235.4206085205078,
"rps_doc_wikipedia_importance_length_correction": -235.4206085205078
},
"fasttext": {
"dclm": 0.36916565895080566,
"english": 0.9593923091888428,
"fineweb_edu_approx": 2.8907032012939453,
"eai_general_math": 0.09694529324769974,
"eai_open_web_math": 0.11150593310594559,
"eai_web_code": 0.02009611949324608
}
}
|
{
"free_decimal_correspondence": {
"primary": {
"code": "005.8",
"labels": {
"level_1": "General works, books and libraries, information sciences",
"level_2": "",
"level_3": "Computer programming"
}
},
"secondary": {
"code": "004.019",
"labels": {
"level_1": "General works, books and libraries, information sciences",
"level_2": "",
"level_3": "Computers and Computer science"
}
}
},
"bloom_cognitive_process": {
"primary": {
"code": "2",
"label": "Understand"
},
"secondary": {
"code": "3",
"label": "Apply"
}
},
"bloom_knowledge_domain": {
"primary": {
"code": "2",
"label": "Conceptual"
},
"secondary": {
"code": "3",
"label": "Procedural"
}
},
"document_type_v1": {
"primary": {
"code": "3",
"label": "Reference/Encyclopedic/Educational"
},
"secondary": {
"code": "1",
"label": "News/Editorial"
}
},
"extraction_artifacts": {
"primary": {
"code": "3",
"label": "Irrelevant Content"
},
"secondary": {
"code": "-1",
"label": "Abstain"
}
},
"missing_content": {
"primary": {
"code": "4",
"label": "Missing Images or Figures"
},
"secondary": {
"code": "-1",
"label": "Abstain"
}
},
"document_type_v2": {
"primary": {
"code": "10",
"label": "Knowledge Article"
},
"secondary": {
"code": "12",
"label": "Listicle"
}
},
"reasoning_depth": {
"primary": {
"code": "2",
"label": "Basic Reasoning"
},
"secondary": {
"code": "3",
"label": "Intermediate Reasoning"
}
},
"technical_correctness": {
"primary": {
"code": "3",
"label": "Mostly Correct"
},
"secondary": {
"code": "4",
"label": "Highly Correct"
}
},
"education_level": {
"primary": {
"code": "1",
"label": "General Audience"
},
"secondary": {
"code": "2",
"label": "High School Level"
}
}
}
|
672f1e42c33a7f9846924a2431ea77df
|
-7,967,038,850,517,556,000
|
Strapi: Customization, customization, customization
Photo by Roman Synkevych on Unsplash
Strapi is a headless CMS that creates an API to access your database with some basic CRUD (Create, Read, Update, Delete) operations. A good option to reduce the backend development work, but with his limitations. After working for a year on real-world projects with Strapi as a backend, we found some problems that were not solved by default. Not a big deal thanks to his customization. Here there are the most important things you should know.
But first…
At any point in these examples, you can access all Strapi functionality. There's a "global variable" that lets you use the controllers of a collection or do queries to the database. Here are some examples:
Notice that, when you access a table that it's related to Strapi plugin functionalities, like the users or the files uploaded, you should add his plugin id to the query. The ids by default are content-manager, content-type-builder, email, upload, and user-permissions.
Lifecycle hooks
Execute code before or after some basic operation occurs. Useful for notifications, calculated values, default values, or creation of another data related.
For example, we want to call another server every time we create/modify some specific field in our database. Go to /api/collection-name/models/collection-name.js
Notify another server after some field is added/updated
Depending on the hook, it could take these attributes:
• data: The body of the operation.
• result: The item that is stored after the operation.
• params: How to identify this item. For example, in update operations, this will be something like { id: 3 }
• populate: Relations that will replace his id with his content.
Full documentation here
Extend the functionality for the CRUD operations
Strapi may seem like a bad idea when you need more than just CRUD operations, but you can do your business logic by overriding your controllers. For example, you can do a more complex roles system, giving access only to some specific elements, do some validations before creating, or improve the population of the responses.
You can override some operations and others leave it by default in the same collection, just add the one that you need to the file in /api/collection-name/controllers/collection-name.js
Full documentation and the default implementation of the controllers, here.
Notice that the find and the findOne service operations that Strapi do in his default controllers, also could receive an array to populate the output (replace the id of the relation with it's content). But, this will override the default one, so, if you want more, you should add all the relations that you want. Here's an example of how to use this:
Create a new API endpoint
It's pretty common to need some new endpoint that do some business logic over your data, and Strapi have this possibility too. Go to /api/collection-name/config/routes.json and add a new entry to the array like the following:
The image is pretty self explanatory, just a couple of notes.
• The handler string follows this format: ControllerName.FunctionName. Add that function to the controller file, as we saw in the past section.
• In the path you can add a wildcard like :id or do validations with a regular expression.
• If you don't add a config object, it will have public access.
• If you make a request to this endpoint and returns a 404 Not Found, make sure that your path does not collide with a wildcard. For example, if you push the example to the route array, will not work, because the find definition will response (/items/:id). To solve this, move the definition before it.
• If you receive a 403 Forbidden error, do a yarn build to recreate the frontend and grant access to this endpoint in the Settings section.
Full documentation, here.
Testing
Do unit testing in Strapi…it's a bit of a pain. The main reason is that the Strapi system have to be mounted between each run and it takes fairly 30 seconds to mount and unmount.
To configure the test env, follow the official documentation.
Conclusions
Strapi offers a wide variety of tools to adapt as easy as possible to your needs. This are just the ones that was most used for me, but you can find more info about the rest in the documentation.
--
--
--
Love podcasts or audiobooks? Learn on the go with our new app.
Recommended from Medium
The impact of a single developer — The Call For Code
Tweetmerge — A mailmerge for Twitter
Plotting Data Visualisation on the Map of India using GeoPandas in Python
AEM as Cloud Service: Working with Multiple Source GIT Repositories
I’m blue DAHba DIT DAH bee DAH (precompiler abuse and confusion)
ADALend: A New Perspective On Native Cardano DeFi From the Eyes of ADALend’s CEO
16 useful Contab commands in Linux with Examples to Schedule Jobs
Cleaning Your Go Code
Get the Medium app
A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Adri Blanco
Adri Blanco
More from Medium
From RBAC to ABAC
Why you should use Consumer-Driven Contracts?
Are you using modern TLS?
FOUNDATION 6 FRAMEWORK
|
{
"url": "https://adriblanco.medium.com/strapi-customization-customization-customization-a0c11e4e2f69",
"source_domain": "adriblanco.medium.com",
"snapshot_id": "crawl=CC-MAIN-2022-21",
"warc_metadata": {
"Content-Length": "155083",
"Content-Type": "application/http; msgtype=response",
"WARC-Block-Digest": "sha1:R5S45573MFUHG5ZWWRNELVB5W4FU5UPM",
"WARC-Concurrent-To": "<urn:uuid:f8d1a8fe-2410-4db7-a42d-329f4bbe40f3>",
"WARC-Date": "2022-05-29T11:56:40Z",
"WARC-IP-Address": "162.159.153.4",
"WARC-Identified-Payload-Type": "text/html",
"WARC-Payload-Digest": "sha1:ISHUBWVZF7RIHXTTMHOCPXFZFLYPU2VI",
"WARC-Record-ID": "<urn:uuid:a26409c6-75e6-41a3-9b16-26785c051c36>",
"WARC-Target-URI": "https://adriblanco.medium.com/strapi-customization-customization-customization-a0c11e4e2f69",
"WARC-Truncated": null,
"WARC-Type": "response",
"WARC-Warcinfo-ID": "<urn:uuid:c010c4f8-5e35-44ca-93b9-29dd72b55724>"
},
"warc_info": "isPartOf: CC-MAIN-2022-21\r\npublisher: Common Crawl\r\ndescription: Wide crawl of the web for May 2022\r\noperator: Common Crawl Admin (info@commoncrawl.org)\r\nhostname: ip-10-67-67-196\r\nsoftware: Apache Nutch 1.18 (modified, https://github.com/commoncrawl/nutch/)\r\nrobots: checked via crawler-commons 1.3-SNAPSHOT (https://github.com/crawler-commons/crawler-commons)\r\nformat: WARC File Format 1.1\r\nconformsTo: https://iipc.github.io/warc-specifications/specifications/warc-format/warc-1.1/"
}
|
{
"line_start_idx": [
0,
52,
53,
90,
91,
536,
537,
548,
549,
755,
756,
1025,
1026,
1042,
1043,
1199,
1200,
1362,
1363,
1419,
1420,
1475,
1476,
1513,
1570,
1682,
1749,
1750,
1774,
1775,
1824,
1825,
2150,
2151,
2337,
2338,
2414,
2415,
2766,
2767,
2793,
2794,
3020,
3021,
3083,
3084,
3230,
3323,
3389,
3694,
3836,
3837,
3863,
3864,
3872,
3873,
4052,
4053,
4115,
4116,
4128,
4129,
4325,
4326,
4329,
4330,
4333,
4334,
4337,
4338,
4401,
4402,
4426,
4427,
4480,
4481,
4518,
4519,
4593,
4594,
4662,
4663,
4728,
4729,
4810,
4811,
4877,
4878,
4900,
4901,
4920,
4921,
5022,
5124,
5136,
5137,
5149,
5150,
5167,
5168,
5186,
5187,
5233,
5234,
5260,
5261
],
"line_end_idx": [
52,
53,
90,
91,
536,
537,
548,
549,
755,
756,
1025,
1026,
1042,
1043,
1199,
1200,
1362,
1363,
1419,
1420,
1475,
1476,
1513,
1570,
1682,
1749,
1750,
1774,
1775,
1824,
1825,
2150,
2151,
2337,
2338,
2414,
2415,
2766,
2767,
2793,
2794,
3020,
3021,
3083,
3084,
3230,
3323,
3389,
3694,
3836,
3837,
3863,
3864,
3872,
3873,
4052,
4053,
4115,
4116,
4128,
4129,
4325,
4326,
4329,
4330,
4333,
4334,
4337,
4338,
4401,
4402,
4426,
4427,
4480,
4481,
4518,
4519,
4593,
4594,
4662,
4663,
4728,
4729,
4810,
4811,
4877,
4878,
4900,
4901,
4920,
4921,
5022,
5124,
5136,
5137,
5149,
5150,
5167,
5168,
5186,
5187,
5233,
5234,
5260,
5261,
5283
]
}
|
{
"red_pajama_v2": {
"ccnet_original_length": 5283,
"ccnet_original_nlines": 105,
"rps_doc_curly_bracket": 0.0003785699955187738,
"rps_doc_ldnoobw_words": 0,
"rps_doc_lorem_ipsum": 0,
"rps_doc_stop_word_fraction": 0.40558141469955444,
"rps_doc_ut1_blacklist": 0,
"rps_doc_frac_all_caps_words": 0.021395349875092506,
"rps_doc_frac_lines_end_with_ellipsis": 0.009433959610760212,
"rps_doc_frac_no_alph_words": 0.16558140516281128,
"rps_doc_frac_unique_words": 0.4241733253002167,
"rps_doc_mean_word_length": 4.754846096038818,
"rps_doc_num_sentences": 46,
"rps_doc_symbol_to_word_ratio": 0.0018604700453579426,
"rps_doc_unigram_entropy": 5.301422119140625,
"rps_doc_word_count": 877,
"rps_doc_frac_chars_dupe_10grams": 0,
"rps_doc_frac_chars_dupe_5grams": 0.014388489536941051,
"rps_doc_frac_chars_dupe_6grams": 0.014388489536941051,
"rps_doc_frac_chars_dupe_7grams": 0.014388489536941051,
"rps_doc_frac_chars_dupe_8grams": 0.014388489536941051,
"rps_doc_frac_chars_dupe_9grams": 0.014388489536941051,
"rps_doc_frac_chars_top_2gram": 0.009592330083251,
"rps_doc_frac_chars_top_3gram": 0.004316550213843584,
"rps_doc_frac_chars_top_4gram": 0.007194240111857653,
"rps_doc_books_importance": -459.76434326171875,
"rps_doc_books_importance_length_correction": -459.76434326171875,
"rps_doc_openwebtext_importance": -260.351318359375,
"rps_doc_openwebtext_importance_length_correction": -260.351318359375,
"rps_doc_wikipedia_importance": -179.59732055664062,
"rps_doc_wikipedia_importance_length_correction": -179.59732055664062
},
"fasttext": {
"dclm": 0.03659540042281151,
"english": 0.9029229879379272,
"fineweb_edu_approx": 1.8901911973953247,
"eai_general_math": 0.3395400047302246,
"eai_open_web_math": 0.2075846791267395,
"eai_web_code": 0.3525673747062683
}
}
|
{
"free_decimal_correspondence": {
"primary": {
"code": "005.74",
"labels": {
"level_1": "General works, books and libraries, information sciences",
"level_2": "",
"level_3": "Computer programming"
}
},
"secondary": {
"code": "005.1",
"labels": {
"level_1": "General works, books and libraries, information sciences",
"level_2": "",
"level_3": "Computer programming"
}
}
},
"bloom_cognitive_process": {
"primary": {
"code": "3",
"label": "Apply"
},
"secondary": {
"code": "2",
"label": "Understand"
}
},
"bloom_knowledge_domain": {
"primary": {
"code": "3",
"label": "Procedural"
},
"secondary": {
"code": "2",
"label": "Conceptual"
}
},
"document_type_v1": {
"primary": {
"code": "3",
"label": "Reference/Encyclopedic/Educational"
},
"secondary": {
"code": "-1",
"label": "Abstain"
}
},
"extraction_artifacts": {
"primary": {
"code": "0",
"label": "No Artifacts"
},
"secondary": {
"code": "3",
"label": "Irrelevant Content"
}
},
"missing_content": {
"primary": {
"code": "0",
"label": "No missing content"
},
"secondary": {
"code": "4",
"label": "Missing Images or Figures"
}
},
"document_type_v2": {
"primary": {
"code": "23",
"label": "Tutorial"
},
"secondary": {
"code": "8",
"label": "Documentation"
}
},
"reasoning_depth": {
"primary": {
"code": "3",
"label": "Intermediate Reasoning"
},
"secondary": {
"code": "2",
"label": "Basic Reasoning"
}
},
"technical_correctness": {
"primary": {
"code": "4",
"label": "Highly Correct"
},
"secondary": {
"code": "3",
"label": "Mostly Correct"
}
},
"education_level": {
"primary": {
"code": "3",
"label": "Undergraduate Level"
},
"secondary": {
"code": "2",
"label": "High School Level"
}
}
}
|
672f1e42c33a7f9846924a2431ea77df
|
-6,765,495,043,239,540,000
|
MIST round
From DCS World Wiki - Hoggitworld.com
mist.utils.round
Added with: Mist 1.0
Description
This function takes a number and returns a rounded version of it. Optional idp defines how many places after the decimal to round the number to; for example, an idp of 2 means the number will be rounded to the nearest hundredth. idp can be negative too, for example, -3 would round to the nearest thousand. If not specified, idp defaults to 0 (rounds to the nearest whole number).
Syntax
number mist.utils.round(number number , number idp )
Valid Input Values:
(25.2343, 1)
Return value:
number
Return example:
25.2
Usage Examples:
local roundedVal = mist.utils.round(145.25436, 2)
Notes:
See Google Unit converter. [1]
Related Functions
converter, toDegree, toRadian, round, roundTbl, metersToNM, metersToFeet, NMToMeters, feetToMeters, mpsToKnots, mpsToKmph, knotsToMps, kmphToMps, kelvinToCelsius, FahrenheitToCelsius, celsiusToFahrenheit, hexToRGB
Scripting Engine
MIST Root Page
|
{
"url": "https://wiki.hoggitworld.com/view/MIST_round",
"source_domain": "wiki.hoggitworld.com",
"snapshot_id": "crawl=CC-MAIN-2022-49",
"warc_metadata": {
"Content-Length": "18130",
"Content-Type": "application/http; msgtype=response",
"WARC-Block-Digest": "sha1:TF2BNW7SJVAZ4AGP7PNCKQPZENFMEJSL",
"WARC-Concurrent-To": "<urn:uuid:d89dbf68-fdb4-4728-a8ab-cdf0d0d4daba>",
"WARC-Date": "2022-11-27T02:43:41Z",
"WARC-IP-Address": "23.239.19.239",
"WARC-Identified-Payload-Type": "text/html",
"WARC-Payload-Digest": "sha1:6KPOIKMS273LS6URZVGPUJJZBI6Q3JAB",
"WARC-Record-ID": "<urn:uuid:329c6b93-4390-4404-910b-b5ba9af73bf5>",
"WARC-Target-URI": "https://wiki.hoggitworld.com/view/MIST_round",
"WARC-Truncated": null,
"WARC-Type": "response",
"WARC-Warcinfo-ID": "<urn:uuid:f3aa8667-7a8a-41b6-bc20-037d37bc7131>"
},
"warc_info": "isPartOf: CC-MAIN-2022-49\r\npublisher: Common Crawl\r\ndescription: Wide crawl of the web for November/December 2022\r\noperator: Common Crawl Admin (info@commoncrawl.org)\r\nhostname: ip-10-67-67-8\r\nsoftware: Apache Nutch 1.19 (modified, https://github.com/commoncrawl/nutch/)\r\nrobots: checked via crawler-commons 1.4-SNAPSHOT (https://github.com/crawler-commons/crawler-commons)\r\nformat: WARC File Format 1.1\r\nconformsTo: https://iipc.github.io/warc-specifications/specifications/warc-format/warc-1.1/"
}
|
{
"line_start_idx": [
0,
11,
12,
50,
51,
52,
69,
70,
91,
103,
484,
491,
544,
564,
577,
591,
598,
614,
619,
635,
685,
692,
723,
741,
955,
956,
973,
974
],
"line_end_idx": [
11,
12,
50,
51,
52,
69,
70,
91,
103,
484,
491,
544,
564,
577,
591,
598,
614,
619,
635,
685,
692,
723,
741,
955,
956,
973,
974,
988
]
}
|
{
"red_pajama_v2": {
"ccnet_original_length": 988,
"ccnet_original_nlines": 27,
"rps_doc_curly_bracket": 0,
"rps_doc_ldnoobw_words": 0,
"rps_doc_lorem_ipsum": 0,
"rps_doc_stop_word_fraction": 0.1893203854560852,
"rps_doc_ut1_blacklist": 0,
"rps_doc_frac_all_caps_words": 0.01456310972571373,
"rps_doc_frac_lines_end_with_ellipsis": 0,
"rps_doc_frac_no_alph_words": 0.34951457381248474,
"rps_doc_frac_unique_words": 0.7111111283302307,
"rps_doc_mean_word_length": 5.814815044403076,
"rps_doc_num_sentences": 17,
"rps_doc_symbol_to_word_ratio": 0,
"rps_doc_unigram_entropy": 4.356436252593994,
"rps_doc_word_count": 135,
"rps_doc_frac_chars_dupe_10grams": 0,
"rps_doc_frac_chars_dupe_5grams": 0,
"rps_doc_frac_chars_dupe_6grams": 0,
"rps_doc_frac_chars_dupe_7grams": 0,
"rps_doc_frac_chars_dupe_8grams": 0,
"rps_doc_frac_chars_dupe_9grams": 0,
"rps_doc_frac_chars_top_2gram": 0.019108280539512634,
"rps_doc_frac_chars_top_3gram": 0.045859869569540024,
"rps_doc_frac_chars_top_4gram": 0,
"rps_doc_books_importance": -81.61122131347656,
"rps_doc_books_importance_length_correction": -81.61122131347656,
"rps_doc_openwebtext_importance": -42.8719367980957,
"rps_doc_openwebtext_importance_length_correction": -28.856510162353516,
"rps_doc_wikipedia_importance": -24.94399642944336,
"rps_doc_wikipedia_importance_length_correction": -24.94399642944336
},
"fasttext": {
"dclm": 0.4485185146331787,
"english": 0.6619894504547119,
"fineweb_edu_approx": 2.89093279838562,
"eai_general_math": 0.7203384637832642,
"eai_open_web_math": 0.43062788248062134,
"eai_web_code": 0.6116622090339661
}
}
|
{
"free_decimal_correspondence": {
"primary": {
"code": "005.1",
"labels": {
"level_1": "General works, books and libraries, information sciences",
"level_2": "",
"level_3": "Computer programming"
}
},
"secondary": {
"code": "510",
"labels": {
"level_1": "Science and Natural history",
"level_2": "Mathematics",
"level_3": ""
}
}
},
"bloom_cognitive_process": {
"primary": {
"code": "2",
"label": "Understand"
},
"secondary": {
"code": "3",
"label": "Apply"
}
},
"bloom_knowledge_domain": {
"primary": {
"code": "3",
"label": "Procedural"
},
"secondary": {
"code": "2",
"label": "Conceptual"
}
},
"document_type_v1": {
"primary": {
"code": "3",
"label": "Reference/Encyclopedic/Educational"
},
"secondary": {
"code": "4",
"label": "Code/Software"
}
},
"extraction_artifacts": {
"primary": {
"code": "0",
"label": "No Artifacts"
},
"secondary": {
"code": "3",
"label": "Irrelevant Content"
}
},
"missing_content": {
"primary": {
"code": "0",
"label": "No missing content"
},
"secondary": {
"code": "-1",
"label": "Abstain"
}
},
"document_type_v2": {
"primary": {
"code": "8",
"label": "Documentation"
},
"secondary": {
"code": "10",
"label": "Knowledge Article"
}
},
"reasoning_depth": {
"primary": {
"code": "2",
"label": "Basic Reasoning"
},
"secondary": {
"code": "1",
"label": "No Reasoning"
}
},
"technical_correctness": {
"primary": {
"code": "4",
"label": "Highly Correct"
},
"secondary": {
"code": "3",
"label": "Mostly Correct"
}
},
"education_level": {
"primary": {
"code": "3",
"label": "Undergraduate Level"
},
"secondary": {
"code": "2",
"label": "High School Level"
}
}
}
|
672f1e42c33a7f9846924a2431ea77df
|
-2,292,764,244,025,513,700
|
# isnumeric()の使い方
Home String Methods
# isnumeric()の例1
Check if all the characters in the text are numeric:
txt =
"565543"x = txt.isnumeric()
print(x)
# isnumeric()の定義と使い方
isumeric()関数は、 文字は数値(0~9)、それ以外はFalseです。 2のような指数 また、3/4も数値とみなされます。
# isnumeric()の構文
string.isnumeric()
# isnumeric()の引数
パラメータがありません。
# isnumeric()の例2
Check if the characters are numeric:
a = "\u0030" #unicode for 0b = "\u00B2" #unicode for ²
c = "10km2"
print(a.isnumeric())print(b.isnumeric())print(c.isnumeric())
Home String Methods
|
{
"url": "https://coderecipe.org/string/string_isnumeric.html",
"source_domain": "coderecipe.org",
"snapshot_id": "crawl=CC-MAIN-2019-47",
"warc_metadata": {
"Content-Length": "64552",
"Content-Type": "application/http; msgtype=response",
"WARC-Block-Digest": "sha1:KMRR4WNVXRXFTG7QSJUSWD4CVUPTFXRF",
"WARC-Concurrent-To": "<urn:uuid:0d11b6fa-f0b8-4120-88e8-04ecc2f43461>",
"WARC-Date": "2019-11-15T18:52:47Z",
"WARC-IP-Address": "198.199.66.189",
"WARC-Identified-Payload-Type": "text/html",
"WARC-Payload-Digest": "sha1:GH5DFJV3BWG7JEVQK26VZ6TYV6XRNWYA",
"WARC-Record-ID": "<urn:uuid:9f83cce7-e1f1-4220-8fac-a7ed4a24e899>",
"WARC-Target-URI": "https://coderecipe.org/string/string_isnumeric.html",
"WARC-Truncated": null,
"WARC-Type": "response",
"WARC-Warcinfo-ID": "<urn:uuid:8a128757-c817-4909-9940-801b5b97a8a1>"
},
"warc_info": "isPartOf: CC-MAIN-2019-47\r\npublisher: Common Crawl\r\ndescription: Wide crawl of the web for November 2019\r\noperator: Common Crawl Admin (info@commoncrawl.org)\r\nhostname: ip-10-67-67-22.ec2.internal\r\nsoftware: Apache Nutch 1.16 (modified, https://github.com/commoncrawl/nutch/)\r\nrobots: checked via crawler-commons 1.1-SNAPSHOT (https://github.com/crawler-commons/crawler-commons)\r\nformat: WARC File Format 1.1\r\nconformsTo: http://iipc.github.io/warc-specifications/specifications/warc-format/warc-1.1/"
}
|
{
"line_start_idx": [
0,
18,
19,
39,
40,
57,
58,
111,
112,
123,
155,
164,
165,
186,
187,
253,
254,
271,
272,
291,
292,
309,
310,
323,
324,
341,
342,
379,
380,
444,
460,
525,
526
],
"line_end_idx": [
18,
19,
39,
40,
57,
58,
111,
112,
123,
155,
164,
165,
186,
187,
253,
254,
271,
272,
291,
292,
309,
310,
323,
324,
341,
342,
379,
380,
444,
460,
525,
526,
545
]
}
|
{
"red_pajama_v2": {
"ccnet_original_length": 545,
"ccnet_original_nlines": 32,
"rps_doc_curly_bracket": 0,
"rps_doc_ldnoobw_words": 0,
"rps_doc_lorem_ipsum": 0,
"rps_doc_stop_word_fraction": 0.13846154510974884,
"rps_doc_ut1_blacklist": 0,
"rps_doc_frac_all_caps_words": 0,
"rps_doc_frac_lines_end_with_ellipsis": 0,
"rps_doc_frac_no_alph_words": 0.5538461208343506,
"rps_doc_frac_unique_words": 0.7599999904632568,
"rps_doc_mean_word_length": 7.699999809265137,
"rps_doc_num_sentences": 6,
"rps_doc_symbol_to_word_ratio": 0.0615384615957737,
"rps_doc_unigram_entropy": 3.568847417831421,
"rps_doc_word_count": 50,
"rps_doc_frac_chars_dupe_10grams": 0,
"rps_doc_frac_chars_dupe_5grams": 0,
"rps_doc_frac_chars_dupe_6grams": 0,
"rps_doc_frac_chars_dupe_7grams": 0,
"rps_doc_frac_chars_dupe_8grams": 0,
"rps_doc_frac_chars_dupe_9grams": 0,
"rps_doc_frac_chars_top_2gram": 0.051948048174381256,
"rps_doc_frac_chars_top_3gram": 0.08831168711185455,
"rps_doc_frac_chars_top_4gram": 0,
"rps_doc_books_importance": -68.15760803222656,
"rps_doc_books_importance_length_correction": -81.71807098388672,
"rps_doc_openwebtext_importance": -39.53068161010742,
"rps_doc_openwebtext_importance_length_correction": -53.091148376464844,
"rps_doc_wikipedia_importance": -27.825204849243164,
"rps_doc_wikipedia_importance_length_correction": -41.38566970825195
},
"fasttext": {
"dclm": 0.8924204111099243,
"english": 0.1311817169189453,
"fineweb_edu_approx": 2.738956928253174,
"eai_general_math": 0.9972839951515198,
"eai_open_web_math": 0.6929342746734619,
"eai_web_code": 0.005916300229728222
}
}
|
{
"free_decimal_correspondence": {
"primary": {
"code": "005.1332",
"labels": {
"level_1": "General works, books and libraries, information sciences",
"level_2": "",
"level_3": "Computer programming"
}
},
"secondary": {
"code": "-1",
"labels": {
"level_1": "",
"level_2": "",
"level_3": ""
}
}
},
"bloom_cognitive_process": {
"primary": {
"code": "2",
"label": "Understand"
},
"secondary": {
"code": "3",
"label": "Apply"
}
},
"bloom_knowledge_domain": {
"primary": {
"code": "2",
"label": "Conceptual"
},
"secondary": {
"code": "3",
"label": "Procedural"
}
},
"document_type_v1": {
"primary": {
"code": "3",
"label": "Reference/Encyclopedic/Educational"
},
"secondary": {
"code": "4",
"label": "Code/Software"
}
},
"extraction_artifacts": {
"primary": {
"code": "0",
"label": "No Artifacts"
},
"secondary": {
"code": "3",
"label": "Irrelevant Content"
}
},
"missing_content": {
"primary": {
"code": "0",
"label": "No missing content"
},
"secondary": {
"code": "-1",
"label": "Abstain"
}
},
"document_type_v2": {
"primary": {
"code": "8",
"label": "Documentation"
},
"secondary": {
"code": "23",
"label": "Tutorial"
}
},
"reasoning_depth": {
"primary": {
"code": "2",
"label": "Basic Reasoning"
},
"secondary": {
"code": "1",
"label": "No Reasoning"
}
},
"technical_correctness": {
"primary": {
"code": "4",
"label": "Highly Correct"
},
"secondary": {
"code": "3",
"label": "Mostly Correct"
}
},
"education_level": {
"primary": {
"code": "2",
"label": "High School Level"
},
"secondary": {
"code": "1",
"label": "General Audience"
}
}
}
|
672f1e42c33a7f9846924a2431ea77df
|
7,872,022,921,138,696,000
|
US9589565B2 - Environmentally aware dialog policies and response generation - Google Patents
Environmentally aware dialog policies and response generation Download PDF
Info
Publication number
US9589565B2
US9589565B2 US13/923,917 US201313923917A US9589565B2 US 9589565 B2 US9589565 B2 US 9589565B2 US 201313923917 A US201313923917 A US 201313923917A US 9589565 B2 US9589565 B2 US 9589565B2
Authority
US
United States
Prior art keywords
environmental conditions
dialog
user
response
machine action
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active, expires
Application number
US13/923,917
Other versions
US20140379353A1 (en
Inventor
Daniel Boies
Larry Heck
Tasos Anastasakos
Ruhi Sarikaya
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Microsoft Technology Licensing LLC
Original Assignee
Microsoft Technology Licensing LLC
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Microsoft Technology Licensing LLC filed Critical Microsoft Technology Licensing LLC
Priority to US13/923,917 priority Critical patent/US9589565B2/en
Assigned to MICROSOFT CORPORATION reassignment MICROSOFT CORPORATION ASSIGNMENT OF ASSIGNORS INTEREST (SEE DOCUMENT FOR DETAILS). Assignors: ANASTASAKOS, TASOS, BOIES, DANIEL, SARIKAYA, RUHI, HECK, LARRY
Assigned to MICROSOFT CORPORATION reassignment MICROSOFT CORPORATION ASSIGNMENT OF ASSIGNORS INTEREST (SEE DOCUMENT FOR DETAILS). Assignors: ANASTASAKOS, TASOS, BOIES, DANIEL, SARIKAYA, RUHI, HECK, LARRY
Publication of US20140379353A1 publication Critical patent/US20140379353A1/en
Assigned to MICROSOFT TECHNOLOGY LICENSING, LLC reassignment MICROSOFT TECHNOLOGY LICENSING, LLC ASSIGNMENT OF ASSIGNORS INTEREST (SEE DOCUMENT FOR DETAILS). Assignors: MICROSOFT CORPORATION
Publication of US9589565B2 publication Critical patent/US9589565B2/en
Application granted granted Critical
Application status is Active legal-status Critical
Adjusted expiration legal-status Critical
Links
Images
Classifications
• GPHYSICS
• G10MUSICAL INSTRUMENTS; ACOUSTICS
• G10LSPEECH ANALYSIS OR SYNTHESIS; SPEECH RECOGNITION; SPEECH OR VOICE PROCESSING; SPEECH OR AUDIO CODING OR DECODING
• G10L15/00Speech recognition
• G10L15/22Procedures used during a speech recognition process, e.g. man-machine dialogue
• GPHYSICS
• G06COMPUTING; CALCULATING; COUNTING
• G06FELECTRIC DIGITAL DATA PROCESSING
• G06F17/00Digital computing or data processing equipment or methods, specially adapted for specific functions
• G06F17/20Handling natural language data
• G06F17/27Automatic analysis, e.g. parsing
• G06F17/2785Semantic analysis
• GPHYSICS
• G10MUSICAL INSTRUMENTS; ACOUSTICS
• G10LSPEECH ANALYSIS OR SYNTHESIS; SPEECH RECOGNITION; SPEECH OR VOICE PROCESSING; SPEECH OR AUDIO CODING OR DECODING
• G10L17/00Speaker identification or verification
• G10L17/22Interactive procedures; Man-machine interfaces
Abstract
Environmental conditions, along with other information, are used to adjust a response of a conversational dialog system. The environmental conditions may be used at different times within the conversational dialog system. For example, the environmental conditions can be used to adjust the dialog manager's output (e.g., the machine action). The dialog state information that is used by the dialog manager includes environmental conditions for the current turn in the dialog as well as environmental conditions for one or more past turns in the dialog. The environmental conditions can also be used after receiving the machine action to adjust the response that is provided to the user. For example, the environmental conditions may affect the machine action that is determined as well as how the action is provided to the user. The dialog manager and the response generation components in the conversational dialog system each use the available environmental conditions.
Description
BACKGROUND
Conversational dialog systems are used for a variety of different applications. For example, conversational dialog systems have been developed to allow users to search for content, buy items, obtain directions, and the like. These conversational dialog systems are continually being improved to allow for more natural interactions to occur between a computer and a user.
SUMMARY
This Summary is provided to introduce a selection of concepts in a simplified form that are further described below in the Detailed Description. This Summary is not intended to identify key features or essential features of the claimed subject matter, nor is it intended to be used as an aid in determining the scope of the claimed subject matter.
Environmental conditions, along with other information, are used to adjust different operations of a conversational dialog system. The environmental conditions may be used at different times within the conversational dialog system. The dialog manager and the response generation components in the conversational dialog system each use the available environmental conditions along with the other information in the dialog system (e.g., previous turn language understanding results in the dialog, speech recognition results and confidences, knowledge results, previous machine actions, session context, client context . . . ) when performing their operations. For example, the environmental conditions can be used to adjust the dialog manager's output (e.g., the machine action). The dialog state information that is used by the dialog manager includes environmental conditions along with other dialog information for the current turn in the dialog as well as environmental conditions for one or more past turns in the dialog. The environmental conditions can also be used after receiving the machine action to adjust the response that is provided to the user. For example, the response generator may use the environmental conditions to affect how the machine action is provided to the user (e.g., speech, visual . . . ).
BRIEF DESCRIPTION OF THE DRAWINGS
FIG. 1 illustrates using environmental conditions to adjust different operations performed by a conversational dialog system;
FIG. 2 shows interactions between an application and a dialog service for configuring permissions;
FIG. 3 illustrates an exemplary conversational dialog system using environmental conditions;
FIG. 4 illustrates a process for using environmental conditions in a conversational dialog system;
FIG. 5 illustrates an exemplary online system that uses environmental conditions in determining a machine action and how to deliver a response in a dialog; and
FIGS. 6, 7A, 7B and 8 and the associated descriptions provide a discussion of a variety of operating environments in which embodiments of the invention may be practiced.
DETAILED DESCRIPTION
Referring now to the drawings, in which like numerals represent like elements, various embodiment will be described.
FIG. 1 illustrates using environmental conditions to adjust different operations performed by a conversational dialog system.
As illustrated, system 100 includes dialog service 105, dialog manager 26, permissions and settings 110, machine action generator 120, dialog policy 130, response generator 140, dialog state information 145, environmental conditions 150, understanding model(s) 160, application 110 and touch screen input device 115.
Generally, conversational dialog system 100 uses environmental signals (e.g., language understanding and knowledge results, speech recognition results and confidences . . . ) for policy and response generation in addition to the use of other information or signals typically available in the dialog system. The environmental signals augment (not replace) the signals typically used within a dialog system. Dialog manager 26 uses environmental conditions 150 in addition to dialog state information 145 to adjust different operations of a conversational dialog system. The environmental conditions may be used at different times within the conversational dialog system 100. The dialog manager 26, machine action generator 120, and the response generator 140 components in the conversational dialog system 100 can each use the available environmental conditions 150 when performing their operations.
Machine action generator 120 can use environmental conditions 150 to adjust the machine action that is determined along with using dialog state information 145. Generally, the environmental conditions 150 augment the dialog state information 145 that is used within the dialog system. For example, dialog state information 145 includes information, such as, but not limited to: e.g., previous turn language understanding results in the dialog, speech recognition results and confidences, knowledge results, previous machine actions, session context, client context, and the like. Each interaction between the user and the computing device (i.e., the machine) is a turn. The current turn is the current interaction between the user and the machine for which a machine action is being determined. A previous turn is a previous interaction between the user and the machine. According to an embodiment, the dialog state information 145 includes information relating to one or more previous turns. For example, language understanding results that associate a meaning to a natural language sentence are stored in dialog state information 145. These previous language understanding results may be used to provide a context for the current turn in the dialog. The dialog state information may also include knowledge results that are the results returned from a knowledge source, such as a database or data source. For example, if a user requests movies in a dialog turn, the knowledge results include a list of movies. The machine action that is determined using the environmental conditions may be different than the machine action that is determined without using the environmental conditions. For example, the machine action that is generated by machine action generator 120 may indicate to ask the driver if they are sure they would like to make a call while driving when environmental conditions 150 indicate that the user is currently driving. Without the use of environmental conditions 150 to augment the machine action, the machine action generator 120 would likely generate a machine action to automatically initiate the call while the user is currently driving instead of asking the driver if they are sure they would like to make a call while driving. Machine action generator 120 uses dialog policy 130 when determining the machine action. The dialog policy 130 includes different rules, including rules that use environmental conditions 150 and other dialog state information, to adjust the machine action that is generated.
Environmental conditions 150 can also be used by response generator 140 after receiving the machine action to adjust the response that is provided to the user. Environmental conditions 150 may affect how the machine action is provided to the user (e.g., speech, visual . . . ). For example, the response generated by response generator 140 may be a visual response when environmental conditions 150 indicate that the user's environment is noisy. The response generated by response generator 140 may be an auditory response when environmental conditions 150 indicate that the user's environment is very bright and it is unlikely that a display may be seen clearly.
Environmental conditions 150 may include a variety of different conditions, such as, but not limited to: weather conditions, traffic conditions, current activity conditions, a current computing device being used, and the like. The current activity conditions may include information, such as, but not limited to: a current speed, a current location, and the like. Generally, the environmental conditions relate to any environmental conditions that are associated with a user providing the input (the user dialog act). According to an embodiment, environmental conditions may also be associated with another user 154 (e.g., a contact that is being called). According to an embodiment, the environmental conditions that are collected and used to adjust the operation of the conversational dialog system are specified and authorized by the user.
In order to facilitate communication with the dialog manager 26, one or more callback routines, may be implemented. According to an embodiment, application program 110 is a multimodal application that is configured to receive speech input and input from a touch-sensitive input device 115 or other input devices. For example, voice input, keyboard input (e.g., a physical keyboard and/or SIP), video based input, and the like. Application program 110 may also provide multimodal output (e.g., speech, graphics, vibrations, sounds, . . . ). Dialog manager 26 may provide information to/from application 110 in response to user input (e.g., speech, gesture). For example, a user may say a phrase to identify a task to perform by application 110 (e.g., selecting a movie, buying an item, identifying a product, . . . ). Gestures may include, but are not limited to: a pinch gesture; a stretch gesture; a select gesture (e.g., a tap action on a displayed element); a select and hold gesture (e.g., a tap and hold gesture received on a displayed element); a swiping action and/or dragging action; and the like. Gestures may also include optically captured gestures, such as: a wave gesture, a scroll gesture, a guide gesture, and the like. For example, a device, such as MICROSOFT KINECT may be used to detect gestures.
System 100 as illustrated comprises a touch screen input device 115 that detects when a touch input has been received (e.g., a finger touching or nearly teaching the touch screen). Any type of touch screen may be utilized that detects a user's touch input.
A natural user interface (NUI) and/or some other interfaces may be used to interact with dialog service 105. For example, a combination of a natural language dialog and other non-verbal modalities of expressing intent (e.g., gestures such as the gestures described above, touch, gaze, images, videos, spoken prosody, etc.) may be used to interact with dialog service 105. Dialog manager 26 may use an understanding model (e.g., a Language Understanding (LU) model or a multimodal understanding model). As illustrated, dialog manager 26 is part of a dialog service 105 that receives speech utterances and is configured to have a dialog with a user.
Generally, Natural Language Understanding (NLU) in goal-oriented dialog systems is directed at identifying the domain(s) and intent(s) of the user, as expressed in natural language (NL), and to extract associated arguments or slots. For example, in an airline domain, users often request flight information (e.g., “I want to fly to Boston from New York next week”). More details are provided below.
FIG. 2 shows interactions between an application and a dialog service for configuring permissions.
As illustrated, FIG. 2 shows dialog service 105 including settings 210 and log(s) 212 and application 110 that includes settings user interface 222, audit user interface 226, location user interface 228 and local settings 224.
A user may configure different criteria, such as permissions, filters and settings that are related to the operation of the application 110 and to the use and collection of environmental conditions that are associated with one or more users. For example, an authorized user may determine what environmental conditions may be collected and used by dialog service 105.
The user may set permissions that specify what environmental conditions may be collected. For example, a user may opt in to allow different types of environmental conditions to be collected and used by dialog service 105.
A user may also configure one or more filters that filter the information using various criteria (e.g., time of day, requesting device, requesting location, and the like). For example, a user may allow certain environmental conditions to be collected during certain times and not allow environmental conditions to be collected during other times. A user may configure a filter to limit the accuracy of one or more of the environmental conditions. For example, location information that is associated with a user may be configured to provide a general location as compared to detailed location. A user may also set local settings 224 such as application customization settings (e.g., color schemes, icons and the like) for use when interacting with application 110. For example, the settings 224 may change an appearance of a User Interface, such as UI 228.
Audit user interface 226 may be used by an authorized user to view and interact with information relating to environmental conditions that are stored in log 212. Access to the log related data is limited to an authorized user who has provided the correct security credentials. The data is stored securely within log(s) 212.
FIG. 3 illustrates an exemplary conversational dialog system using environmental conditions.
As illustrated, system 300 includes input manager 310, language understanding component 320, dialog engine 330, response generator 140, and environment engine 350.
Input manager 310 is configured to receive a user input (the user dialog act). The user dialog act may be different types of user input. For example, the user dialog act may be speech input (e.g., an utterance), touch input, gesture input, text input, as well as other types of input. Input manager 310 may include different components, such as an Automatic Speech Recognizer (ASR), a gesture recognizer, a handwriting recognizer, and the like. When the user dialog act is speech, the speech is recognized by input manager 310 using ASR. Input manager 310 outputs text that is delivered to language understanding component 320.
Language understanding component 320 is configured to receive and analyze the text. Generally, the language understanding component 320 associates a meaning to the words of the text. For example, the language understanding component 320 may tag the text, perform a syntactic analysis of the text, and the like. The language understanding component 320 is traditionally a rules based component that converts natural language sentences into semantic representations.
Dialog engine 330 manages the dialog by determining a machine action in response to the user dialog act. Dialog engine 330 may be a rules based model or a statistical model, or some combination of rules and statistical models. Dialog engine 330 computes possible dialog states using dialog state computation component 332. Dialog state computation component 332 uses environmental conditions obtained from environment engine 350 in addition to other dialog state information when calculating the possible dialog states. The environmental conditions that are used by the dialog system are in addition to other dialog information generally used within a dialog system, such as but not limited to: previous turn language understanding results, speech recognition results and confidences, knowledge results, previous machine actions, session context, client context, and the like. The environmental conditions may be associated with one or more users. Dialog manager 26 determines the machine action or machine actions. The dialog state information that is used by dialog manager 26 includes environmental conditions for the current turn in the dialog as well as environmental conditions for one or more past turns in the dialog. Dialog engine 330 provides the determined machine action to response generator 140.
Response generator 140 uses environmental conditions that are obtained from environment engine in addition to the other dialog information to determine what type of response to provide the user. For example, the response generator 140 may determine to provide a spoken response to the user or a visual response to the user. For example, a Text-to-Speech (“TTS”) component may output the response as synthesized speech when determined. According to an embodiment, the environmental conditions are updated after dialog manager 26 determines the machine action and before response generator 140 receives the environmental conditions.
FIG. 4 illustrates a process for using environmental conditions in a conversational dialog system. When reading the discussion of the routines presented herein, it should be appreciated that the logical operations of various embodiments are implemented (1) as a sequence of computer implemented acts or program modules running on a computing system and/or (2) as interconnected machine logic circuits or circuit modules within the computing system. The implementation is a matter of choice dependent on the performance requirements of the computing system implementing the invention. Accordingly, the logical operations illustrated and making up the embodiments described herein are referred to variously as operations, structural devices, acts or modules. These operations, structural devices, acts and modules may be implemented in software, in firmware, in special purpose digital logic, and any combination thereof.
After a start operation, the process 400 moves to operation 410, where a user dialog act is received. The user dialog act may be different types of user input, such as, but not limited to: speech input (e.g., an utterance), touch input, gesture input, text input, as well as other types of input. Generally, the user dialog act is part of a conversation with a dialog system.
Transitioning to operation 420, environmental conditions are determined. The environmental conditions are associated with one or more users. For example, the environmental conditions may be current environmental conditions that are associated with a user making the user dialog act. The environmental conditions may also be current environmental conditions that are associated with another user that is a part of the user dialog act. For example, the user dialog act may be an act to contact another user. The environmental conditions may include a variety of different conditions, such as, but not limited to: weather conditions (e.g., temperature, pressure . . . ), traffic conditions, current activity conditions, a current computing device being used, and the like. Generally, any environmental condition may be determined and used by the conversational dialog system. The current activity conditions may include a variety of different environmental conditions, such as, a location of the user, a velocity of the user, and the like.
Moving to operation 430, the machine action is determined using the environmental conditions, other dialog state information, and the user dialog act. According to an embodiment, the environmental conditions are used in addition to the other dialog state information by the conversational dialog system when calculating the possible dialog states. For example, the other dialog state information may include but is not limited to: previous turn language understanding results, speech recognition results and confidences, knowledge results, previous machine actions, session context, client context, and the like. The dialog state information includes environmental conditions for the current turn in the dialog as well as environmental conditions for one or more past turns in the dialog.
The following examples illustrate adjusting the machine action using environmental conditions and the other information in the dialog system to determine the machine action. The examples are for illustration purposes and are not intended to be limiting.
The following is an example dialog while a user is driving. 1) User: “Call Paul at home”; 2) Dialog System: “Are you sure you want to make the call while driving?” As can be seen, instead of the machine action being to make the call, the machine action was adjusted to request whether the user wanted to make the call.
The next example is a dialog where a user attempts to call a contact in a time zone where the contact is likely sleeping. 1) User: “Call Paul”; 2) Dialog System: “Paul is likely sleeping right now. Would you like to send a message to Paul instead?” In this example, the environmental conditions that are associated with the contact changed the machine action.
The next example is a dialog where a user attempts to place a call while user is in a roaming mode or the contact is in a roaming mode. 1) User: “Call Paul”; Dialog System: “Calling Paul will cost Paul two dollars a minute since he is currently roaming. Would you like to message Paul instead?” In this example, the environmental conditions that changed the machine action are associated with the current activity of the contact.
The next example is a dialog where a user attempts to call a contact while the contact is likely driving. 1) User: “Call Paul”; 2) Dialog System: “Paul may be driving. Would you like to send a message instead?” In this example, the environmental conditions that changed the machine action are associated with the current activity of the contact.
The next example is a dialog where a user attempts to call a contact while the contact is in a noisy environment. 1) User: “Call Paul”; 2) Dialog System “Paul might not be able to hear you well. Would you like to send a message instead?” In this example, the environmental conditions that changed the machine action are associated with the current noise conditions of the contact.
Flowing to operation 440, a response for the machine action is determined using the environmental conditions. Many different types of responses may be provided (e.g., visual, auditory, haptic . . . ). A spoken response may be provided to the user or a visual response may be provided to the user. For example, a user may be in a noisy environment, and the response is adjusted to be louder than normal. The type of response may also be changed. For example, the response may be changed from an auditory response to a visual response.
Moving to operation 450, the response is provided to the user.
The process then flows to an end operation and returns to processing other actions.
FIG. 5 illustrates an exemplary online system that uses environmental conditions in determining a machine action and how to deliver a response in a dialog. As illustrated, system 1000 includes service 1010, data store 1045, environmental conditions 150, touch screen input device 1050 (e.g., a slate), smart phone 1030 and display device 1080.
As illustrated, service 1010 is a cloud based and/or enterprise based service that may be configured to provide services, such as dialog services as described herein. The service may be interacted with using different types of input and output. For example, a user may use speech input, touch input, hardware based input, and the like. Functionality of one or more of the services provided by service 1010 may also be configured as a client/server based application.
As illustrated, service 1010 is a multi-tenant service that provides resources 1015 and services to any number of tenants (e.g., Tenants 1-N). Multi-tenant service 1010 is a cloud based service that provides resources 1015 to tenants subscribed to the service and maintains each tenant's data separately and protected from other tenant data.
System 1000 as illustrated comprises a touch screen input device 1050 (e.g., a slate device) and smart phone 1030 that detects when a touch input has been received (e.g., a finger touching or nearly touching the touch screen). Any type of touch screen may be utilized that detects a user's touch input. For example, the touch screen may include one or more layers of capacitive material that detects the touch input. Other sensors may be used in addition to or in place of the capacitive material. For example, Infrared (IR) sensors may be used. According to an embodiment, the touch screen is configured to detect objects that in contact with or above a touchable surface. Although the term “above” is used in this description, it should be understood that the orientation of the touch panel system is irrelevant. The term “above” is intended to be applicable to all such orientations. The touch screen may be configured to determine locations of where touch input is received (e.g., a starting point, intermediate points and an ending point). Actual contact between the touchable surface and the object may be detected by any suitable means, including, for example, by a vibration sensor or microphone coupled to the touch panel. A non-exhaustive list of examples for sensors to detect contact includes pressure-based mechanisms, micro-machined accelerometers, piezoelectric devices, capacitive sensors, resistive sensors, inductive sensors, laser vibrometers, and LED vibrometers.
According to an embodiment, smart phone 1030, touch screen input device 1050, and device 1080 are configured with multimodal input and output and each include an application (1031, 1051, 1081) that interact with service 1010.
As illustrated, touch screen input device 1050, smart phone 1030, and display device 1080 shows exemplary displays 1052, 1032, and 1082 showing the use of an application. Data may be stored on a device (e.g., smart phone 1030, touch screen input device 1050 and/or at some other location (e.g., network data store 1045). Data store 1045, or some other store, may be used to store an understanding model, as well as other data. The applications used by the devices may be client based applications, server based applications, cloud based applications or some combination. According to an embodiment, display device 1080 is a device such as a MICROSOFT XBOX coupled to a display.
Dialog manager 26 is configured to perform operations relating to processes as described herein. Dialog manager 26 is configured to access environmental conditions 150. While manager 26 is shown within service 1010, the functionality of the manager may be included in other locations (e.g., on smart phone 1030 and/or touch screen input device 1050 and/or device 1080).
The embodiments and functionalities described herein may operate via a multitude of computing systems including, without limitation, desktop computer systems, wired and wireless computing systems, mobile computing systems (e.g., mobile telephones, netbooks, tablet or slate type computers, notebook computers, and laptop computers), hand-held devices, multiprocessor systems, microprocessor-based or programmable consumer electronics, minicomputers, and mainframe computers.
In addition, the embodiments and functionalities described herein may operate over distributed systems (e.g., cloud-based computing systems), where application functionality, memory, data storage and retrieval and various processing functions may be operated remotely from each other over a distributed computing network, such as the Internet or an intranet. User interfaces and information of various types may be displayed via on-board computing device displays or via remote display units associated with one or more computing devices. For example user interfaces and information of various types may be displayed and interacted with on a wall surface onto which user interfaces and information of various types are projected. Interaction with the multitude of computing systems with which embodiments of the invention may be practiced include, keystroke entry, touch screen entry, voice or other audio entry, gesture entry where an associated computing device is equipped with detection (e.g., camera) functionality for capturing and interpreting user gestures for controlling the functionality of the computing device, and the like.
FIGS. 6-8 and the associated descriptions provide a discussion of a variety of operating environments in which embodiments of the invention may be practiced. However, the devices and systems illustrated and discussed with respect to FIGS. 6-8 are for purposes of example and illustration and are not limiting of a vast number of computing device configurations that may be utilized for practicing embodiments of the invention, described herein.
FIG. 6 is a block diagram illustrating physical components (i.e., hardware) of a computing device 1100 with which embodiments of the invention may be practiced. The computing device components described below may be suitable for the computing devices described above. In a basic configuration, the computing device 1100 may include at least one processing unit 1102 and a system memory 1104. Depending on the configuration and type of computing device, the system memory 1104 may comprise, but is not limited to, volatile storage (e.g., random access memory), non-volatile storage (e.g., read-only memory), flash memory, or any combination of such memories. The system memory 1104 may include an operating system 1105 and one or more program modules 1106 suitable for running software applications 1120 such as the dialog manager 26. The operating system 1105, for example, may be suitable for controlling the operation of the computing device 1100. Furthermore, embodiments of the invention may be practiced in conjunction with a graphics library, other operating systems, or any other application program and is not limited to any particular application or system. This basic configuration is illustrated in FIG. 6 by those components within a dashed line 1108. The computing device 1100 may have additional features or functionality. For example, the computing device 1100 may also include additional data storage devices (removable and/or non-removable) such as, for example, magnetic disks, optical disks, or tape. Such additional storage is illustrated in FIG. 6 by a removable storage device 1109 and a non-removable storage device 1110.
As stated above, a number of program modules and data files may be stored in the system memory 1104. While executing on the processing unit 1102, the program modules 1106 (e.g., the dialog manager 26) may perform processes including, but not limited to, one or more of the stages of the methods and processes illustrated in the figures. Other program modules that may be used in accordance with embodiments of the present invention may include electronic mail and contacts applications, word processing applications, spreadsheet applications, database applications, slide presentation applications, drawing or computer-aided application programs, etc.
Furthermore, embodiments of the invention may be practiced in an electrical circuit comprising discrete electronic elements, packaged or integrated electronic chips containing logic gates, a circuit utilizing a microprocessor, or on a single chip containing electronic elements or microprocessors. For example, embodiments of the invention may be practiced via a system-on-a-chip (SOC) where each or many of the components illustrated in FIG. 6 may be integrated onto a single integrated circuit. Such an SOC device may include one or more processing units, graphics units, communications units, system virtualization units and various application functionality all of which are integrated (or “burned”) onto the chip substrate as a single integrated circuit. When operating via an SOC, the functionality, described herein, with respect to the dialog manager 26 may be operated via application-specific logic integrated with other components of the computing device 1100 on the single integrated circuit (chip). Embodiments of the invention may also be practiced using other technologies capable of performing logical operations such as, for example, AND, OR, and NOT, including but not limited to mechanical, optical, fluidic, and quantum technologies. In addition, embodiments of the invention may be practiced within a general purpose computer or in any other circuits or systems.
The computing device 1100 may also have one or more input device(s) 1112 such as a keyboard, a mouse, a pen, a sound input device, a touch input device, etc. The output device(s) 1114 such as a display, speakers, a printer, etc. may also be included. The aforementioned devices are examples and others may be used. The computing device 1100 may include one or more communication connections 1116 allowing communications with other computing devices 1118. Examples of suitable communication connections 1116 include, but are not limited to, RF transmitter, receiver, and/or transceiver circuitry; universal serial bus (USB), parallel, and/or serial ports.
The term computer readable media as used herein may include computer storage media. Computer storage media may include volatile and nonvolatile, removable and non-removable media implemented in any method or technology for storage of information, such as computer readable instructions, data structures, or program modules. The system memory 1104, the removable storage device 1109, and the non-removable storage device 1110 are all computer storage media examples (i.e., memory storage.) Computer storage media may include RAM, ROM, electrically erasable read-only memory (EEPROM), flash memory or other memory technology, CD-ROM, digital versatile disks (DVD) or other optical storage, magnetic cassettes, magnetic tape, magnetic disk storage or other magnetic storage devices, or any other article of manufacture which can be used to store information and which can be accessed by the computing device 1100. Any such computer storage media may be part of the computing device 1100. Computer storage media does not include a carrier wave or other propagated or modulated data signal.
Communication media may be embodied by computer readable instructions, data structures, program modules, or other data in a modulated data signal, such as a carrier wave or other transport mechanism, and includes any information delivery media. The term “modulated data signal” may describe a signal that has one or more characteristics set or changed in such a manner as to encode information in the signal. By way of example, and not limitation, communication media may include wired media such as a wired network or direct-wired connection, and wireless media such as acoustic, radio frequency (RF), infrared, and other wireless media.
FIGS. 7A and 7B illustrate a mobile computing device 1200, for example, a mobile telephone, a smart phone, a tablet personal computer, a laptop computer, and the like, with which embodiments of the invention may be practiced. With reference to FIG. 7A, one embodiment of a mobile computing device 1200 for implementing the embodiments is illustrated. In a basic configuration, the mobile computing device 1200 is a handheld computer having both input elements and output elements. The mobile computing device 1200 typically includes a display 1205 and one or more input buttons 1210 that allow the user to enter information into the mobile computing device 1200. The display 1205 of the mobile computing device 1200 may also function as an input device (e.g., a touch screen display). If included, an optional side input element 1215 allows further user input. The side input element 1215 may be a rotary switch, a button, or any other type of manual input element. In alternative embodiments, mobile computing device 1200 may incorporate more or less input elements. For example, the display 1205 may not be a touch screen in some embodiments. In yet another alternative embodiment, the mobile computing device 1200 is a portable phone system, such as a cellular phone. The mobile computing device 1200 may also include an optional keypad 1235. Optional keypad 1235 may be a physical keypad or a “soft” keypad generated on the touch screen display. In various embodiments, the output elements include the display 1205 for showing a graphical user interface (GUI), a visual indicator 1220 (e.g., a light emitting diode), and/or an audio transducer 1225 (e.g., a speaker). In some embodiments, the mobile computing device 1200 incorporates a vibration transducer for providing the user with tactile feedback. In yet another embodiment, the mobile computing device 1200 incorporates input and/or output ports, such as an audio input (e.g., a microphone jack), an audio output (e.g., a headphone jack), and a video output (e.g., a HDMI port) for sending signals to or receiving signals from an external device.
FIG. 7B is a block diagram illustrating the architecture of one embodiment of a mobile computing device. That is, the mobile computing device 1200 can incorporate a system 1202 (i.e., an architecture) to implement some embodiments. In one embodiment, the system 1202 is implemented as a “smart phone” capable of running one or more applications (e.g., browser, e-mail, calendaring, contact managers, messaging clients, games, and media clients, players). In some embodiments, the system 1202 is integrated as a computing device, such as an integrated personal digital assistant (PDA) and wireless phone.
One or more application programs 1266 may be loaded into the memory 1262 and run on or in association with the operating system 1264. Examples of the application programs include phone dialer programs, e-mail programs, personal information management (PIM) programs, word processing programs, spreadsheet programs, Internet browser programs, messaging programs, and so forth. The system 1202 also includes a non-volatile storage area 1268 within the memory 1262. The non-volatile storage area 1268 may be used to store persistent information that should not be lost if the system 1202 is powered down. The application programs 1266 may use and store information in the non-volatile storage area 1268, such as e-mail or other messages used by an e-mail application, and the like. A synchronization application (not shown) also resides on the system 1202 and is programmed to interact with a corresponding synchronization application resident on a host computer to keep the information stored in the non-volatile storage area 1268 synchronized with corresponding information stored at the host computer. As should be appreciated, other applications may be loaded into the memory 1262 and run on the mobile computing device 1200, including the dialog manager 26 as described herein.
The system 1202 has a power supply 1270, which may be implemented as one or more batteries. The power supply 1270 might further include an external power source, such as an AC adapter or a powered docking cradle that supplements or recharges the batteries.
The system 1202 may also include a radio 1272 that performs the function of transmitting and receiving radio frequency communications. The radio 1272 facilitates wireless connectivity between the system 1202 and the “outside world,” via a communications carrier or service provider. Transmissions to and from the radio 1272 are conducted under control of the operating system 1264. In other words, communications received by the radio 1272 may be disseminated to the application programs 1266 via the operating system 1264, and vice versa.
The visual indicator 1220 may be used to provide visual notifications, and/or an audio interface 1274 may be used for producing audible notifications via the audio transducer 1225. In the illustrated embodiment, the visual indicator 1220 is a light emitting diode (LED) and the audio transducer 1225 is a speaker. These devices may be directly coupled to the power supply 1270 so that when activated, they remain on for a duration dictated by the notification mechanism even though the processor 1260 and other components might shut down for conserving battery power. The LED may be programmed to remain on indefinitely until the user takes action to indicate the powered-on status of the device. The audio interface 1274 is used to provide audible signals to and receive audible signals from the user. For example, in addition to being coupled to the audio transducer 1225, the audio interface 1274 may also be coupled to a microphone to receive audible input, such as to facilitate a telephone conversation. In accordance with embodiments of the present invention, the microphone may also serve as an audio sensor to facilitate control of notifications, as will be described below. The system 1202 may further include a video interface 1276 that enables an operation of an on-board camera to record still images, video stream, and the like.
A mobile computing device 1200 implementing the system 1202 may have additional features or functionality. For example, the mobile computing device 1200 may also include additional data storage devices (removable and/or non-removable) such as, magnetic disks, optical disks, or tape. Such additional storage is illustrated in FIG. 7B by the non-volatile storage area 1268. Mobile computing device 1200 may also include peripheral device port 1230.
Data/information generated or captured by the mobile computing device 1200 and stored via the system 1202 may be stored locally on the mobile computing device 1200, as described above, or the data may be stored on any number of storage media that may be accessed by the device via the radio 1272 or via a wired connection between the mobile computing device 1200 and a separate computing device associated with the mobile computing device 1200, for example, a server computer in a distributed computing network, such as the Internet. As should be appreciated such data/information may be accessed via the mobile computing device 1200 via the radio 1272 or via a distributed computing network. Similarly, such data/information may be readily transferred between computing devices for storage and use according to well-known data/information transfer and storage means, including electronic mail and collaborative data/information sharing systems.
FIG. 8 illustrates an embodiment of an architecture of an exemplary system, as described above. Content developed, interacted with, or edited in association with the dialog manager 26 may be stored in different communication channels or other storage types. For example, various documents may be stored using a directory service 1322, a web portal 1324, a mailbox service 1326, an instant messaging store 1328, or a social networking site 1330. The dialog manager 26 may use any of these types of systems or the like for enabling data utilization, as described herein. A server 1320 may provide the dialog manager 26 to clients. As one example, the server 1320 may be a web server providing the dialog manager 26 over the web. The server 1320 may provide the dialog manager 26 over the web to clients through a network 1315. By way of example, the client computing device may be implemented as the computing device 1100 and embodied in a personal computer, a tablet computing device 1310 and/or a mobile computing device 1200 (e.g., a smart phone). Any of these embodiments of the client computing device 1100, 1310, and 1200 may obtain content from the store 1316.
Embodiments of the present invention, for example, are described above with reference to block diagrams and/or operational illustrations of methods, systems, and computer program products according to embodiments of the invention. The functions/acts noted in the blocks may occur out of the order as shown in any flowchart. For example, two blocks shown in succession may in fact be executed substantially concurrently or the blocks may sometimes be executed in the reverse order, depending upon the functionality/acts involved.
The description and illustration of one or more embodiments provided in this application are not intended to limit or restrict the scope of the invention as claimed in any way. The embodiments, examples, and details provided in this application are considered sufficient to convey possession and enable others to make and use the best mode of claimed invention. The claimed invention should not be construed as being limited to any embodiment, example, or detail provided in this application. Regardless of whether shown and described in combination or separately, the various features (both structural and methodological) are intended to be selectively included or omitted to produce an embodiment with a particular set of features. Having been provided with the description and illustration of the present application, one skilled in the art may envision variations, modifications, and alternate embodiments falling within the spirit of the broader aspects of the general inventive concept embodied in this application that do not depart from the broader scope of the claimed invention.
Claims (20)
What is claimed is:
1. A computer-implemented method, performed by at least one processor, for using environmental conditions in addition to other dialog state information in a conversational dialog system, comprising:
receiving a user dialog act requesting a computer system to perform a task;
based on the user dialog act, determining a first machine action to perform the task;
accessing environmental conditions that are associated with the user dialog act;
based on the environmental conditions and the user dialog act, determining a second machine action other than performing the task, wherein the second machine action at least temporarily prevents completion of the first machine action; and
performing the second machine action to provide a response to a user.
2. The method of claim 1, further comprising determining a response type for the second machine action based on the environmental conditions.
3. The method of claim 1, wherein accessing the environmental conditions that are associated with the input comprises accessing at least one of: a location; a noise level; a velocity; a temperature; a current activity, or a current computing device.
4. The method of claim 1, wherein the environmental conditions comprise environmental conditions associated with another user.
5. The method of claim 1, wherein determining the machine actions based on the environmental conditions and the user dialog act comprises using at least one of a rules based model or a statistical model.
6. The method of claim 2, wherein determining the response type comprises using the environmental conditions to determine a type of response from: an audible response or a visual presentation of the response.
7. The method of claim 1, further comprising updating the environmental conditions after determining the second machine action.
8. The method of claim 1, further comprising receiving a selection of environmental conditions that may be used for a particular user.
9. The method of claim 1, further comprising updating a dialog policy to include rules relating to different environmental conditions.
10. The method of claim 1, wherein the response comprises a prompt to the user, wherein the prompt requests an additional response from the user based on the environmental conditions and the requested task.
11. A computer-readable storage device storing computer-executable instructions for using environmental conditions in addition to other dialog state information in a conversational dialog system, comprising:
receiving a user dialog act requesting a computer system to perform a task;
based on the user dialog act, determining a first machine action to perform the task;
accessing environmental conditions that are associated with the user dialog act;
based on the environmental conditions and the user dialog act, determining a second machine action other than performing the task, wherein the second machine action at least temporarily prevents completion of the first machine action; and
performing the second machine action to provide a response to a user.
12. The computer-readable storage device of claim 11, wherein accessing the environmental conditions that are associated with the input comprises accessing at least one of: a current activity being performed when the user dialog act is received or a current computing device.
13. The computer-readable storage device of claim 11, wherein the environmental conditions comprise environmental conditions that are associated with a current contact.
14. The computer-readable storage device of claim 11, wherein determining the machine actions comprises using a rules based model that include rules for different environmental conditions.
15. The computer-readable storage device of claim 11, further comprising instruction for using the environmental conditions to determine a type of response from: an audible response or a visual presentation of the response.
16. The computer-readable storage device of claim 11, further comprising updating the environmental conditions after determining the second machine action using the environmental conditions.
17. A system for using environmental conditions in addition to other dialog state information in a conversational dialog system, comprising:
a processor and memory;
an operating environment, executing using the processor; and
a dialog manager that is configured to perform actions comprising:
receiving a user dialog act requesting a computer system to perform a task;
based on the user dialog act, determining a first machine action to perform the task;
accessing environmental conditions that are associated with a user dialog act;
determining a second machine action, other than performing the task, using the user dialog act and the environmental conditions, wherein the second machine action at least temporarily prevents completion of the first machine action; and
performing the second machine action to provide a response to a user.
18. The system of claim 17, wherein accessing the environmental conditions comprises accessing at least one of: a current activity being performed when the user dialog act is received or a current computing device when authorized.
19. The system of claim 17, wherein the dialog manager is further configured to determine, based on the environmental conditions, a type of response from: an audible response or a visual presentation of the response.
20. The system of claim 17, wherein the dialog manager is further configured to update the environmental conditions after determining the second machine action using the environmental conditions.
US13/923,917 2013-06-21 2013-06-21 Environmentally aware dialog policies and response generation Active 2033-12-19 US9589565B2 (en)
Priority Applications (1)
Application Number Priority Date Filing Date Title
US13/923,917 US9589565B2 (en) 2013-06-21 2013-06-21 Environmentally aware dialog policies and response generation
Applications Claiming Priority (12)
Application Number Priority Date Filing Date Title
US13/923,917 US9589565B2 (en) 2013-06-21 2013-06-21 Environmentally aware dialog policies and response generation
BR112015031231A BR112015031231A2 (en) 2013-06-21 2014-06-05 environmentally perceptive policy dialogue and response generation
KR1020167001395A KR20160021850A (en) 2013-06-21 2014-06-05 Environmentally aware dialog policies and response generation
AU2014281049A AU2014281049B9 (en) 2013-06-21 2014-06-05 Environmentally aware dialog policies and response generation
RU2015154501A RU2667717C2 (en) 2013-06-21 2014-06-05 Environmentally aware dialog policies and response generation
PCT/US2014/041014 WO2014204655A1 (en) 2013-06-21 2014-06-05 Environmentally aware dialog policies and response generation
EP14736140.6A EP3011471A1 (en) 2013-06-21 2014-06-05 Environmentally aware dialog policies and response generation
CA2913735A CA2913735A1 (en) 2013-06-21 2014-06-05 Environmentally aware dialog policies and response generation
CN201480035401.9A CN105378708A (en) 2013-06-21 2014-06-05 Environmentally aware dialog policies and response generation
JP2016521428A JP6492069B2 (en) 2013-06-21 2014-06-05 Environment-aware interaction policy and response generation
MX2015017624A MX352774B (en) 2013-06-21 2014-06-05 Environmentally aware dialog policies and response generation.
US15/438,227 US10304448B2 (en) 2013-06-21 2017-02-21 Environmentally aware dialog policies and response generation
Related Child Applications (1)
Application Number Title Priority Date Filing Date
US15/438,227 Continuation US10304448B2 (en) 2013-06-21 2017-02-21 Environmentally aware dialog policies and response generation
Publications (2)
Publication Number Publication Date
US20140379353A1 US20140379353A1 (en) 2014-12-25
US9589565B2 true US9589565B2 (en) 2017-03-07
Family
ID=51134327
Family Applications (2)
Application Number Title Priority Date Filing Date
US13/923,917 Active 2033-12-19 US9589565B2 (en) 2013-06-21 2013-06-21 Environmentally aware dialog policies and response generation
US15/438,227 Active US10304448B2 (en) 2013-06-21 2017-02-21 Environmentally aware dialog policies and response generation
Family Applications After (1)
Application Number Title Priority Date Filing Date
US15/438,227 Active US10304448B2 (en) 2013-06-21 2017-02-21 Environmentally aware dialog policies and response generation
Country Status (11)
Country Link
US (2) US9589565B2 (en)
EP (1) EP3011471A1 (en)
JP (1) JP6492069B2 (en)
KR (1) KR20160021850A (en)
CN (1) CN105378708A (en)
AU (1) AU2014281049B9 (en)
BR (1) BR112015031231A2 (en)
CA (1) CA2913735A1 (en)
MX (1) MX352774B (en)
RU (1) RU2667717C2 (en)
WO (1) WO2014204655A1 (en)
Cited By (3)
* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20160239758A1 (en) * 2015-02-17 2016-08-18 Microsoft Technology Licensing, Llc Training systems and methods for sequence taggers
US9996531B1 (en) * 2016-03-29 2018-06-12 Facebook, Inc. Conversational understanding
US10162814B2 (en) * 2014-10-29 2018-12-25 Baidu Online Network Technology (Beijing) Co., Ltd. Conversation processing method, conversation management system and computer device
Families Citing this family (16)
* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9728184B2 (en) 2013-06-18 2017-08-08 Microsoft Technology Licensing, Llc Restructuring deep neural network acoustic models
US9311298B2 (en) 2013-06-21 2016-04-12 Microsoft Technology Licensing, Llc Building conversational understanding systems using a toolset
US9589565B2 (en) 2013-06-21 2017-03-07 Microsoft Technology Licensing, Llc Environmentally aware dialog policies and response generation
US9324321B2 (en) 2014-03-07 2016-04-26 Microsoft Technology Licensing, Llc Low-footprint adaptation and personalization for a deep neural network
US9529794B2 (en) 2014-03-27 2016-12-27 Microsoft Technology Licensing, Llc Flexible schema for language model customization
US9614724B2 (en) 2014-04-21 2017-04-04 Microsoft Technology Licensing, Llc Session-based device configuration
US9520127B2 (en) 2014-04-29 2016-12-13 Microsoft Technology Licensing, Llc Shared hidden layer combination for speech recognition systems
US9430667B2 (en) 2014-05-12 2016-08-30 Microsoft Technology Licensing, Llc Managed wireless distribution network
US10111099B2 (en) 2014-05-12 2018-10-23 Microsoft Technology Licensing, Llc Distributing content in managed wireless distribution networks
US9384334B2 (en) 2014-05-12 2016-07-05 Microsoft Technology Licensing, Llc Content discovery in managed wireless distribution networks
US9874914B2 (en) 2014-05-19 2018-01-23 Microsoft Technology Licensing, Llc Power management contracts for accessory devices
US9367490B2 (en) 2014-06-13 2016-06-14 Microsoft Technology Licensing, Llc Reversible connector for accessory devices
US10338959B2 (en) 2015-07-13 2019-07-02 Microsoft Technology Licensing, Llc Task state tracking in systems and services
US9978367B2 (en) * 2016-03-16 2018-05-22 Google Llc Determining dialog states for language models
EP3441889A4 (en) * 2016-04-08 2019-05-22 Sony Corporation Information processing device and information processing method
US20180005629A1 (en) * 2016-06-30 2018-01-04 Microsoft Technology Licensing, Llc Policy authoring for task state tracking during dialogue
Citations (84)
* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP0553101B1 (en) 1991-08-19 1997-07-23 LERNOUT & HAUSPIE SPEECHPRODUCTS A pattern recognition device using an artificial neural network for context dependent modelling
US6167377A (en) 1997-03-28 2000-12-26 Dragon Systems, Inc. Speech recognition language models
US6185528B1 (en) 1998-05-07 2001-02-06 Cselt - Centro Studi E Laboratori Telecomunicazioni S.P.A. Method of and a device for speech recognition employing neural network and markov model recognition techniques
US6263308B1 (en) 2000-03-20 2001-07-17 Microsoft Corporation Methods and apparatus for performing speech recognition using acoustic models which are improved through an interactive process
JP2002091477A (en) 2000-09-14 2002-03-27 Mitsubishi Electric Corp Voice recognition system, voice recognition device, acoustic model control server, language model control server, voice recognition method and computer readable recording medium which records voice recognition program
US20020083041A1 (en) 2000-11-16 2002-06-27 Dimitris Achlioptas Methods and systems for computing singular value decompositions of matrices and low rank approximations of matrices
US20020116171A1 (en) 2001-02-16 2002-08-22 Motorola, Inc. Interactive tool for semi-automatic creation of a domain model
US20030125948A1 (en) 2002-01-02 2003-07-03 Yevgeniy Lyudovyk System and method for speech recognition by multi-pass recognition using context specific grammars
US20030212544A1 (en) 2002-05-10 2003-11-13 Alejandro Acero System for automatically annotating training data for a natural language understanding system
US20030212543A1 (en) 2002-05-07 2003-11-13 International Business Machines Corporation Integrated development tool for building a natural language understanding application
US20040088726A1 (en) 2002-11-01 2004-05-06 Yu-Fei Ma Systems and methods for generating a comprehensive user attention model
WO2005013262A1 (en) 2003-08-01 2005-02-10 Philips Intellectual Property & Standards Gmbh Method for driving a dialog system
US20050065789A1 (en) 2003-09-23 2005-03-24 Sherif Yacoub System and method with automated speech recognition engines
US20050091057A1 (en) 1999-04-12 2005-04-28 General Magic, Inc. Voice application development methodology
US20050144013A1 (en) * 2003-11-20 2005-06-30 Jun Fujimoto Conversation control apparatus, conversation control method, and programs therefor
US20050165598A1 (en) 2003-10-01 2005-07-28 Dictaphone Corporation System and method for modifying a language model and post-processor information
US6970947B2 (en) * 2001-07-18 2005-11-29 International Business Machines Corporation Method and apparatus for providing a flexible and scalable context service
US20070038436A1 (en) * 2005-08-10 2007-02-15 Voicebox Technologies, Inc. System and method of supporting adaptive misrecognition in conversational speech
US20070128979A1 (en) * 2005-12-07 2007-06-07 J. Shackelford Associates Llc. Interactive Hi-Tech doll
US20070150428A1 (en) 2007-03-20 2007-06-28 Brandyn Webb Inference engine for discovering features and making predictions using generalized incremental singular value decomposition
US20070156392A1 (en) 2005-12-30 2007-07-05 International Business Machines Corporation Method and system for automatically building natural language understanding models
US20070203863A1 (en) 2006-02-01 2007-08-30 Rakesh Gupta Meta learning for question classification
US20070226649A1 (en) 2006-03-23 2007-09-27 Agmon Jonathan Method for predictive typing
US20080004877A1 (en) 2006-06-30 2008-01-03 Nokia Corporation Method, Apparatus and Computer Program Product for Providing Adaptive Language Model Scaling
US20080195388A1 (en) 2007-02-08 2008-08-14 Microsoft Corporation Context based word prediction
US20080215183A1 (en) * 2007-03-01 2008-09-04 Ying-Tsai Chen Interactive Entertainment Robot and Method of Controlling the Same
US20080235017A1 (en) * 2007-03-22 2008-09-25 Honda Motor Co., Ltd. Voice interaction device, voice interaction method, and voice interaction program
US20090030697A1 (en) 2007-03-07 2009-01-29 Cerra Joseph P Using contextual information for delivering results generated from a speech recognition facility using an unstructured language model
US20090292687A1 (en) 2008-05-23 2009-11-26 International Business Machines Corporation System and method for providing question and answers with deferred type evaluation
US20100004930A1 (en) 2008-07-02 2010-01-07 Brian Strope Speech Recognition with Parallel Recognition Tasks
US20100114890A1 (en) 2008-10-31 2010-05-06 Purediscovery Corporation System and Method for Discovering Latent Relationships in Data
US20100128863A1 (en) 2008-11-21 2010-05-27 Robert Bosch Gmbh Context aware voice communication proxy
US7729902B1 (en) 2003-04-02 2010-06-01 At&T Intellectual Property Ii, L.P. Method of generation a labeling guide for spoken dialog services
US20100211695A1 (en) 2009-02-16 2010-08-19 Comverse, Ltd. Context-aware communications
US7835910B1 (en) 2003-05-29 2010-11-16 At&T Intellectual Property Ii, L.P. Exploiting unlabeled utterances for spoken language understanding
US20100312546A1 (en) 2009-06-04 2010-12-09 Microsoft Corporation Recognition using re-recognition and statistical classification
US20110010171A1 (en) 2009-07-07 2011-01-13 General Motors Corporation Singular Value Decomposition for Improved Voice Recognition in Presence of Multi-Talker Background Noise
US20110093459A1 (en) 2009-10-15 2011-04-21 Yahoo! Inc. Incorporating Recency in Network Search Using Machine Learning
US20110144999A1 (en) 2009-12-11 2011-06-16 Samsung Electronics Co., Ltd. Dialogue system and dialogue method thereof
US20110153324A1 (en) 2009-12-23 2011-06-23 Google Inc. Language Model Selection for Speech-to-Text Conversion
US8015006B2 (en) 2002-06-03 2011-09-06 Voicebox Technologies, Inc. Systems and methods for processing natural language speech utterances with context-specific domain agents
US20120065976A1 (en) 2010-09-15 2012-03-15 Microsoft Corporation Deep belief network for large vocabulary continuous speech recognition
US20120084086A1 (en) 2010-09-30 2012-04-05 At&T Intellectual Property I, L.P. System and method for open speech recognition
US8229729B2 (en) 2008-03-25 2012-07-24 International Business Machines Corporation Machine translation in continuous space
US20120232885A1 (en) 2011-03-08 2012-09-13 At&T Intellectual Property I, L.P. System and method for building diverse language models
US8275615B2 (en) 2007-07-13 2012-09-25 International Business Machines Corporation Model weighting, selection and hypotheses combination for automatic speech recognition and machine translation
US20120245944A1 (en) 2010-01-18 2012-09-27 Apple Inc. Intelligent Automated Assistant
US20120253802A1 (en) * 2011-03-31 2012-10-04 Microsoft Corporation Location-Based Conversational Understanding
US20120253799A1 (en) 2011-03-28 2012-10-04 At&T Intellectual Property I, L.P. System and method for rapid customization of speech recognition models
US20120254086A1 (en) 2011-03-31 2012-10-04 Microsoft Corporation Deep convex network with joint use of nonlinear random projection, restricted boltzmann machine and batch-based parallelizable optimization
US20120254227A1 (en) 2011-03-31 2012-10-04 Microsoft Corporation Augmented Conversational Understanding Architecture
US20120265531A1 (en) 1999-11-12 2012-10-18 Bennett Ian M Speech based learning/training system using semantic decoding
US8296107B2 (en) 2000-06-29 2012-10-23 Aspen Technology, Inc. Computer method and apparatus for constraining a non-linear approximator of an empirical process
US20120271617A1 (en) 2011-04-25 2012-10-25 Google Inc. Cross-lingual initialization of language models
US20120290293A1 (en) 2011-05-13 2012-11-15 Microsoft Corporation Exploiting Query Click Logs for Domain Detection in Spoken Language Understanding
US8321220B1 (en) 2005-11-30 2012-11-27 At&T Intellectual Property Ii, L.P. System and method of semi-supervised learning for spoken language understanding using semantic role labeling
US20120303565A1 (en) 2011-05-23 2012-11-29 Microsoft Corporation Learning processes for single hidden layer neural networks with linear output units
US8326634B2 (en) 2005-08-05 2012-12-04 Voicebox Technologies, Inc. Systems and methods for responding to natural language speech utterance
US8346563B1 (en) 2012-04-10 2013-01-01 Artificial Solutions Ltd. System and methods for delivering advanced natural language interaction applications
US20130031476A1 (en) 2011-07-25 2013-01-31 Coin Emmett Voice activated virtual assistant
KR20130022513A (en) 2011-08-24 2013-03-07 한국전자통신연구원 Speaker adaptation method based on joint bilinear transformation space and apparatus therefor
US8400332B2 (en) 2010-02-09 2013-03-19 Ford Global Technologies, Llc Emotive advisory system including time agent
US8412521B2 (en) 2004-08-20 2013-04-02 Multimodal Technologies, Llc Discriminative training of document transcription system
EP2575128A2 (en) 2011-09-30 2013-04-03 Apple Inc. Using context information to facilitate processing of commands in a virtual assistant
US20130138436A1 (en) 2011-11-26 2013-05-30 Microsoft Corporation Discriminative pretraining of deep neural networks
US20130152092A1 (en) 2011-12-08 2013-06-13 Osher Yadgar Generic virtual personal assistant platform
US20130185065A1 (en) * 2012-01-17 2013-07-18 GM Global Technology Operations LLC Method and system for using sound related vehicle information to enhance speech recognition
US8571866B2 (en) 2009-10-23 2013-10-29 At&T Intellectual Property I, L.P. System and method for improving speech recognition accuracy using textual context
WO2013171481A2 (en) 2012-05-14 2013-11-21 Touchtype Limited Mechanism for synchronising devices, system and method
US20130325148A1 (en) 2012-05-31 2013-12-05 Honeywell Asca Inc. Efficient quadratic programming (qp) solver for process control and optimization
US20140025380A1 (en) 2012-07-18 2014-01-23 International Business Machines Corporation System, method and program product for providing automatic speech recognition (asr) in a shared resource environment
US20140257803A1 (en) 2013-03-06 2014-09-11 Microsoft Corporation Conservatively adapting a deep neural network in a recognition system
US20140372112A1 (en) 2013-06-18 2014-12-18 Microsoft Corporation Restructuring deep neural network acoustic models
US20140379326A1 (en) 2013-06-21 2014-12-25 Microsoft Corporation Building conversational understanding systems using a toolset
US20150100312A1 (en) 2013-10-04 2015-04-09 At&T Intellectual Property I, L.P. System and method of using neural transforms of robust audio features for speech processing
US20150161994A1 (en) 2013-12-05 2015-06-11 Nuance Communications, Inc. Method and Apparatus for Speech Recognition Using Neural Networks with Speaker Adaptation
US20150161993A1 (en) 2013-12-06 2015-06-11 International Business Machines Corporation Systems and methods for applying speaker adaption techniques to correlated features
US20150170020A1 (en) 2013-12-13 2015-06-18 Amazon Technologies, Inc. Reducing dynamic range of low-rank decomposition matrices
US20150255069A1 (en) 2014-03-04 2015-09-10 Amazon Technologies, Inc. Predicting pronunciation in speech recognition
US20150255061A1 (en) 2014-03-07 2015-09-10 Microsoft Corporation Low-footprint adaptation and personalization for a deep neural network
US20150278191A1 (en) 2014-03-27 2015-10-01 Microsoft Corporation Flexible Schema for Language Model Customization
US20150310858A1 (en) 2014-04-29 2015-10-29 Microsoft Corporation Shared hidden layer combination for speech recognition systems
US20150325236A1 (en) 2014-05-08 2015-11-12 Microsoft Corporation Context specific language model scale factors
US9324323B1 (en) 2012-01-13 2016-04-26 Google Inc. Speech recognition using topic-specific language models
Family Cites Families (49)
* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2631864B2 (en) 1988-06-13 1997-07-16 大成建設株式会社 Construction method of the flat tunnel
US5170499A (en) * 1989-03-06 1992-12-08 Motorola, Inc. Method and apparatus for adjusting the volume level of a radio
US5233681A (en) 1992-04-24 1993-08-03 International Business Machines Corporation Context-dependent speech recognizer using estimated next word context
JPH10312196A (en) * 1997-03-12 1998-11-24 Seiko Epson Corp Method and device for optimizing response voice volume
KR100241901B1 (en) 1997-08-28 2000-02-01 윤종용 Method for managing registered entry of a voice recognition device of handset and hands-free kit
US6405132B1 (en) * 1997-10-22 2002-06-11 Intelligent Technologies International, Inc. Accident avoidance system
US6647270B1 (en) * 1999-09-10 2003-11-11 Richard B. Himmelstein Vehicletalk
US7788602B2 (en) 2000-06-06 2010-08-31 Microsoft Corporation Method and system for providing restricted actions for recognized semantic categories
JP2003280683A (en) 2002-03-20 2003-10-02 Toshiba Corp Voice recognition device, voice recognition control method of the device, and dictionary controller related to voice processing
US7006972B2 (en) 2002-03-20 2006-02-28 Microsoft Corporation Generating a task-adapted acoustic model from one or more different corpora
US7756531B2 (en) * 2002-09-04 2010-07-13 Farhad John Aminzadeh Method and apparatus for avoiding call disturbances and facilitating urgent calls based on a caller's decision
JP2004227468A (en) * 2003-01-27 2004-08-12 Canon Inc Information provision device and information provision method
US20040176083A1 (en) * 2003-02-25 2004-09-09 Motorola, Inc. Method and system for reducing distractions of mobile device users
CA2473195C (en) 2003-07-29 2014-02-04 Microsoft Corporation Head mounted multi-sensory audio input system
EP2506252B1 (en) 2003-11-21 2019-06-05 Nuance Communications, Inc. Topic specific models for text formatting and speech recognition
CN100539763C (en) * 2003-11-27 2009-09-09 国际商业机器公司 Method for controlling wireless communications from a moving vehicle
US7693713B2 (en) 2005-06-17 2010-04-06 Microsoft Corporation Speech models generated using competitive training, asymmetric training, and data boosting
DE102006006551B4 (en) 2006-02-13 2008-09-11 Siemens Ag A method and system for providing voice response applications, and mobile terminal
JP2007264128A (en) 2006-03-27 2007-10-11 Toshiba Corp Voice recognition device and its method
US7627536B2 (en) 2006-06-13 2009-12-01 Microsoft Corporation Dynamic interaction menus from natural language representations
WO2008081543A1 (en) * 2006-12-28 2008-07-10 Fujitsu Limited Portable terminal, its conversation control program, recording medium storing the conversation control program, and its conversation control method
US8838457B2 (en) 2007-03-07 2014-09-16 Vlingo Corporation Using results of unstructured language model based speech recognition to control a system-level function of a mobile communications facility
CN101415039A (en) * 2007-10-17 2009-04-22 宏达国际电子股份有限公司 Talking management method
JP2009230068A (en) 2008-03-25 2009-10-08 Denso Corp Voice recognition device and navigation system
US8412529B2 (en) 2008-10-29 2013-04-02 Verizon Patent And Licensing Inc. Method and system for enhancing verbal communication sessions
CN102272754B (en) 2008-11-05 2015-04-01 谷歌公司 Custom language models
RU2509350C2 (en) * 2008-11-07 2014-03-10 Матрокс Профешнл Инк Method for semantic processing of natural language using graphic intermediary language
US8447608B1 (en) 2008-12-10 2013-05-21 Adobe Systems Incorporated Custom language models for audio content
US8315597B2 (en) * 2009-12-21 2012-11-20 Julia Olincy “I am driving/busy” automatic response system for mobile phones
US8249627B2 (en) * 2009-12-21 2012-08-21 Julia Olincy “I am driving/busy” automatic response system for mobile phones
JP2012038239A (en) 2010-08-11 2012-02-23 Sony Corp Information processing equipment, information processing method and program
FR2965377A1 (en) 2010-09-24 2012-03-30 Univ D Avignon Et Des Pays De Vaucluse biometric data classification Method
JP2012075047A (en) * 2010-09-29 2012-04-12 Toshiba Corp Ip exchange system and ip exchanger
JP5704692B2 (en) 2010-11-30 2015-04-22 独立行政法人情報通信研究機構 Learning device and a computer program therefor pattern classification apparatus
US8352245B1 (en) 2010-12-30 2013-01-08 Google Inc. Adjusting language models
JP5861649B2 (en) 2011-02-03 2016-02-16 日本電気株式会社 Model adaptation apparatus, model adaptation methods and models adaptation program
EP2691870A4 (en) * 2011-03-31 2015-05-20 Microsoft Technology Licensing Llc Task driven user intents
US8698621B2 (en) * 2011-11-22 2014-04-15 Verizon Patent And Licensing Inc. Method and system for providing notifications of a mobile device in motion to determine call treatment
JP2012128440A (en) * 2012-02-06 2012-07-05 Denso Corp Voice interactive device
CN102609264A (en) 2012-02-14 2012-07-25 深圳市同洲视讯传媒有限公司 Method and device for generating calling codes by calling application programming interfaces
WO2013149123A1 (en) 2012-03-30 2013-10-03 The Ohio State University Monaural speech filter
US9424840B1 (en) 2012-08-31 2016-08-23 Amazon Technologies, Inc. Speech recognition platforms
US8527276B1 (en) 2012-10-25 2013-09-03 Google Inc. Speech synthesis using deep neural networks
US10282419B2 (en) 2012-12-12 2019-05-07 Nuance Communications, Inc. Multi-domain natural language processing architecture
KR101559124B1 (en) 2013-02-28 2015-10-12 한양대학교 산학협력단 Cathod active material for lithium sulfur battery, lithium sulfur battery including the same, and manufacturing method of the same
US9589565B2 (en) 2013-06-21 2017-03-07 Microsoft Technology Licensing, Llc Environmentally aware dialog policies and response generation
CN103456299B (en) 2013-08-01 2016-06-15 百度在线网络技术(北京)有限公司 A method and apparatus for controlling the voice recognition
CN103400577B (en) 2013-08-01 2015-09-16 百度在线网络技术(北京)有限公司 Multilingual acoustic model speech recognition method and apparatus
KR101937655B1 (en) 2013-12-31 2019-01-11 코오롱인더스트리 주식회사 Composite Hollow Fiber Membrane and Method for Manufacturing The Same
Patent Citations (88)
* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP0553101B1 (en) 1991-08-19 1997-07-23 LERNOUT & HAUSPIE SPEECHPRODUCTS A pattern recognition device using an artificial neural network for context dependent modelling
US6167377A (en) 1997-03-28 2000-12-26 Dragon Systems, Inc. Speech recognition language models
US6185528B1 (en) 1998-05-07 2001-02-06 Cselt - Centro Studi E Laboratori Telecomunicazioni S.P.A. Method of and a device for speech recognition employing neural network and markov model recognition techniques
US20050091057A1 (en) 1999-04-12 2005-04-28 General Magic, Inc. Voice application development methodology
US20120265531A1 (en) 1999-11-12 2012-10-18 Bennett Ian M Speech based learning/training system using semantic decoding
US6263308B1 (en) 2000-03-20 2001-07-17 Microsoft Corporation Methods and apparatus for performing speech recognition using acoustic models which are improved through an interactive process
US8296107B2 (en) 2000-06-29 2012-10-23 Aspen Technology, Inc. Computer method and apparatus for constraining a non-linear approximator of an empirical process
JP2002091477A (en) 2000-09-14 2002-03-27 Mitsubishi Electric Corp Voice recognition system, voice recognition device, acoustic model control server, language model control server, voice recognition method and computer readable recording medium which records voice recognition program
US20020083041A1 (en) 2000-11-16 2002-06-27 Dimitris Achlioptas Methods and systems for computing singular value decompositions of matrices and low rank approximations of matrices
US20020116171A1 (en) 2001-02-16 2002-08-22 Motorola, Inc. Interactive tool for semi-automatic creation of a domain model
US6970947B2 (en) * 2001-07-18 2005-11-29 International Business Machines Corporation Method and apparatus for providing a flexible and scalable context service
US20030125948A1 (en) 2002-01-02 2003-07-03 Yevgeniy Lyudovyk System and method for speech recognition by multi-pass recognition using context specific grammars
US20030212543A1 (en) 2002-05-07 2003-11-13 International Business Machines Corporation Integrated development tool for building a natural language understanding application
US20030212544A1 (en) 2002-05-10 2003-11-13 Alejandro Acero System for automatically annotating training data for a natural language understanding system
US8015006B2 (en) 2002-06-03 2011-09-06 Voicebox Technologies, Inc. Systems and methods for processing natural language speech utterances with context-specific domain agents
US20040088726A1 (en) 2002-11-01 2004-05-06 Yu-Fei Ma Systems and methods for generating a comprehensive user attention model
US7729902B1 (en) 2003-04-02 2010-06-01 At&T Intellectual Property Ii, L.P. Method of generation a labeling guide for spoken dialog services
US7835910B1 (en) 2003-05-29 2010-11-16 At&T Intellectual Property Ii, L.P. Exploiting unlabeled utterances for spoken language understanding
WO2005013262A1 (en) 2003-08-01 2005-02-10 Philips Intellectual Property & Standards Gmbh Method for driving a dialog system
US20050065789A1 (en) 2003-09-23 2005-03-24 Sherif Yacoub System and method with automated speech recognition engines
US20050165598A1 (en) 2003-10-01 2005-07-28 Dictaphone Corporation System and method for modifying a language model and post-processor information
US20050144013A1 (en) * 2003-11-20 2005-06-30 Jun Fujimoto Conversation control apparatus, conversation control method, and programs therefor
US8412521B2 (en) 2004-08-20 2013-04-02 Multimodal Technologies, Llc Discriminative training of document transcription system
US8326634B2 (en) 2005-08-05 2012-12-04 Voicebox Technologies, Inc. Systems and methods for responding to natural language speech utterance
US20070038436A1 (en) * 2005-08-10 2007-02-15 Voicebox Technologies, Inc. System and method of supporting adaptive misrecognition in conversational speech
US8321220B1 (en) 2005-11-30 2012-11-27 At&T Intellectual Property Ii, L.P. System and method of semi-supervised learning for spoken language understanding using semantic role labeling
US20130085756A1 (en) 2005-11-30 2013-04-04 At&T Corp. System and Method of Semi-Supervised Learning for Spoken Language Understanding Using Semantic Role Labeling
US20070128979A1 (en) * 2005-12-07 2007-06-07 J. Shackelford Associates Llc. Interactive Hi-Tech doll
US20070156392A1 (en) 2005-12-30 2007-07-05 International Business Machines Corporation Method and system for automatically building natural language understanding models
US20070203863A1 (en) 2006-02-01 2007-08-30 Rakesh Gupta Meta learning for question classification
US20070226649A1 (en) 2006-03-23 2007-09-27 Agmon Jonathan Method for predictive typing
US20080004877A1 (en) 2006-06-30 2008-01-03 Nokia Corporation Method, Apparatus and Computer Program Product for Providing Adaptive Language Model Scaling
US20080195388A1 (en) 2007-02-08 2008-08-14 Microsoft Corporation Context based word prediction
US20080215183A1 (en) * 2007-03-01 2008-09-04 Ying-Tsai Chen Interactive Entertainment Robot and Method of Controlling the Same
US20090030697A1 (en) 2007-03-07 2009-01-29 Cerra Joseph P Using contextual information for delivering results generated from a speech recognition facility using an unstructured language model
US20070150428A1 (en) 2007-03-20 2007-06-28 Brandyn Webb Inference engine for discovering features and making predictions using generalized incremental singular value decomposition
US20080235017A1 (en) * 2007-03-22 2008-09-25 Honda Motor Co., Ltd. Voice interaction device, voice interaction method, and voice interaction program
US8275615B2 (en) 2007-07-13 2012-09-25 International Business Machines Corporation Model weighting, selection and hypotheses combination for automatic speech recognition and machine translation
US8229729B2 (en) 2008-03-25 2012-07-24 International Business Machines Corporation Machine translation in continuous space
US20090292687A1 (en) 2008-05-23 2009-11-26 International Business Machines Corporation System and method for providing question and answers with deferred type evaluation
US20100004930A1 (en) 2008-07-02 2010-01-07 Brian Strope Speech Recognition with Parallel Recognition Tasks
US20100114890A1 (en) 2008-10-31 2010-05-06 Purediscovery Corporation System and Method for Discovering Latent Relationships in Data
US20100128863A1 (en) 2008-11-21 2010-05-27 Robert Bosch Gmbh Context aware voice communication proxy
US20100211695A1 (en) 2009-02-16 2010-08-19 Comverse, Ltd. Context-aware communications
US20100312546A1 (en) 2009-06-04 2010-12-09 Microsoft Corporation Recognition using re-recognition and statistical classification
US20110010171A1 (en) 2009-07-07 2011-01-13 General Motors Corporation Singular Value Decomposition for Improved Voice Recognition in Presence of Multi-Talker Background Noise
US20110093459A1 (en) 2009-10-15 2011-04-21 Yahoo! Inc. Incorporating Recency in Network Search Using Machine Learning
US8571866B2 (en) 2009-10-23 2013-10-29 At&T Intellectual Property I, L.P. System and method for improving speech recognition accuracy using textual context
US20110144999A1 (en) 2009-12-11 2011-06-16 Samsung Electronics Co., Ltd. Dialogue system and dialogue method thereof
US20140214410A1 (en) * 2009-12-11 2014-07-31 Samsung Electronics Co., Ltd Dialogue system and method for responding to multimodal input using calculated situation adaptability
US20110153324A1 (en) 2009-12-23 2011-06-23 Google Inc. Language Model Selection for Speech-to-Text Conversion
US20120245944A1 (en) 2010-01-18 2012-09-27 Apple Inc. Intelligent Automated Assistant
US8400332B2 (en) 2010-02-09 2013-03-19 Ford Global Technologies, Llc Emotive advisory system including time agent
US20120065976A1 (en) 2010-09-15 2012-03-15 Microsoft Corporation Deep belief network for large vocabulary continuous speech recognition
US20140358537A1 (en) 2010-09-30 2014-12-04 At&T Intellectual Property I, L.P. System and Method for Combining Speech Recognition Outputs From a Plurality of Domain-Specific Speech Recognizers Via Machine Learning
US20120084086A1 (en) 2010-09-30 2012-04-05 At&T Intellectual Property I, L.P. System and method for open speech recognition
US20120232885A1 (en) 2011-03-08 2012-09-13 At&T Intellectual Property I, L.P. System and method for building diverse language models
US20120253799A1 (en) 2011-03-28 2012-10-04 At&T Intellectual Property I, L.P. System and method for rapid customization of speech recognition models
US20120253802A1 (en) * 2011-03-31 2012-10-04 Microsoft Corporation Location-Based Conversational Understanding
US20120254086A1 (en) 2011-03-31 2012-10-04 Microsoft Corporation Deep convex network with joint use of nonlinear random projection, restricted boltzmann machine and batch-based parallelizable optimization
US20120254227A1 (en) 2011-03-31 2012-10-04 Microsoft Corporation Augmented Conversational Understanding Architecture
US20120271617A1 (en) 2011-04-25 2012-10-25 Google Inc. Cross-lingual initialization of language models
US20120290293A1 (en) 2011-05-13 2012-11-15 Microsoft Corporation Exploiting Query Click Logs for Domain Detection in Spoken Language Understanding
US20120303565A1 (en) 2011-05-23 2012-11-29 Microsoft Corporation Learning processes for single hidden layer neural networks with linear output units
US20130031476A1 (en) 2011-07-25 2013-01-31 Coin Emmett Voice activated virtual assistant
KR20130022513A (en) 2011-08-24 2013-03-07 한국전자통신연구원 Speaker adaptation method based on joint bilinear transformation space and apparatus therefor
EP2575128A2 (en) 2011-09-30 2013-04-03 Apple Inc. Using context information to facilitate processing of commands in a virtual assistant
US20130138436A1 (en) 2011-11-26 2013-05-30 Microsoft Corporation Discriminative pretraining of deep neural networks
US20130152092A1 (en) 2011-12-08 2013-06-13 Osher Yadgar Generic virtual personal assistant platform
US9324323B1 (en) 2012-01-13 2016-04-26 Google Inc. Speech recognition using topic-specific language models
US20130185065A1 (en) * 2012-01-17 2013-07-18 GM Global Technology Operations LLC Method and system for using sound related vehicle information to enhance speech recognition
US8346563B1 (en) 2012-04-10 2013-01-01 Artificial Solutions Ltd. System and methods for delivering advanced natural language interaction applications
WO2013171481A2 (en) 2012-05-14 2013-11-21 Touchtype Limited Mechanism for synchronising devices, system and method
US20130325148A1 (en) 2012-05-31 2013-12-05 Honeywell Asca Inc. Efficient quadratic programming (qp) solver for process control and optimization
US20140025380A1 (en) 2012-07-18 2014-01-23 International Business Machines Corporation System, method and program product for providing automatic speech recognition (asr) in a shared resource environment
US20140257803A1 (en) 2013-03-06 2014-09-11 Microsoft Corporation Conservatively adapting a deep neural network in a recognition system
US20140372112A1 (en) 2013-06-18 2014-12-18 Microsoft Corporation Restructuring deep neural network acoustic models
US20160203125A1 (en) 2013-06-21 2016-07-14 Microsoft Technology Licensing, Llc Building conversational understanding systems using a toolset
US20140379326A1 (en) 2013-06-21 2014-12-25 Microsoft Corporation Building conversational understanding systems using a toolset
US20150100312A1 (en) 2013-10-04 2015-04-09 At&T Intellectual Property I, L.P. System and method of using neural transforms of robust audio features for speech processing
US20150161994A1 (en) 2013-12-05 2015-06-11 Nuance Communications, Inc. Method and Apparatus for Speech Recognition Using Neural Networks with Speaker Adaptation
US20150161993A1 (en) 2013-12-06 2015-06-11 International Business Machines Corporation Systems and methods for applying speaker adaption techniques to correlated features
US20150170020A1 (en) 2013-12-13 2015-06-18 Amazon Technologies, Inc. Reducing dynamic range of low-rank decomposition matrices
US20150255069A1 (en) 2014-03-04 2015-09-10 Amazon Technologies, Inc. Predicting pronunciation in speech recognition
US20150255061A1 (en) 2014-03-07 2015-09-10 Microsoft Corporation Low-footprint adaptation and personalization for a deep neural network
US20150278191A1 (en) 2014-03-27 2015-10-01 Microsoft Corporation Flexible Schema for Language Model Customization
US20150310858A1 (en) 2014-04-29 2015-10-29 Microsoft Corporation Shared hidden layer combination for speech recognition systems
US20150325236A1 (en) 2014-05-08 2015-11-12 Microsoft Corporation Context specific language model scale factors
Non-Patent Citations (110)
* Cited by examiner, † Cited by third party
Title
"Integrated Development Environments for Natural Language Processing", Published on: Oct. 2001, Available at: http://www.textanalysis.com/TAI-IDE-WP.pdf; 13 pgs.
"International Search Report & Written Opinion for PCT Application No. PCT/US2014/041014", Mailed Date: Oct. 2, 2014, 9 Pages.
Abad, et al., "Context Dependent Modelling Approaches for Hybrid Speech Recognizers", In Proceeding of INTERSPEECH, Sep. 26, 2010, 4 pages.
Abdel-Hamid, et al., "Fast Speaker Adaptation of Hybrid NN/HMM Model for Speech Recognition Based on Discriminative Learning of Speaker Code", In IEEE International Conference on Acoustics, Speech and Signal Processing, May 26, 2013, 5 pages.
Abid, et al., "A New Neural Network Pruning Method Based on the Singular Value Decomposition and the Weight Initialisation", In Proceedings of 11th European Signal Processing Conference, Sep. 3, 2002, 4 pages.
Barman, et al., "Nonnegative Matrix Factorization (NMF) Based Supervised Feature Selection and Adaptation", In Proceedings of the 9th International Conference on Intelligent Data Engineering and Automated Learning, Nov. 2, 2008, 2 pages.
Bohus, et al., "Olympus: An Open-Source Framework for Conversational Spoken Language Interface Research", In Proceedings of the Workshop on Bridging the Gap: Academic and Industrial Research in Dialog Technologies, Apr. 2007, 8 pages.
Chandrasekaran et al., "Sparse and Low-Rank Matrix Decompositions"; IFAC Symposium on System Identification, 2009; 6 pgs.
Chen, Wei, "Building Language Model on Continuous Space using Gaussian Mixture Models", In Proceedings of Research in Language Modeling, Jan. 2007, 66 pages.
Dahl, et al., "Context-Dependent Pre-Trained Deep Neural Networks for Large Vocabulary Speech Recognition", In IEEE Transactions on Audio, Speech, and Language Processing, vol. 20, Issue 1, Jan. 1, 2012, 13 pages.
Dahl, et al., "Large Vocabulary Continuous Speech Recognition with Context-Dependent DBN-HMMs", In IEEE International Conference on Acoustics, Speech and Signal Processing, May 22, 2011, 4 pages.
Davis, et al., "Low-Rank Approximations for Conditional Feedforward Computation in Deep Neural Networks", In Proceedings of ArXiv preprint arXiv:1312.4461, Dec. 2013, 9 pages.
Deng et al., "Roles of Pre-Training and Fine-Tuning in Context-Dependent DBN-HMMs for Real-Word Speech Recognition", In Proceeding of NIPS Workshop on Deep Learning and Unsupervised Feature Learning, Dec. 2010, 8 pages.
Dos Reis Mota, Pedro Jose, "LUP: A Language Understanding Platform", A Dissertation for the Degree of Master of Information Systems and Computer Engineering, Jul. 2012, 128 pages.
Eagle, et al., "Common Sense Conversations: Understanding Casual Conversation using a Common Sense Database", In Proceedings of the Artificial Intelligence, Information Access, and Mobile Computing Workshop, Aug. 2003, 6 pages.
European Official Communication in Application 14736140.6, mailed Jan. 28, 2016, 2 pgs.
European Official Communication in Application 14736143.0, mailed Feb. 2, 2016, 2 pgs.
Gemello, et al., "Adaptation of Hybrid ANN/HMM Models Using Linear Hidden Transformations and Conservative Training", In IEEE International Conference on Acoustics, Speech and Signal Processing, May 14, 2006, 4 pages.
Gruenstein, et al., "Context-Sensitive Language Modeling for Large Sets of Proper Nouns in Multimodal Dialogue Systems", In Proceedings of IEEE/ACL Workshop on Spoken Language Technology, Dec. 10, 2006, 4 pages.
He et al; "What is Discriminative Learning"; Achorn International; Jun. 25, 2008; 25 pgs.
Heck et al.; "Robustness to Telephone Handset Distortion in Speaker Recognition by Discriminative Feature Design"; In Journal of Speech Communication-Speaker Recognition and its Commercial and Forensic Applications, vol. 31, Issue 2-3; Jun. 2000; http://rrncet.com/lib/E-Journals/Speech%20Communication/1-s2.0-S0167639399000771-main.pdf; 12 pgs.
Hinton, et al., "Deep Neural Networks for Acoustic Modeling in Speech Recognition", In IEEE Signal Processing Magazine, vol. 29, Issue 6, Nov. 2012, 27 pages.
Hoffmeister et al., "Log-Linear Model Combination with Word-Dependent Scaling Factors"; Human Language Technology and Pattern Recognition Computer Science Department; Sep. 6-10; Brighton UK; Copyright © 2009 ISCA; 4 pgs.
Huang et al., "Unified Stochastic Engine (USE) for Speech Recognition"; School of Computer Science; 1993 IEEE; 4 pgs.
International Search Report & Written Opinion for PCT Application No. PCT/US2014/041014, Mailed Date: May 11, 2015, 9 Pages.
International Search Report and Written Opinion Issued in PCT Application No. PCT/US2014/041023, Mailed Date: Jun. 3, 2015, 17 Pages.
International Search Report and Written Opinion Issued in PCT Application No. PCT/US2015/017872, Mailed Date: Jun. 25, 2015, 11 Pages.
International Search Report and Written Opinion Issued in PCT Application No. PCT/US2015/021921, Mailed Date: Jul. 17, 2015, 11 Pages.
International Search Report and Written Opinion Issued in PCT Application No. PCT/US2015/029334, Mailed Date: Jul. 7, 2015, 12 Pages.
Jaitly, et al., "An Application of Pretrained Deep Neural Networks to Large Vocabulary Conversational Speech Recognition", In Proceedings of 13th Annual Conference of the International Speech Communication Association, Mar. 12, 2012, 11 pages.
Keshtkar et al., "A Corpus-based Method for Extracting Paraphrases of Emotion Terms"; Proceedings of the NAACL HLT 2010 Workshop on Computational Appraoches to Analysis and Generation of Emotion in Text; Jun. 2010; 10 pgs.
Ko, et al., "Cammia-A Context-Aware Spoken Dialog System for Mobile Environments", In Automatic Speech Recognition and Understanding Workshop, Jul. 29, 2011, 2 pages.
Konig et al., "Nonlinear Discriminant Feature Extraction for Robust Text-Independent Speaker Recognition"; In Proceeding of the RLA2C, ESCA workshop on Speaker Recognition and its Commercial and Forensic Applications; Apr. 1998; http://www.msr-waypoint.com/pubs/193653/konig-heck-DNN.pdf; 4 pgs.
Lecouteux et al., "Dynamic Combination of Automatic Speech Recognition Systems by Driven Decoding"; In Journal of IEEE Transactions on Audio, Speech and Language Processing; Jan. 2013; http://ha.archives-ouvertes.fr/docs/00/75/86/26/PDF/SystemCombination.pdf; 10 pgs.
Lee, et al., "Intention-Based Corrective Feedback Generationusing Context-Aware Model", In Proceedings of the Second International Conference on Computer Supported Education, Apr. 7, 2010, 8 pages.
Li et al., "Lattice Combination for Improved Speech Recognition"; In Proceedings of the 7th International Conference of Spoken Language Processing; Sep. 16, 2002; http://www.cs.cmu.edu/afs/cs/user/robust/www/Papers/icslp02-xiang.pdf; 4 pgs.
Li, et al., "Comparison of Discriminative Input and Output Transformations for Speaker Adaptation in the Hybrid NN/HMM Systems", In Proceedings of 11th Annual Conference of the International Speech Communication Association, Sep. 26, 2010, 4 pages.
Liao, Hank, "Speaker Adaptation of Context Dependent Deep Neural Networks", In IEEE International Conference on Acoustics, Speech and Signal Processing, May 26, 2013, 5 pages.
Lilly, et al., "Robust Speech Recognition Using Singular Value Decomposition Based Speech Enhancement," IEEE TENCON, 1997, 4 pgs.
Liu, et al., "Language Model Combination and Adaptation using Weighted Finite State Transducers", In Proceedings of IEEE International Conference on Acoustics Speech and Signal Processing, Mar. 14, 2010, 4 pages.
Liu, et al., "Use of Contexts in Language Model Interpolation and Adaptation", In Journal of Computer Speech and Language vol. 27 Issue 1, Feb. 2009, 23 pages.
Meinedo et al., "Combination of Acoustic Models in Continuous Speech Recognition Hybrid Systems"; In Proceedings of Sixth International Conference on Spoken Language Processing; Oct. 2000; http://www.inesc-id.pt/pt/indicadores/Ficheiros/416.pdf; 4 pgs.
Mohamed, et al., "Acoustic Modeling Using Deep Belief Networks", In IEEE Transactions on Audio, Speech, and Language Processing, vol. 20, Issue 1, Jan. 2012, 10 pages.
Moreira, et al., "Towards the Rapid Development of a Natural Language Understanding Module", In Proceedings of the 10th International Conference on Intelligent Virtual Agents, Jan. 2011, 7 pages.
Motlicek et al., "Feature and Score Level Combination of Subspace Gaussinasin LVCSR Task"; In IEEE International Conference on Acoustics, Speech and Signal Processing; May 26, 2013; http://ieeexplore.ieee.org/stamp/stamp.jsp?tp=&arnumber=6639142; 5 pgs.
Notice of Allowance dated Dec. 18, 2015 in U.S. Appl. No. 14/201,704, 15 pgs.
Notice of Allowance dated Nov. 30, 2015 in U.S. Appl. No. 13/923,969, 12 pgs.
Notice of Allowance dated Oct. 1, 2015 in U.S. Appl. No. 13/923,969, 7 pgs.
Novak, et al., "Use of Non-Negative Matrix Factorization for Language Model Adaptation in a Lecture Transcription Task", In Proceedings of IEEE International Conference on Acoustics, Speech, and Signal Processing, vol. 1, May 7, 2001, 4 pages.
PCT 2nd Written Opinion in International Application PCT/US2015/029334, mailed Mar. 31, 2016, 5 pgs.
PCT Written Opinion dated Feb. 11, 2016 in Appln No. PCT/US2015/021921, 7 pgs.
Preliminary Report on Patentability dated Dec. 14, 2015 in Appln No. PCT/US2015/017872, 7 pgs.
Preliminary Report on Patentability dated Nov. 13, 2015 in Appin No. PCT/US2014/041023, 7 pgs.
Preliminary Report on Patentability dated Sep. 15, 2015 in Appln No. PCT/US2014/041014, 13 pgs.
Response dated Aug. 6, 2015 in U.S. Appl. No. 13/923,969, 7 pgs.
Response dated May 21, 2015 in U.S. Appl. No. 13/920,323, 15 pgs.
Sainath, et al., "Auto-Encoder Bottleneck Features Using Deep Belief Networks", In Proceedings of IEEE International Conference on Acoustics, Speech and Signal Processing, Mar. 25, 2012, 4 pages.
Sainath, et al., "Low-Rank Matrix Factorization for Deep Neural Network Training with High-Dimensional Output Targets", In proceedings of IEEE International Conference on Acoustics, Speech and Signal Processing, May 26, 2013, 5 pages.
Sainath, et al., "Making Deep Belief Networks Effective for Large Vocabulary Continuous Speech Recognition", In Proceedings of IEEE Workshop on Automatic Speech Recognition and Understanding, Dec. 11, 2011, 6 pages.
Saluja, et al., "Context-aware Language Modeling for Conversational Speech Translation", In Proceedings of Machine Translation Summit XIII, Sep. 19, 2011, 8 pages.
Sarukkai et al., "Word Set Probability Boosting for Improved Spontaneous Dialog Recognition"; IEEE Transactions on Speech and Audio Processing, vol. 5, No. 5, Sep. 1997; 13 pgs.
Sarukkai, et al., "Improved Spontaneous Dialogue Recognition Using Dialogue and Utterance Triggers by Adaptive Probability Boosting", In Fourth International Conference on Spoken Language, vol. 1, Oct. 3, 1996, 4 pages.
Seide, et al., "Conversational Speech Transcription using Context-Dependent Deep Neural Networks", In Proceeding of 12th Annual Conference of the International Speech Communication Association, Aug. 28, 2011, 4 pages.
Seneff, et al., "Galaxy-II: A Reference Architecture for Conversational System Development", In Proceedings of the 6th International Conference on Spoken Language Processing, Nov. 2008, 4 pages.
Sing, et al., "Domain Metric Knowledge Model for Embodied Conversation Agents", In 5th International Conference on Research, Innovation & Vision for the Future, Mar. 5, 2007, 7 pages.
Singh-Miller et al., "Dimensionality Reduction for Speech Recognition Using Neighborhood Components Analysis"; In Proceedings of 8th Annual Conference of the International Speech Communication Association, Antwerp; Dec. 27, 2007; http://www.cs.columbia.edu/~mcollins/papers/icslp07.pdf; 4 pgs.
Singh-Miller et al., "Dimensionality Reduction for Speech Recognition Using Neighborhood Components Analysis"; In Proceedings of 8th Annual Conference of the International Speech Communication Association, Antwerp; Dec. 27, 2007; http://www.cs.columbia.edu/˜mcollins/papers/icslp07.pdf; 4 pgs.
Siniscalchi, et al., "Hermitian Based Hidden Activation Functions for Adaptation of Hybrid HMM/ANN Models", In Proceedings of 13th Annual Conference of the International Speech Communication Association, Sep. 9, 2012, 4 pages.
Su et al., "Error Back Propagation for Sequence Training of Context-Dependent Deep Networks for Conversational Speech Transcription"; In IEEE International Conference on Acoustics, Speech, and Signal Processing; May 26, 2013; http://research.microsoft.com/pubs/194345/0006664.pdf; 5 pgs.
Swietojanski et al., "Revisiting Hybrid and GMM-HMM System Combination Techniques"; In Proceeding of the IEEE International Conference on Acoustics, Speech and Signal Processing; May 26, 2013; http://homepages.inf.ed.ac.uk/s1136550/data/Swietojanski-ICASSP2013.pdf; 5 pgs.
Trmal, et al., "Adaptation of a Feedforward Artificial Neural Network Using a Linear Transform", In Proceedings of In Text, Speech and Dialogue, Sep. 10, 2010, 8 pgs.
U.S. Appl. No. 13/920,323, Amendment and Response filed Aug. 5, 2016, 23 pages.
U.S. Appl. No. 13/920,323, Office Action mailed Apr. 5, 2016, 23 pgs.
U.S. Appl. No. 13/920,323, Office Action mailed Nov. 18, 2016, 25 pgs.
U.S. Appl. No. 13/923,969, Amendment after Allowance filed Feb. 29, 2016, 8 pgs.
U.S. Appl. No. 13/923,969, Notice of Allowance mailed Feb. 18, 2016, 2 pgs.
U.S. Appl. No. 13/923,969, Notice of Allowance mailed Mar. 9, 2016, 2 pgs.
U.S. Appl. No. 14/201,704 USPTO Response mailed Mar. 3, 2016, 2 pgs.
U.S. Appl. No. 14/201,704, Amendment after Allowance filed Feb. 24, 2016, 6 pgs.
U.S. Appl. No. 14/227,492, Amendment and Response filed Jan. 13, 2016, 13 pgs.
U.S. Appl. No. 14/227,492, Amendment and Response filed Nov. 4, 2016, 6 pgs.
U.S. Appl. No. 14/227,492, filed Mar. 27, 2014, entitled "Flexible Schema for Language Model Customization".
U.S. Appl. No. 14/227,492, Notice of Allowance mailed Apr. 19, 2016, 16 pgs.
U.S. Appl. No. 14/227,492, Notice of Allowance mailed Aug. 4, 2016, 12 pages.
U.S. Appl. No. 14/227,492, Notice of Allowance mailed Oct. 14, 2016, 8 pgs.
U.S. Appl. No. 14/265,110, Amendment and Response filed Mar. 17, 2016, 17 pgs.
U.S. Appl. No. 14/265,110, Notice of Allowance mailed Aug. 3, 2016, 21 pages.
U.S. Appl. No. 14/273,100, Amendment and Response filed Jan. 4, 2016, 18 pgs.
U.S. Appl. No. 14/273,100, Amendment and Response filed Jun. 2, 2016, 12 pages.
U.S. Appl. No. 14/273,100, Office Action mailed Mar. 3, 2016, 19 pgs.
U.S. Appl. No. 15/076,125, Amendment and Response filed Oct. 14, 2016, 11 pgs.
U.S. Appl. No. 15/076,125, Office Action mailed Dec. 8, 2016, 6 pgs.
U.S. Appl. No. 15/076,125, Office Action mailed May 25, 2016, 13 pages.
U.S. Official Action dated Aug. 13, 2015 in U.S. Appl. No. 14/227,492, 41 pgs.
U.S. Official Action dated Feb. 27, 2015 in U.S. Appl. No. 13/920,323, 22 pgs.
U.S. Official Action dated Jan. 4, 2016 in U.S. Appl. No. 13/920,323, 49 pgs.
U.S. Official Action dated Jul. 1, 2015 in U.S. Appl. No. 14/201,704, 17 pgs.
U.S. Official Action dated May 6, 2015 in U.S. Appl. No. 13/923,969, 12 pgs.
U.S. Official Action dated Oct. 1, 2015 in U.S. Appl. No. 13/920,323, 34 pgs.
U.S. Official Action dated Sep. 24, 2015 in U.S. Appl. No. 13/920,323, 25 pgs.
Vanhoucke, et al., "Improving the Speed of Neural Networks on CPUs", In Proceedings of NIPS Workshop on Deep Learning and Unsupervised Feature Learning, Dec. 16, 2011, 8 pages.
Xiaodong, et al., "Discriminative Learning for Speech Recognition: Theory and Practice", In Book on Discriminative Learning for Speech Recognition: Theory and Practice, Chapter 1, Aug. 12, 2008, 25 Pages.
Xue, et al., "Restructuring of Deep Neural Network Acoustic Models with Singular Value Decomposition", In Proceedings of 14th Annual Conference of the International Speech Communication Association, Aug. 25, 2013, 5 pages.
Xue, et al., "Singular Value Decomposition Based Low-Footprint Speaker Adaptation and Personalization for Deep Neural Network", In Proceedings of the IEEE International Conference on Acoustics, Speech and Signal Processing, May 4, 2014, pp. 6359-6363.
Yan et al., "A Scalable Approach to Using DSS-Derived Features in GMM-HMM Based Acoustic Modeling for LVCSR"; In Proceeding of the 14th Annual Conference of the International Speech Communication Association; Aug. 25, 2013; http://homepages.inf.ed.ac.uk/s1136550/data/Swietojanski-ICASSP2013.pdf; 5 pgs.
Yao, et al., "Adaptation of Context-Dependent Deep Neural Networks for Automatic Speech Recognition", In IEEE Spoken Language Technology Workshop, Dec. 2, 2012, 4 pages.
Yu, et al., "Exploiting Sparseness in Deep Neural Networks for Large Vocabulary Speech Recognition", In Proceeding of IEEE International Conference on Acoustics, Speech and Signal Processing, Mar. 25, 2012, 4 pages.
Yu, et al., "Improved Bottleneck Features Using Pretrained Deep Neural Networks", In Proceedings of 12th Annual Conference of the International Speech Communication Association, Aug. 28, 2011, 4 pages.
Yu, et al., "KL-Divergence Regularized Deep Neural Network Adaptation for Improved Large Vocabulary Speech Recognition", In IEEE International Conference on Acoustics, Speech and Signal Processing, May 26, 2013, 5 pages.
Yu, et al., "Roles of Pre-Training and Fine-Tuning in Context-Dependent DBN-HMMs for Real-Word Speech Recognition", In Proceeding of NIPS Workshop on Deep Learning and Unsupervised Feature Learning, Dec. 2010, 8 pages.
Cited By (4)
* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10162814B2 (en) * 2014-10-29 2018-12-25 Baidu Online Network Technology (Beijing) Co., Ltd. Conversation processing method, conversation management system and computer device
US20160239758A1 (en) * 2015-02-17 2016-08-18 Microsoft Technology Licensing, Llc Training systems and methods for sequence taggers
US9792560B2 (en) * 2015-02-17 2017-10-17 Microsoft Technology Licensing, Llc Training systems and methods for sequence taggers
US9996531B1 (en) * 2016-03-29 2018-06-12 Facebook, Inc. Conversational understanding
Also Published As
Publication number Publication date
BR112015031231A2 (en) 2017-07-25
MX352774B (en) 2017-12-07
EP3011471A1 (en) 2016-04-27
AU2014281049B9 (en) 2019-05-23
WO2014204655A1 (en) 2014-12-24
RU2015154501A3 (en) 2018-05-04
JP2016524190A (en) 2016-08-12
CN105378708A (en) 2016-03-02
CA2913735A1 (en) 2014-12-24
JP6492069B2 (en) 2019-03-27
AU2014281049A1 (en) 2015-12-10
RU2667717C2 (en) 2018-09-24
AU2014281049B2 (en) 2019-05-02
US20140379353A1 (en) 2014-12-25
US10304448B2 (en) 2019-05-28
KR20160021850A (en) 2016-02-26
US20170162201A1 (en) 2017-06-08
RU2015154501A (en) 2017-06-20
MX2015017624A (en) 2016-04-15
Similar Documents
Publication Publication Date Title
RU2542937C2 (en) Using context information to facilitate command processing in virtual assistant
KR101703911B1 (en) Visual confirmation for a recognized voice-initiated action
US10235018B2 (en) Browsing electronic messages displayed as titles
CN102750271B (en) Conversational dialogue and learning correction
US20170092278A1 (en) Speaker recognition
EP3149728B1 (en) Multi-command single utterance input method
US9886953B2 (en) Virtual assistant activation
US20190095050A1 (en) Application Gateway for Providing Different User Interfaces for Limited Distraction and Non-Limited Distraction Contexts
US9733821B2 (en) Voice control to diagnose inadvertent activation of accessibility features
US9697200B2 (en) Building conversational understanding systems using a toolset
US9728184B2 (en) Restructuring deep neural network acoustic models
AU2012316484A1 (en) Automatically adapting user interfaces for hands-free interaction
US20140191939A1 (en) Using nonverbal communication in determining actions
US10209954B2 (en) Equal access to speech and touch input
KR101809808B1 (en) System and method for emergency calls initiated by voice command
CN107430501A (en) Competing devices responding to voice triggers
CN106104677A (en) Visual indication of a recognized voice-initiated action
US10186254B2 (en) Context-based endpoint detection
CN105144069B (en) For display content based on semantic zoom navigation
US20140281870A1 (en) Document collaboration and notification of changes using different notification mechanisms
US9865280B2 (en) Structured dictation using intelligent automated assistants
US20160357728A1 (en) Language identification from short strings
AU2017100486B4 (en) Intelligent device arbitration and control
EP2965313A1 (en) Speech recognition assisted evaluation on text-to-speech pronunciation issue detection
US20150325236A1 (en) Context specific language model scale factors
Legal Events
Date Code Title Description
AS Assignment
Owner name: MICROSOFT CORPORATION, WASHINGTON
Free format text: ASSIGNMENT OF ASSIGNORS INTEREST;ASSIGNORS:BOIES, DANIEL;HECK, LARRY;ANASTASAKOS, TASOS;AND OTHERS;SIGNING DATES FROM 20130618 TO 20130620;REEL/FRAME:030917/0900
AS Assignment
Owner name: MICROSOFT CORPORATION, WASHINGTON
Free format text: ASSIGNMENT OF ASSIGNORS INTEREST;ASSIGNORS:BOIES, DANIEL;HECK, LARRY;ANASTASAKOS, TASOS;AND OTHERS;SIGNING DATES FROM 20130618 TO 20130620;REEL/FRAME:032839/0399
AS Assignment
Owner name: MICROSOFT TECHNOLOGY LICENSING, LLC, WASHINGTON
Free format text: ASSIGNMENT OF ASSIGNORS INTEREST;ASSIGNOR:MICROSOFT CORPORATION;REEL/FRAME:034747/0417
Effective date: 20141014
Owner name: MICROSOFT TECHNOLOGY LICENSING, LLC, WASHINGTON
Free format text: ASSIGNMENT OF ASSIGNORS INTEREST;ASSIGNOR:MICROSOFT CORPORATION;REEL/FRAME:039025/0454
Effective date: 20141014
STCF Information on status: patent grant
Free format text: PATENTED CASE
|
{
"url": "https://patents.google.com/patent/US9589565B2/en",
"source_domain": "patents.google.com",
"snapshot_id": "crawl=CC-MAIN-2019-39",
"warc_metadata": {
"Content-Length": "383264",
"Content-Type": "application/http; msgtype=response",
"WARC-Block-Digest": "sha1:JNCHYT5MAXXITAOHXYLADJYXPXQEOJVN",
"WARC-Concurrent-To": "<urn:uuid:650b95b0-f1f0-47af-9a1e-614f70ce4569>",
"WARC-Date": "2019-09-23T05:16:57Z",
"WARC-IP-Address": "172.217.164.174",
"WARC-Identified-Payload-Type": "text/html",
"WARC-Payload-Digest": "sha1:3JTN67EEX7ZKCX63AGC2CZLQP2SEQDIH",
"WARC-Record-ID": "<urn:uuid:5fe5fb3a-58f0-4e55-bc96-a90537f5a531>",
"WARC-Target-URI": "https://patents.google.com/patent/US9589565B2/en",
"WARC-Truncated": null,
"WARC-Type": "response",
"WARC-Warcinfo-ID": "<urn:uuid:16fc0199-0aef-448c-9ba6-ea3ceb49cf60>"
},
"warc_info": "isPartOf: CC-MAIN-2019-39\r\npublisher: Common Crawl\r\ndescription: Wide crawl of the web for September 2019\r\noperator: Common Crawl Admin (info@commoncrawl.org)\r\nhostname: ip-10-67-67-68.ec2.internal\r\nsoftware: Apache Nutch 1.15 (modified, https://github.com/commoncrawl/nutch/)\r\nrobots: checked via crawler-commons 1.1-SNAPSHOT (https://github.com/crawler-commons/crawler-commons)\r\nformat: WARC File Format 1.1\r\nconformsTo: http://iipc.github.io/warc-specifications/specifications/warc-format/warc-1.1/"
}
|
{
"line_start_idx": [
0,
93,
94,
169,
170,
175,
176,
195,
207,
392,
402,
405,
419,
438,
463,
470,
475,
484,
499,
514,
705,
721,
740,
753,
768,
788,
797,
810,
821,
839,
853,
1026,
1061,
1079,
1114,
1305,
1317,
1334,
1440,
1505,
1709,
1913,
1991,
2182,
2252,
2289,
2340,
2382,
2383,
2389,
2390,
2397,
2398,
2414,
2415,
2430,
2470,
2593,
2627,
2721,
2736,
2778,
2821,
2936,
2982,
3030,
3065,
3080,
3120,
3243,
3297,
3359,
3360,
3369,
3370,
4342,
4343,
4355,
4356,
4367,
4368,
4739,
4740,
4748,
4749,
5097,
5098,
6418,
6419,
6453,
6454,
6580,
6581,
6680,
6681,
6774,
6775,
6874,
6875,
7035,
7036,
7206,
7207,
7228,
7229,
7346,
7347,
7473,
7474,
7791,
7792,
8690,
8691,
11222,
11223,
11887,
11888,
12731,
12732,
14047,
14048,
14305,
14306,
14954,
14955,
15354,
15355,
15454,
15455,
15682,
15683,
16050,
16051,
16273,
16274,
17131,
17132,
17456,
17457,
17550,
17551,
17715,
17716,
18344,
18345,
18810,
18811,
20121,
20122,
20753,
20754,
21674,
21675,
22051,
22052,
23089,
23090,
23879,
23880,
24134,
24135,
24454,
24455,
24815,
24816,
25246,
25247,
25593,
25594,
25975,
25976,
26510,
26511,
26574,
26575,
26659,
26660,
27004,
27005,
27472,
27473,
27815,
27816,
29300,
29301,
29527,
29528,
30206,
30207,
30577,
30578,
31053,
31054,
32192,
32193,
32638,
32639,
34284,
34285,
34937,
34938,
36322,
36323,
36978,
36979,
38065,
38066,
38705,
38706,
40814,
40815,
41419,
41420,
42700,
42701,
42958,
42959,
43499,
43500,
44843,
44844,
45292,
45293,
46239,
46240,
47406,
47407,
47936,
47937,
49026,
49027,
49039,
49040,
49060,
49259,
49335,
49421,
49502,
49741,
49811,
49953,
50203,
50330,
50534,
50743,
50871,
51006,
51141,
51348,
51556,
51632,
51718,
51799,
52038,
52108,
52384,
52553,
52742,
52966,
53157,
53298,
53322,
53383,
53450,
53526,
53612,
53691,
53928,
53998,
54229,
54446,
54642,
54774,
54775,
54801,
54802,
54853,
54967,
54968,
55004,
55005,
55056,
55170,
55297,
55418,
55536,
55651,
55773,
55888,
56000,
56120,
56234,
56348,
56463,
56464,
56495,
56496,
56547,
56675,
56676,
56693,
56694,
56730,
56778,
56823,
56824,
56831,
56832,
56844,
56845,
56869,
56870,
56921,
57053,
57175,
57176,
57206,
57207,
57258,
57380,
57381,
57401,
57402,
57415,
57439,
57463,
57487,
57514,
57539,
57566,
57595,
57619,
57641,
57665,
57692,
57693,
57706,
57707,
57751,
57816,
57947,
58032,
58209,
58210,
58243,
58244,
58288,
58353,
58478,
58615,
58752,
58898,
59022,
59132,
59270,
59383,
59522,
59657,
59781,
59899,
60019,
60117,
60239,
60377,
60378,
60393,
60394,
60438,
60503,
60675,
60769,
60978,
61167,
61451,
61630,
61751,
61911,
62064,
62237,
62362,
62486,
62603,
62708,
62849,
62995,
63155,
63309,
63410,
63590,
63760,
63858,
63945,
64099,
64194,
64321,
64470,
64662,
64832,
64939,
65071,
65172,
65312,
65399,
65540,
65669,
65844,
65962,
66079,
66189,
66362,
66498,
66622,
66745,
66878,
67072,
67158,
67269,
67418,
67623,
67740,
67859,
68018,
68121,
68268,
68452,
68601,
68740,
68890,
68979,
69125,
69239,
69364,
69500,
69616,
69716,
69889,
70045,
70160,
70304,
70508,
70643,
70758,
70885,
71055,
71216,
71387,
71514,
71630,
71766,
71880,
72008,
72119,
72226,
72227,
72254,
72255,
72299,
72364,
72451,
72569,
72721,
72835,
72977,
73089,
73165,
73312,
73494,
73631,
73805,
73920,
74047,
74153,
74285,
74405,
74557,
74695,
74789,
74914,
75122,
75321,
75402,
75501,
75636,
75704,
75853,
75960,
76078,
76196,
76323,
76438,
76530,
76665,
76742,
76873,
76974,
77152,
77231,
77378,
77469,
77563,
77658,
77780,
77964,
78101,
78219,
78344,
78469,
78470,
78492,
78493,
78537,
78602,
78774,
78868,
79077,
79182,
79301,
79490,
79649,
79933,
80112,
80233,
80393,
80553,
80726,
80879,
81052,
81177,
81317,
81458,
81582,
81699,
81845,
81986,
82111,
82250,
82404,
82588,
82751,
82852,
83022,
83120,
83207,
83361,
83456,
83583,
83775,
83955,
84104,
84298,
84421,
84591,
84698,
84830,
84931,
85018,
85147,
85322,
85440,
85596,
85713,
85889,
85999,
86085,
86199,
86335,
86548,
86672,
86805,
86954,
87065,
87270,
87387,
87490,
87637,
87786,
87875,
88021,
88157,
88273,
88373,
88480,
88653,
88803,
88918,
89062,
89266,
89401,
89516,
89657,
89784,
89954,
90115,
90286,
90413,
90529,
90665,
90779,
90907,
91018,
91019,
91046,
91047,
91091,
91097,
91259,
91386,
91526,
91769,
91979,
92217,
92452,
92574,
92732,
92946,
93142,
93318,
93538,
93718,
93946,
94034,
94121,
94339,
94551,
94641,
94987,
95146,
95367,
95485,
95610,
95744,
95879,
96014,
96148,
96392,
96615,
96782,
97078,
97346,
97544,
97785,
98034,
98210,
98340,
98553,
98713,
98966,
99134,
99330,
99584,
99662,
99740,
99816,
100060,
100161,
100240,
100335,
100430,
100526,
100591,
100657,
100853,
101088,
101304,
101468,
101646,
101866,
102084,
102279,
102463,
102757,
103051,
103278,
103566,
103839,
104006,
104086,
104156,
104227,
104308,
104384,
104459,
104528,
104609,
104688,
104765,
104874,
104951,
105029,
105105,
105184,
105262,
105340,
105420,
105490,
105569,
105638,
105710,
105789,
105868,
105946,
106024,
106101,
106179,
106258,
106435,
106640,
106863,
107115,
107419,
107589,
107805,
108007,
108228,
108447,
108448,
108461,
108462,
108506,
108571,
108748,
108879,
109006,
109091,
109092,
109110,
109111,
109147,
109180,
109206,
109234,
109265,
109296,
109327,
109357,
109386,
109414,
109442,
109473,
109501,
109532,
109564,
109593,
109624,
109656,
109686,
109716,
109717,
109735,
109736,
109771,
109868,
109947,
110014,
110080,
110121,
110182,
110228,
110370,
110462,
110541,
110608,
110694,
110768,
110825,
110909,
110974,
111049,
111100,
111172,
111284,
111361,
111425,
111488,
111592,
111659,
111660,
111673,
111674,
111702,
111716,
111717,
111763,
111764,
111944,
111945,
111959,
111960,
112006,
112007,
112187,
112188,
112202,
112203,
112263,
112264,
112369,
112370,
112395,
112396,
112456,
112457,
112562,
112563,
112588,
112589,
112630,
112631
],
"line_end_idx": [
93,
94,
169,
170,
175,
176,
195,
207,
392,
402,
405,
419,
438,
463,
470,
475,
484,
499,
514,
705,
721,
740,
753,
768,
788,
797,
810,
821,
839,
853,
1026,
1061,
1079,
1114,
1305,
1317,
1334,
1440,
1505,
1709,
1913,
1991,
2182,
2252,
2289,
2340,
2382,
2383,
2389,
2390,
2397,
2398,
2414,
2415,
2430,
2470,
2593,
2627,
2721,
2736,
2778,
2821,
2936,
2982,
3030,
3065,
3080,
3120,
3243,
3297,
3359,
3360,
3369,
3370,
4342,
4343,
4355,
4356,
4367,
4368,
4739,
4740,
4748,
4749,
5097,
5098,
6418,
6419,
6453,
6454,
6580,
6581,
6680,
6681,
6774,
6775,
6874,
6875,
7035,
7036,
7206,
7207,
7228,
7229,
7346,
7347,
7473,
7474,
7791,
7792,
8690,
8691,
11222,
11223,
11887,
11888,
12731,
12732,
14047,
14048,
14305,
14306,
14954,
14955,
15354,
15355,
15454,
15455,
15682,
15683,
16050,
16051,
16273,
16274,
17131,
17132,
17456,
17457,
17550,
17551,
17715,
17716,
18344,
18345,
18810,
18811,
20121,
20122,
20753,
20754,
21674,
21675,
22051,
22052,
23089,
23090,
23879,
23880,
24134,
24135,
24454,
24455,
24815,
24816,
25246,
25247,
25593,
25594,
25975,
25976,
26510,
26511,
26574,
26575,
26659,
26660,
27004,
27005,
27472,
27473,
27815,
27816,
29300,
29301,
29527,
29528,
30206,
30207,
30577,
30578,
31053,
31054,
32192,
32193,
32638,
32639,
34284,
34285,
34937,
34938,
36322,
36323,
36978,
36979,
38065,
38066,
38705,
38706,
40814,
40815,
41419,
41420,
42700,
42701,
42958,
42959,
43499,
43500,
44843,
44844,
45292,
45293,
46239,
46240,
47406,
47407,
47936,
47937,
49026,
49027,
49039,
49040,
49060,
49259,
49335,
49421,
49502,
49741,
49811,
49953,
50203,
50330,
50534,
50743,
50871,
51006,
51141,
51348,
51556,
51632,
51718,
51799,
52038,
52108,
52384,
52553,
52742,
52966,
53157,
53298,
53322,
53383,
53450,
53526,
53612,
53691,
53928,
53998,
54229,
54446,
54642,
54774,
54775,
54801,
54802,
54853,
54967,
54968,
55004,
55005,
55056,
55170,
55297,
55418,
55536,
55651,
55773,
55888,
56000,
56120,
56234,
56348,
56463,
56464,
56495,
56496,
56547,
56675,
56676,
56693,
56694,
56730,
56778,
56823,
56824,
56831,
56832,
56844,
56845,
56869,
56870,
56921,
57053,
57175,
57176,
57206,
57207,
57258,
57380,
57381,
57401,
57402,
57415,
57439,
57463,
57487,
57514,
57539,
57566,
57595,
57619,
57641,
57665,
57692,
57693,
57706,
57707,
57751,
57816,
57947,
58032,
58209,
58210,
58243,
58244,
58288,
58353,
58478,
58615,
58752,
58898,
59022,
59132,
59270,
59383,
59522,
59657,
59781,
59899,
60019,
60117,
60239,
60377,
60378,
60393,
60394,
60438,
60503,
60675,
60769,
60978,
61167,
61451,
61630,
61751,
61911,
62064,
62237,
62362,
62486,
62603,
62708,
62849,
62995,
63155,
63309,
63410,
63590,
63760,
63858,
63945,
64099,
64194,
64321,
64470,
64662,
64832,
64939,
65071,
65172,
65312,
65399,
65540,
65669,
65844,
65962,
66079,
66189,
66362,
66498,
66622,
66745,
66878,
67072,
67158,
67269,
67418,
67623,
67740,
67859,
68018,
68121,
68268,
68452,
68601,
68740,
68890,
68979,
69125,
69239,
69364,
69500,
69616,
69716,
69889,
70045,
70160,
70304,
70508,
70643,
70758,
70885,
71055,
71216,
71387,
71514,
71630,
71766,
71880,
72008,
72119,
72226,
72227,
72254,
72255,
72299,
72364,
72451,
72569,
72721,
72835,
72977,
73089,
73165,
73312,
73494,
73631,
73805,
73920,
74047,
74153,
74285,
74405,
74557,
74695,
74789,
74914,
75122,
75321,
75402,
75501,
75636,
75704,
75853,
75960,
76078,
76196,
76323,
76438,
76530,
76665,
76742,
76873,
76974,
77152,
77231,
77378,
77469,
77563,
77658,
77780,
77964,
78101,
78219,
78344,
78469,
78470,
78492,
78493,
78537,
78602,
78774,
78868,
79077,
79182,
79301,
79490,
79649,
79933,
80112,
80233,
80393,
80553,
80726,
80879,
81052,
81177,
81317,
81458,
81582,
81699,
81845,
81986,
82111,
82250,
82404,
82588,
82751,
82852,
83022,
83120,
83207,
83361,
83456,
83583,
83775,
83955,
84104,
84298,
84421,
84591,
84698,
84830,
84931,
85018,
85147,
85322,
85440,
85596,
85713,
85889,
85999,
86085,
86199,
86335,
86548,
86672,
86805,
86954,
87065,
87270,
87387,
87490,
87637,
87786,
87875,
88021,
88157,
88273,
88373,
88480,
88653,
88803,
88918,
89062,
89266,
89401,
89516,
89657,
89784,
89954,
90115,
90286,
90413,
90529,
90665,
90779,
90907,
91018,
91019,
91046,
91047,
91091,
91097,
91259,
91386,
91526,
91769,
91979,
92217,
92452,
92574,
92732,
92946,
93142,
93318,
93538,
93718,
93946,
94034,
94121,
94339,
94551,
94641,
94987,
95146,
95367,
95485,
95610,
95744,
95879,
96014,
96148,
96392,
96615,
96782,
97078,
97346,
97544,
97785,
98034,
98210,
98340,
98553,
98713,
98966,
99134,
99330,
99584,
99662,
99740,
99816,
100060,
100161,
100240,
100335,
100430,
100526,
100591,
100657,
100853,
101088,
101304,
101468,
101646,
101866,
102084,
102279,
102463,
102757,
103051,
103278,
103566,
103839,
104006,
104086,
104156,
104227,
104308,
104384,
104459,
104528,
104609,
104688,
104765,
104874,
104951,
105029,
105105,
105184,
105262,
105340,
105420,
105490,
105569,
105638,
105710,
105789,
105868,
105946,
106024,
106101,
106179,
106258,
106435,
106640,
106863,
107115,
107419,
107589,
107805,
108007,
108228,
108447,
108448,
108461,
108462,
108506,
108571,
108748,
108879,
109006,
109091,
109092,
109110,
109111,
109147,
109180,
109206,
109234,
109265,
109296,
109327,
109357,
109386,
109414,
109442,
109473,
109501,
109532,
109564,
109593,
109624,
109656,
109686,
109716,
109717,
109735,
109736,
109771,
109868,
109947,
110014,
110080,
110121,
110182,
110228,
110370,
110462,
110541,
110608,
110694,
110768,
110825,
110909,
110974,
111049,
111100,
111172,
111284,
111361,
111425,
111488,
111592,
111659,
111660,
111673,
111674,
111702,
111716,
111717,
111763,
111764,
111944,
111945,
111959,
111960,
112006,
112007,
112187,
112188,
112202,
112203,
112263,
112264,
112369,
112370,
112395,
112396,
112456,
112457,
112562,
112563,
112588,
112589,
112630,
112631,
112662
]
}
|
{
"red_pajama_v2": {
"ccnet_original_length": 112662,
"ccnet_original_nlines": 807,
"rps_doc_curly_bracket": 0,
"rps_doc_ldnoobw_words": 0,
"rps_doc_lorem_ipsum": 0,
"rps_doc_stop_word_fraction": 0.20665666460990906,
"rps_doc_ut1_blacklist": 0,
"rps_doc_frac_all_caps_words": 0.04369572177529335,
"rps_doc_frac_lines_end_with_ellipsis": 0,
"rps_doc_frac_no_alph_words": 0.3375619351863861,
"rps_doc_frac_unique_words": 0.16449373960494995,
"rps_doc_mean_word_length": 5.963611602783203,
"rps_doc_num_sentences": 1066,
"rps_doc_symbol_to_word_ratio": 0,
"rps_doc_unigram_entropy": 6.372424125671387,
"rps_doc_word_count": 15417,
"rps_doc_frac_chars_dupe_10grams": 0.38717222213745117,
"rps_doc_frac_chars_dupe_5grams": 0.5314930081367493,
"rps_doc_frac_chars_dupe_6grams": 0.4868448078632355,
"rps_doc_frac_chars_dupe_7grams": 0.4590335190296173,
"rps_doc_frac_chars_dupe_8grams": 0.43436551094055176,
"rps_doc_frac_chars_dupe_9grams": 0.408783882856369,
"rps_doc_frac_chars_top_2gram": 0.027767809107899666,
"rps_doc_frac_chars_top_3gram": 0.013856709934771061,
"rps_doc_frac_chars_top_4gram": 0.009440840221941471,
"rps_doc_books_importance": -10968.931640625,
"rps_doc_books_importance_length_correction": -10968.931640625,
"rps_doc_openwebtext_importance": -7180.45703125,
"rps_doc_openwebtext_importance_length_correction": -7180.45703125,
"rps_doc_wikipedia_importance": -5737.1591796875,
"rps_doc_wikipedia_importance_length_correction": -5737.1591796875
},
"fasttext": {
"dclm": 0.0222929697483778,
"english": 0.790030300617218,
"fineweb_edu_approx": 2.5457260608673096,
"eai_general_math": 0.05168306827545166,
"eai_open_web_math": 0.08825069665908813,
"eai_web_code": 0.007352709770202637
}
}
|
{
"free_decimal_correspondence": {
"primary": {
"code": "004.0194",
"labels": {
"level_1": "General works, books and libraries, information sciences",
"level_2": "",
"level_3": "Computers and Computer science"
}
},
"secondary": {
"code": "005.4",
"labels": {
"level_1": "General works, books and libraries, information sciences",
"level_2": "",
"level_3": "Computer programming"
}
}
},
"bloom_cognitive_process": {
"primary": {
"code": "3",
"label": "Apply"
},
"secondary": {
"code": "-1",
"label": "Abstain"
}
},
"bloom_knowledge_domain": {
"primary": {
"code": "3",
"label": "Procedural"
},
"secondary": {
"code": "-1",
"label": "Abstain"
}
},
"document_type_v1": {
"primary": {
"code": "11",
"label": "Legal/Regulatory"
},
"secondary": {
"code": "-1",
"label": "Abstain"
}
},
"extraction_artifacts": {
"primary": {
"code": "0",
"label": "No Artifacts"
},
"secondary": {
"code": "0",
"label": "No Artifacts"
}
},
"missing_content": {
"primary": {
"code": "0",
"label": "No missing content"
},
"secondary": {
"code": "0",
"label": "No missing content"
}
},
"document_type_v2": {
"primary": {
"code": "8",
"label": "Documentation"
},
"secondary": {
"code": "10",
"label": "Knowledge Article"
}
},
"reasoning_depth": {
"primary": {
"code": "3",
"label": "Intermediate Reasoning"
},
"secondary": {
"code": "4",
"label": "Advanced Reasoning"
}
},
"technical_correctness": {
"primary": {
"code": "4",
"label": "Highly Correct"
},
"secondary": {
"code": "3",
"label": "Mostly Correct"
}
},
"education_level": {
"primary": {
"code": "4",
"label": "Graduate/Expert Level"
},
"secondary": {
"code": "3",
"label": "Undergraduate Level"
}
}
}
|
672f1e42c33a7f9846924a2431ea77df
|
-7,435,478,061,390,031,000
|
Abstract factory pattern
From wiki.visual-prolog.com
From wikipedia::Abstract factory pattern:
A software design pattern, the Abstract Factory Pattern provides a way to encapsulate a group of individual factories that have a common theme. In normal usage, the client software would create a concrete implementation of the abstract factory and then use the generic interfaces to create the concrete objects that are part of the theme. The client does not know (nor care) about which concrete objects it gets from each of these internal factories since it uses only the generic interfaces of their products. This pattern separates the details of implementation of a set of objects from its general usage.
Example
A program must work with one of two different GUI systems: win or osx. Each of the GUI systems provides buttons and edit controls. The controls are represented by the same interfaces in the two GUI systems, but different classes:
interface win class osx class
button winButton : button osxButton : button
edit winEdit : edit osxEdit : edit
So when we use the win system, we must use the win- classes; and when we use the osx system, we must use the osx- classes. Rather than testing for GUI system each time we want to create a button or edit control, we use an abstract factory.
The abstract factory is an object that can create (i.e. manufacture) buttons and edit controls:
interface guiFactory
predicates
createButton : () -> button NewButton.
createEdit : () -> edit Edit.
end interface guiFactory
We implement two factories, one for win- controls:
class winFactory : guiFactory
end class winFactory
implement winFactory
clauses
createButton() = winButton::new().
clauses
createEdit() = winEdit::new().
end implement winFactory
and one for osx- controls:
class osxFactory : guiFactory
end class osxFactory
implement osxFactory
clauses
createButton() = osxButton::new().
clauses
createEdit() = osxEdit::new().
end implement osxFactory
Now we can some where create either a win-factory or an osx-factory, and in the rest of the program we will create controls using this factory.
The goal here is just for illustrative purposes; in a real program the GUI system would have to be initialized, and the button must be drawn somewhere.
goal
if 1 = config::getAttribute("OS_TYPE") then
GuiFactory = winFactory::new()
else
GuiFactory = osxFactory::new()
end if,
Button = GuiFactory:createButton(),
Button:setText("Play"),
Button:paint().
Additional Notes
1. In the example above we create one factory at the very start of the program and retain it throughout the entire execution. But in other setup's you may create several factories for each their purpose, or create factories that are only temporarily and then disposed again. Consider for example a print version of the factory above. You might create an instance of this factory, when you want to print a "dialog" and then dispose it again once you have printed the dialog. So this factory will only live temporarily and it may coexist with one of the other factories.
2. The client software does not have any knowledge about the concrete factories. Particularly, it does not know how many there are, the name, purpose or any other characteristics about them.
References
|
{
"url": "https://wiki.visual-prolog.com/index.php?title=Abstract_factory_pattern",
"source_domain": "wiki.visual-prolog.com",
"snapshot_id": "CC-MAIN-2024-33",
"warc_metadata": {
"Content-Length": "21318",
"Content-Type": "application/http; msgtype=response",
"WARC-Block-Digest": "sha1:EFHGAIN5VUBLQQIZKSKY2LTGCBKCLGVT",
"WARC-Concurrent-To": "<urn:uuid:6c232980-88d7-44ff-ae94-f28db6ae1eba>",
"WARC-Date": "2024-08-14T04:45:18Z",
"WARC-IP-Address": "86.48.74.145",
"WARC-Identified-Payload-Type": "text/html",
"WARC-Payload-Digest": "sha1:ZFLHMK2JQZSBNMYGEZ5B2ZK7CT6ECQ4S",
"WARC-Record-ID": "<urn:uuid:c5e6d010-374c-42b4-ae42-c0df849c5104>",
"WARC-Target-URI": "https://wiki.visual-prolog.com/index.php?title=Abstract_factory_pattern",
"WARC-Truncated": null,
"WARC-Type": "response",
"WARC-Warcinfo-ID": "<urn:uuid:f851533a-e372-4460-ad6f-57e9e8a5702e>"
},
"warc_info": "isPartOf: CC-MAIN-2024-33\r\npublisher: Common Crawl\r\ndescription: Wide crawl of the web for August 2024\r\noperator: Common Crawl Admin (info@commoncrawl.org)\r\nhostname: ip-10-67-67-36\r\nsoftware: Apache Nutch 1.20 (modified, https://github.com/commoncrawl/nutch/)\r\nrobots: checked via crawler-commons 1.5-SNAPSHOT (https://github.com/crawler-commons/crawler-commons)\r\nformat: WARC File Format 1.1\r\nconformsTo: https://iipc.github.io/warc-specifications/specifications/warc-format/warc-1.1/"
}
|
{
"line_start_idx": [
0,
25,
26,
54,
55,
97,
98,
706,
707,
715,
716,
946,
947,
977,
1022,
1057,
1058,
1298,
1299,
1395,
1396,
1417,
1432,
1479,
1517,
1542,
1543,
1594,
1595,
1625,
1646,
1667,
1679,
1722,
1734,
1773,
1798,
1799,
1826,
1827,
1857,
1878,
1899,
1911,
1954,
1966,
2005,
2030,
2031,
2175,
2176,
2328,
2329,
2334,
2382,
2421,
2430,
2469,
2481,
2521,
2549,
2569,
2570,
2571,
2588,
2589,
3160,
3353,
3354
],
"line_end_idx": [
25,
26,
54,
55,
97,
98,
706,
707,
715,
716,
946,
947,
977,
1022,
1057,
1058,
1298,
1299,
1395,
1396,
1417,
1432,
1479,
1517,
1542,
1543,
1594,
1595,
1625,
1646,
1667,
1679,
1722,
1734,
1773,
1798,
1799,
1826,
1827,
1857,
1878,
1899,
1911,
1954,
1966,
2005,
2030,
2031,
2175,
2176,
2328,
2329,
2334,
2382,
2421,
2430,
2469,
2481,
2521,
2549,
2569,
2570,
2571,
2588,
2589,
3160,
3353,
3354,
3364
]
}
|
{
"red_pajama_v2": {
"ccnet_original_length": 3364,
"ccnet_original_nlines": 68,
"rps_doc_curly_bracket": 0,
"rps_doc_ldnoobw_words": 0,
"rps_doc_lorem_ipsum": 0,
"rps_doc_stop_word_fraction": 0.3893376290798187,
"rps_doc_ut1_blacklist": 0,
"rps_doc_frac_all_caps_words": 0.012924069538712502,
"rps_doc_frac_lines_end_with_ellipsis": 0,
"rps_doc_frac_no_alph_words": 0.1809370070695877,
"rps_doc_frac_unique_words": 0.38163265585899353,
"rps_doc_mean_word_length": 5.261224269866943,
"rps_doc_num_sentences": 31,
"rps_doc_symbol_to_word_ratio": 0,
"rps_doc_unigram_entropy": 4.812985420227051,
"rps_doc_word_count": 490,
"rps_doc_frac_chars_dupe_10grams": 0,
"rps_doc_frac_chars_dupe_5grams": 0.01396431028842926,
"rps_doc_frac_chars_dupe_6grams": 0,
"rps_doc_frac_chars_dupe_7grams": 0,
"rps_doc_frac_chars_dupe_8grams": 0,
"rps_doc_frac_chars_dupe_9grams": 0,
"rps_doc_frac_chars_top_2gram": 0.013576420024037361,
"rps_doc_frac_chars_top_3gram": 0.02094646915793419,
"rps_doc_frac_chars_top_4gram": 0.01706749014556408,
"rps_doc_books_importance": -302.1781005859375,
"rps_doc_books_importance_length_correction": -302.1781005859375,
"rps_doc_openwebtext_importance": -189.1053924560547,
"rps_doc_openwebtext_importance_length_correction": -189.1053924560547,
"rps_doc_wikipedia_importance": -136.2085418701172,
"rps_doc_wikipedia_importance_length_correction": -136.2085418701172
},
"fasttext": {
"dclm": 0.2516201138496399,
"english": 0.8160774111747742,
"fineweb_edu_approx": 3.236140489578247,
"eai_general_math": 0.9048550128936768,
"eai_open_web_math": 0.02881593070924282,
"eai_web_code": 0.9080225825309753
}
}
|
{
"free_decimal_correspondence": {
"primary": {
"code": "005.13",
"labels": {
"level_1": "General works, books and libraries, information sciences",
"level_2": "",
"level_3": "Computer programming"
}
},
"secondary": {
"code": "005.1",
"labels": {
"level_1": "General works, books and libraries, information sciences",
"level_2": "",
"level_3": "Computer programming"
}
}
},
"bloom_cognitive_process": {
"primary": {
"code": "2",
"label": "Understand"
},
"secondary": {
"code": "3",
"label": "Apply"
}
},
"bloom_knowledge_domain": {
"primary": {
"code": "2",
"label": "Conceptual"
},
"secondary": {
"code": "3",
"label": "Procedural"
}
},
"document_type_v1": {
"primary": {
"code": "3",
"label": "Reference/Encyclopedic/Educational"
},
"secondary": {
"code": "4",
"label": "Code/Software"
}
},
"extraction_artifacts": {
"primary": {
"code": "0",
"label": "No Artifacts"
},
"secondary": {
"code": "3",
"label": "Irrelevant Content"
}
},
"missing_content": {
"primary": {
"code": "0",
"label": "No missing content"
},
"secondary": {
"code": "4",
"label": "Missing Images or Figures"
}
},
"document_type_v2": {
"primary": {
"code": "8",
"label": "Documentation"
},
"secondary": {
"code": "10",
"label": "Knowledge Article"
}
},
"reasoning_depth": {
"primary": {
"code": "3",
"label": "Intermediate Reasoning"
},
"secondary": {
"code": "2",
"label": "Basic Reasoning"
}
},
"technical_correctness": {
"primary": {
"code": "4",
"label": "Highly Correct"
},
"secondary": {
"code": "3",
"label": "Mostly Correct"
}
},
"education_level": {
"primary": {
"code": "3",
"label": "Undergraduate Level"
},
"secondary": {
"code": "2",
"label": "High School Level"
}
}
}
|
672f1e42c33a7f9846924a2431ea77df
|
-4,698,886,652,245,771,000
|
Mac Tutorials
How to Stop Push Notifications on Chrome
Feeling annoyed by multiple notifications on your computer? We feel you. In this article, we’ll explain what causes these alerts and help you prevent and block them, including such widespread alert forms as Chrome notifications.
Stop receiving unwanted Chrome notifications by doing the following steps:
1. Open Chrome on your Mac
2. Click on the three dots in the right upper corner and open Settings. Alternatively press and hold Command (⌘) + , (comma) buttons
3. Navigate to Privacy and security tab on the left—go to Site Settings
4. Click Notifications
5. Move the slider to prevent websites from requesting to send notifications
6. Block notifications from the websites where you previously agreed to it
7. Manually add websites you don’t want to get notifications from
Tip: Try using incognito mode (Command (⌘)+ Shift+N) in Chrome to browse without interruptions.
Important note
You should always think twice before granting browsers or apps access or permission to make changes to your device. Are you sure they’re credible? Why do they need this access? To keep your Mac safe, you really need to keep track of all processes, but we understand that it’s almost impossible to keep an eye on everything.
So if you need help—try MacKeeper. It will protect your Mac and your data with minimal involvement from you and allow you to just enjoy your Mac experience.
Now let’s have a closer look at alerts and notifications you get. They’re not the same and you’ll need to take different steps to get rid of them.
What is a Chrome push notification?
A push notification is an alert in your browser, on your desktop, or your mobile phone with a message prompting you to take some action. Like here:
example of chrome push notification
Do you remember the times when you were not bombarded by ads, banners, and other web notifications? When visiting a website was only limited to what you were looking for without any imposing messages? Yes, it’s hard to imagine we ever even had those golden internet days.
Apart from push notifications, a modern internet user faces multiple pop-up ads trying to win their attention and money. On the bright side, these can be controlled in Chrome settings and with the help of an ad tracker blocker.
What’s harder to manage and control are the services that are built into websites—pre-rolls and unskippable ads when trying to watch a video online, subscription forms, support chats, cookies notifications, etc. In these cases, usually, nothing much can be done.
However, being aware of what’s popping up on your screen and what to do about it is a pretty good thing. There’s no way to turn off Chrome notifications automatically, so we’ll teach you how to do this manually. And before we discuss how to shield yourself from different kinds of push ads and stop unwanted Chrome notifications from bothering you, let’s try to figure out what’s behind all of this.
Why do you get push notifications in Chrome?
In fact, before receiving push notifications you need to agree to it. However, it’s quite easy to do so inadvertently. Let’s focus on the moment when it happens.
Once you visit a website, you may expect a window popping up under the lock icon in the address bar. Next time you see such an opt-in box with a message Show notifications next to a bell sign—here is when you need to take action.
What options do you have? You can simply close this window and ignore it for a while. However, if a website is persistently trying to engage you into subscribing, most likely it is for ads. If it is a trusted source and you do want to get push alerts in Chrome whenever an update comes up—click Allow. By giving your consent, you are automatically added to this website's subscriber list. However, if you click Block—this website will have no permission to send you alerts.
So, everything is under your control. If you have accidentally clicked Allow and don't wish to get any messages in Chrome—don't worry and read further. We'll show you how to unsubscribe.
Types of push notifications
What are the most common push notifications Mac users happen to see when using a Mac?
Web push notifications
The booming growth of online advertising has resulted in the rapid development of web push notifications. Ad publishers and networks are working hard to produce new campaigns to help their revenues thrive. This is when such browser push notification becomes a handy tool in the hands of marketers.
You must have seen multiple alerts when opening the Chrome browser. These alert messages can pop up even when you open it on a blank tab or home page and haven’t done any actions in your browser yet. Let’s dig more into what’s behind this type of push notifications.
Web push notifications can show various messages—from news, weather, ads, giveaways, exclusive deals—to scam notifications. The purpose is simple—to encourage users to navigate to a website and make a purchase or revisit it for better conversion. Very often this type of alert is used for malicious purposes trying to lure you into buying or doing what you weren’t planning to.
If you use Chrome as a preferred browser, you’ll get web push notifications is the form of Chrome notifications. To allow Chrome push notifications you need to give your consent with a click on a popup suggested by the website once visiting it. Usually, it contains Allow and Block buttons. Sometimes, websites may also ask to share your location.
example of popup in chrome
Once a push ad pops up on your Mac, you can click anywhere on this window and this will redirect you to a website. Or you can click the Close or More/Settings buttons.
Let’s imagine we’ve accepted such push notifications for airline ticket updates. What will happen next? Once a new offer for your destination appears—this is when to expect a push ad with an exclusive deal for you.
App push notifications
Another way you might get alerts on your device is through in-app push notifications. Such push messages are sent by apps you’ve installed or that were pre-installed on your Mac. This way, an app tries to inform you or give you hints about what should be done next.
For example, if you use MacKeeper, you will get a notification after it has run a background scan of your Mac and detected some outdated apps. This way you can keep an eye on app updates for a smooth Mac performance.
mackeeper regular scan popup with outdated apps message
Or how about your Calendar reminding that tomorrow is a big day—like a flight to your dream destination or your wedding anniversary? Such push notifications can appear on lock screen first and after you’ve unlocked your Mac they are moved to the Notification Center.
Tip: To mute notifications on your desktop, hold down the Option key (alt) while you click on the Notification Center icon in the right upper corner of your screen. Once doing so it goes gray. Or alternatively, open Notification Center—go to Today tab—turn on DO NOT DISTURB.
notification center with do not disturb enabled
By the way, check out this useful Apple User Guide on how to deal with notifications on your Mac.
Mobile push notifications
Mobile push notifications look like text messages and alerts sent by pre-installed apps on your phone. They can be sent out anytime and you don't have to be in the app to get them. This way, an app informs you about any new update—a package delivered to your local post office, or a dating app that has found a new match for you.
Until recently, Apple stuck to strict rules by banning apps from sending out push notifications for promotions and ads. Recent App Store guidelines updates brought some changes. From now on, Apple has allowed iOS push notifications for ads, as long as users consent to receive such push messages with exclusive offers.
Useful push notifications
Not all push notifications are promotional. Push technology was primarily created to help regular readers stay informed about updates and get useful information. For example, your favorite YouTube channel goes live at 8 pm. If you don’t want to miss this live stream, you can turn on push notifications in Chrome and join the minute it starts.
If you want to subscribe to website push notifications, here’s what you need to do:
• Open the desired website
• Click on a lock sign in the address bar
• Choose Allow from the drop-down menu next to Notifications
chrome push notification website settings with allow option highlighted
Malicious push notifications
It’s becoming harder and harder to distinguish a good, informative push notification from a malicious one—as the abundance of them online makes your head spin.
Modern businesses take advantage of online advertising by doing this through partners who place push ads on various websites. Of course, businesses tend to apply strict rules to these campaigns as no one wants to be associated with annoying and imposing ads. However, at times, their ad partners turn out to be irresponsible and break the rules by posting scary and aggressive ads to generate more user reactions and make more money.
Scam notifications saying that your Mac is at risk, suggestions to meet singles nearby, lottery wins—these are usually phishing attacks aimed at making internet users say good-bye to their money. Shady advertisers may sneakily hoax users into subscribing to unwanted notifications. The good news is that there are ways to stop and prevent push notifications. Read further and we’ll tell you more on how to do so in Chrome.
How to prevent and block Chrome push notifications
A few simple recommendations will save the day and help avoid receiving intrusive push notifications on Chrome. Follow these recommendations:
• Check twice before allowing a website to send you push notifications. Accept updates only from trusted and popular websites.
• If you have subscribed to unwanted updates and subscriptions, you can unsubscribe in Chrome settings or right from the website you’re on. Let’s see how to do this.
Unsubscribe from push notifications through Chrome settings
To get rid of the notifications, do the following:
• Open ChromeSettings (three dots in the right upper corner of the Chrome window)
• Go to Privacy and securityNotifications—click on three dots next to a website you want to block. Here you’ll see a list of all websites sending you push notifications in Chrome.
For more tips about push ads use this Chrome guide.
chrome settings with privacy and security tab highlighted
Unsubscribe from push notifications through a website
For a fast notifications fix:
• Click on a lock icon in Chrome’s address bar
• Choose Block from the drop-down menu
For more actions:
• Click on the lock icon—go to Site settings. This will give you an overview of this website—here you can see more options like location, pop-ups, and redirects, ads, etc.
site settings page with notifications drop-down menu highlighted
Now you know all about Chrome push notifications and how to decide for yourself whether to allow or block them. Enjoy your browsing experience!
Use your Mac to the fullest! Sign up and get:
Effective tips on how to fix Mac issues
Reliable advice on how to stay safe online
Mac-world news and updates
Thank you!
You’ll love exploring your Mac with us.
Oops, something went wrong.
Try again or reload a page.
Here’s another sign you need to upgrade your macOS ASAP:
30% off your MacKeeper subscription
Сopy the code now and use it in the MacKeeper checkout after the upgrade.
Copy Code
Please be aware that this code cannot be combined with any other discounts, offers, or promotions.
PC
MacKeeper - your all-in-one solution for more space and maximum security.
Try Now
Contents
bg
Don’t go! Enjoy our Black Friday deal
Add MacKeeper to your shopping list to live the event to the fullest.
Try 1 Week for $1
arrow
Run Application
step_1
Click Continue
step_2
Click Install
step_1
Your macOS version is lower than OS 10.11. We’d like to offer you MacKeeper 4 to solve the cleaning, privacy, and security issues of your macOS.
|
{
"url": "https://mackeeper.com/blog/stop-chrome-notifications/",
"source_domain": "mackeeper.com",
"snapshot_id": "CC-MAIN-2023-50",
"warc_metadata": {
"Content-Length": "269607",
"Content-Type": "application/http; msgtype=response",
"WARC-Block-Digest": "sha1:TQH45YZDPTSE6HIU2NB4OZHPA4KIQDJA",
"WARC-Concurrent-To": "<urn:uuid:4603c49a-046f-45ba-9a99-169952d294b2>",
"WARC-Date": "2023-12-05T09:41:55Z",
"WARC-IP-Address": "108.138.64.61",
"WARC-Identified-Payload-Type": "text/html",
"WARC-Payload-Digest": "sha1:JRT6SX462YMXL6ZOQ75AH7IAOPVY2KKL",
"WARC-Record-ID": "<urn:uuid:0909592a-d0e1-4c87-9674-9bcafcf69dd0>",
"WARC-Target-URI": "https://mackeeper.com/blog/stop-chrome-notifications/",
"WARC-Truncated": null,
"WARC-Type": "response",
"WARC-Warcinfo-ID": "<urn:uuid:b060e8f1-f7ab-44ec-be9c-998e1b02050f>"
},
"warc_info": "isPartOf: CC-MAIN-2023-50\r\npublisher: Common Crawl\r\ndescription: Wide crawl of the web for November/December 2023\r\noperator: Common Crawl Admin (info@commoncrawl.org)\r\nhostname: ip-10-67-67-172\r\nsoftware: Apache Nutch 1.19 (modified, https://github.com/commoncrawl/nutch/)\r\nrobots: checked via crawler-commons 1.5-SNAPSHOT (https://github.com/crawler-commons/crawler-commons)\r\nformat: WARC File Format 1.1\r\nconformsTo: https://iipc.github.io/warc-specifications/specifications/warc-format/warc-1.1/"
}
|
{
"line_start_idx": [
0,
14,
15,
56,
57,
286,
287,
288,
363,
364,
393,
528,
602,
627,
706,
783,
851,
852,
948,
949,
964,
965,
966,
1290,
1291,
1293,
1294,
1451,
1452,
1453,
1600,
1601,
1637,
1638,
1786,
1787,
1823,
1824,
2096,
2097,
2099,
2100,
2328,
2329,
2331,
2332,
2595,
2596,
2598,
2599,
2999,
3000,
3045,
3046,
3208,
3209,
3211,
3212,
3442,
3443,
3445,
3446,
3920,
3921,
3923,
3924,
4111,
4112,
4140,
4141,
4227,
4228,
4251,
4252,
4550,
4551,
4553,
4554,
4821,
4822,
4824,
4825,
5203,
5204,
5206,
5207,
5556,
5557,
5584,
5585,
5753,
5754,
5756,
5757,
5972,
5973,
5996,
5997,
6263,
6264,
6266,
6267,
6484,
6485,
6541,
6542,
6809,
6810,
6812,
6813,
7089,
7090,
7138,
7139,
7237,
7238,
7264,
7265,
7595,
7596,
7598,
7599,
7918,
7919,
7945,
7946,
8290,
8291,
8293,
8294,
8378,
8379,
8408,
8452,
8515,
8587,
8588,
8617,
8618,
8778,
8779,
8781,
8782,
9216,
9217,
9219,
9220,
9643,
9644,
9695,
9696,
9838,
9839,
9968,
10136,
10137,
10197,
10198,
10249,
10250,
10334,
10516,
10517,
10569,
10570,
10628,
10629,
10683,
10684,
10714,
10715,
10764,
10805,
10806,
10824,
10825,
10999,
11064,
11065,
11211,
11212,
11258,
11298,
11341,
11368,
11369,
11380,
11381,
11421,
11422,
11450,
11451,
11479,
11480,
11537,
11538,
11574,
11575,
11649,
11650,
11660,
11661,
11760,
11761,
11764,
11765,
11839,
11840,
11848,
11849,
11858,
11859,
11862,
11900,
11901,
11971,
11972,
11990,
11996,
11997,
12013,
12014,
12021,
12022,
12037,
12038,
12045,
12046,
12060,
12061,
12068,
12069
],
"line_end_idx": [
14,
15,
56,
57,
286,
287,
288,
363,
364,
393,
528,
602,
627,
706,
783,
851,
852,
948,
949,
964,
965,
966,
1290,
1291,
1293,
1294,
1451,
1452,
1453,
1600,
1601,
1637,
1638,
1786,
1787,
1823,
1824,
2096,
2097,
2099,
2100,
2328,
2329,
2331,
2332,
2595,
2596,
2598,
2599,
2999,
3000,
3045,
3046,
3208,
3209,
3211,
3212,
3442,
3443,
3445,
3446,
3920,
3921,
3923,
3924,
4111,
4112,
4140,
4141,
4227,
4228,
4251,
4252,
4550,
4551,
4553,
4554,
4821,
4822,
4824,
4825,
5203,
5204,
5206,
5207,
5556,
5557,
5584,
5585,
5753,
5754,
5756,
5757,
5972,
5973,
5996,
5997,
6263,
6264,
6266,
6267,
6484,
6485,
6541,
6542,
6809,
6810,
6812,
6813,
7089,
7090,
7138,
7139,
7237,
7238,
7264,
7265,
7595,
7596,
7598,
7599,
7918,
7919,
7945,
7946,
8290,
8291,
8293,
8294,
8378,
8379,
8408,
8452,
8515,
8587,
8588,
8617,
8618,
8778,
8779,
8781,
8782,
9216,
9217,
9219,
9220,
9643,
9644,
9695,
9696,
9838,
9839,
9968,
10136,
10137,
10197,
10198,
10249,
10250,
10334,
10516,
10517,
10569,
10570,
10628,
10629,
10683,
10684,
10714,
10715,
10764,
10805,
10806,
10824,
10825,
10999,
11064,
11065,
11211,
11212,
11258,
11298,
11341,
11368,
11369,
11380,
11381,
11421,
11422,
11450,
11451,
11479,
11480,
11537,
11538,
11574,
11575,
11649,
11650,
11660,
11661,
11760,
11761,
11764,
11765,
11839,
11840,
11848,
11849,
11858,
11859,
11862,
11900,
11901,
11971,
11972,
11990,
11996,
11997,
12013,
12014,
12021,
12022,
12037,
12038,
12045,
12046,
12060,
12061,
12068,
12069,
12213
]
}
|
{
"red_pajama_v2": {
"ccnet_original_length": 12213,
"ccnet_original_nlines": 231,
"rps_doc_curly_bracket": 0,
"rps_doc_ldnoobw_words": 0,
"rps_doc_lorem_ipsum": 0,
"rps_doc_stop_word_fraction": 0.4348006546497345,
"rps_doc_ut1_blacklist": 0,
"rps_doc_frac_all_caps_words": 0.0037375399842858315,
"rps_doc_frac_lines_end_with_ellipsis": 0,
"rps_doc_frac_no_alph_words": 0.13081395626068115,
"rps_doc_frac_unique_words": 0.32058823108673096,
"rps_doc_mean_word_length": 4.780392169952393,
"rps_doc_num_sentences": 120,
"rps_doc_symbol_to_word_ratio": 0,
"rps_doc_unigram_entropy": 5.60966157913208,
"rps_doc_word_count": 2040,
"rps_doc_frac_chars_dupe_10grams": 0,
"rps_doc_frac_chars_dupe_5grams": 0.024712879210710526,
"rps_doc_frac_chars_dupe_6grams": 0.00871616043150425,
"rps_doc_frac_chars_dupe_7grams": 0.00615258002653718,
"rps_doc_frac_chars_dupe_8grams": 0,
"rps_doc_frac_chars_dupe_9grams": 0,
"rps_doc_frac_chars_top_2gram": 0.05752665922045708,
"rps_doc_frac_chars_top_3gram": 0.00461443979293108,
"rps_doc_frac_chars_top_4gram": 0.00461443979293108,
"rps_doc_books_importance": -1266.434326171875,
"rps_doc_books_importance_length_correction": -1266.434326171875,
"rps_doc_openwebtext_importance": -653.764404296875,
"rps_doc_openwebtext_importance_length_correction": -653.764404296875,
"rps_doc_wikipedia_importance": -514.7308959960938,
"rps_doc_wikipedia_importance_length_correction": -514.7308959960938
},
"fasttext": {
"dclm": 0.025661470368504524,
"english": 0.9182008504867554,
"fineweb_edu_approx": 1.540680170059204,
"eai_general_math": 0.006356480065733194,
"eai_open_web_math": 0.048681680113077164,
"eai_web_code": 0.017090560868382454
}
}
|
{
"free_decimal_correspondence": {
"primary": {
"code": "005.467",
"labels": {
"level_1": "General works, books and libraries, information sciences",
"level_2": "",
"level_3": "Computer programming"
}
},
"secondary": {
"code": "004.67",
"labels": {
"level_1": "General works, books and libraries, information sciences",
"level_2": "",
"level_3": "Computers and Computer science"
}
}
},
"bloom_cognitive_process": {
"primary": {
"code": "3",
"label": "Apply"
},
"secondary": {
"code": "2",
"label": "Understand"
}
},
"bloom_knowledge_domain": {
"primary": {
"code": "3",
"label": "Procedural"
},
"secondary": {
"code": "2",
"label": "Conceptual"
}
},
"document_type_v1": {
"primary": {
"code": "3",
"label": "Reference/Encyclopedic/Educational"
},
"secondary": {
"code": "6",
"label": "Promotional/Advertisement"
}
},
"extraction_artifacts": {
"primary": {
"code": "3",
"label": "Irrelevant Content"
},
"secondary": {
"code": "-1",
"label": "Abstain"
}
},
"missing_content": {
"primary": {
"code": "4",
"label": "Missing Images or Figures"
},
"secondary": {
"code": "-1",
"label": "Abstain"
}
},
"document_type_v2": {
"primary": {
"code": "23",
"label": "Tutorial"
},
"secondary": {
"code": "10",
"label": "Knowledge Article"
}
},
"reasoning_depth": {
"primary": {
"code": "2",
"label": "Basic Reasoning"
},
"secondary": {
"code": "1",
"label": "No Reasoning"
}
},
"technical_correctness": {
"primary": {
"code": "4",
"label": "Highly Correct"
},
"secondary": {
"code": "3",
"label": "Mostly Correct"
}
},
"education_level": {
"primary": {
"code": "1",
"label": "General Audience"
},
"secondary": {
"code": "2",
"label": "High School Level"
}
}
}
|
672f1e42c33a7f9846924a2431ea77df
|
1,750,538,204,866,774,300
|
Take the 2-minute tour ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.
I have an question about performance of my code. Let's say I have a struct in C for a point:
typedef struct _CPoint
{
float x, y;
} CPoint;
and a function where I use the struct.
float distance(CPoint p1, CPoint p2)
{
return sqrt(pow((p2.x-p1.x),2)+pow((p2.y-p1.y),2));
}
I was wondering if it would be a smart idea to replace this function for a #define,
#define distance(p1, p2)(sqrt(pow((p2.x-p1.x),2)+pow((p2.y-p1.y),2)));
I think it will be faster because there will be no function overhead, and I'm wondering if I should use this approach for all other functions in my program to increase the performance. So my question is:
Should I replace all my functions with #define to increase the performance of my code?
Thanks in advance
share|improve this question
please use trailing instead of leading underscores: most uses of leading underscores are a violation of the ISO C standard, and underscores followed by upper-case letters are especially bad as that's what new C language keywords use (_Bool, _Complex, _Generic, _Atomic, ...) – Christoph Oct 14 '11 at 13:43
5 Answers 5
up vote 7 down vote accepted
No. You should never make the decision between a macro and a function based on a perceived performance difference. You should evaluate it soley based on the merits of functions over macros. In general choose functions.
Macros have a lot of hidden downsides that can bite you. Case in point, your translation to a macro here is incorrect (or at least not semantics preserving with the original function). The argument to the macro distance gets evaluated 2 times each. Imagine I made the following call
distance(GetPointA(), GetPointB());
In the macro version this actually results in 4 function calls because each argument is evaluated twice. Had distance been left as a function it would only result in 3 function calls (distance and each argument). Note: I'm ignoring the impact of sqrt and pow in the above calculations as they're the same in both versions.
share|improve this answer
There are three things:
• normal functions like your distance above
• inline functions
• preprocessor macros
While functions guarantee some kind of type safety, they also incur a performance loss due to the fact that a stack frame needs to be used at each function call. code from inline functions is copied at the call site so that penalty is not paid -- however, your code size will increase. Macros provide no type safety and also involve textual substitution.
Choosing from all three, I'd usually use inline functions. Macros only when they are very short and very useful in this form (like hlist_for_each from the Linux kernel)
share|improve this answer
I'd recommend an inline function rather than a macro. It'll give you any possible performance benefits of a macro, without the ugliness. (Macros have some gotchas that make them very iffy as a general replacement for functions. In particular, macro args are evaluated every time they're used, while function args are evaluated once each before the "call".)
inline float distance(CPoint p1, CPoint p2)
{
float dx = p2.x - p1.x;
float dy = p2.y - p1.y;
return sqrt(dx*dx + dy*dy);
}
(Note i also replaced pow(dx, 2) with dx * dx. The two are equivalent, and multiplication is more likely to be efficient. Some compilers might try to optimize away the call to pow...but guess what they replace it with.)
share|improve this answer
If using a fairly mature compiler it propaby will do this for you on assembly level if optimisation is swtiched on.
For gcc the -O3 or (for "small" functions) even the -O2 option will do this.
For details on this you might consider reading here http://gcc.gnu.org/onlinedocs/gcc/Optimize-Options.html for "-finline*" options.
share|improve this answer
Jared's right, and in this specific case, the cycles spent in the pow calls and the sqrt call would be in the range of 2 orders of magnitude more than the cycles spent in the call to distance.
Sometimes people assume that small code equals small time. Not so.
share|improve this answer
Your Answer
discard
By posting your answer, you agree to the privacy policy and terms of service.
Not the answer you're looking for? Browse other questions tagged or ask your own question.
|
{
"url": "http://stackoverflow.com/questions/7757223/ansi-c-define-vs-functions?answertab=oldest",
"source_domain": "stackoverflow.com",
"snapshot_id": "crawl=CC-MAIN-2014-23",
"warc_metadata": {
"Content-Length": "83594",
"Content-Type": "application/http; msgtype=response",
"WARC-Block-Digest": "sha1:DHM4VPHRT5J457HEC6H5JUSVPYEO54KG",
"WARC-Concurrent-To": "<urn:uuid:28c9d7c5-1347-4b6b-a889-96505da8ff71>",
"WARC-Date": "2014-08-02T02:38:06Z",
"WARC-IP-Address": "198.252.206.16",
"WARC-Identified-Payload-Type": null,
"WARC-Payload-Digest": "sha1:G3AGZHZMBYNSDJRKCM7TNDUA3LVIMD3E",
"WARC-Record-ID": "<urn:uuid:4277ae6e-2760-47eb-abfc-a5ecf1f4cfd4>",
"WARC-Target-URI": "http://stackoverflow.com/questions/7757223/ansi-c-define-vs-functions?answertab=oldest",
"WARC-Truncated": null,
"WARC-Type": "response",
"WARC-Warcinfo-ID": "<urn:uuid:844d6cf7-2db9-40d1-9544-a64809869345>"
},
"warc_info": "robots: classic\r\nhostname: ip-10-146-231-18.ec2.internal\r\nsoftware: Nutch 1.6 (CC)/CC WarcExport 1.0\r\nisPartOf: CC-MAIN-2014-23\r\noperator: CommonCrawl Admin\r\ndescription: Wide crawl of the web with URLs provided by Blekko for July 2014\r\npublisher: CommonCrawl\r\nformat: WARC File Format 1.0\r\nconformsTo: http://bibnum.bnf.fr/WARC/WARC_ISO_28500_version1_latestdraft.pdf"
}
|
{
"line_start_idx": [
0,
25,
157,
158,
251,
252,
275,
277,
293,
303,
304,
343,
344,
381,
383,
439,
441,
442,
526,
527,
598,
599,
803,
804,
891,
892,
910,
911,
939,
944,
1252,
1253,
1265,
1266,
1295,
1296,
1515,
1516,
1799,
1800,
1836,
1837,
2160,
2161,
2187,
2188,
2212,
2213,
2259,
2280,
2304,
2305,
2660,
2661,
2830,
2831,
2857,
2858,
3215,
3216,
3260,
3262,
3290,
3318,
3350,
3352,
3353,
3573,
3574,
3600,
3601,
3717,
3718,
3795,
3796,
3929,
3930,
3956,
3957,
4150,
4151,
4218,
4219,
4245,
4246,
4258,
4259,
4261,
4269,
4270,
4348,
4349
],
"line_end_idx": [
25,
157,
158,
251,
252,
275,
277,
293,
303,
304,
343,
344,
381,
383,
439,
441,
442,
526,
527,
598,
599,
803,
804,
891,
892,
910,
911,
939,
944,
1252,
1253,
1265,
1266,
1295,
1296,
1515,
1516,
1799,
1800,
1836,
1837,
2160,
2161,
2187,
2188,
2212,
2213,
2259,
2280,
2304,
2305,
2660,
2661,
2830,
2831,
2857,
2858,
3215,
3216,
3260,
3262,
3290,
3318,
3350,
3352,
3353,
3573,
3574,
3600,
3601,
3717,
3718,
3795,
3796,
3929,
3930,
3956,
3957,
4150,
4151,
4218,
4219,
4245,
4246,
4258,
4259,
4261,
4269,
4270,
4348,
4349,
4439
]
}
|
{
"red_pajama_v2": {
"ccnet_original_length": 4439,
"ccnet_original_nlines": 91,
"rps_doc_curly_bracket": 0.001351660001091659,
"rps_doc_ldnoobw_words": 0,
"rps_doc_lorem_ipsum": 0,
"rps_doc_stop_word_fraction": 0.3731656074523926,
"rps_doc_ut1_blacklist": 0,
"rps_doc_frac_all_caps_words": 0.018867919221520424,
"rps_doc_frac_lines_end_with_ellipsis": 0,
"rps_doc_frac_no_alph_words": 0.21174004673957825,
"rps_doc_frac_unique_words": 0.46327683329582214,
"rps_doc_mean_word_length": 4.836158275604248,
"rps_doc_num_sentences": 53,
"rps_doc_symbol_to_word_ratio": 0.005241089966148138,
"rps_doc_unigram_entropy": 5.324094772338867,
"rps_doc_word_count": 708,
"rps_doc_frac_chars_dupe_10grams": 0,
"rps_doc_frac_chars_dupe_5grams": 0.028037380427122116,
"rps_doc_frac_chars_dupe_6grams": 0,
"rps_doc_frac_chars_dupe_7grams": 0,
"rps_doc_frac_chars_dupe_8grams": 0,
"rps_doc_frac_chars_dupe_9grams": 0,
"rps_doc_frac_chars_top_2gram": 0.028037380427122116,
"rps_doc_frac_chars_top_3gram": 0.03212616965174675,
"rps_doc_frac_chars_top_4gram": 0.01109812967479229,
"rps_doc_books_importance": -459.7626037597656,
"rps_doc_books_importance_length_correction": -459.7626037597656,
"rps_doc_openwebtext_importance": -266.8829040527344,
"rps_doc_openwebtext_importance_length_correction": -266.8829040527344,
"rps_doc_wikipedia_importance": -247.6006317138672,
"rps_doc_wikipedia_importance_length_correction": -247.6006317138672
},
"fasttext": {
"dclm": 0.6095051169395447,
"english": 0.8864531517028809,
"fineweb_edu_approx": 1.763472318649292,
"eai_general_math": 0.35067832469940186,
"eai_open_web_math": 0.27300167083740234,
"eai_web_code": 0.07666050642728806
}
}
|
{
"free_decimal_correspondence": {
"primary": {
"code": "005.1",
"labels": {
"level_1": "General works, books and libraries, information sciences",
"level_2": "",
"level_3": "Computer programming"
}
},
"secondary": {
"code": "004.02",
"labels": {
"level_1": "General works, books and libraries, information sciences",
"level_2": "",
"level_3": "Computers and Computer science"
}
}
},
"bloom_cognitive_process": {
"primary": {
"code": "4",
"label": "Analyze"
},
"secondary": {
"code": "3",
"label": "Apply"
}
},
"bloom_knowledge_domain": {
"primary": {
"code": "3",
"label": "Procedural"
},
"secondary": {
"code": "2",
"label": "Conceptual"
}
},
"document_type_v1": {
"primary": {
"code": "5",
"label": "Social/Forum"
},
"secondary": {
"code": "-1",
"label": "Abstain"
}
},
"extraction_artifacts": {
"primary": {
"code": "3",
"label": "Irrelevant Content"
},
"secondary": {
"code": "-1",
"label": "Abstain"
}
},
"missing_content": {
"primary": {
"code": "0",
"label": "No missing content"
},
"secondary": {
"code": "-1",
"label": "Abstain"
}
},
"document_type_v2": {
"primary": {
"code": "18",
"label": "Q&A Forum"
},
"secondary": {
"code": "8",
"label": "Documentation"
}
},
"reasoning_depth": {
"primary": {
"code": "3",
"label": "Intermediate Reasoning"
},
"secondary": {
"code": "2",
"label": "Basic Reasoning"
}
},
"technical_correctness": {
"primary": {
"code": "4",
"label": "Highly Correct"
},
"secondary": {
"code": "3",
"label": "Mostly Correct"
}
},
"education_level": {
"primary": {
"code": "3",
"label": "Undergraduate Level"
},
"secondary": {
"code": "2",
"label": "High School Level"
}
}
}
|
672f1e42c33a7f9846924a2431ea77df
|
-7,925,356,195,304,644,000
|
Custom raspbian kernel + wifi monitoring?
wifi
#1
Anyone have any insight into whether it’s possible to create a custom raspbian kernel with wifi monitoring enabled, via resin ?
For example, this is how i would do it on a normal raspberry pi zero (or CM3) deploy - https://raspberrypi.stackexchange.com/questions/36747/enable-monitoring-mode-for-rtl8188cus-via-usb-on-raspbian
I would love to do the same via resin, but not sure if it’s possible.
Matt.
#2
Hey there!
resinOS is an open source project, so you can re-build it for a particular board to add any customization you might need. Check https://github.com/resin-os/resin-raspberrypi for the Raspberry Pi resinOS flavor, and don’t hesitate to get in touch if need help along the way.
#3
Awesome - is there an example of how to modify/change the resin-raspberrypi (or other) OS? I’m not sure where to start…
Matt.
#4
Hi, looking at the current kernel (4.4.8) in the 2.0.0+rev3 release of resinOS, it comes with the rtl8192cu driver enabled - that’s the part that you wanted to add? Or is there any other thing that you needed to change? Have you gave that version of resinOS a try?
What exact changes / steps would you need monitoring to be enabled? The StackOverflow question is quite old, and would be good to have a specific list to see how to facilitate that for you. :pencil:
If you still need to modify the image, the repository above have the information how to build it in the README. The kernel info you would need to change in the meta-raspberrypi layer. In meta-raspberrypi you’d need to change the settings within relevant files in the recipes-kernel/linux/ directory. That’s some work with Yocto, the build system we use, but should be able to find many resources online on how to work with that.
#5
I actually need the rtlwifi modules enabled and the rtl8192cu drivers disabled. The rtlwifi drivers include monitoring capabilities, the other drivers do not.
I outlined the process for enabling this on an older version of raspbian here - http://stackoverflow.com/questions/32703715/enable-monitoring-mode-for-rtl8188cus-via-usb-on-raspbian , which involves recompiling the kernel (enabling/disabling modules in the KConfig and makefiles). Not sure how to apply these same steps to the resin way of doing things.
Any help would be greatly appreciated.
Thanks,
Matt.
#6
We have some development planned that would help with this quite abut, but it’s not yet ready, unfortunately (will keep you posted for sure)
In the meantime probably you would need to dig into resin-raspberrypi and check the readme there how to compile things. The configurations are usually in recipes, so would think you would need to change the kernel configuration in the relevant layers/recipes, e.g in (I think) /layers/meta-resin-raspberrypi/recipes-kernel/linux/linux-raspberrypi_%.bbappend (this), where you would add your own configuration group and enable that. This whole setup is using Yocto, in case you need some more info for how to modify these layers, etc. (is that right, @andrei?)
#7
I will admit, I’m a little unsure how to work with the configs you referenced to get a non-standard driver working.
I’d love to figure this out - manually maintaining hundreds of units is a real pain!
Matt.
|
{
"url": "https://forums.balena.io/t/custom-raspbian-kernel-wifi-monitoring/796",
"source_domain": "forums.balena.io",
"snapshot_id": "crawl=CC-MAIN-2019-09",
"warc_metadata": {
"Content-Length": "18155",
"Content-Type": "application/http; msgtype=response",
"WARC-Block-Digest": "sha1:UWCACRYHWIYYY7HB55CFQSJQC43B3FRW",
"WARC-Concurrent-To": "<urn:uuid:ffe2815f-ba06-4d37-836e-469caf7bfab8>",
"WARC-Date": "2019-02-19T22:49:36Z",
"WARC-IP-Address": "64.71.168.218",
"WARC-Identified-Payload-Type": "text/html",
"WARC-Payload-Digest": "sha1:MLJIBZ7IXG2MWFD6YNFDOJUX6EEP5JGH",
"WARC-Record-ID": "<urn:uuid:90ca654e-4706-4484-800b-fc8ce672db0b>",
"WARC-Target-URI": "https://forums.balena.io/t/custom-raspbian-kernel-wifi-monitoring/796",
"WARC-Truncated": null,
"WARC-Type": "response",
"WARC-Warcinfo-ID": "<urn:uuid:ae013a2f-a4d0-41a9-b67b-390051c47b16>"
},
"warc_info": "isPartOf: CC-MAIN-2019-09\r\npublisher: Common Crawl\r\ndescription: Wide crawl of the web for February 2019\r\noperator: Common Crawl Admin (info@commoncrawl.org)\r\nhostname: ip-10-159-135-91.ec2.internal\r\nsoftware: Apache Nutch 1.15 (modified, https://github.com/commoncrawl/nutch/)\r\nrobots: checked via crawler-commons 0.11-SNAPSHOT (https://github.com/crawler-commons/crawler-commons)\r\nformat: WARC File Format 1.1\r\nconformsTo: http://iipc.github.io/warc-specifications/specifications/warc-format/warc-1.1/"
}
|
{
"line_start_idx": [
0,
42,
43,
48,
49,
52,
53,
181,
182,
381,
382,
452,
453,
459,
460,
461,
464,
465,
476,
477,
751,
752,
753,
756,
757,
877,
878,
884,
885,
886,
889,
890,
1155,
1156,
1355,
1356,
1785,
1786,
1787,
1790,
1791,
1950,
1951,
2305,
2306,
2345,
2346,
2354,
2355,
2361,
2362,
2363,
2366,
2367,
2508,
2509,
3069,
3070,
3071,
3074,
3075,
3191,
3192,
3277,
3278
],
"line_end_idx": [
42,
43,
48,
49,
52,
53,
181,
182,
381,
382,
452,
453,
459,
460,
461,
464,
465,
476,
477,
751,
752,
753,
756,
757,
877,
878,
884,
885,
886,
889,
890,
1155,
1156,
1355,
1356,
1785,
1786,
1787,
1790,
1791,
1950,
1951,
2305,
2306,
2345,
2346,
2354,
2355,
2361,
2362,
2363,
2366,
2367,
2508,
2509,
3069,
3070,
3071,
3074,
3075,
3191,
3192,
3277,
3278,
3283
]
}
|
{
"red_pajama_v2": {
"ccnet_original_length": 3283,
"ccnet_original_nlines": 64,
"rps_doc_curly_bracket": 0,
"rps_doc_ldnoobw_words": 0,
"rps_doc_lorem_ipsum": 0,
"rps_doc_stop_word_fraction": 0.4240766167640686,
"rps_doc_ut1_blacklist": 0,
"rps_doc_frac_all_caps_words": 0.01504787988960743,
"rps_doc_frac_lines_end_with_ellipsis": 0.015384620055556297,
"rps_doc_frac_no_alph_words": 0.23392613232135773,
"rps_doc_frac_unique_words": 0.46047431230545044,
"rps_doc_mean_word_length": 5.0948615074157715,
"rps_doc_num_sentences": 41,
"rps_doc_symbol_to_word_ratio": 0.010943910107016563,
"rps_doc_unigram_entropy": 4.955564022064209,
"rps_doc_word_count": 506,
"rps_doc_frac_chars_dupe_10grams": 0,
"rps_doc_frac_chars_dupe_5grams": 0.01551590021699667,
"rps_doc_frac_chars_dupe_6grams": 0,
"rps_doc_frac_chars_dupe_7grams": 0,
"rps_doc_frac_chars_dupe_8grams": 0,
"rps_doc_frac_chars_dupe_9grams": 0,
"rps_doc_frac_chars_top_2gram": 0.01551590021699667,
"rps_doc_frac_chars_top_3gram": 0.01396431028842926,
"rps_doc_frac_chars_top_4gram": 0.016291700303554535,
"rps_doc_books_importance": -347.0660400390625,
"rps_doc_books_importance_length_correction": -347.0660400390625,
"rps_doc_openwebtext_importance": -208.83506774902344,
"rps_doc_openwebtext_importance_length_correction": -208.83506774902344,
"rps_doc_wikipedia_importance": -154.5106658935547,
"rps_doc_wikipedia_importance_length_correction": -154.5106658935547
},
"fasttext": {
"dclm": 0.04146962985396385,
"english": 0.8984610438346863,
"fineweb_edu_approx": 1.8274041414260864,
"eai_general_math": 0.8568429946899414,
"eai_open_web_math": 0.22726130485534668,
"eai_web_code": 0.1993430256843567
}
}
|
{
"free_decimal_correspondence": {
"primary": {
"code": "004.16",
"labels": {
"level_1": "General works, books and libraries, information sciences",
"level_2": "",
"level_3": "Computers and Computer science"
}
},
"secondary": {
"code": "004.67",
"labels": {
"level_1": "General works, books and libraries, information sciences",
"level_2": "",
"level_3": "Computers and Computer science"
}
}
},
"bloom_cognitive_process": {
"primary": {
"code": "3",
"label": "Apply"
},
"secondary": {
"code": "2",
"label": "Understand"
}
},
"bloom_knowledge_domain": {
"primary": {
"code": "3",
"label": "Procedural"
},
"secondary": {
"code": "2",
"label": "Conceptual"
}
},
"document_type_v1": {
"primary": {
"code": "5",
"label": "Social/Forum"
},
"secondary": {
"code": "3",
"label": "Reference/Encyclopedic/Educational"
}
},
"extraction_artifacts": {
"primary": {
"code": "0",
"label": "No Artifacts"
},
"secondary": {
"code": "-1",
"label": "Abstain"
}
},
"missing_content": {
"primary": {
"code": "0",
"label": "No missing content"
},
"secondary": {
"code": "-1",
"label": "Abstain"
}
},
"document_type_v2": {
"primary": {
"code": "18",
"label": "Q&A Forum"
},
"secondary": {
"code": "8",
"label": "Documentation"
}
},
"reasoning_depth": {
"primary": {
"code": "3",
"label": "Intermediate Reasoning"
},
"secondary": {
"code": "2",
"label": "Basic Reasoning"
}
},
"technical_correctness": {
"primary": {
"code": "3",
"label": "Mostly Correct"
},
"secondary": {
"code": "4",
"label": "Highly Correct"
}
},
"education_level": {
"primary": {
"code": "3",
"label": "Undergraduate Level"
},
"secondary": {
"code": "4",
"label": "Graduate/Expert Level"
}
}
}
|
672f1e42c33a7f9846924a2431ea77df
|
1,067,114,761,416,306,800
|
Building web applications with Django, Django REST Framework, Nuxt.js and docker
Last Updated on December 27, 2020
Over the holidays between lots of big meals and many naps, I tried to tackle one more goal of mine before this year come to an end: building an application with Django and Nuxt.js.
This year I rebuilt my personal blog (briancaffey.github.io) with Nuxt.js, the @nuxt/content headless git-based CMS and TailwindCSS. It is statically generated with Nuxt's full-static mode and has been really enjoyable to work with. I have also learned a lot more about SEO and how Nuxt helps improve Vue applications' SEO. I have also been working a lot with Django and Vue.js applications where Django serves as an API to a Vue.js SPA. This combination of technologies works well for a lot of use cases, but it falls short in SEO. Nuxt also provides a great way to organize large Vue.js projects which I have been finding very helpful. For these reasons, combining Django and Nuxt has been something that I have wanted to try for a while, so this article will share some of my experiences in recent efforts to build with these two frameworks. I took detailed notes of each step of the project setup starting from an empty repository, and I put together a diagram of my understanding of how data flows in the application.
Here's the link to the project repository that I'll be referencing: https://gitlab.com/briancaffey/django-nuxt-starter
This article will focus on explaining the project through the diagram shown below. I added two types of labels: letters and numbers. The letters will introduce each component of the application and its role in the application as a whole. The numbers summarize how data flows through the different components in my sample blog application.
Diagram
Diagram components
A. Your computer - Possibly also your development machine which is running the application in docker containers with docker-compose.
B. NGINX - This is the "front desk" of the application that does a few different things. It is the first component that web requests come to. It serves as a reverse proxy which does path-based routing. It looks at the URL request and determines where to send it. For example: /api/posts/1, /dashboard/, /admin/ could all be routed differently depending on the NGINX configuration file. We will look at this again in the next section. This component, like most of the other things in the diagram, runs in a container. NGINX can also serve static files for our Django app and do TLS termination to make our application available over a secure HTTPS connection.
C. Nuxt.JS server - The first "S" in SSR (server side rendering). It is a Node.js process that renders HTML from Vue components that we define in our Nuxt app, as well as data fetched from other servers/APIs before returning HTML back to the client.
D. Django server - This runs the WSGI application with a gunicorn process in a container.
E. Django REST Framework is a Django package the facilitates the creation of REST API endpoints. This is part of the Django application, it primarily takes care of data serialization (which can be thought of as translating between JSON and Python objects that represent rows of data in our Postgres database)
F. This is the Postgres database, also a containerized service. It is on the same docker network as the Django/gunicorn application, so the Django application can connect to the Postgres database using the hostname postgres.
G. docker-compose is used to orchestrate the docker network, containers and volumes that make up the application.
H. This box represents the docker network that allows for easy networking between services. We will come back to this the significance of this in the next section.
Data flow in the application
The simple application I have built for this demonstration is a blog. There is only a list view and a detail view for simple blog post model with three fields: title, body and created date. For the list view, the frontend (Nuxt) route is /posts/ and the backend route is /api/posts/ for the detail view the frontend route is /posts/_id and the API route is /api/posts/_id/.
The data flow shown here will walk through what happens when a user visits http://localhost/posts/, and then show what happens when the user clicks on one of the listed posts to see the detail view of the post (http://localhost/posts/2).
1. docker-compose up is one command that is used to start the entire application in local development. This exposes the NGINX process on port 80 of the host machine (your laptop).
2. When the application is running on your machine and you navigate to http://localhost/posts/, the request is first handled by NGINX.
3. As we mentioned earlier, NGINX's path-based routing sends all requests that do not start with /api/* or /admin/* to the Nuxt.js server.
4. When the request gets to the Nuxt server, the Nuxt lifecycle methods start. The important one that I'm using so far is asyncData. This property is used to request data that will be used in the rendering of our HTML response.
5. Inside of asyncData, the application uses axios to make a request to /api/posts/ (for example). In nuxt.config.js, the privateRuntimeConfig sets a baseUrl value for axios to http://backend:8000. Since the Nuxt server is on the same docker network as the backend Django/gunicorn server, the Nuxt server is able to resolve http://backend to the address of the backend server.
6. Django processes this endpoint, using the PostViewSet, the views of which have been added to urlpatterns in blog/urls.py.
7. The PostViewSet makes a database query on the posts which is used to serialize the data.
8. The Django server returns the response to the original axios call.
9. The data returned from Django is used to render the HTML response.
10. The HTML response from the Nuxt server is sent back to the browser that originally navigated to http://localhost/posts/.
11. The user is presented with page that lists blog posts. Each blog posts lists to a detail view. When a blog post (let's say the post with id of 2) is clicked on, a request for /posts/2/ is made directly to the Django backend. The browserBaseURL value in the axios settings under publicRuntimeConfig defined in nuxt.config.js is set to http://localhost, so the request is made to http://localhost/api/posts/2/. To clarify, since we are making this request using axios in the browser, we can't make a request to http://backend:8000/api/posts/2/ like we did in step 4 (http://backend:8000/api/posts/) because the browser doesn't know how to resolve the backend hostname.
12. This request to http://localhost/api/posts/2/, like all others, first goes to NGINX which sends it to the backend since the path starts with /api/. At this point the application functions like a regular Vue SPA making axios calls to a backend service. This is because we used <nuxt-link> for the posts listed in the posts list view. If we used <a> tags, we would go through the same process as in step 4 where the HTML is rendered on the Nuxt server and sent back to the browser all at once.
Discussion
My main takeaway is that using Nuxt and Django together can give you good SEO and a great SPA experience at the same time. Using Django alone, or Django with traditional non SSR Vue makes this harder to do. Being a progressive framework, there are a lot of ways to use Vue with any other backend. From what I have heard, most people use Vue via CDN similar to how jQuery was and still is delivered for use in the browser.
There is additional work in setting up 3 servers for a single application (Nuxt, Django and NGINX), but the tradeoff is that I am (at least I feel) very productive writing frontend logic in Vue and backend logic with DRF. I have never liked working with Django templates and I used to know a lot more about them than I do now.
Spotlight for baserow.io's awesome open-source Django Nuxt application
Lastly I want to mention that there are some great resources in the nuxt-community/awesome-nuxt GitHub repo. There's one project that really stood out to me when I searched for "django" projects in the README, and that project is called baserow.io (repo: https://gitlab.com/bramw/baserow). Please check this repo our if you are interested in Django and Nuxt. This company is building an open source no-code database, similar to Airtable which I have worked with before.
Their entire product is open source and I have been very impressed with what I have seen. Please go give that project a star or consider becoming a Github sponsor if you are interested. I'm not affiliated with that project in any way, but I'll be referencing how they use Django and Nuxt to build their application.
Next steps
There is a still a lot I have to learn about Nuxt. I'm still very new to the Framework and this is my first time using Nuxt's SSR mode. Nuxt seems to have its own way of doing lots of things that I'm used to doing in Vue. There is a very supportive community and well-maintained official packages to help with lots of things, like the @nuxt/axios package that I'm using.
My next step is to keep expanding my blog application. One thing I didn't mention is authentication. I plan on using Django session authentication for authenticating request to Django. It seems that it already works correctly in my application (logging in through Django admin and then navigating to Nuxt routes that make Django requests are working only when I'm logged in.) I think I have an idea about how Vuex, authentication and route guards will work together, but I haven't gotten there yet. If anyone has some good reference projects or recommendations on how to expand on what I already have, please let me know!
I know that Nuxt has an auth module, so I need to see if that is relevant for what I want need in my application. I also need to continue reading the Nuxt documentation. I still don't know what I don't know about Nuxt and the plugins and modules that it makes available. I also noticed that Nuxt has it's own version of the Vue 3 Composition API, something I am just now starting to learn more about, so that it another area I'll need to dig into eventually.
Join my mailing list to get updated whenever I publish a new article.
Thanks for checking out my site!
© 2021 Brian Caffey
|
{
"url": "https://briancaffey.github.io/2020/12/27/building-web-applications-with-django-drf-and-nuxt/",
"source_domain": "briancaffey.github.io",
"snapshot_id": "crawl=CC-MAIN-2021-49",
"warc_metadata": {
"Content-Length": "57392",
"Content-Type": "application/http; msgtype=response",
"WARC-Block-Digest": "sha1:MC5KK7TLYV6XWOPMXSTE5NY63WDFB3U5",
"WARC-Concurrent-To": "<urn:uuid:25f41426-9eb8-4667-86f8-e4c69e4c5fe6>",
"WARC-Date": "2021-11-27T05:54:35Z",
"WARC-IP-Address": "185.199.110.153",
"WARC-Identified-Payload-Type": "text/html",
"WARC-Payload-Digest": "sha1:BJJVXJU5Y3ZCJNSHQFE7UBYYX4RMFBXP",
"WARC-Record-ID": "<urn:uuid:ecf1e699-c8d2-4bf8-a964-9543c0864b5d>",
"WARC-Target-URI": "https://briancaffey.github.io/2020/12/27/building-web-applications-with-django-drf-and-nuxt/",
"WARC-Truncated": null,
"WARC-Type": "response",
"WARC-Warcinfo-ID": "<urn:uuid:8570a4db-0c37-4689-b950-0b8c41b4ae36>"
},
"warc_info": "isPartOf: CC-MAIN-2021-49\r\npublisher: Common Crawl\r\ndescription: Wide crawl of the web for November/December 2021\r\noperator: Common Crawl Admin (info@commoncrawl.org)\r\nhostname: ip-10-67-67-155\r\nsoftware: Apache Nutch 1.18 (modified, https://github.com/commoncrawl/nutch/)\r\nrobots: checked via crawler-commons 1.3-SNAPSHOT (https://github.com/crawler-commons/crawler-commons)\r\nformat: WARC File Format 1.1\r\nconformsTo: https://iipc.github.io/warc-specifications/specifications/warc-format/warc-1.1/"
}
|
{
"line_start_idx": [
0,
81,
82,
116,
117,
298,
299,
1322,
1323,
1442,
1443,
1782,
1783,
1791,
1792,
1811,
1812,
1945,
1946,
2605,
2606,
2856,
2857,
2947,
2948,
3257,
3258,
3483,
3484,
3598,
3599,
3763,
3764,
3793,
3794,
4168,
4169,
4407,
4408,
4590,
4591,
4728,
4729,
4870,
4871,
5101,
5102,
5481,
5482,
5609,
5610,
5704,
5705,
5777,
5778,
5850,
5851,
5978,
5979,
6652,
6653,
7151,
7152,
7163,
7164,
7586,
7587,
7914,
7915,
7986,
7987,
8457,
8458,
8774,
8775,
8786,
8787,
9158,
9159,
9781,
9782,
10241,
10242,
10243,
10313,
10314,
10347
],
"line_end_idx": [
81,
82,
116,
117,
298,
299,
1322,
1323,
1442,
1443,
1782,
1783,
1791,
1792,
1811,
1812,
1945,
1946,
2605,
2606,
2856,
2857,
2947,
2948,
3257,
3258,
3483,
3484,
3598,
3599,
3763,
3764,
3793,
3794,
4168,
4169,
4407,
4408,
4590,
4591,
4728,
4729,
4870,
4871,
5101,
5102,
5481,
5482,
5609,
5610,
5704,
5705,
5777,
5778,
5850,
5851,
5978,
5979,
6652,
6653,
7151,
7152,
7163,
7164,
7586,
7587,
7914,
7915,
7986,
7987,
8457,
8458,
8774,
8775,
8786,
8787,
9158,
9159,
9781,
9782,
10241,
10242,
10243,
10313,
10314,
10347,
10366
]
}
|
{
"red_pajama_v2": {
"ccnet_original_length": 10366,
"ccnet_original_nlines": 86,
"rps_doc_curly_bracket": 0,
"rps_doc_ldnoobw_words": 0,
"rps_doc_lorem_ipsum": 0,
"rps_doc_stop_word_fraction": 0.4051094949245453,
"rps_doc_ut1_blacklist": 0,
"rps_doc_frac_all_caps_words": 0.043795619159936905,
"rps_doc_frac_lines_end_with_ellipsis": 0,
"rps_doc_frac_no_alph_words": 0.1646897792816162,
"rps_doc_frac_unique_words": 0.33656588196754456,
"rps_doc_mean_word_length": 4.658870697021484,
"rps_doc_num_sentences": 129,
"rps_doc_symbol_to_word_ratio": 0,
"rps_doc_unigram_entropy": 5.502752780914307,
"rps_doc_word_count": 1753,
"rps_doc_frac_chars_dupe_10grams": 0,
"rps_doc_frac_chars_dupe_5grams": 0.01199951022863388,
"rps_doc_frac_chars_dupe_6grams": 0.007101750001311302,
"rps_doc_frac_chars_dupe_7grams": 0.007101750001311302,
"rps_doc_frac_chars_dupe_8grams": 0.007101750001311302,
"rps_doc_frac_chars_dupe_9grams": 0,
"rps_doc_frac_chars_top_2gram": 0.007958860136568546,
"rps_doc_frac_chars_top_3gram": 0.004897760227322578,
"rps_doc_frac_chars_top_4gram": 0.005509980022907257,
"rps_doc_books_importance": -1044.8992919921875,
"rps_doc_books_importance_length_correction": -1044.8992919921875,
"rps_doc_openwebtext_importance": -604.8675537109375,
"rps_doc_openwebtext_importance_length_correction": -604.8675537109375,
"rps_doc_wikipedia_importance": -512.881103515625,
"rps_doc_wikipedia_importance_length_correction": -512.881103515625
},
"fasttext": {
"dclm": 0.0822523832321167,
"english": 0.9364089369773865,
"fineweb_edu_approx": 1.6127886772155762,
"eai_general_math": 0.4507472515106201,
"eai_open_web_math": 0.12835919857025146,
"eai_web_code": 0.8565524816513062
}
}
|
{
"free_decimal_correspondence": {
"primary": {
"code": "005.1",
"labels": {
"level_1": "General works, books and libraries, information sciences",
"level_2": "",
"level_3": "Computer programming"
}
},
"secondary": {
"code": "005.452",
"labels": {
"level_1": "General works, books and libraries, information sciences",
"level_2": "",
"level_3": "Computer programming"
}
}
},
"bloom_cognitive_process": {
"primary": {
"code": "3",
"label": "Apply"
},
"secondary": {
"code": "4",
"label": "Analyze"
}
},
"bloom_knowledge_domain": {
"primary": {
"code": "3",
"label": "Procedural"
},
"secondary": {
"code": "2",
"label": "Conceptual"
}
},
"document_type_v1": {
"primary": {
"code": "3",
"label": "Reference/Encyclopedic/Educational"
},
"secondary": {
"code": "9",
"label": "Personal/Misc"
}
},
"extraction_artifacts": {
"primary": {
"code": "0",
"label": "No Artifacts"
},
"secondary": {
"code": "3",
"label": "Irrelevant Content"
}
},
"missing_content": {
"primary": {
"code": "0",
"label": "No missing content"
},
"secondary": {
"code": "4",
"label": "Missing Images or Figures"
}
},
"document_type_v2": {
"primary": {
"code": "16",
"label": "Personal Blog"
},
"secondary": {
"code": "23",
"label": "Tutorial"
}
},
"reasoning_depth": {
"primary": {
"code": "3",
"label": "Intermediate Reasoning"
},
"secondary": {
"code": "2",
"label": "Basic Reasoning"
}
},
"technical_correctness": {
"primary": {
"code": "3",
"label": "Mostly Correct"
},
"secondary": {
"code": "4",
"label": "Highly Correct"
}
},
"education_level": {
"primary": {
"code": "3",
"label": "Undergraduate Level"
},
"secondary": {
"code": "2",
"label": "High School Level"
}
}
}
|
672f1e42c33a7f9846924a2431ea77df
|
8,902,059,723,979,136,000
|
Monday, 2013-07-01
*** tpb has joined #hdmi2usb00:00
*** CarlFK has joined #hdmi2usb00:37
CarlFKatlys pugged in!00:38
mithro-workCarlFK, yay!02:03
mithro-workCarlFK, did you see Ryan's email?02:03
CarlFKyeah - I'm a bit hesitant to be investing02:04
CarlFKwhy do HD cameras need something like this? I would expect they have something built in02:05
CarlFKmithro-work: where is the current atlys files?02:07
mithro-work"built in" by?02:08
CarlFKlike a usb port on the camera that streams video02:08
mithro-workI've yet to see anything which supports Linux02:08
CarlFKah.. I somehow thought there was a standard .. silly me02:09
mithro-workHDMI seems to be the standard sadly02:09
CarlFKdjtgcfg prog -d Atlys -i 0 -f ./gdrive/hdmi2usb.bit02:20
CarlFKwhere is the current version of that?02:20
mithro-worksee the mailing list?02:20
CarlFKgdrive came from a google drive dowload..02:20
CarlFKI remember seeing something02:21
CarlFKits not on https://github.com/timvideos/HDMI2USB or https://github.com/timvideos/HDMI2USB/wiki ?02:21
tpbTitle: timvideos/HDMI2USB · GitHub (at github.com)02:21
*** mithro has joined #hdmi2usb02:56
CarlFKmithro-work: june 16 I just uploaded a New firmware on git hub https://github.com/jahanzeb/HDMI2USB/tree/master/release/2013061603:18
tpb<http://ln-s.net/-L6f> (at github.com)03:18
CarlFKi think that is this: 2013-05-25 development/phase1/build/bitfile/hdmi2usb.bit03:22
CarlFKmithro-work: last ping before I leave for a late dinner.. where is the doc ?03:33
CarlFKI think I need to push a button to get the test pattern03:34
CarlFKfound it03:34
mithro-workDoc?03:36
mithro-workwhich doc?03:36
mithro-workFlashing the firmware?03:36
mithro-workDeveloper Documentation?03:37
mithro-work?03:37
mithro-workparx, he's as bad as the students :P03:37
CarlFKhttps://docs.google.com/document/d/1sEhcLmseSLfqr2kH5UtSyMhg5yaNTnCkdNkSvA_ayq4/edit03:48
tpb<http://ln-s.net/-HFV> (at docs.google.com)03:48
CarlFKthat doc - I added it to the wiki03:48
CarlFKI am off - I can get back to this in 10 ours03:49
CarlFKhours03:49
CarlFKsee ya03:49
*** CarlFK has quit IRC03:49
*** CarlFK has joined #hdmi2usb04:32
CarlFKdinner got canceled - I can hack on atlys more now04:32
mithro-workCarlFK, How did you find that friken old firmware!?04:39
mithro-workCarlFK, when is your next big event in the US?04:39
CarlFKthe find command :)04:39
CarlFKabout 30 days04:40
CarlFKPyOhio - 2 days 3 or 4 rooms04:40
CarlFKoh.. I have colors!04:44
CarlFKmithro-work: is there a reference image of what the test pattern should look like?04:48
mithro-workSo04:52
mithro-workWhen you turn on the Atlys, before you load the firmware you'll get a standard test pattern04:52
mithro-workassuming your board is not faulty04:53
CarlFKhmm, let me try that04:53
CarlFKwait.. test pattern where?04:54
mithro-workOn the output display04:54
CarlFKI don't have an hdmi monitor handy04:54
mithro-workIt's going to be hard to debug any problem then....04:54
CarlFKI am now getting an image over usb04:55
CarlFKbut I think it is broken04:55
mithro-workbroken is not very descriptive04:56
mithro-workin what way?04:56
CarlFKthere are colored boxes ? not sure how to describe them down most of the screen - then a gray bar along the bottom04:56
CarlFKthey gray looks out of place04:56
mithro-workscreenshot?04:56
CarlFKoh right, need to re-flash04:58
mithro-workany luck06:34
CarlFKI am on a journey of discovery looking for an app that will make image files06:44
CarlFKhttp://www.linuxconsulting.ro/picturegrabber/ "Picture Grabber is a video 4 linux capture application able to read raw data from a V4L compatible device and output to a jpeg file."06:44
tpbTitle: picture grabber - V4L jpeg capture (at www.linuxconsulting.ro)06:44
CarlFKthat's the only thing I have found.. trying to avoid building something from source06:45
*** CarlFK has left #hdmi2usb06:45
*** CarlFK has joined #hdmi2usb06:45
CarlFKmithro-work: http://veyepar.nextdayvideo.com/site_media/static/veyepar/temp/img-1372662148.png07:25
tpb<http://ln-s.net/-L82> (at veyepar.nextdayvideo.com)07:25
mithro-workluvcview07:55
mithro-workyes, that grey bit looks wrong07:55
mithro-workdo you have any HDMI sources plugged in?07:55
mithro-workwhat are the LED lights showning?07:56
*** CarlFK has quit IRC08:10
*** mithro has quit IRC09:40
*** mithro has joined #hdmi2usb10:08
*** CarlFK has joined #hdmi2usb14:12
*** CarlFK has quit IRC14:46
*** CarlFK has joined #hdmi2usb14:50
*** CarlFK has quit IRC15:37
*** CarlFK has joined #hdmi2usb15:43
mithro-worksure I guess15:51
mithro-workI should be in bed15:51
CarlFKcan you put the current firmware into your repo?15:52
CarlFKI am assuming there is source that someone could hack on15:54
mithro-workin that same repository15:54
CarlFKtopi says Code - http://github.com/timvideos/HDMI2USB ... can we have the code there?15:56
tpbTitle: timvideos/HDMI2USB · GitHub (at github.com)15:56
mithro-worktopic is correct15:57
mithro-workcode is in that repository15:57
CarlFKI am using https://github.com/jahanzeb/HDMI2USB/raw/master/release/R2/pre-build/hdmi2usb.bit15:59
mithro-work7 6 5 4 x 3 x x ( number = on, x = off)15:59
mithro-workthat 3 is in the wrong place....15:59
CarlFKopps15:59
mithro-work7 6 5 4 3 2 1 0....15:59
CarlFKoff by 1 error15:59
mithro-workLED0 - Indicates HDMI 0 input is connected.15:59
mithro-workLED1 - Indicates HDMI 1 input is connected.15:59
mithro-workLED2 - If on then UVC is MJPEG if off then output is RAW.15:59
mithro-workLED3 - Flab B (Full Flag) of cypress USB device.15:59
mithro-workLED4 - Flab C (Empty Flag) of cypress USB device.15:59
mithro-workLED5 - SLWR signal to cypress USB device.15:59
CarlFK 7 6 5 4 x 2 x x15:59
mithro-workLED7:6 - Combination of LED7 and 6 tells which input source is selected as output to HDMI matrix and USB.15:59
mithro-workSo 0 and 1 being off means you have no HDMI sources connected?16:02
CarlFKcorrect16:02
mithro-workwhat is the MD5 sums for the files you are flashing?16:05
mithro-workwhy does your script download hdmi2usb.ex file then random path for programming it?16:05
CarlFKoh hell..16:06
CarlFKdo i need to power cycle before flashing new firmware, or can I do it over the top of existing ?16:08
mithro-workpower cycle16:09
CarlFKk16:09
CarlFKusing the right files, no weird bar16:10
mithro-workWhen you powercycle you have to go all the way from the top16:12
iiiemithro-work: quick sanity check which is newer and would we likely see help with http://github.com/timvideos/HDMI2USB or https://github.com/jahanzeb/HDMI2USB16:22
tpbTitle: timvideos/HDMI2USB · GitHub (at github.com)16:22
mithro-workthey should be identical at most times16:23
mithro-workjahanzeb might be a little ahead sometimes16:23
iiieThanks16:25
*** iiie is now known as iiie216:32
mithro-workI'm going to bed now16:41
CarlFKsee ya16:41
mithro-workCarlFK, can you capture the test video and post it somewhere?16:42
CarlFKsure16:50
mithro-workCan you access https://www.dropbox.com/sh/s5zw70u754lpbmv/ZIw3yxtuHE16:53
mithro-work?16:53
CarlFKhttp://veyepar.nextdayvideo.com/site_media/static/veyepar/temp/00000001.png\16:53
CarlFKhttp://veyepar.nextdayvideo.com/site_media/static/veyepar/temp/00000001.png no slash16:53
tpb<http://ln-s.net/-LA_> (at veyepar.nextdayvideo.com)16:53
mithro-workopps16:53
mithro-workI mean16:53
mithro-workhttps://www.dropbox.com/sh/s5zw70u754lpbmv/N95myLaoJT16:53
tpbTitle: Dropbox - pre-build (at www.dropbox.com)16:53
CarlFKI see a web page with 2 files16:54
CarlFKI can never figure out how to wget from dropbox16:54
CarlFKbrb - need to make a cereal for S and I before it turns lunch time in 3 min16:56
CarlFKback17:07
mithrotry those newer bit files17:15
mithrowe'll work on fixing up the git repository tomorrow17:15
mithroanway gnight for me17:15
*** iiie has joined #hdmi2usb19:06
*** parx has left #hdmi2usb19:26
CarlFKwoo, I am capturing an image from my pi22:31
CarlFKhttp://veyepar.nextdayvideo.com/site_media/static/veyepar/temp/rpi-1.png22:45
tpb<http://ln-s.net/-LF7> (at veyepar.nextdayvideo.com)22:46
CarlFKproblem... I guess that would be a sync problem?22:46
CarlFKbrb22:49
*** CarlFK has quit IRC23:16
Generated by irclog2html.py 2.5 by Marius Gedminas - find it at mg.pov.lt!
|
{
"url": "https://logs.timvideos.us/%23hdmi2usb/%23hdmi2usb.2013-07-01.log.html",
"source_domain": "logs.timvideos.us",
"snapshot_id": "crawl=CC-MAIN-2018-51",
"warc_metadata": {
"Content-Length": "40896",
"Content-Type": "application/http; msgtype=response",
"WARC-Block-Digest": "sha1:4MHCX2TSIXGE4V6MZA4D2UP5WQZ34XN7",
"WARC-Concurrent-To": "<urn:uuid:4c78cc29-18a9-4c22-a9ff-36b9cdf674bc>",
"WARC-Date": "2018-12-10T13:04:40Z",
"WARC-IP-Address": "104.18.33.234",
"WARC-Identified-Payload-Type": "text/html",
"WARC-Payload-Digest": "sha1:KUDHNEPYAK6MWY5BE4TBAROADIDK6KPV",
"WARC-Record-ID": "<urn:uuid:1c7e2b94-1ece-4ec0-9817-676ca58aeb96>",
"WARC-Target-URI": "https://logs.timvideos.us/%23hdmi2usb/%23hdmi2usb.2013-07-01.log.html",
"WARC-Truncated": null,
"WARC-Type": "response",
"WARC-Warcinfo-ID": "<urn:uuid:9dfdc63e-52da-488e-90e4-d0b89dba5e62>"
},
"warc_info": "isPartOf: CC-MAIN-2018-51\r\npublisher: Common Crawl\r\ndescription: Wide crawl of the web for December 2018\r\noperator: Common Crawl Admin (info@commoncrawl.org)\r\nhostname: ip-10-102-177-182.ec2.internal\r\nsoftware: Apache Nutch 1.15 (modified, https://github.com/commoncrawl/nutch/)\r\nrobots: checked via crawler-commons 0.11-SNAPSHOT (https://github.com/crawler-commons/crawler-commons)\r\nformat: WARC File Format 1.1\r\nconformsTo: http://iipc.github.io/warc-specifications/specifications/warc-format/warc-1.1/"
}
|
{
"line_start_idx": [
0,
19,
20,
54,
91,
119,
148,
198,
251,
351,
409,
440,
500,
562,
629,
681,
744,
793,
831,
884,
923,
1032,
1091,
1128,
1268,
1315,
1407,
1495,
1562,
1582,
1603,
1630,
1669,
1710,
1728,
1781,
1877,
1929,
1974,
2030,
2047,
2065,
2094,
2131,
2193,
2261,
2324,
2355,
2380,
2420,
2451,
2545,
2564,
2672,
2722,
2754,
2792,
2830,
2876,
2944,
2990,
3026,
3073,
3102,
3228,
3268,
3296,
3334,
3359,
3448,
3642,
3720,
3815,
3850,
3887,
3993,
4054,
4079,
4126,
4183,
4233,
4262,
4291,
4328,
4365,
4394,
4431,
4460,
4497,
4526,
4561,
4621,
4689,
4729,
4826,
4885,
4918,
4961,
5065,
5123,
5172,
5188,
5224,
5250,
5310,
5370,
5444,
5509,
5575,
5633,
5661,
5783,
5862,
5881,
5950,
6050,
6071,
6179,
6207,
6220,
6267,
6343,
6510,
6569,
6624,
6683,
6699,
6735,
6772,
6790,
6868,
6884,
6969,
6987,
7075,
7171,
7232,
7253,
7276,
7346,
7402,
7443,
7502,
7589,
7605,
7642,
7705,
7736,
7771,
7804,
7855,
7939,
8000,
8060,
8075,
8104,
8105
],
"line_end_idx": [
19,
20,
54,
91,
119,
148,
198,
251,
351,
409,
440,
500,
562,
629,
681,
744,
793,
831,
884,
923,
1032,
1091,
1128,
1268,
1315,
1407,
1495,
1562,
1582,
1603,
1630,
1669,
1710,
1728,
1781,
1877,
1929,
1974,
2030,
2047,
2065,
2094,
2131,
2193,
2261,
2324,
2355,
2380,
2420,
2451,
2545,
2564,
2672,
2722,
2754,
2792,
2830,
2876,
2944,
2990,
3026,
3073,
3102,
3228,
3268,
3296,
3334,
3359,
3448,
3642,
3720,
3815,
3850,
3887,
3993,
4054,
4079,
4126,
4183,
4233,
4262,
4291,
4328,
4365,
4394,
4431,
4460,
4497,
4526,
4561,
4621,
4689,
4729,
4826,
4885,
4918,
4961,
5065,
5123,
5172,
5188,
5224,
5250,
5310,
5370,
5444,
5509,
5575,
5633,
5661,
5783,
5862,
5881,
5950,
6050,
6071,
6179,
6207,
6220,
6267,
6343,
6510,
6569,
6624,
6683,
6699,
6735,
6772,
6790,
6868,
6884,
6969,
6987,
7075,
7171,
7232,
7253,
7276,
7346,
7402,
7443,
7502,
7589,
7605,
7642,
7705,
7736,
7771,
7804,
7855,
7939,
8000,
8060,
8075,
8104,
8105,
8179
]
}
|
{
"red_pajama_v2": {
"ccnet_original_length": 8179,
"ccnet_original_nlines": 156,
"rps_doc_curly_bracket": 0,
"rps_doc_ldnoobw_words": 0,
"rps_doc_lorem_ipsum": 0,
"rps_doc_stop_word_fraction": 0.2188282459974289,
"rps_doc_ut1_blacklist": 0,
"rps_doc_frac_all_caps_words": 0.031046569347381592,
"rps_doc_frac_lines_end_with_ellipsis": 0,
"rps_doc_frac_no_alph_words": 0.41412118077278137,
"rps_doc_frac_unique_words": 0.5527383685112,
"rps_doc_mean_word_length": 6.551723957061768,
"rps_doc_num_sentences": 113,
"rps_doc_symbol_to_word_ratio": 0.00851276982575655,
"rps_doc_unigram_entropy": 5.842566967010498,
"rps_doc_word_count": 986,
"rps_doc_frac_chars_dupe_10grams": 0,
"rps_doc_frac_chars_dupe_5grams": 0.023839009925723076,
"rps_doc_frac_chars_dupe_6grams": 0,
"rps_doc_frac_chars_dupe_7grams": 0,
"rps_doc_frac_chars_dupe_8grams": 0,
"rps_doc_frac_chars_dupe_9grams": 0,
"rps_doc_frac_chars_top_2gram": 0.016718270257115364,
"rps_doc_frac_chars_top_3gram": 0.01393189001828432,
"rps_doc_frac_chars_top_4gram": 0.01486068032681942,
"rps_doc_books_importance": -1040.706298828125,
"rps_doc_books_importance_length_correction": -1040.706298828125,
"rps_doc_openwebtext_importance": -546.5604858398438,
"rps_doc_openwebtext_importance_length_correction": -546.5604858398438,
"rps_doc_wikipedia_importance": -401.1351013183594,
"rps_doc_wikipedia_importance_length_correction": -401.1351013183594
},
"fasttext": {
"dclm": 0.06616330146789551,
"english": 0.8347854018211365,
"fineweb_edu_approx": 1.2357664108276367,
"eai_general_math": 0.25896793603897095,
"eai_open_web_math": 0.23490244150161743,
"eai_web_code": 0.14728879928588867
}
}
|
{
"free_decimal_correspondence": {
"primary": {
"code": "004.16",
"labels": {
"level_1": "General works, books and libraries, information sciences",
"level_2": "",
"level_3": "Computers and Computer science"
}
},
"secondary": {
"code": "005.456",
"labels": {
"level_1": "General works, books and libraries, information sciences",
"level_2": "",
"level_3": "Computer programming"
}
}
},
"bloom_cognitive_process": {
"primary": {
"code": "3",
"label": "Apply"
},
"secondary": {
"code": "4",
"label": "Analyze"
}
},
"bloom_knowledge_domain": {
"primary": {
"code": "3",
"label": "Procedural"
},
"secondary": {
"code": "2",
"label": "Conceptual"
}
},
"document_type_v1": {
"primary": {
"code": "5",
"label": "Social/Forum"
},
"secondary": {
"code": "3",
"label": "Reference/Encyclopedic/Educational"
}
},
"extraction_artifacts": {
"primary": {
"code": "3",
"label": "Irrelevant Content"
},
"secondary": {
"code": "0",
"label": "No Artifacts"
}
},
"missing_content": {
"primary": {
"code": "4",
"label": "Missing Images or Figures"
},
"secondary": {
"code": "0",
"label": "No missing content"
}
},
"document_type_v2": {
"primary": {
"code": "8",
"label": "Documentation"
},
"secondary": {
"code": "18",
"label": "Q&A Forum"
}
},
"reasoning_depth": {
"primary": {
"code": "3",
"label": "Intermediate Reasoning"
},
"secondary": {
"code": "2",
"label": "Basic Reasoning"
}
},
"technical_correctness": {
"primary": {
"code": "3",
"label": "Mostly Correct"
},
"secondary": {
"code": "4",
"label": "Highly Correct"
}
},
"education_level": {
"primary": {
"code": "3",
"label": "Undergraduate Level"
},
"secondary": {
"code": "4",
"label": "Graduate/Expert Level"
}
}
}
|
672f1e42c33a7f9846924a2431ea77df
|
9,081,123,863,772,312,000
|
Skip to main content
The 2024 Developer Survey results are live! See the results
Questions tagged [terminal]
A terminal emulator (or terminal, for short) displays characters, colours, and the cursor on the screen. Vi & Vim are run inside of a terminal, gVim is not.
Filter by
Sorted by
Tagged with
86 votes
8 answers
96k views
How to map Alt key?
I'm trying to map Alt key in the following way: :map <A-j> j :map <A-k> k but it doesn't work (bell is rang on Alt + j/Alt + k). What am I missing? I'm using Terminal on OSX, the same ...
kenorb's user avatar
• 18.7k
12 votes
3 answers
4k views
Mapping Ctrl+s does not work
I am trying to map Ctrl+s to save my file however it does not work. My mappings: map <C-s> :w <CR> :echo "Saved" <CR> imap <C-s> <Esc> :w <CR> :echo "Saved" <...
iProgram's user avatar
• 1,599
13 votes
3 answers
1k views
Scrolling issues when the `wrap` option is set
I find myself dealing with this issue every time the wrap option is active (in my particular case whenever I'm working with markdown files). What happens is that, while scrolling up and down the ...
mrzool's user avatar
• 1,022
8 votes
1 answer
2k views
Mapping control-H in insert mode doesn't work; it always works like backspace
I tried mapping control-H, J, K, and L respectively in insert mode to move around splits. inoremap <C-h> <ESC><C-W><C-h>i inoremap <C-l> <ESC><C-W><C-l&...
matts1's user avatar
• 181
59 votes
4 answers
24k views
Can Vim interpret terminal color escape codes?
Many CLI programs output nicely-highlighted text. While most of them check if the output is going to a file, some include the terminal escape codes. I like the output with the escape codes, but ...
beatgammit's user avatar
• 1,323
11 votes
1 answer
6k views
What's t_TE and t_TI added by vim 8?
First let me show a screenshot below. In the modeline, a strange sequence of characters(>4;m<ESC>[>4;m<ESC) is shown. And not only in the modeline, I have seen such similar sentence in ...
HQW.ang's user avatar
• 113
16 votes
2 answers
4k views
Tmux is changing part of the background in vim
This only seems to happens when using vim inside of tmux. I'm also using iTerm 2. If I create a new tmux pane or resize a tmux pane, it immediately looks like the this: And then the only way to fix ...
aharris88's user avatar
• 1,857
10 votes
1 answer
23k views
How to run terminal command in interactive mode from NeoVim?
I have a terminal command which runs code with a breakpoint in it. When I run this command in NeoVim the code execution does not stop at the breakpoint, instead I get an error, that its not a TTY ...
niekas's user avatar
• 1,655
7 votes
1 answer
389 views
Difference between `:!{cmd}` and `:w !{cmd}` regarding alternate screen
On a Linux platform I see this difference of behavior between running a shell command with :!{cmd} (which just runs the command directly) and with :w !{cmd} (which passes the buffer as standard input ...
filbranden's user avatar
• 29.2k
5 votes
1 answer
2k views
How to know which highlighting group is used for the background of a word?
Vim highlights the background of certain words (e.g. when doing spellchecking) in a way that I would like to change (because the background and the word itself are almost of the same color, which ...
Eric O. Lebigot's user avatar
4 votes
1 answer
623 views
What's wrong with "terminal cd ." in vim 8.1?
terminal cd . results in following weird error in the terminal buffer: executing job failed: No such file or directory The same error appears for term_start('cd .'). It doesn't matter which directory ...
dedowsdi's user avatar
• 6,298
3 votes
3 answers
6k views
How to use WSL's bash shell as default terminal of gvim/windows 10?
gvim 8 1-26 / windows 10 I'd like to use Windows Subsystem Linux (WSL)'s bash shell as a gvim's terminal instead of cmd. So if I type in command potion of gvim: :!.\test.sh, it will echo result ...
raring-coffee20's user avatar
44 votes
3 answers
15k views
Can I use a non-monospaced font in either Vim or gVim?
Is there any way to use a non-monospace font in either vim or gvim? I tried changing the font for gVim with: :set guifont=Dejavu\ Serif\ 12 But this gives me some rather ugly results: I get the ...
Martin Tournoij's user avatar
24 votes
3 answers
15k views
Scroll the screen, not the cursor, when using scrollwheel
I'm using Vim in a terminal, so scrolling with the scroll wheel uses the \e[A and \e[B syntax (where \e symbolizes \x1b, or escape). However, Vim interprets this by moving the cursor up or down a ...
Doorknob's user avatar
• 15.4k
15 votes
1 answer
404 views
Using <C-,> causes "<80>ü^D," to flash in the showcmd area?
I've mapped <C-,> as well as some other special keys (<C-Enter>, <C-S-Space>, ...) in my vimrc like, :set <F13>=^[[44;5u :map <F13> <C-,> :map! <F13> <C-...
ivan's user avatar
• 1,470
8 votes
3 answers
15k views
Neovim with split integrated terminal / REPL
Other editors and IDEs, such as VSCode and RStudio, have an integrated console/terminal/REPL with the following characteristics: They open in a split window. The file we’re working on is visible at ...
user137369's user avatar
7 votes
4 answers
7k views
How to clear neovim terminal buffer
I have a terminal buffer with 10000 lines of previously executed output. In order to search for the particular sequence of words I have to go through all 10000 lines before getting to my last executed ...
NikitQa's user avatar
• 161
6 votes
2 answers
5k views
How to set a colorscheme that still shows spelling errors?
How to set a colorscheme that still shows spelling errors? I am looking for two combined effects that I can acquire separately but not yet together. Set Colorscheme alone: OK. If I want highlights ...
nilon's user avatar
• 217
4 votes
1 answer
3k views
How to read the exact command executed by the shell when sent from vim?
Sometimes, when I send a shell command from vim, I receive an error. For example, when I type the following command :!chmod +x shellescape("%"), zsh complains with : zsh:1: unknown sort specifier ...
saginaw's user avatar
• 6,846
4 votes
2 answers
2k views
How to activate bracketed paste mode in GNOME Terminal for Vim inside tmux
Edit this issue happens inside a tmux session. The original value of $TERM before starting vim is: echo $TERM screen The issue appears for example when pasting this kind of indented code: def ...
Paul Rougieux's user avatar
3 votes
1 answer
353 views
Restore working directory in terminal windows when loading session
While using :mksession feature, I found that it works well with files and netrw, but not so much with neovim terminal windows. The problem is that, for terminal, it never preserves working directory ...
Thunderbeef's user avatar
3 votes
1 answer
811 views
Why does terminal vim enter replace mode with my vimrc file? [duplicate]
I mostly use MacVim, but sometimes I'm in the terminal and use the CLI vim. I recently decided to clean up my vimrc file, retaining only what I knew I wanted. It works fine with MacVim, but when I ...
Chuck's user avatar
• 133
2 votes
1 answer
317 views
How can I give a keyboard shortcut (c-tab, c-s-tab) back to the terminal?
I am a long time user of git bash and its included vim and mintty. I updated from an older package including vim 8.1 to one with 8.2, and I have a new problem with just two mintty shortcuts. I haven't ...
Jack's user avatar
• 23
41 votes
5 answers
5k views
Terminal borked after invoking Vim with xargs
I've sometimes tried invoking Vim using xargs, like this: find . -name '*.java' | xargs vim … which kind of works: As Vim launches, I see the following warning flash briefly: Vim: Warning: Input ...
200_success's user avatar
• 9,599
28 votes
3 answers
15k views
Can the split separator in vim be less than a full column wide?
I use a tiling window manager (awesome) + a terminal multiplexer (tmux) + splits inside of vim. I have no window decorations at all, so there is no visual split between them at all if the content of ...
Caleb's user avatar
• 2,245
16 votes
2 answers
11k views
Why doesn't my numpad work right in my terminal?
In several terminal programs, such as PuTTY, SecureCRT, iTerm, and Mac OS Terminal, if I have NumLock on and I press the number pad (numpad) keys 0123456789 in insert mode, my vim looks like this: y ...
Jacktose's user avatar
• 883
14 votes
2 answers
2k views
Detect neovim terminal from bash in bashrc
Does neovim set any environment variables that would let me detect from bash that the terminal is neovim? I want to change the behavior of my .bashrc if neovim is the terminal.
Praxeolitic's user avatar
• 2,488
9 votes
1 answer
938 views
Change the cursor shape in operator pending mode
My cursor in Gvim: My cursor in Gvim after pressing d: Is there any way I can change the cursor in terminal Vim when in operator pending mode? It doesn't have to look exactly like the screenshots. ...
Martin Tournoij's user avatar
8 votes
2 answers
537 views
How to capture errors from make in terminal window
Vim 8.1's release note seems to indicate that you can feed output from make running in a terminal window to a quickfix list, but I couldn't find any detailed explanation. Is there a way to do this ...
Sora Minazuki's user avatar
8 votes
3 answers
2k views
how to change local directory of terminal buffer whenever its shell change directory
After :term ++curwin zsh, I use that buffer as an alternative of tmux window. But there is one caveat, if I cd in zsh, vim will not know. Which cause problem in below case In terminal normal mode, ...
qeatzy's user avatar
• 968
7 votes
3 answers
7k views
How can I change the colorscheme of the vim terminal buffer?
I use GVim with the gruvbox colorscheme. When I open a terminal inside vim with :term, the colors are different, it looks like another colorscheme is applied. The other terminals I use (urxvt and ...
mike23's user avatar
• 290
7 votes
4 answers
7k views
VIM: how to send entire line to a buffer of type "Terminal"?
In Vim 8, you can open a terminal inside Vim with the term command. This opens a new buffer of type terminal inside vim. Is there any way of sending lines from other buffers to this type of buffer? ...
user avatar
6 votes
1 answer
2k views
Pressing Shift-Backspace in insert mode types '^?' instead of backspacing
When I mess up typing an uppercase letter, I usually hold Shift while pressing the Backspace. Instead of backspacing, it types ^? (to my frustration). Google tells me that ^? is the "delete" ...
PoorProgrammer's user avatar
5 votes
1 answer
4k views
How can I map Ctrl-Alt-<letter> mappings in vim?
My keybindings are consistent and work across different operating systems, terminal emulators, browsers, tmux, etc. There are no clashes, but this sometimes means remapping things in some instances. ...
paradroid's user avatar
• 377
5 votes
1 answer
904 views
Understanding :help set-termcap
I would like to define some mappings involving key combinations like <S-F1> or <A-d>. For example something like this: nnoremap <A-d> :echo "hello world!"<cr> However, on my ...
saginaw's user avatar
• 6,846
4 votes
3 answers
76 views
search for sentences that contains a few keywords (that is not in proper order)
Is there script or function for vim to do search of words that is not in proper location (sorry, i don't know how to put it in question) ? Example: This is a vim user who like the functionality which ...
andrew_ysk's user avatar
4 votes
3 answers
737 views
Switching buffers in VI while skipping any terminal in VI 8.1
I am using multiple files within the same tab and when I switch buffers using :bn I reach the terminal, at which point I have to issue the command again to move. Here is the catch, I am using keymaps ...
ArunMKumar's user avatar
3 votes
1 answer
926 views
Opening a terminal window and executing the cd command [duplicate]
In my current vim session, I would like to open a new terminal window and immediately execute the cd command in that terminal to change to a specific directory. I have tried :terminal cd /home/me/...
James Hungerford's user avatar
3 votes
3 answers
181 views
How to map CMD+Alt alone to the command?
I am trying to map Cmd+Alt to start searching in vim (/). The only question is: how would I do this? I know to map Alt in vimscript is by typing <A> but I do not know how to do Cmd. I also want ...
iProgram's user avatar
• 1,599
3 votes
3 answers
916 views
Apply terminal colors in gui?
I am on neovim with Oni. vim-netranger plugin uses terminal colors in this format to highlight things. It does work in terminal with neovim , but not in a gui app. I am looking for a way to replace ...
eyal karni's user avatar
• 1,146
3 votes
1 answer
438 views
Why has vim started launching the ilist on FocusGained?
Recently, on Debian Sid (accessed via SSH from an ArchLinux machine using Terminator), something has started triggering the [I / :ilist function whenever vim gains focus. If I start vim without ...
Dan's user avatar
• 131
3 votes
1 answer
2k views
Vim 8 terminal change width
Suppose I run :terminal someprg_wide_output the output is wrapped by current terminal window size wrapped hard way, so :set nowrap there can't help When I run same program not from vim like this: ...
Tag Wint's user avatar
• 213
3 votes
2 answers
739 views
Is there an upgraded version of the Conque plugin?
My searches for plugins which enable a terminal inside a Vim windows indicate that the main one is Conque, but the last update was 6 years ago. Are there some other better updated forks which are seen ...
vfclists's user avatar
• 897
3 votes
2 answers
3k views
How can Vim be configured to restore normal terminal color on exit?
I have set Vim's default colorscheme to Monokai, and when I exit Vim the Monokai colors are still on the screen until I clear it. How can Vim be set to run clear automatically on exit, or change the ...
vfclists's user avatar
• 897
2 votes
1 answer
2k views
Vim does not react to Ctrl key combinations on alacritty
I have been a happy termite user for years, but that project was abandoned recently and superseded by alacritty. The problem is that a Vim session launched in alacritty ignores key combinations with ...
Luís de Sousa's user avatar
2 votes
1 answer
1k views
How to move the cursor out of the terminal
I'm now using Vim 8 and its new feature: :term. Well, it's great but I don't know how to move the cursor out of the terminal without the mouse. In Vim 7, we can type <C-w><C-h>, <C-w&...
Yves's user avatar
• 1,023
2 votes
1 answer
611 views
Suppress system broadcasts/messages
Is it possible to suppress messages in vim that are coming from the system or shell? E.g. message from sysadmin or batch queue messages when jobs complete. Note that I want to specify this at the vim ...
JohnE's user avatar
• 131
1 vote
0 answers
276 views
How to clear pieces of other windows/popups stuck to screen
I'm running 8.1.2269 in a terminal on Ubuntu 20.04 (with Regolith). What sometimes happens, is pieces from other windows, sometimes popups get stuck on the screen. What I mean by this is for example ...
fbence's user avatar
• 707
1 vote
1 answer
2k views
solarized in xterm256(terminal.app) has wrong background
I using solarized in both terminal.app and vim, but in vim the background, airline and other things are not the color scheme's appearance which is different with MacVim. So how to deal with it? I ...
Vonfry's user avatar
• 195
1 vote
1 answer
945 views
Hide terminal buffer from buffer list
How do I keep the terminal buffer from showing up in my airline list of buffers? I assume airline just pulls buffers from what normally shows up in :ls. But I actually don't want the terminal to show ...
Josh Lawrence's user avatar
|
{
"url": "https://vi.stackexchange.com/questions/tagged/terminal?tab=Frequent",
"source_domain": "vi.stackexchange.com",
"snapshot_id": "CC-MAIN-2024-30",
"warc_metadata": {
"Content-Length": "334108",
"Content-Type": "application/http; msgtype=response",
"WARC-Block-Digest": "sha1:QYJRUTQC2B7QX2XSYXGSOY6OB3VON7TK",
"WARC-Concurrent-To": "<urn:uuid:277fb9de-eab7-4b5c-ba4f-463fd7d0392a>",
"WARC-Date": "2024-07-24T21:12:40Z",
"WARC-IP-Address": "172.64.144.30",
"WARC-Identified-Payload-Type": "text/html",
"WARC-Payload-Digest": "sha1:5BWXCRTHXMYNLQDFBYOZVJNVERFR2O7W",
"WARC-Record-ID": "<urn:uuid:f98f9a81-02a4-4c32-bef6-ddcc229fa01b>",
"WARC-Target-URI": "https://vi.stackexchange.com/questions/tagged/terminal?tab=Frequent",
"WARC-Truncated": null,
"WARC-Type": "response",
"WARC-Warcinfo-ID": "<urn:uuid:7215c05d-9823-4d67-b080-4dae0589e793>"
},
"warc_info": "isPartOf: CC-MAIN-2024-30\r\npublisher: Common Crawl\r\ndescription: Wide crawl of the web for July 2024\r\noperator: Common Crawl Admin (info@commoncrawl.org)\r\nhostname: ip-10-67-67-28\r\nsoftware: Apache Nutch 1.20 (modified, https://github.com/commoncrawl/nutch/)\r\nrobots: checked via crawler-commons 1.5-SNAPSHOT (https://github.com/crawler-commons/crawler-commons)\r\nformat: WARC File Format 1.1\r\nconformsTo: https://iipc.github.io/warc-specifications/specifications/warc-format/warc-1.1/"
}
|
{
"line_start_idx": [
0,
21,
81,
82,
110,
111,
268,
269,
279,
289,
301,
310,
320,
330,
331,
351,
352,
540,
561,
571,
580,
590,
599,
600,
629,
630,
792,
815,
825,
834,
844,
853,
854,
901,
902,
1101,
1122,
1132,
1140,
1149,
1158,
1159,
1237,
1238,
1394,
1415,
1423,
1432,
1442,
1452,
1453,
1500,
1501,
1699,
1724,
1734,
1743,
1752,
1761,
1762,
1799,
1800,
1989,
2011,
2019,
2028,
2038,
2047,
2048,
2095,
2096,
2298,
2322,
2332,
2341,
2350,
2360,
2361,
2422,
2423,
2623,
2644,
2654,
2662,
2671,
2681,
2682,
2754,
2755,
2959,
2984,
2994,
3002,
3011,
3020,
3021,
3096,
3097,
3297,
3327,
3335,
3344,
3354,
3355,
3401,
3402,
3606,
3629,
3639,
3647,
3657,
3666,
3667,
3735,
3736,
3934,
3964,
3973,
3983,
3993,
3994,
4049,
4050,
4248,
4278,
4287,
4297,
4307,
4308,
4366,
4367,
4567,
4590,
4600,
4609,
4618,
4628,
4629,
4689,
4690,
4847,
4866,
4876,
4884,
4894,
4904,
4905,
4950,
4951,
5153,
5178,
5186,
5196,
5205,
5206,
5242,
5243,
5448,
5470,
5478,
5486,
5496,
5505,
5506,
5565,
5566,
5767,
5787,
5795,
5803,
5812,
5821,
5822,
5894,
5895,
6095,
6117,
6127,
6135,
6145,
6154,
6155,
6230,
6231,
6427,
6455,
6463,
6472,
6482,
6483,
6550,
6551,
6754,
6780,
6788,
6797,
6807,
6808,
6881,
6882,
7083,
7103,
7111,
7119,
7128,
7138,
7139,
7213,
7214,
7419,
7438,
7445,
7454,
7464,
7473,
7474,
7520,
7521,
7720,
7746,
7756,
7765,
7775,
7785,
7786,
7850,
7851,
8054,
8074,
8084,
8093,
8103,
8113,
8114,
8163,
8164,
8367,
8390,
8398,
8407,
8417,
8426,
8427,
8470,
8471,
8648,
8674,
8684,
8692,
8701,
8711,
8712,
8761,
8762,
8963,
8993,
9001,
9011,
9021,
9022,
9073,
9074,
9275,
9303,
9311,
9321,
9330,
9331,
9416,
9417,
9618,
9639,
9647,
9655,
9665,
9674,
9675,
9736,
9737,
9937,
9958,
9966,
9974,
9984,
9993,
9994,
10055,
10056,
10258,
10270,
10278,
10287,
10296,
10297,
10371,
10372,
10567,
10596,
10604,
10613,
10622,
10623,
10672,
10673,
10876,
10900,
10908,
10916,
10925,
10935,
10936,
10968,
10969,
11147,
11169,
11179,
11187,
11197,
11206,
11207,
11287,
11288,
11492,
11517,
11525,
11535,
11545,
11546,
11608,
11609,
11813,
11838,
11846,
11855,
11865,
11866,
11933,
11934,
12134,
12165,
12173,
12183,
12193,
12194,
12235,
12236,
12434,
12457,
12467,
12475,
12485,
12495,
12496,
12526,
12527,
12729,
12754,
12764,
12772,
12781,
12791,
12792,
12848,
12849,
13047,
13065,
13073,
13081,
13090,
13099,
13100,
13128,
13129,
13329,
13352,
13360,
13368,
13378,
13388,
13389,
13440,
13441,
13646,
13669,
13677,
13685,
13695,
13704,
13705,
13773,
13774,
13977,
14000,
14008,
14016,
14025,
14034,
14035,
14092,
14093,
14296,
14324,
14332,
14341,
14350,
14351,
14394,
14395,
14582,
14601,
14611,
14619,
14628,
14638,
14639,
14675,
14676,
14880,
14900,
14908,
14915,
14925,
14935,
14936,
14996,
14997,
15200,
15221,
15229,
15236,
15245,
15254,
15255,
15312,
15313,
15513,
15534,
15542,
15549,
15558,
15568,
15569,
15607,
15608,
15812
],
"line_end_idx": [
21,
81,
82,
110,
111,
268,
269,
279,
289,
301,
310,
320,
330,
331,
351,
352,
540,
561,
571,
580,
590,
599,
600,
629,
630,
792,
815,
825,
834,
844,
853,
854,
901,
902,
1101,
1122,
1132,
1140,
1149,
1158,
1159,
1237,
1238,
1394,
1415,
1423,
1432,
1442,
1452,
1453,
1500,
1501,
1699,
1724,
1734,
1743,
1752,
1761,
1762,
1799,
1800,
1989,
2011,
2019,
2028,
2038,
2047,
2048,
2095,
2096,
2298,
2322,
2332,
2341,
2350,
2360,
2361,
2422,
2423,
2623,
2644,
2654,
2662,
2671,
2681,
2682,
2754,
2755,
2959,
2984,
2994,
3002,
3011,
3020,
3021,
3096,
3097,
3297,
3327,
3335,
3344,
3354,
3355,
3401,
3402,
3606,
3629,
3639,
3647,
3657,
3666,
3667,
3735,
3736,
3934,
3964,
3973,
3983,
3993,
3994,
4049,
4050,
4248,
4278,
4287,
4297,
4307,
4308,
4366,
4367,
4567,
4590,
4600,
4609,
4618,
4628,
4629,
4689,
4690,
4847,
4866,
4876,
4884,
4894,
4904,
4905,
4950,
4951,
5153,
5178,
5186,
5196,
5205,
5206,
5242,
5243,
5448,
5470,
5478,
5486,
5496,
5505,
5506,
5565,
5566,
5767,
5787,
5795,
5803,
5812,
5821,
5822,
5894,
5895,
6095,
6117,
6127,
6135,
6145,
6154,
6155,
6230,
6231,
6427,
6455,
6463,
6472,
6482,
6483,
6550,
6551,
6754,
6780,
6788,
6797,
6807,
6808,
6881,
6882,
7083,
7103,
7111,
7119,
7128,
7138,
7139,
7213,
7214,
7419,
7438,
7445,
7454,
7464,
7473,
7474,
7520,
7521,
7720,
7746,
7756,
7765,
7775,
7785,
7786,
7850,
7851,
8054,
8074,
8084,
8093,
8103,
8113,
8114,
8163,
8164,
8367,
8390,
8398,
8407,
8417,
8426,
8427,
8470,
8471,
8648,
8674,
8684,
8692,
8701,
8711,
8712,
8761,
8762,
8963,
8993,
9001,
9011,
9021,
9022,
9073,
9074,
9275,
9303,
9311,
9321,
9330,
9331,
9416,
9417,
9618,
9639,
9647,
9655,
9665,
9674,
9675,
9736,
9737,
9937,
9958,
9966,
9974,
9984,
9993,
9994,
10055,
10056,
10258,
10270,
10278,
10287,
10296,
10297,
10371,
10372,
10567,
10596,
10604,
10613,
10622,
10623,
10672,
10673,
10876,
10900,
10908,
10916,
10925,
10935,
10936,
10968,
10969,
11147,
11169,
11179,
11187,
11197,
11206,
11207,
11287,
11288,
11492,
11517,
11525,
11535,
11545,
11546,
11608,
11609,
11813,
11838,
11846,
11855,
11865,
11866,
11933,
11934,
12134,
12165,
12173,
12183,
12193,
12194,
12235,
12236,
12434,
12457,
12467,
12475,
12485,
12495,
12496,
12526,
12527,
12729,
12754,
12764,
12772,
12781,
12791,
12792,
12848,
12849,
13047,
13065,
13073,
13081,
13090,
13099,
13100,
13128,
13129,
13329,
13352,
13360,
13368,
13378,
13388,
13389,
13440,
13441,
13646,
13669,
13677,
13685,
13695,
13704,
13705,
13773,
13774,
13977,
14000,
14008,
14016,
14025,
14034,
14035,
14092,
14093,
14296,
14324,
14332,
14341,
14350,
14351,
14394,
14395,
14582,
14601,
14611,
14619,
14628,
14638,
14639,
14675,
14676,
14880,
14900,
14908,
14915,
14925,
14935,
14936,
14996,
14997,
15200,
15221,
15229,
15236,
15245,
15254,
15255,
15312,
15313,
15513,
15534,
15542,
15549,
15558,
15568,
15569,
15607,
15608,
15812,
15839
]
}
|
{
"red_pajama_v2": {
"ccnet_original_length": 15839,
"ccnet_original_nlines": 444,
"rps_doc_curly_bracket": 0.0005050799809396267,
"rps_doc_ldnoobw_words": 0,
"rps_doc_lorem_ipsum": 0,
"rps_doc_stop_word_fraction": 0.31130483746528625,
"rps_doc_ut1_blacklist": 0,
"rps_doc_frac_all_caps_words": 0.04527559131383896,
"rps_doc_frac_lines_end_with_ellipsis": 0.11011236160993576,
"rps_doc_frac_no_alph_words": 0.238470196723938,
"rps_doc_frac_unique_words": 0.2971118986606598,
"rps_doc_mean_word_length": 4.34837532043457,
"rps_doc_num_sentences": 179,
"rps_doc_symbol_to_word_ratio": 0.014341959729790688,
"rps_doc_unigram_entropy": 5.721982002258301,
"rps_doc_word_count": 2770,
"rps_doc_frac_chars_dupe_10grams": 0.007970109581947327,
"rps_doc_frac_chars_dupe_5grams": 0.07106682658195496,
"rps_doc_frac_chars_dupe_6grams": 0.04308842122554779,
"rps_doc_frac_chars_dupe_7grams": 0.018430879339575768,
"rps_doc_frac_chars_dupe_8grams": 0.01361561007797718,
"rps_doc_frac_chars_dupe_9grams": 0.01361561007797718,
"rps_doc_frac_chars_top_2gram": 0.04151099920272827,
"rps_doc_frac_chars_top_3gram": 0.031963471323251724,
"rps_doc_frac_chars_top_4gram": 0.006973850075155497,
"rps_doc_books_importance": -1416.1602783203125,
"rps_doc_books_importance_length_correction": -1416.1602783203125,
"rps_doc_openwebtext_importance": -826.1715698242188,
"rps_doc_openwebtext_importance_length_correction": -826.1715698242188,
"rps_doc_wikipedia_importance": -611.6826171875,
"rps_doc_wikipedia_importance_length_correction": -611.6826171875
},
"fasttext": {
"dclm": 0.08473724126815796,
"english": 0.8859792351722717,
"fineweb_edu_approx": 1.3844221830368042,
"eai_general_math": 0.2830291986465454,
"eai_open_web_math": 0.2467295527458191,
"eai_web_code": 0.06644690036773682
}
}
|
{
"free_decimal_correspondence": {
"primary": {
"code": "005.435",
"labels": {
"level_1": "General works, books and libraries, information sciences",
"level_2": "",
"level_3": "Computer programming"
}
},
"secondary": {
"code": "005.462",
"labels": {
"level_1": "General works, books and libraries, information sciences",
"level_2": "",
"level_3": "Computer programming"
}
}
},
"bloom_cognitive_process": {
"primary": {
"code": "3",
"label": "Apply"
},
"secondary": {
"code": "4",
"label": "Analyze"
}
},
"bloom_knowledge_domain": {
"primary": {
"code": "3",
"label": "Procedural"
},
"secondary": {
"code": "2",
"label": "Conceptual"
}
},
"document_type_v1": {
"primary": {
"code": "5",
"label": "Social/Forum"
},
"secondary": {
"code": "-1",
"label": "Abstain"
}
},
"extraction_artifacts": {
"primary": {
"code": "3",
"label": "Irrelevant Content"
},
"secondary": {
"code": "0",
"label": "No Artifacts"
}
},
"missing_content": {
"primary": {
"code": "0",
"label": "No missing content"
},
"secondary": {
"code": "-1",
"label": "Abstain"
}
},
"document_type_v2": {
"primary": {
"code": "18",
"label": "Q&A Forum"
},
"secondary": {
"code": "8",
"label": "Documentation"
}
},
"reasoning_depth": {
"primary": {
"code": "3",
"label": "Intermediate Reasoning"
},
"secondary": {
"code": "2",
"label": "Basic Reasoning"
}
},
"technical_correctness": {
"primary": {
"code": "4",
"label": "Highly Correct"
},
"secondary": {
"code": "3",
"label": "Mostly Correct"
}
},
"education_level": {
"primary": {
"code": "3",
"label": "Undergraduate Level"
},
"secondary": {
"code": "2",
"label": "High School Level"
}
}
}
|
672f1e42c33a7f9846924a2431ea77df
|
2,028,249,998,608,687,600
|
XM Magdalena 3D print, GGeorgy (3D)
LC #42 Pipers Alley
View Full Version : Is it possible to execute nested commands?
Geuse
11-10-2011, 01:56 AM
Like this for instance?
string $jnt[] = `ls -long `joint` `;
then I'd know $jnt[0] is my joint
instead of writing this
joint -n "jnt_0#";
string $sel[] = `ls -long -sl`;
string $jnt = $sel[0];
Thanks and god night!
dah. Once I figured out to call it nested commands when writing this post I found it =P
ex:
print (size(ls("-selection")));
On second thought, I don't fully grasp it though.
How would you add another attribute in there?
for instance:
print (size(ls("-selection -long")));
Obviously this throws an error. :hmm:
WesHowe
11-10-2011, 05:19 AM
An individual MEL command (in your example, 'ls') that has to have parameters to be processed needs to be bounded by back-ticks (the key left of the digit 1) in order to all be interpreted as one command.
Here is a working version of what you were trying to do:
print (size(`ls -selection -long`));
Note that instead of parentheses, the whole of ls -selection -long is grouped together between back-ticks, so the interpreter knows to take all that and process it as one expression, feed that to size() and then feed the result of that to print().
<* Wes *>
zoharl
11-10-2011, 06:51 AM
Use python, it makes more sense, and has infinite more features. If you'll miss mel you could always call it using the mel package inside python.
NaughtyNathan
11-10-2011, 12:56 PM
functions in MEL can be (and still often are) called using the more traditional coding style:
string $array[] = ls("-selection", "-long", "-r", 1);
so to make your example slightly more pythonic and uniform (forego the `backticks` completely):
print(size(ls("-selection","-long")));gets a little harsh on the eyes though...
:nathaN
Geuse
11-10-2011, 07:17 PM
Thanks alot guys!
Yeah, I have big plans to start using python instead. Or really....in addition and delving into plugins scripting.
I just tried some basic, but since I'm still so far fluent with mel, jumping to python without learning the basics of object oriented programming seems the wrong way to go? like using python to write mel? Sure you'd have easier to learn the syntax, but I got the hang of that so in due time I will make the big leap over to python. Waiting for a copy of the new maya python book as of writing this.
Thanks guys!
zoharl
11-10-2011, 07:57 PM
Listen, you don't have to use python OOP, nor its other functionalities. Each mel line correspond to each python line, and if you do a little exercise and write your code in python, you'll see there's not much difference and it makes much more sense. You can use python's hints or a one hour crash course:
http://www.chadvernon.com/blog/resources/python-scripting-for-maya-artists/
http://rgruet.free.fr/PQR26/PQR2.6.html
No offense, but you doesn't sound like a mel expert, so the transition shouldn't be that hard. Just learn the new stuff in python instead of mel.
Geuse
11-10-2011, 08:26 PM
I just haven't done things this way :O and have a hard time understanding how to connect it properly.
MEL in itself is not that hard. Seems I know enough to move to the next step, but stuff like this that seems to be very basic things you learn as a programmer is not something I've ever come across before.
string $sel[] = ls ("-sl","-long") polyCube ("-w", 100, "-h", 100, "-d", 100);
Was messing with parentheses, but can't seem to get it right =/
Thanks for being there!
NaughtyNathan
11-10-2011, 11:17 PM
I'm not sure what you are trying to do in that last code example, but this nesting is very easy to understand and get a grip on. the clue is in the name "nesting", Your last example has neither command inside the parameter braces/parenthesis of the other, so there isn't any nesting happening...
Just remember that every function has it's own parameters and ALL it's parameters have to go inside it's own SINGLE set of parenthesis:
function(ALL, params, go, inside, these, braces) // this is the basic principle, ONE command, ONE set of braces
// examples:
print("some text")
ls("-sl", "-l")
mag($V)
hideAllLights() // this one HAS NO parameters, but it still has it's own pair of braces.
Notice how there is always one command, and only one pair of braces, one right at the start or it's own params, one right at the end of it's parameter list. If it helps, don't put a space between the function and the open brace. You never have more (or less) than one set of braces per command. Of course there may be other braces anywhere inside a commands parameters, but these are part of the parameters, and not related to the functions braces e.g.:
ls("-type", "nurbsCurve", "-tail", 3, ("edgeAlign"+$i) );
When you nest these commands inside each other, all you are doing is using a command(braces) combo as one parameter inside another command. lets colour code them to make it easier to see:
string $allMeshes[] = ls("-type","mesh");
string $parentTransforms[] = listRelatives("-parent", $allMeshes);
// and in nested format:
string $parentTransforms[] = listRelatives("-parent", ls("-type","mesh") )
If it helps, simply write out each individual command on it's own line, then copy/paste it wholesale into the appropriate place in the other command. e.g.
ls("-selection", "-long") // get the selection
size( input ) // get the size of the selection
print( input ) // print it all out
size( ls("-selection", "-long") ) // step 1
print( size( ls("-selection", "-long") ) ) // step 2
I hope that makes sense and I've not just complicated it!! :D
:nathaN
Geuse
11-11-2011, 09:52 AM
Yes, make total sense!
string $sel[] = ls("-sl", "-long", (polyCube("-w", "100", "-h", "100", "-d", "100", "-n", "sphere") ) )
string $sphere = $sel[0];
Thanks alot! Now I get it
CGTalk Moderation
11-11-2011, 09:52 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.
1
|
{
"url": "http://forums.cgsociety.org/archive/index.php?t-1018386.html",
"source_domain": "forums.cgsociety.org",
"snapshot_id": "crawl=CC-MAIN-2015-48",
"warc_metadata": {
"Content-Length": "29388",
"Content-Type": "application/http; msgtype=response",
"WARC-Block-Digest": "sha1:TAXNKAFBNHYKL2CUUNUW67MNSY34HVDH",
"WARC-Concurrent-To": "<urn:uuid:8f4bb917-a50c-405b-bdcd-6a65564e950f>",
"WARC-Date": "2015-11-30T22:33:40Z",
"WARC-IP-Address": "54.88.254.247",
"WARC-Identified-Payload-Type": null,
"WARC-Payload-Digest": "sha1:Q5TJSB36NZ7BIQTXBC4ZO2ZYGCLAPYXA",
"WARC-Record-ID": "<urn:uuid:064dc092-16c6-4c23-a9cc-813437d43a06>",
"WARC-Target-URI": "http://forums.cgsociety.org/archive/index.php?t-1018386.html",
"WARC-Truncated": "length",
"WARC-Type": "response",
"WARC-Warcinfo-ID": "<urn:uuid:e5e8ff72-ebcf-4119-832f-0be4b4cd6c3e>"
},
"warc_info": "robots: classic\r\nhostname: ip-10-71-132-137.ec2.internal\r\nsoftware: Nutch 1.6 (CC)/CC WarcExport 1.0\r\nisPartOf: CC-MAIN-2015-48\r\noperator: CommonCrawl Admin\r\ndescription: Wide crawl of the web for Nov 2015\r\npublisher: CommonCrawl\r\nformat: WARC File Format 1.0\r\nconformsTo: http://bibnum.bnf.fr/WARC/WARC_ISO_28500_version1_latestdraft.pdf"
}
|
{
"line_start_idx": [
0,
36,
56,
57,
58,
121,
122,
123,
129,
150,
174,
211,
245,
246,
270,
271,
290,
322,
345,
346,
368,
369,
457,
458,
462,
494,
495,
496,
546,
547,
593,
607,
645,
646,
684,
685,
693,
714,
919,
920,
977,
1014,
1262,
1263,
1273,
1274,
1281,
1302,
1448,
1449,
1463,
1484,
1578,
1632,
1728,
1808,
1816,
1817,
1823,
1844,
1862,
1977,
2376,
2377,
2390,
2391,
2398,
2419,
2725,
2726,
2802,
2842,
2843,
2989,
2990,
2996,
3017,
3119,
3120,
3326,
3327,
3406,
3407,
3471,
3472,
3496,
3497,
3511,
3532,
3828,
3964,
4076,
4089,
4108,
4124,
4132,
4221,
4675,
4733,
4921,
4963,
5030,
5055,
5130,
5285,
5332,
5379,
5414,
5415,
5459,
5512,
5574,
5582,
5583,
5589,
5610,
5633,
5634,
5738,
5739,
5765,
5766,
5792,
5793,
5811,
5832,
6006,
6007,
6008
],
"line_end_idx": [
36,
56,
57,
58,
121,
122,
123,
129,
150,
174,
211,
245,
246,
270,
271,
290,
322,
345,
346,
368,
369,
457,
458,
462,
494,
495,
496,
546,
547,
593,
607,
645,
646,
684,
685,
693,
714,
919,
920,
977,
1014,
1262,
1263,
1273,
1274,
1281,
1302,
1448,
1449,
1463,
1484,
1578,
1632,
1728,
1808,
1816,
1817,
1823,
1844,
1862,
1977,
2376,
2377,
2390,
2391,
2398,
2419,
2725,
2726,
2802,
2842,
2843,
2989,
2990,
2996,
3017,
3119,
3120,
3326,
3327,
3406,
3407,
3471,
3472,
3496,
3497,
3511,
3532,
3828,
3964,
4076,
4089,
4108,
4124,
4132,
4221,
4675,
4733,
4921,
4963,
5030,
5055,
5130,
5285,
5332,
5379,
5414,
5415,
5459,
5512,
5574,
5582,
5583,
5589,
5610,
5633,
5634,
5738,
5739,
5765,
5766,
5792,
5793,
5811,
5832,
6006,
6007,
6008,
6009
]
}
|
{
"red_pajama_v2": {
"ccnet_original_length": 6009,
"ccnet_original_nlines": 128,
"rps_doc_curly_bracket": 0,
"rps_doc_ldnoobw_words": 0,
"rps_doc_lorem_ipsum": 0,
"rps_doc_stop_word_fraction": 0.3378746509552002,
"rps_doc_ut1_blacklist": 0,
"rps_doc_frac_all_caps_words": 0.03201635181903839,
"rps_doc_frac_lines_end_with_ellipsis": 0.015503879636526108,
"rps_doc_frac_no_alph_words": 0.3140327036380768,
"rps_doc_frac_unique_words": 0.41225337982177734,
"rps_doc_mean_word_length": 4.590861797332764,
"rps_doc_num_sentences": 53,
"rps_doc_symbol_to_word_ratio": 0.0034059900790452957,
"rps_doc_unigram_entropy": 5.474973201751709,
"rps_doc_word_count": 963,
"rps_doc_frac_chars_dupe_10grams": 0,
"rps_doc_frac_chars_dupe_5grams": 0.004976250231266022,
"rps_doc_frac_chars_dupe_6grams": 0,
"rps_doc_frac_chars_dupe_7grams": 0,
"rps_doc_frac_chars_dupe_8grams": 0,
"rps_doc_frac_chars_dupe_9grams": 0,
"rps_doc_frac_chars_top_2gram": 0.005654830019921064,
"rps_doc_frac_chars_top_3gram": 0.005881019867956638,
"rps_doc_frac_chars_top_4gram": 0.0036190899554640055,
"rps_doc_books_importance": -594.3292236328125,
"rps_doc_books_importance_length_correction": -594.3292236328125,
"rps_doc_openwebtext_importance": -335.05316162109375,
"rps_doc_openwebtext_importance_length_correction": -335.05316162109375,
"rps_doc_wikipedia_importance": -249.08998107910156,
"rps_doc_wikipedia_importance_length_correction": -249.08998107910156
},
"fasttext": {
"dclm": 0.28780466318130493,
"english": 0.8881797194480896,
"fineweb_edu_approx": 1.9336787462234497,
"eai_general_math": 0.912716805934906,
"eai_open_web_math": 0.36148929595947266,
"eai_web_code": 0.6931560635566711
}
}
|
{
"free_decimal_correspondence": {
"primary": {
"code": "005.133",
"labels": {
"level_1": "General works, books and libraries, information sciences",
"level_2": "",
"level_3": "Computer programming"
}
},
"secondary": {
"code": "741.5",
"labels": {
"level_1": "Arts",
"level_2": "Drawing, Decoration and ornament, and Design",
"level_3": "Drawing — Technique and Caricatures and cartoons"
}
}
},
"bloom_cognitive_process": {
"primary": {
"code": "3",
"label": "Apply"
},
"secondary": {
"code": "2",
"label": "Understand"
}
},
"bloom_knowledge_domain": {
"primary": {
"code": "3",
"label": "Procedural"
},
"secondary": {
"code": "2",
"label": "Conceptual"
}
},
"document_type_v1": {
"primary": {
"code": "5",
"label": "Social/Forum"
},
"secondary": {
"code": "4",
"label": "Code/Software"
}
},
"extraction_artifacts": {
"primary": {
"code": "0",
"label": "No Artifacts"
},
"secondary": {
"code": "3",
"label": "Irrelevant Content"
}
},
"missing_content": {
"primary": {
"code": "0",
"label": "No missing content"
},
"secondary": {
"code": "-1",
"label": "Abstain"
}
},
"document_type_v2": {
"primary": {
"code": "18",
"label": "Q&A Forum"
},
"secondary": {
"code": "8",
"label": "Documentation"
}
},
"reasoning_depth": {
"primary": {
"code": "3",
"label": "Intermediate Reasoning"
},
"secondary": {
"code": "2",
"label": "Basic Reasoning"
}
},
"technical_correctness": {
"primary": {
"code": "4",
"label": "Highly Correct"
},
"secondary": {
"code": "3",
"label": "Mostly Correct"
}
},
"education_level": {
"primary": {
"code": "3",
"label": "Undergraduate Level"
},
"secondary": {
"code": "2",
"label": "High School Level"
}
}
}
|
672f1e42c33a7f9846924a2431ea77df
|
-6,960,280,083,078,527,000
|
TCPASTE(7)
TCPASTE(7)
Tcpaste Manual
NAME
tcpaste - a TCP pastebin
SYNOPSIS
netcat tcpst.net 7777
telnet tcpst.net 7777
DESCRIPTION
This manual page describes the tcpaste interface. Tcpaste is a pastebin that doesn't make use of any application layer protocol. The result is provided in a simple format designed to be easily readable by humans, and easily parsable by programs. As such, any TCP-capable system can use this service without having to implement tons of boilerplate for HTTP or other protocol.
Tcpaste abandons the request-response model, because the only way to signal the end of request in TCP, is to close the connection. Instead, upon opening a connection, you will be immediately given a paste URL, and only then the paste data will be received and recorded. The end of the paste is signaled by closing the connection.
RETURN VALUE
The data tcpaste sends, consists of one or more LF-separated lines, containing a key, followed by a space and a value. As of now, the following keys are defined:
URL - the paste URL.
ADMIN - the URL of an administration page for the paste.
ERROR - an exceptional situation has occured.
EXAMPLES
Bash:
Simple netcat usage:
netcat tcpst.net 7777
command | netcat -q 1 tcpst.net 7777
Only obtain the paste URL (ignoring errors):
command | netcat -q 1 tcpst.net 7777 | grep URL | cut -d ' ' -f 2
Python:
import socket
sock = socket.create_connection(("tcpst.net", 7777))
sock.sendall(data)
sock.settimeout(1)
reply = b""
while True:
try:
reply += sock.recv(4096)
except:
break
url = {key: value for key, value in [line.split(b" ") for line in reply.split(b"\n") if line]}[b"URL"]
Lua:
local socket = require"socket"
sock = socket.connect("tcpst.net", 7777)
local i = 1
while i <= #data do
i = 1 + sock.send(data, i)
end
sock.settimeout(1)
local reply = sock.receive"*a"
local url
for key, value in reply:gmatch"(%S+) ([^\n]*)\n" do
if key == "URL" then
url = value
end
end
SSL
You can also use tcpaste over SSL using the port 8777. URL and ADMIN parameters automatically become HTTPS links.
PASTE REMOVAL
Upon pasting, you will receive a URL for administering the paste. Anyone who has the admin URL can delete the paste. Pastes also expire, and the expiration period is configurable via the admin URL.
For pastes violating various laws, including intellectual property laws, please contact the author (see below). Due to the public availability of the service, the host of tcpaste should not be held responsible for any submitted content.
DONATE
184wPiepHA1hSdK3QuowSXMg17B8pKX7hY
AUTHOR
mniip. My email can be found in the SOA record for the domain.
1.2.0
TCPASTE(7)
2017-01-21
|
{
"url": "http://tcpst.net/",
"source_domain": "tcpst.net",
"snapshot_id": "crawl=CC-MAIN-2017-09",
"warc_metadata": {
"Content-Length": "5377",
"Content-Type": "application/http; msgtype=response",
"WARC-Block-Digest": "sha1:WTTX26YMKXPRLTA53VDBMKQQGIG5SZTV",
"WARC-Concurrent-To": "<urn:uuid:db0b9382-f1a4-4780-b53a-814b497e316d>",
"WARC-Date": "2017-02-22T15:09:46Z",
"WARC-IP-Address": "81.4.105.153",
"WARC-Identified-Payload-Type": null,
"WARC-Payload-Digest": "sha1:WQU2P6KQLXV73OU4YNUGS54UNPTHX46R",
"WARC-Record-ID": "<urn:uuid:6ac107e5-84c7-4d75-aa09-3a85d0c3507c>",
"WARC-Target-URI": "http://tcpst.net/",
"WARC-Truncated": null,
"WARC-Type": "response",
"WARC-Warcinfo-ID": "<urn:uuid:b7498019-529a-49c0-8001-695a36b0d521>"
},
"warc_info": "robots: classic\r\nhostname: ip-10-171-10-108.ec2.internal\r\nsoftware: Nutch 1.6 (CC)/CC WarcExport 1.0\r\nisPartOf: CC-MAIN-2017-09\r\noperator: CommonCrawl Admin\r\ndescription: Wide crawl of the web for February 2017\r\npublisher: CommonCrawl\r\nformat: WARC File Format 1.0\r\nconformsTo: http://bibnum.bnf.fr/WARC/WARC_ISO_28500_version1_latestdraft.pdf"
}
|
{
"line_start_idx": [
0,
11,
22,
23,
38,
39,
44,
45,
70,
71,
80,
81,
103,
125,
126,
138,
139,
514,
515,
845,
846,
859,
860,
1022,
1043,
1100,
1146,
1147,
1156,
1157,
1163,
1164,
1185,
1207,
1244,
1289,
1355,
1356,
1364,
1365,
1379,
1432,
1451,
1470,
1482,
1494,
1501,
1530,
1540,
1550,
1653,
1654,
1659,
1660,
1691,
1732,
1744,
1764,
1793,
1797,
1816,
1847,
1857,
1909,
1932,
1948,
1954,
1958,
1959,
1963,
1964,
2078,
2079,
2093,
2094,
2292,
2293,
2530,
2531,
2538,
2539,
2574,
2575,
2582,
2583,
2646,
2647,
2653,
2664,
2665
],
"line_end_idx": [
11,
22,
23,
38,
39,
44,
45,
70,
71,
80,
81,
103,
125,
126,
138,
139,
514,
515,
845,
846,
859,
860,
1022,
1043,
1100,
1146,
1147,
1156,
1157,
1163,
1164,
1185,
1207,
1244,
1289,
1355,
1356,
1364,
1365,
1379,
1432,
1451,
1470,
1482,
1494,
1501,
1530,
1540,
1550,
1653,
1654,
1659,
1660,
1691,
1732,
1744,
1764,
1793,
1797,
1816,
1847,
1857,
1909,
1932,
1948,
1954,
1958,
1959,
1963,
1964,
2078,
2079,
2093,
2094,
2292,
2293,
2530,
2531,
2538,
2539,
2574,
2575,
2582,
2583,
2646,
2647,
2653,
2664,
2665,
2675
]
}
|
{
"red_pajama_v2": {
"ccnet_original_length": 2675,
"ccnet_original_nlines": 89,
"rps_doc_curly_bracket": 0.0007476600003428757,
"rps_doc_ldnoobw_words": 0,
"rps_doc_lorem_ipsum": 0,
"rps_doc_stop_word_fraction": 0.28020134568214417,
"rps_doc_ut1_blacklist": 0,
"rps_doc_frac_all_caps_words": 0.06375838816165924,
"rps_doc_frac_lines_end_with_ellipsis": 0,
"rps_doc_frac_no_alph_words": 0.2936241626739502,
"rps_doc_frac_unique_words": 0.5211970210075378,
"rps_doc_mean_word_length": 5.042394161224365,
"rps_doc_num_sentences": 40,
"rps_doc_symbol_to_word_ratio": 0.001677850028499961,
"rps_doc_unigram_entropy": 4.921798229217529,
"rps_doc_word_count": 401,
"rps_doc_frac_chars_dupe_10grams": 0,
"rps_doc_frac_chars_dupe_5grams": 0.026706229895353317,
"rps_doc_frac_chars_dupe_6grams": 0.026706229895353317,
"rps_doc_frac_chars_dupe_7grams": 0,
"rps_doc_frac_chars_dupe_8grams": 0,
"rps_doc_frac_chars_dupe_9grams": 0,
"rps_doc_frac_chars_top_2gram": 0.027695350348949432,
"rps_doc_frac_chars_top_3gram": 0.01780414953827858,
"rps_doc_frac_chars_top_4gram": 0.014836800284683704,
"rps_doc_books_importance": -262.52410888671875,
"rps_doc_books_importance_length_correction": -262.52410888671875,
"rps_doc_openwebtext_importance": -130.5631561279297,
"rps_doc_openwebtext_importance_length_correction": -130.5631561279297,
"rps_doc_wikipedia_importance": -50.29145050048828,
"rps_doc_wikipedia_importance_length_correction": -50.29145050048828
},
"fasttext": {
"dclm": 0.12134159356355667,
"english": 0.7407573461532593,
"fineweb_edu_approx": 1.9658386707305908,
"eai_general_math": 0.43828409910202026,
"eai_open_web_math": 0.2495599389076233,
"eai_web_code": 0.4064543843269348
}
}
|
{
"free_decimal_correspondence": {
"primary": {
"code": "004.656",
"labels": {
"level_1": "General works, books and libraries, information sciences",
"level_2": "",
"level_3": "Computers and Computer science"
}
},
"secondary": {
"code": "005.1",
"labels": {
"level_1": "General works, books and libraries, information sciences",
"level_2": "",
"level_3": "Computer programming"
}
}
},
"bloom_cognitive_process": {
"primary": {
"code": "3",
"label": "Apply"
},
"secondary": {
"code": "2",
"label": "Understand"
}
},
"bloom_knowledge_domain": {
"primary": {
"code": "3",
"label": "Procedural"
},
"secondary": {
"code": "2",
"label": "Conceptual"
}
},
"document_type_v1": {
"primary": {
"code": "3",
"label": "Reference/Encyclopedic/Educational"
},
"secondary": {
"code": "4",
"label": "Code/Software"
}
},
"extraction_artifacts": {
"primary": {
"code": "0",
"label": "No Artifacts"
},
"secondary": {
"code": "-1",
"label": "Abstain"
}
},
"missing_content": {
"primary": {
"code": "0",
"label": "No missing content"
},
"secondary": {
"code": "-1",
"label": "Abstain"
}
},
"document_type_v2": {
"primary": {
"code": "8",
"label": "Documentation"
},
"secondary": {
"code": "10",
"label": "Knowledge Article"
}
},
"reasoning_depth": {
"primary": {
"code": "2",
"label": "Basic Reasoning"
},
"secondary": {
"code": "3",
"label": "Intermediate Reasoning"
}
},
"technical_correctness": {
"primary": {
"code": "4",
"label": "Highly Correct"
},
"secondary": {
"code": "3",
"label": "Mostly Correct"
}
},
"education_level": {
"primary": {
"code": "3",
"label": "Undergraduate Level"
},
"secondary": {
"code": "2",
"label": "High School Level"
}
}
}
|
672f1e42c33a7f9846924a2431ea77df
|
2,444,534,738,417,982,000
|
If you want to look for the internet easily, make use of a VPN. This will likely encrypt your computer data and stop other folks from spying on you. Yet , there are many different vpn services accessible in 2023 and choosing the anonymous right one could be tricky. Information will give you the information you need to examine vpn for your requirements.
The most important matter to remember once shopping for a VPN is to choose a service it does not leak the IP address or perhaps DNS requests. These can expose your location, identification, and surfing around record to third social gatherings.
You also need to make certain that the VPN you select is definitely not within a country where government engages in censorship. Including countries like China, Emborrachar, Iraq, Chicken, and Russian federation.
CyberGhost is one of the most well-liked and best-known vpns on the market as well as its user-friendly computer software makes it easy to use actually for users who would not consider themselves tech-savvy. It could be also incredibly reliable while offering a huge web server network with preset programs for different types of via the internet activity.
Proton VPN is a great means to fix anyone who’s looking for a vpn that’s specifically designed for torrenting. Its AES-256 encryption helps to protect your level of privacy while torrenting and its NetSheild ad-blocker keeps advertisings from keeping track of your actions.
UltraVPN is certainly a mid-range choice that has a network greater than 3, 500 servers in 94 nations around the world, giving you use of the speediest and most safeguarded internet rates of speed. It’s also a good choice for those who want to cover their personality while surfing the internet, as it maintains no wood logs of your over the internet activity.
Geef een antwoord
Het e-mailadres wordt niet gepubliceerd. Vereiste velden zijn gemarkeerd met *
|
{
"url": "https://rijschooledvance.nl/2023/04/20/finest-vpn-contrast-for-2023/",
"source_domain": "rijschooledvance.nl",
"snapshot_id": "CC-MAIN-2023-50",
"warc_metadata": {
"Content-Length": "26525",
"Content-Type": "application/http; msgtype=response",
"WARC-Block-Digest": "sha1:NAUJCQ7DBLAU736RILVYFTDBA5JVZEBO",
"WARC-Concurrent-To": "<urn:uuid:f6e6bc4a-a630-4b19-b257-e86225b1a1c9>",
"WARC-Date": "2023-12-03T21:30:50Z",
"WARC-IP-Address": "185.107.112.222",
"WARC-Identified-Payload-Type": "text/html",
"WARC-Payload-Digest": "sha1:3TQIN2JB4XLAMSOQFCYJUBZNKDY74IUE",
"WARC-Record-ID": "<urn:uuid:bc7ba042-ba9c-4c67-880a-e02ee5fe029d>",
"WARC-Target-URI": "https://rijschooledvance.nl/2023/04/20/finest-vpn-contrast-for-2023/",
"WARC-Truncated": null,
"WARC-Type": "response",
"WARC-Warcinfo-ID": "<urn:uuid:33d3a8ff-4813-47da-b8cc-97c34be3676b>"
},
"warc_info": "isPartOf: CC-MAIN-2023-50\r\npublisher: Common Crawl\r\ndescription: Wide crawl of the web for November/December 2023\r\noperator: Common Crawl Admin (info@commoncrawl.org)\r\nhostname: ip-10-67-67-40\r\nsoftware: Apache Nutch 1.19 (modified, https://github.com/commoncrawl/nutch/)\r\nrobots: checked via crawler-commons 1.5-SNAPSHOT (https://github.com/crawler-commons/crawler-commons)\r\nformat: WARC File Format 1.1\r\nconformsTo: https://iipc.github.io/warc-specifications/specifications/warc-format/warc-1.1/"
}
|
{
"line_start_idx": [
0,
355,
356,
600,
601,
814,
815,
1172,
1173,
1447,
1448,
1809,
1810,
1828,
1829
],
"line_end_idx": [
355,
356,
600,
601,
814,
815,
1172,
1173,
1447,
1448,
1809,
1810,
1828,
1829,
1907
]
}
|
{
"red_pajama_v2": {
"ccnet_original_length": 1907,
"ccnet_original_nlines": 14,
"rps_doc_curly_bracket": 0,
"rps_doc_ldnoobw_words": 0,
"rps_doc_lorem_ipsum": 0,
"rps_doc_stop_word_fraction": 0.4626038670539856,
"rps_doc_ut1_blacklist": 0,
"rps_doc_frac_all_caps_words": 0.01939057931303978,
"rps_doc_frac_lines_end_with_ellipsis": 0,
"rps_doc_frac_no_alph_words": 0.11911357194185257,
"rps_doc_frac_unique_words": 0.6346153616905212,
"rps_doc_mean_word_length": 4.974359035491943,
"rps_doc_num_sentences": 16,
"rps_doc_symbol_to_word_ratio": 0,
"rps_doc_unigram_entropy": 4.973727703094482,
"rps_doc_word_count": 312,
"rps_doc_frac_chars_dupe_10grams": 0,
"rps_doc_frac_chars_dupe_5grams": 0,
"rps_doc_frac_chars_dupe_6grams": 0,
"rps_doc_frac_chars_dupe_7grams": 0,
"rps_doc_frac_chars_dupe_8grams": 0,
"rps_doc_frac_chars_dupe_9grams": 0,
"rps_doc_frac_chars_top_2gram": 0.028350520879030228,
"rps_doc_frac_chars_top_3gram": 0.00902062002569437,
"rps_doc_frac_chars_top_4gram": 0,
"rps_doc_books_importance": -121.48025512695312,
"rps_doc_books_importance_length_correction": -121.48017883300781,
"rps_doc_openwebtext_importance": -74.60823059082031,
"rps_doc_openwebtext_importance_length_correction": -74.60823059082031,
"rps_doc_wikipedia_importance": -45.15717315673828,
"rps_doc_wikipedia_importance_length_correction": -45.15717315673828
},
"fasttext": {
"dclm": 0.12390779703855515,
"english": 0.9249494075775146,
"fineweb_edu_approx": 1.7493507862091064,
"eai_general_math": 0.03716253861784935,
"eai_open_web_math": 0.16026365756988525,
"eai_web_code": 0.02745842933654785
}
}
|
{
"free_decimal_correspondence": {
"primary": {
"code": "005.82",
"labels": {
"level_1": "General works, books and libraries, information sciences",
"level_2": "",
"level_3": "Computer programming"
}
},
"secondary": {
"code": "323.119",
"labels": {
"level_1": "Social sciences",
"level_2": "Political science",
"level_3": "Human rights, Ethnic relations, Race relations, and Minorities"
}
}
},
"bloom_cognitive_process": {
"primary": {
"code": "2",
"label": "Understand"
},
"secondary": {
"code": "3",
"label": "Apply"
}
},
"bloom_knowledge_domain": {
"primary": {
"code": "2",
"label": "Conceptual"
},
"secondary": {
"code": "3",
"label": "Procedural"
}
},
"document_type_v1": {
"primary": {
"code": "3",
"label": "Reference/Encyclopedic/Educational"
},
"secondary": {
"code": "6",
"label": "Promotional/Advertisement"
}
},
"extraction_artifacts": {
"primary": {
"code": "3",
"label": "Irrelevant Content"
},
"secondary": {
"code": "-1",
"label": "Abstain"
}
},
"missing_content": {
"primary": {
"code": "0",
"label": "No missing content"
},
"secondary": {
"code": "-1",
"label": "Abstain"
}
},
"document_type_v2": {
"primary": {
"code": "10",
"label": "Knowledge Article"
},
"secondary": {
"code": "17",
"label": "Product Page"
}
},
"reasoning_depth": {
"primary": {
"code": "2",
"label": "Basic Reasoning"
},
"secondary": {
"code": "1",
"label": "No Reasoning"
}
},
"technical_correctness": {
"primary": {
"code": "3",
"label": "Mostly Correct"
},
"secondary": {
"code": "4",
"label": "Highly Correct"
}
},
"education_level": {
"primary": {
"code": "1",
"label": "General Audience"
},
"secondary": {
"code": "2",
"label": "High School Level"
}
}
}
|
672f1e42c33a7f9846924a2431ea77df
|
7,223,976,437,373,340,000
|
AppDividend
Latest Code Tutorials
Browsing Tag
React.js
React Autocomplete Example Tutorial
React Autocomplete Example Tutorial is today's main topic. In the modern web development, improving the user experience, and with React is easy. The concept of autocomplete is straightforward. It is a list of suggestions based on a user’s…
How To Connect React and Redux With Example
In this tutorial, we will see How To Connect React and Redux With Example. For this simple demo, we will not be going to use any backend; we will do that in the next tutorial. We keep this example very simple and make it work at the client…
React Bootstrap Table2 Example
React Bootstrap Table2 Example is the today's leading topic. In this example, I will show you how you can install react-bootstrap-table2 and display the backend data to the frontend using this library. There are so many options that we can…
Create React App Tutorial
Create React App Tutorial is today's leading topic. The create react app tutorial is only for beginners so if you are a beginner then and then you can take this tutorial. Otherwise, you can skip this tutorial. React is a declarative,…
|
{
"url": "https://appdividend.com/tag/react-js/",
"source_domain": "appdividend.com",
"snapshot_id": "crawl=CC-MAIN-2019-51",
"warc_metadata": {
"Content-Length": "148407",
"Content-Type": "application/http; msgtype=response",
"WARC-Block-Digest": "sha1:REIF4PFE7G6CXLHIW5CJJZQUH2XQXKCD",
"WARC-Concurrent-To": "<urn:uuid:4903ff69-3021-4db7-9fc3-5688721644fe>",
"WARC-Date": "2019-12-13T03:14:48Z",
"WARC-IP-Address": "3.234.120.64",
"WARC-Identified-Payload-Type": "text/html",
"WARC-Payload-Digest": "sha1:CAKLUN6MUO4HNZO5QEYEQAX5S4NENYBO",
"WARC-Record-ID": "<urn:uuid:e97808a3-b87c-4cb3-af75-c0c82acce958>",
"WARC-Target-URI": "https://appdividend.com/tag/react-js/",
"WARC-Truncated": null,
"WARC-Type": "response",
"WARC-Warcinfo-ID": "<urn:uuid:15180139-5286-4673-a414-2070b342ba92>"
},
"warc_info": "isPartOf: CC-MAIN-2019-51\r\npublisher: Common Crawl\r\ndescription: Wide crawl of the web for December 2019\r\noperator: Common Crawl Admin (info@commoncrawl.org)\r\nhostname: ip-10-67-67-128.ec2.internal\r\nsoftware: Apache Nutch 1.16 (modified, https://github.com/commoncrawl/nutch/)\r\nrobots: checked via crawler-commons 1.1-SNAPSHOT (https://github.com/crawler-commons/crawler-commons)\r\nformat: WARC File Format 1.1\r\nconformsTo: http://iipc.github.io/warc-specifications/specifications/warc-format/warc-1.1/"
}
|
{
"line_start_idx": [
0,
12,
34,
47,
48,
57,
58,
94,
95,
336,
337,
381,
382,
623,
624,
655,
656,
898,
899,
925,
926
],
"line_end_idx": [
12,
34,
47,
48,
57,
58,
94,
95,
336,
337,
381,
382,
623,
624,
655,
656,
898,
899,
925,
926,
1160
]
}
|
{
"red_pajama_v2": {
"ccnet_original_length": 1160,
"ccnet_original_nlines": 20,
"rps_doc_curly_bracket": 0,
"rps_doc_ldnoobw_words": 0,
"rps_doc_lorem_ipsum": 0,
"rps_doc_stop_word_fraction": 0.38864630460739136,
"rps_doc_ut1_blacklist": 0,
"rps_doc_frac_all_caps_words": 0.004366809967905283,
"rps_doc_frac_lines_end_with_ellipsis": 0.190476194024086,
"rps_doc_frac_no_alph_words": 0.12227074056863785,
"rps_doc_frac_unique_words": 0.4793814420700073,
"rps_doc_mean_word_length": 4.804123878479004,
"rps_doc_num_sentences": 12,
"rps_doc_symbol_to_word_ratio": 0.017467249184846878,
"rps_doc_unigram_entropy": 4.197653293609619,
"rps_doc_word_count": 194,
"rps_doc_frac_chars_dupe_10grams": 0,
"rps_doc_frac_chars_dupe_5grams": 0.1287553608417511,
"rps_doc_frac_chars_dupe_6grams": 0.07725322246551514,
"rps_doc_frac_chars_dupe_7grams": 0.07725322246551514,
"rps_doc_frac_chars_dupe_8grams": 0.07725322246551514,
"rps_doc_frac_chars_dupe_9grams": 0,
"rps_doc_frac_chars_top_2gram": 0.032188840210437775,
"rps_doc_frac_chars_top_3gram": 0.045064378529787064,
"rps_doc_frac_chars_top_4gram": 0.07081545144319534,
"rps_doc_books_importance": -73.2074203491211,
"rps_doc_books_importance_length_correction": -73.2074203491211,
"rps_doc_openwebtext_importance": -50.41306686401367,
"rps_doc_openwebtext_importance_length_correction": -48.88944625854492,
"rps_doc_wikipedia_importance": -34.604705810546875,
"rps_doc_wikipedia_importance_length_correction": -34.604705810546875
},
"fasttext": {
"dclm": 0.17413604259490967,
"english": 0.735302209854126,
"fineweb_edu_approx": 1.9903820753097534,
"eai_general_math": 0.08004981279373169,
"eai_open_web_math": 0.25348520278930664,
"eai_web_code": 0.11053519695997238
}
}
|
{
"free_decimal_correspondence": {
"primary": {
"code": "005.133",
"labels": {
"level_1": "General works, books and libraries, information sciences",
"level_2": "",
"level_3": "Computer programming"
}
},
"secondary": {
"code": "005.1",
"labels": {
"level_1": "General works, books and libraries, information sciences",
"level_2": "",
"level_3": "Computer programming"
}
}
},
"bloom_cognitive_process": {
"primary": {
"code": "3",
"label": "Apply"
},
"secondary": {
"code": "2",
"label": "Understand"
}
},
"bloom_knowledge_domain": {
"primary": {
"code": "3",
"label": "Procedural"
},
"secondary": {
"code": "2",
"label": "Conceptual"
}
},
"document_type_v1": {
"primary": {
"code": "3",
"label": "Reference/Encyclopedic/Educational"
},
"secondary": {
"code": "4",
"label": "Code/Software"
}
},
"extraction_artifacts": {
"primary": {
"code": "0",
"label": "No Artifacts"
},
"secondary": {
"code": "-1",
"label": "Abstain"
}
},
"missing_content": {
"primary": {
"code": "1",
"label": "Truncated Snippets"
},
"secondary": {
"code": "-1",
"label": "Abstain"
}
},
"document_type_v2": {
"primary": {
"code": "23",
"label": "Tutorial"
},
"secondary": {
"code": "6",
"label": "Content Listing"
}
},
"reasoning_depth": {
"primary": {
"code": "2",
"label": "Basic Reasoning"
},
"secondary": {
"code": "1",
"label": "No Reasoning"
}
},
"technical_correctness": {
"primary": {
"code": "6",
"label": "Not Applicable/Indeterminate"
},
"secondary": {
"code": "3",
"label": "Mostly Correct"
}
},
"education_level": {
"primary": {
"code": "2",
"label": "High School Level"
},
"secondary": {
"code": "1",
"label": "General Audience"
}
}
}
|
672f1e42c33a7f9846924a2431ea77df
|
-5,228,278,304,499,925,000
|
router talk wirelessly guys have tp link - evolveStar Search - Cannot wirelessly connect with laptop to the router I have just set up
Cannot wirelessly connect with laptop to the router I have just set up
techguy.org - 2013-05-02 18:15:50 - Similar - Report/Block
Hi guys, I'm a total idiot when it comes to computers so please feel free to make fun : I just got a TL- WR740N router and somehow managed to configure it using my girlfriends Acer Aspire One Happy netbook. The internet works fine when the netbook is connected to the router via cable but it can't connect wirelessly to the network I have c...
How to get my router to talk wirelessly to my STB
avforums.com - 2013-04-26 15:00:51 - Similar - Report/Block
Hi guys. I have a TP-LINK TL MR3020 which runs my home network using a 3G usb dongle to connect to the internet. All works fine and my PC, Iphone and tablet all connect without issue to my network. Now I have a Spiderbox STB (Satellite box) that requires to be connected to the internet. In order to do this it must be connected either via...
I cannot connect to my wireless router from my widnows vista
techguy.org - 2013-05-13 12:58:16 - Similar - Report/Block
Hello, i am needing some advice with connecting my wireless Huawei HG523a to my Compaq Presario cq60 Notebook PC (windows vista home premium) 2007. My wireless router is currewntly connected through my Ethernet cable. However, it will not connect wirelessley. I have contacted talk talk and they tried many troubleshooting problems. However...
zyxel router vsg1432 won't give laptop wireless internet access
techguy.org - 2012-09-16 01:57:39 - Similar - Report/Block
Just recently got a Zyxel VSG1432 router connected to the main computer in my home. I am now trying to connect my laptop wirelessly. It will connect to the router but says it is an unidentified network and it doesn't connect to the internet. There is an x in the network and sharing window. I have tried restarting the router, going to the...
Wireless printing problem
tweaktown.com - 2013-03-14 02:33:50 - Similar - Report/Block
I receive my internet wirelessly and I want to wirelessly print from a printer. I can not use the wireless router providing my internet access as I do not own it. I do pay for access from it so I am not doing anything illegal or unethical I have TPLink TL-WR841ND router with wireless Rosewill RNX-N250UBE RTL8192CU Wireless N access poi...
Apple TV3 - wont connect to internet wirelessly
avforums.com - 2013-02-07 14:01:50 - Similar - Report/Block
I bought an ATV3 2 weeks ago, it set up and it worked great on ethernet & wireless for about 1 week then I tried to apply an update and the update failed. I tried the update wirelessly and connected, and it failed over and over. After this, it would no longer connect to the internet wirelessly. It would connect to my home network but not...
Youview talk talk firmware updates (non TT customer)
avforums.com - 2013-02-28 10:53:44 - Similar - Report/Block
Hi Guys, saw a reply on another thread regarding the Humax boxes but havent found an answer with regards to the Talk Talk Huawei Boxes. Are non customers of talk talk still able to receive firmware updates for this box? thanks...
Good Wireless Signal but No Internet
techguy.org - 2013-03-11 12:59:37 - Similar - Report/Block
The laptop is my wife's Sony Vaio running Windows Vista Business wirelessly connecting to BT router. This worked successfully for some time. We have recently encountered a problem whereby the laptop was wirelessly connected to our router but could not contact the server(s) for Internet access. I have been trying to resolve this and suspec...
Iphone 4s connects to router but no internet
techguy.org - 2012-11-09 08:21:59 - Similar - Report/Block
I got a new xfinity router and telephone modem all in one. I hooked up telephone/router and the wi-fi is working. I changed the wireless network name and wireless password and I connected wirelessly my laptop and my son's Iphone 3gs with no problems. These devices are surfing the net no problem, but my wife's Iphone 4 and my Iphone 4s wil...
Suggest a wifi router for Reliance 999 Freedom plan connecction
broadbandforum.in - 2012-08-08 06:02:19 - Similar - Report/Block
Guys i am planning to buy a wifi router for my reliance broadnet connection(this does not have a modem-direct connect to CPU metro ethernet),could any one suggest a wifi router for this,have zeroed in on the TP link TL-WR740N and the entry level buffalo router..which among the two is best and will be compatible?will just connect my laptop...
Help me make my house a WiFi Hotzone
guru3d.com - 2013-06-07 18:52:15 - Similar - Report/Block
Dear Guru's, In my house live 16 people(it is a very big and old house with big walls and such). We decided to get one new and very fast internet connection instead of several interfearing ADSL connections. The issue is how to distribute the Wifi correctly throughout the whole house. The house has 3 floors, with around 5 people living on...
Solved: Lost router firmware password
techguy.org - 2013-03-22 23:26:57 - Similar - Report/Block
My wifi router stopped working so I grabbed an old Netgear out of the closet. I have the wifi password and can connect to the internet fine but I guess I changed the default password at some point and cannot remember what it was. I could take it to work and connect it with a cable if i need to, right? I'd like to avoid that, and if possib...
evolveStar Join
Wireless not connecting Dell Inspiron N5110 to router
techguy.org - 2013-03-14 20:37:59 - Similar - Report/Block
Hello Problem Solver, Problem: . Situation: Dell Inspiron N5110 quit connecting last night about 8 PM while I was online. Both iphone and our other Dell operate wirelessly fine. N5110 works fine hooked to router with ethernet cable. I have: 1. turned on the off Norton fire wall and tried to connect wirelessly - no success. 2. loaded laste...
how to reconfigure my pldt router
istorya.net - 2013-06-12 17:40:04 - Similar - Report/Block
need nko help ninyo guys, ako unta gamiton ako pldt wifi router kay ni shift man ko sa globe, d na nko makaya ang bayad gud, then ako unta i-route sa ako igso-on ang net pra half mi sa bayad kay 1 port raman ang globe na router, sayang man gud ang pldt nko nga router kay 4 ports sya. Ask unta ko kung pwede ba ni sya ma reconfigure nato an...
unidentified network
techguy.org - 2013-03-10 23:59:03 - Similar - Report/Block
hey guys.. not sure if i am meant to post here as i am new but heres my problem.. i have a Compaq Presario A900 and TP-Link router with Vista system.. ever since i brought the router i couldn't leave the laptop without the ethernet plugged in my computer because if i without it, i would simply have no internet connection.. the whole point...
Solved: D-Link Router being set up. Unsuccessful
techguy.org - 2013-06-04 18:06:35 - Similar - Report/Block
Hey! I have a D-Link Router and recently I lost connection on my iPod (doesn't matter anymore) so I reseted the router and now everything is okay. I wanted to set up the router again to protect it from other people. As I was setting it up, at the end, all I see is a message saying that it was unsuccessful. I made sure that the PIN and the...
Virtual router software
sevenforums.com - 2013-06-07 23:50:29 - Similar - Report/Block
Hey guys! Is there a way I can plug my broadband modem directly into my machine and then use the wifi card + software to function as a router? I am aware of ad-hoc networks, but I am want it to have similar functionality to that of physical router-like being able to perform port forwarding, DHCP, and dynamic DLNA. Thanks in advanced for t...
Constant on/off internet
techguy.org - 2013-03-21 09:27:00 - Similar - Report/Block
We have had ongoing problems with our router for two weeks now and I would be very grateful if anyone could help. I rely on the internet for work so really need to get this sorted. First, I live in Hull, UK. We have access to only one ISP here called Karoo. A couple of weeks ago our Netgear router just stopped working. No lights on it wha...
Intermittent problems are the worst! Netgear WNDR3700
techguy.org - 2013-05-14 17:30:04 - Similar - Report/Block
I’m a home user with a (new) Motorola cable modem, an (almost new) Netgear WNDR3700 (N600) router, two Win 7 computers hardwired to the router and a MacBook that I use wirelessly. In addition, an iPad and a couple of iPhones use the wireless. There’s a wireless repeater (also Netgear) across the house to extend wireless into the back yard...
Problem with D-Link Router
broadbandforum.in - 2012-09-06 05:03:48 - Similar - Report/Block
Hi everyone! I'm using D-Link Router (Model: DSL-2730U) with BSNL connection. There is a 'strange' problem with the router. The desktop & 2 laptops at home won't connect to the router when it is switched on for the first time. Everytime I need to power off the router and on it again to get it connected to the devices. Router needs a d...
Router behind router setup help
techimo.com - 2012-07-24 01:28:24 - Similar - Report/Block
I need help setting up a router behind router so my laptop can get wireless while my tower stays wired. I'm renting a room and the house network here is not wireless, but ive got a cable coming into my room from the main router. I've tried disabling the DHCP on the wireless router I've got, but i still can't access the internet. I must be...
New router, no internet access
techguy.org - 2012-07-23 05:16:16 - Similar - Report/Block
Currently am on a cable internet connection. My cable modem is a linksys CM100. Connected to this set-up is a wireless router WRT54G that I have had for a number of years. Right now I'm using a laptop running windows 7 64bit. I want to upgrade to an N-based wireless connection and have recently purchased a linksys WRT160N router. Thought...
Wifi doesn't work
techguy.org - 2012-09-15 06:23:23 - Similar - Report/Block
I got a new Asus RT-N10E router. Using it over Windows 7. Router was working fine until someone switched it off once. Now though I can see other wifi signals, my router doesn't show up. I have tried removing the connection and searching for it again. It doesn't work. I tried completely switching off the router and restarting my computer.
You Talk for Android
androidzoom.com - 2013-03-22 15:33:52 - Similar - Report/Block
Gamewave Voomga You Talk. The Way You Talk. Join ‘You Talk’ and experience a brand new way to communicate. You Talk lets you communicate one on one or with a group of your friends, instantly sharing your items including photos and videos. How does You... FREE
Need OpenCV to work with a wireless camera
stackoverflow.com - 2012-03-02 01:09:34 - Similar - Report/Block
I need to do some processing in OpenCV; I have it working fine with a USB camera, but my application requires wireless transmission. I've been around and around trying to find the best solution; I have a Cisco WVC80N that I can't get working without an internet connection - I'm doing it at school, and they won't let us set up a static IP...
Nanostation 5 Cat5 wired to 2.4 GHz Router Help
techguy.org - 2012-09-18 23:40:35 - Similar - Report/Block
Hello All, I am looking for a solution to attaching a 2.4GHz router to a Nanostation 5 fed network. For those that don't know, a Nanostation 5 is a 5GHz radio/antenna combo for wirelessly sending a TCP/IP connection over a large distance in a clear line of sight. The device is a Transceiver but also functions as a modem/router/WAP for 5GH...
Will getting a new router make more bandwidth available to me?
sevenforums.com - 2013-03-23 03:04:23 - Similar - Report/Block
My internet is really terrible and I am thinking of getting a better router I am currently on an unlimited plan from my ISP My current router is a NetComm NB304N N300 router And I am looking at getting a D-Link DSL2870B would I see any improvements? or is it just my ISP being bad?...
IP segments on router and Linksys router
techguy.org - 2013-04-11 23:17:52 - Similar - Report/Block
My ISP issued me a new modem/router and the LAN side is 192.168.1.1 and the Linksys router that I need for port forwarding is also the 192.168.1.1 series. Is there a way to use the Linksys router with the modem router? The modem router is an ADSL that has the encapsulation settings and the ISP's specific settings in it. It is a lot differ...
c'ant save my port on my router
guru3d.com - 2013-05-08 21:31:59 - Similar - Report/Block
hey guys i have a D-link 2730 u when i open port's for some games they are saved but next time if I restart my router ore my conex is down the router automatically clean all the port's so i need to enter those port again :/ is there any tips that save those port's all the time ?...
i cant acess facebook on my PC
techguy.org - 2013-03-21 08:18:17 - Similar - Report/Block
i use windows 7 with a DSL connection and a router connected to it. my problem is that whenever i acess facebook it displays This webpage is not available The webpage at http://www.facebook.com/ might be temporarily down or it may have moved permanently to a new web address. Error 103 (net::ERR_CONNECTION_ABORTED): Unknown error. i have...
Connecting pc to tv wirelessly
techguy.org - 2013-06-09 19:49:02 - Similar - Report/Block
How can I connect my pc to my new 42 inch lg smart tv wirelessly, and watch downloaded films on the tv?...
How to see the clients connected to a TP-Link TD-W8960N
techguy.org - 2013-04-17 09:14:21 - Similar - Report/Block
Hi Everyone, I have a TP-Link TD-W8960N Wireless Router. I would like to know what the I.P. addresses of connected clients are (both those connected wirelessly & those connected by Ethernet cable). There are about 6 computers in my network, some have dynamic and others have static I.P. addresses. I am finding it difficult to navigate the...
Wondering 2nd router might cause trouble
techguy.org - 2013-02-27 01:13:53 - Similar - Report/Block
My grandson's router seems to have quit working. It worked fine for several months, then a couple days ago, he could no longer connect to the Internet. He did the usual things of turning off his computer, unplugging the router and modem, then reconnecting all of them with no luck. After I spent a few hours trying to resolve the issue, I g...
intresting modem query.....modem + router as juss a router/...is it possible..??
broadbandforum.in - 2012-09-16 11:37:46 - Similar - Report/Block
hi readers... i initially used netgare's n300 adsl(dgn 2200) + router for my bsnl broadband..it worked flawless... now i have shifted to beam .......is there any way i can use the above modem+ router as just a router for wifi in my beams connection ...??? since bsnl is a cu dsl input( requires a modem) and beam is a cable internet ( do no...
3G Router for IP cams, can I use an unlimited data SIM?
avforums.com - 2013-02-25 19:28:58 - Similar - Report/Block
I am aware of the fact that an unlimited data SIM from 3 (for example on the "One" deal) does not have a static IP. But, with a 3G router like the Teltonika RUT 500, it supports DYNDNS and port forwarding like a standard router, so in theory this would work to ensure an end user only has to know the URL not the IP address... right? Theref...
Solved: Router not connecting to internet
techguy.org - 2012-09-01 08:46:58 - Similar - Report/Block
I have recently bought a Belkin N300 Wireless N Modem-Router and am unable to connect it to the internet. My laptop registers the router but the router won't connect to the internet. The router also is blinking a red light. Can you please help me?...
need wifi router for hathway-i don't have a computer
broadbandforum.in - 2012-09-10 18:31:48 - Similar - Report/Block
hi guys i need a wifi router for hathway connection which i applied and am hoping.it will be installed in nxt 48hrs..... i don't have adesktop or laptop and will be using it for internet on my Samsung galaxy r and micromax funbook so plz suggest me a good one i am considering tp link router for 1035rs from flipkart or belkin basic one for...
Wifi Analyser for MacBook Pro
photomalaysia.com - 2013-06-10 09:31:49 - Similar - Report/Block
Greetings. I'm looking for a reliable app or software that I can use to detect wifi signals while using my MacBook Pro, which is on the latest version of Mountain Lion. I can detect my neighbours using wifi and I'm certain some of their wifi routers are interfering with my wifi router, which is causing very slow transfer rates even though...
Que es un Router?
informatica-hoy.com.ar - 2013-02-27 12:10:48 - Similar - Report/Block
Una sencilla explicacion para entender que es y que hace un router. Que podemos esperar de un router. El router en el hogar y las empresas.
Allnet W-LAN Router 300 M Bit Der Router ist ein kompakter, sicherer Router mit
quoka.de - 2012-09-02 17:51:00 - Similar - Report/Block
Allnet W-LAN Router 300 M Bit Der Router ist ein kompakter, sicherer Router mit integriertem WLAN und 4fach Switch. Die integrie...
dialogShowMessage!
Fill out the form you see below. Registration is free, fast and simple.
If you are already registered, sign in page login.
Web Site :
Required Field
First Name :
Required Field
Last Name :
Required Field
Email :
Required Field
Sex :
Required Field
evolveStar.com is free for ever !
evolveStar.com provides a search engine that allows you to gather information to write their own blog.
evolveStar.com enhances the sources displaying the logo of the site.
If you want to remove your site or you believe a site listed infringes copyright, please report it to: info@evolvestar.com
Specifies the subject copyright violation and the url of the page
evolveStar.com respecting the law DMCA (Digital Millennium Copyright Act) will immediately remove whatever its merits.
Next will be effectual and relevant checks.
Who We Are Partner Advertising Contacts Privacy terms Help & FAQ
© Copyright 2010-2017 Fabrizio Fichera. All rights reserved.
|
{
"url": "http://evolvestar.com/want/router-talk-wirelessly-guys-have-tp-link",
"source_domain": "evolvestar.com",
"snapshot_id": "crawl=CC-MAIN-2019-26",
"warc_metadata": {
"Content-Length": "152030",
"Content-Type": "application/http; msgtype=response",
"WARC-Block-Digest": "sha1:VDU6VHR766XGIDIWCAHEB5IZTZXTYXXK",
"WARC-Concurrent-To": "<urn:uuid:0588e6d7-7bd0-4d29-a863-7ea3ab7f2ffd>",
"WARC-Date": "2019-06-25T17:36:27Z",
"WARC-IP-Address": "81.27.135.111",
"WARC-Identified-Payload-Type": "application/xhtml+xml",
"WARC-Payload-Digest": "sha1:YIQ2AAVIRGUUWEL5ATCAHYL7F2MXJIB7",
"WARC-Record-ID": "<urn:uuid:5741ab03-8d50-493f-9dc6-8c5dc0e20a93>",
"WARC-Target-URI": "http://evolvestar.com/want/router-talk-wirelessly-guys-have-tp-link",
"WARC-Truncated": null,
"WARC-Type": "response",
"WARC-Warcinfo-ID": "<urn:uuid:abf4dcd4-235e-415e-b3c1-bbe280984064>"
},
"warc_info": "isPartOf: CC-MAIN-2019-26\r\npublisher: Common Crawl\r\ndescription: Wide crawl of the web for June 2019\r\noperator: Common Crawl Admin (info@commoncrawl.org)\r\nhostname: ip-10-146-47-206.ec2.internal\r\nsoftware: Apache Nutch 1.15 (modified, https://github.com/commoncrawl/nutch/)\r\nrobots: checked via crawler-commons 1.1-SNAPSHOT (https://github.com/crawler-commons/crawler-commons)\r\nformat: WARC File Format 1.1\r\nconformsTo: http://iipc.github.io/warc-specifications/specifications/warc-format/warc-1.1/"
}
|
{
"line_start_idx": [
0,
136,
137,
138,
139,
140,
141,
142,
143,
145,
151,
152,
223,
224,
283,
284,
628,
629,
679,
680,
740,
741,
1084,
1085,
1146,
1147,
1206,
1207,
1551,
1552,
1616,
1617,
1676,
1677,
2020,
2021,
2047,
2048,
2109,
2110,
2451,
2452,
2500,
2501,
2561,
2562,
2905,
2906,
2959,
2960,
3020,
3021,
3251,
3252,
3289,
3290,
3349,
3350,
3694,
3695,
3740,
3741,
3800,
3801,
4145,
4146,
4210,
4211,
4276,
4277,
4621,
4622,
4659,
4660,
4718,
4719,
5062,
5063,
5101,
5102,
5161,
5162,
5506,
5507,
5523,
5524,
5578,
5579,
5638,
5639,
5983,
5984,
6018,
6019,
6078,
6079,
6423,
6424,
6445,
6446,
6505,
6506,
6850,
6851,
6900,
6901,
6960,
6961,
7305,
7306,
7330,
7331,
7394,
7395,
7739,
7740,
7765,
7766,
7825,
7826,
8170,
8171,
8225,
8226,
8285,
8286,
8630,
8631,
8658,
8659,
8724,
8725,
9065,
9066,
9098,
9099,
9158,
9159,
9503,
9504,
9535,
9536,
9595,
9596,
9939,
9940,
9958,
9959,
10018,
10019,
10359,
10360,
10381,
10382,
10445,
10446,
10706,
10707,
10750,
10751,
10816,
10817,
11160,
11161,
11209,
11210,
11269,
11270,
11614,
11615,
11678,
11679,
11742,
11743,
12028,
12029,
12070,
12071,
12130,
12131,
12475,
12476,
12508,
12509,
12567,
12568,
12851,
12852,
12883,
12884,
12943,
12944,
13286,
13287,
13318,
13319,
13378,
13379,
13486,
13487,
13543,
13544,
13603,
13604,
13947,
13948,
13989,
13990,
14049,
14050,
14394,
14395,
14476,
14477,
14542,
14543,
14887,
14888,
14944,
14945,
15005,
15006,
15350,
15351,
15393,
15394,
15453,
15454,
15705,
15706,
15759,
15760,
15825,
15826,
16170,
16171,
16201,
16202,
16267,
16268,
16612,
16613,
16631,
16632,
16702,
16703,
16843,
16844,
16924,
16925,
16981,
16982,
17114,
17115,
17116,
17117,
17118,
17137,
17138,
17210,
17261,
17262,
17263,
17274,
17289,
17302,
17317,
17329,
17344,
17352,
17367,
17373,
17388,
17389,
17423,
17424,
17425,
17528,
17529,
17530,
17599,
17600,
17601,
17724,
17725,
17726,
17792,
17793,
17794,
17913,
17914,
17915,
17959,
17960,
17961,
17962,
17963,
17964,
17965,
17966,
18031,
18032
],
"line_end_idx": [
136,
137,
138,
139,
140,
141,
142,
143,
145,
151,
152,
223,
224,
283,
284,
628,
629,
679,
680,
740,
741,
1084,
1085,
1146,
1147,
1206,
1207,
1551,
1552,
1616,
1617,
1676,
1677,
2020,
2021,
2047,
2048,
2109,
2110,
2451,
2452,
2500,
2501,
2561,
2562,
2905,
2906,
2959,
2960,
3020,
3021,
3251,
3252,
3289,
3290,
3349,
3350,
3694,
3695,
3740,
3741,
3800,
3801,
4145,
4146,
4210,
4211,
4276,
4277,
4621,
4622,
4659,
4660,
4718,
4719,
5062,
5063,
5101,
5102,
5161,
5162,
5506,
5507,
5523,
5524,
5578,
5579,
5638,
5639,
5983,
5984,
6018,
6019,
6078,
6079,
6423,
6424,
6445,
6446,
6505,
6506,
6850,
6851,
6900,
6901,
6960,
6961,
7305,
7306,
7330,
7331,
7394,
7395,
7739,
7740,
7765,
7766,
7825,
7826,
8170,
8171,
8225,
8226,
8285,
8286,
8630,
8631,
8658,
8659,
8724,
8725,
9065,
9066,
9098,
9099,
9158,
9159,
9503,
9504,
9535,
9536,
9595,
9596,
9939,
9940,
9958,
9959,
10018,
10019,
10359,
10360,
10381,
10382,
10445,
10446,
10706,
10707,
10750,
10751,
10816,
10817,
11160,
11161,
11209,
11210,
11269,
11270,
11614,
11615,
11678,
11679,
11742,
11743,
12028,
12029,
12070,
12071,
12130,
12131,
12475,
12476,
12508,
12509,
12567,
12568,
12851,
12852,
12883,
12884,
12943,
12944,
13286,
13287,
13318,
13319,
13378,
13379,
13486,
13487,
13543,
13544,
13603,
13604,
13947,
13948,
13989,
13990,
14049,
14050,
14394,
14395,
14476,
14477,
14542,
14543,
14887,
14888,
14944,
14945,
15005,
15006,
15350,
15351,
15393,
15394,
15453,
15454,
15705,
15706,
15759,
15760,
15825,
15826,
16170,
16171,
16201,
16202,
16267,
16268,
16612,
16613,
16631,
16632,
16702,
16703,
16843,
16844,
16924,
16925,
16981,
16982,
17114,
17115,
17116,
17117,
17118,
17137,
17138,
17210,
17261,
17262,
17263,
17274,
17289,
17302,
17317,
17329,
17344,
17352,
17367,
17373,
17388,
17389,
17423,
17424,
17425,
17528,
17529,
17530,
17599,
17600,
17601,
17724,
17725,
17726,
17792,
17793,
17794,
17913,
17914,
17915,
17959,
17960,
17961,
17962,
17963,
17964,
17965,
17966,
18031,
18032,
18092
]
}
|
{
"red_pajama_v2": {
"ccnet_original_length": 18092,
"ccnet_original_nlines": 301,
"rps_doc_curly_bracket": 0,
"rps_doc_ldnoobw_words": 1,
"rps_doc_lorem_ipsum": 0,
"rps_doc_stop_word_fraction": 0.3226359486579895,
"rps_doc_ut1_blacklist": 0,
"rps_doc_frac_all_caps_words": 0.048750609159469604,
"rps_doc_frac_lines_end_with_ellipsis": 0.12251655757427216,
"rps_doc_frac_no_alph_words": 0.2584517300128937,
"rps_doc_frac_unique_words": 0.32579338550567627,
"rps_doc_mean_word_length": 4.703916072845459,
"rps_doc_num_sentences": 236,
"rps_doc_symbol_to_word_ratio": 0.011513959616422653,
"rps_doc_unigram_entropy": 5.838842391967773,
"rps_doc_word_count": 2962,
"rps_doc_frac_chars_dupe_10grams": 0.017512379214167595,
"rps_doc_frac_chars_dupe_5grams": 0.03186678886413574,
"rps_doc_frac_chars_dupe_6grams": 0.02526376023888588,
"rps_doc_frac_chars_dupe_7grams": 0.017512379214167595,
"rps_doc_frac_chars_dupe_8grams": 0.017512379214167595,
"rps_doc_frac_chars_dupe_9grams": 0.017512379214167595,
"rps_doc_frac_chars_top_2gram": 0.05167587846517563,
"rps_doc_frac_chars_top_3gram": 0.01227302011102438,
"rps_doc_frac_chars_top_4gram": 0.008612650446593761,
"rps_doc_books_importance": -1824.2879638671875,
"rps_doc_books_importance_length_correction": -1824.2879638671875,
"rps_doc_openwebtext_importance": -1151.103271484375,
"rps_doc_openwebtext_importance_length_correction": -1151.103271484375,
"rps_doc_wikipedia_importance": -715.3101196289062,
"rps_doc_wikipedia_importance_length_correction": -715.3101196289062
},
"fasttext": {
"dclm": 0.02159314975142479,
"english": 0.885194718837738,
"fineweb_edu_approx": 1.171141266822815,
"eai_general_math": 0.02350514940917492,
"eai_open_web_math": 0.09674090147018433,
"eai_web_code": 0.06147516146302223
}
}
|
{
"free_decimal_correspondence": {
"primary": {
"code": "004.665",
"labels": {
"level_1": "General works, books and libraries, information sciences",
"level_2": "",
"level_3": "Computers and Computer science"
}
},
"secondary": {
"code": "004.6",
"labels": {
"level_1": "General works, books and libraries, information sciences",
"level_2": "",
"level_3": "Computers and Computer science"
}
}
},
"bloom_cognitive_process": {
"primary": {
"code": "3",
"label": "Apply"
},
"secondary": {
"code": "2",
"label": "Understand"
}
},
"bloom_knowledge_domain": {
"primary": {
"code": "3",
"label": "Procedural"
},
"secondary": {
"code": "2",
"label": "Conceptual"
}
},
"document_type_v1": {
"primary": {
"code": "5",
"label": "Social/Forum"
},
"secondary": {
"code": "-1",
"label": "Abstain"
}
},
"extraction_artifacts": {
"primary": {
"code": "3",
"label": "Irrelevant Content"
},
"secondary": {
"code": "0",
"label": "No Artifacts"
}
},
"missing_content": {
"primary": {
"code": "0",
"label": "No missing content"
},
"secondary": {
"code": "2",
"label": "Click Here References"
}
},
"document_type_v2": {
"primary": {
"code": "18",
"label": "Q&A Forum"
},
"secondary": {
"code": "21",
"label": "Customer Support"
}
},
"reasoning_depth": {
"primary": {
"code": "2",
"label": "Basic Reasoning"
},
"secondary": {
"code": "3",
"label": "Intermediate Reasoning"
}
},
"technical_correctness": {
"primary": {
"code": "2",
"label": "Partially Correct"
},
"secondary": {
"code": "3",
"label": "Mostly Correct"
}
},
"education_level": {
"primary": {
"code": "2",
"label": "High School Level"
},
"secondary": {
"code": "1",
"label": "General Audience"
}
}
}
|
672f1e42c33a7f9846924a2431ea77df
|
-3,259,702,978,879,474,700
|
1
I have my own iPhone and iPad and my boys iPods on an iCloud account. I've since added my boys iPhones on the same account so that I can monitor and control their apps and purchases.
However I'm now getting calls and texts on my iPhone that are sent to them and when I send a text it shows as coming from their phones. Do I need to set up separate iCloud's to prevent this happening?
1 Answer 1
3
Yes. From Apple's perspective, one Apple ID = one person. If you want to share that Apple ID, it also means that all those sharing that Apple ID will have access to all the same things (purchases, texts, emails, etc.)
You may want to look into iCloud's Family Sharing, which allows up to six Apple IDs to be designated as belonging to one family. That allows the family to share each other’s iTunes, iBooks, and App Store purchases without needing to share an Apple ID.
2
• To add to this: you can have the same Apple ID for iTunes and App Store purchases, while having a spectate one for iCloud (and iMessage, FaceTime, Calls on other Devices) Commented Oct 9, 2015 at 19:23
• Good point by @IronCraftMan - I have three AppleID on most devices. One testing, one work, one personal. I use the personal one for mail, find my phone, app purchases and music subscriptions. That ID also is part of a family so that we can all share purchases and some calendars/reminder lists amongst the family.
– bmike
Commented Oct 10, 2015 at 18:25
You must log in to answer this question.
Not the answer you're looking for? Browse other questions tagged .
|
{
"url": "https://apple.stackexchange.com/questions/210143/one-icloud-account-for-multiple-users",
"source_domain": "apple.stackexchange.com",
"snapshot_id": "CC-MAIN-2024-26",
"warc_metadata": {
"Content-Length": "141155",
"Content-Type": "application/http; msgtype=response",
"WARC-Block-Digest": "sha1:I5OK7MTH6F4SMSH4UY6C6PBYVMHWFFTH",
"WARC-Concurrent-To": "<urn:uuid:fd99900b-b2de-471a-bd51-c91d17fceffb>",
"WARC-Date": "2024-06-16T00:33:19Z",
"WARC-IP-Address": "104.18.43.226",
"WARC-Identified-Payload-Type": "text/html",
"WARC-Payload-Digest": "sha1:WNWLUJEXDMPRUQPGZTMMZ4OUJVAYMJ6D",
"WARC-Record-ID": "<urn:uuid:76c02550-60fa-40ba-b5bc-e14fbdd6eeae>",
"WARC-Target-URI": "https://apple.stackexchange.com/questions/210143/one-icloud-account-for-multiple-users",
"WARC-Truncated": null,
"WARC-Type": "response",
"WARC-Warcinfo-ID": "<urn:uuid:01c7df1a-d3ec-48f1-aa17-66dd44231d84>"
},
"warc_info": "isPartOf: CC-MAIN-2024-26\r\npublisher: Common Crawl\r\ndescription: Wide crawl of the web for June 2024\r\noperator: Common Crawl Admin (info@commoncrawl.org)\r\nhostname: ip-10-67-67-228\r\nsoftware: Apache Nutch 1.20 (modified, https://github.com/commoncrawl/nutch/)\r\nrobots: checked via crawler-commons 1.5-SNAPSHOT (https://github.com/crawler-commons/crawler-commons)\r\nformat: WARC File Format 1.1\r\nconformsTo: https://iipc.github.io/warc-specifications/specifications/warc-format/warc-1.1/"
}
|
{
"line_start_idx": [
0,
2,
3,
186,
187,
388,
389,
400,
401,
403,
404,
622,
623,
875,
876,
878,
1084,
1402,
1414,
1450,
1451,
1492,
1493
],
"line_end_idx": [
2,
3,
186,
187,
388,
389,
400,
401,
403,
404,
622,
623,
875,
876,
878,
1084,
1402,
1414,
1450,
1451,
1492,
1493,
1559
]
}
|
{
"red_pajama_v2": {
"ccnet_original_length": 1559,
"ccnet_original_nlines": 22,
"rps_doc_curly_bracket": 0,
"rps_doc_ldnoobw_words": 0,
"rps_doc_lorem_ipsum": 0,
"rps_doc_stop_word_fraction": 0.417391300201416,
"rps_doc_ut1_blacklist": 0,
"rps_doc_frac_all_caps_words": 0.04057971015572548,
"rps_doc_frac_lines_end_with_ellipsis": 0,
"rps_doc_frac_no_alph_words": 0.19130435585975647,
"rps_doc_frac_unique_words": 0.5403508543968201,
"rps_doc_mean_word_length": 4.2140350341796875,
"rps_doc_num_sentences": 16,
"rps_doc_symbol_to_word_ratio": 0,
"rps_doc_unigram_entropy": 4.723634719848633,
"rps_doc_word_count": 285,
"rps_doc_frac_chars_dupe_10grams": 0,
"rps_doc_frac_chars_dupe_5grams": 0,
"rps_doc_frac_chars_dupe_6grams": 0,
"rps_doc_frac_chars_dupe_7grams": 0,
"rps_doc_frac_chars_dupe_8grams": 0,
"rps_doc_frac_chars_dupe_9grams": 0,
"rps_doc_frac_chars_top_2gram": 0.029142379760742188,
"rps_doc_frac_chars_top_3gram": 0.018318070098757744,
"rps_doc_frac_chars_top_4gram": 0.0333055816590786,
"rps_doc_books_importance": -154.79087829589844,
"rps_doc_books_importance_length_correction": -142.30776977539062,
"rps_doc_openwebtext_importance": -77.71465301513672,
"rps_doc_openwebtext_importance_length_correction": -77.71465301513672,
"rps_doc_wikipedia_importance": -88.11758422851562,
"rps_doc_wikipedia_importance_length_correction": -74.41226196289062
},
"fasttext": {
"dclm": 0.026579320430755615,
"english": 0.9462222456932068,
"fineweb_edu_approx": 1.5736373662948608,
"eai_general_math": 0.0028548201080411673,
"eai_open_web_math": 0.1729423999786377,
"eai_web_code": 0.0031272200867533684
}
}
|
{
"free_decimal_correspondence": {
"primary": {
"code": "004.68",
"labels": {
"level_1": "General works, books and libraries, information sciences",
"level_2": "",
"level_3": "Computers and Computer science"
}
},
"secondary": {
"code": "005.1",
"labels": {
"level_1": "General works, books and libraries, information sciences",
"level_2": "",
"level_3": "Computer programming"
}
}
},
"bloom_cognitive_process": {
"primary": {
"code": "2",
"label": "Understand"
},
"secondary": {
"code": "3",
"label": "Apply"
}
},
"bloom_knowledge_domain": {
"primary": {
"code": "2",
"label": "Conceptual"
},
"secondary": {
"code": "3",
"label": "Procedural"
}
},
"document_type_v1": {
"primary": {
"code": "5",
"label": "Social/Forum"
},
"secondary": {
"code": "3",
"label": "Reference/Encyclopedic/Educational"
}
},
"extraction_artifacts": {
"primary": {
"code": "3",
"label": "Irrelevant Content"
},
"secondary": {
"code": "0",
"label": "No Artifacts"
}
},
"missing_content": {
"primary": {
"code": "0",
"label": "No missing content"
},
"secondary": {
"code": "-1",
"label": "Abstain"
}
},
"document_type_v2": {
"primary": {
"code": "18",
"label": "Q&A Forum"
},
"secondary": {
"code": "21",
"label": "Customer Support"
}
},
"reasoning_depth": {
"primary": {
"code": "2",
"label": "Basic Reasoning"
},
"secondary": {
"code": "3",
"label": "Intermediate Reasoning"
}
},
"technical_correctness": {
"primary": {
"code": "4",
"label": "Highly Correct"
},
"secondary": {
"code": "3",
"label": "Mostly Correct"
}
},
"education_level": {
"primary": {
"code": "1",
"label": "General Audience"
},
"secondary": {
"code": "2",
"label": "High School Level"
}
}
}
|
672f1e42c33a7f9846924a2431ea77df
|
-7,984,764,942,583,112,000
|
LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (April 1998)Back to main SPSSX-L pageJoin or leave SPSSX-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date: Wed, 1 Apr 1998 19:01:33 -0300
Reply-To: guilherme Coelho Rabello <guilherm@INEP.GOV.BR>
Sender: "SPSSX(r) Discussion" <SPSSX-L@UGA.CC.UGA.EDU>
From: guilherme Coelho Rabello <guilherm@INEP.GOV.BR>
Subject: Re: MXMEMORY AND WORKING MEMORY
Content-Type: multipart/related; type="multipart/alternative";
This is a multi-part message in MIME format.
------=_NextPart_000_001D_01BD5DA0.964CAD80 Content-Type: multipart/alternative; boundary="----=_NextPart_001_001E_01BD5DA0.964CAD80"
------=_NextPart_001_001E_01BD5DA0.964CAD80 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
Hello again. I am still in doubt about MXMEMORY. After I set up = SET MAXMEMOMORY=3D48000 and change the EDIT MENU to 48000 MB, after the = SPSS is re-estarted, it shows the followin message :=20 ********* message *********
>Warning # 883 in column 72. Text: 48000
>The specified value of WORKSPACE exceeds MXMEMORY (the maximum amount = of
>memory that can be allocated). WORKSPACE has been set to MXMEMORY. Use
>SHOW MXMEMORY to find the maximum allocation and SET MXMEMORY to change = it.
*********** end of message *************
Then it sets up the memory to 14000 MB. Can someone help. = Thanks.
= Guilherme.
=20
---------------------------------------------------- Guilherme Coelho Rabello Minist=E9rio da Educa=E7=E3o do Brasil INEP/DAEB Bras=EDlia-DF, 71620-025 Tel : (061) 242-5399=20 E-mail : guilherm@inep.gov.br ----------------------------------------------------
-----Mensagem original----- De: William M. Bailey <WBailey@cse-online.com> Para: guilherme Coelho Rabello <guilherm@INEP.GOV.BR> Data: Quarta-feira, 1 de Abril de 1998 15:14 Assunto: RE: MXMEMORY AND WORKING MEMORY =20 =20 Go into the Edit Options where you can set memory. However, this is = usually not necessary since Windows & SPSS work together. =20 -----Original Message----- From: SPSSX(r) Discussion [mailto:SPSSX-L@UGA.CC.UGA.EDU]On Behalf = Of guilherme Coelho Rabello Sent: Wednesday, April 01, 1998 12:36 PM To: SPSSX-L@UGA.CC.UGA.EDU Subject: MXMEMORY AND WORKING MEMORY =20 =20 HI.=20 =20 I want to set the working memory to 32 MB RAM in a Pentium 166 = with 64 MB RAM. My SPSS 7.5 only accepts that if I run a SET MEMORY=3D = command before the EDIT option in the MENU, every session. Can someone = help me ? Thanks. =20 = Guilherme. =20 ---------------------------------------------------- Guilherme Coelho Rabello Minist=E9rio da Educa=E7=E3o do Brasil INEP/DAEB Bras=EDlia-DF, 71620-025 Tel : (061) 242-5399=20 E-mail : guilherm@inep.gov.br ---------------------------------------------------- =20
------=_NextPart_001_001E_01BD5DA0.964CAD80 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD W3 HTML//EN"> <HTML> <HEAD>
<META content=3Dtext/html;charset=3Diso-8859-1 = http-equiv=3DContent-Type><!DOCTYPE HTML PUBLIC "-//W3C//DTD W3 = HTML//EN"><BASE=20 href=3D"file://C:\Arquivos de Programas\Arquivos comuns\Microsoft = Shared\Papel de carta\"> <STYLE>BODY { COLOR: #000000; FONT-FAMILY: Arial; FONT-SIZE: 12pt } PRE { COLOR: #000000; FONT-FAMILY: Arial; FONT-SIZE: 12pt } BLOCKQUOTE { COLOR: #000000; FONT-FAMILY: Arial; FONT-SIZE: 12pt } A { COLOR: #000000; FONT-FAMILY: Arial; FONT-SIZE: 12pt } MENU { COLOR: #000000; FONT-FAMILY: Arial; FONT-SIZE: 12pt } DD { COLOR: #000000; FONT-FAMILY: Arial; FONT-SIZE: 12pt } UL { COLOR: #000000; FONT-FAMILY: Arial; FONT-SIZE: 12pt } DT { COLOR: #000000; FONT-FAMILY: Arial; FONT-SIZE: 12pt } DIR { COLOR: #000000; FONT-FAMILY: Arial; FONT-SIZE: 12pt } ADDRESS { COLOR: #000000; FONT-FAMILY: Arial; FONT-SIZE: 12pt } H1 { COLOR: #000000; FONT-FAMILY: Arial; FONT-SIZE: 12pt } H2 { COLOR: #000000; FONT-FAMILY: Arial; FONT-SIZE: 12pt } H3 { COLOR: #000000; FONT-FAMILY: Arial; FONT-SIZE: 12pt } H4 { COLOR: #000000; FONT-FAMILY: Arial; FONT-SIZE: 12pt } H5 { COLOR: #000000; FONT-FAMILY: Arial; FONT-SIZE: 12pt } H6 { COLOR: #000000; FONT-FAMILY: Arial; FONT-SIZE: 12pt } HR { COLOR: #000000; FONT-FAMILY: Arial; FONT-SIZE: 12pt } </STYLE>
<META content=3D'"MSHTML 4.71.1712.3"' name=3DGENERATOR> </HEAD> <BODY background=3Dcid:001501bd5db9$bb70b2a0$df7813c8@daeb08.inep.gov.br =
bgColor=3D#ffffff> <DIV><FONT color=3D#000000 = size=3D2> =20 H<FONT color=3D#000000>ello again. I am still in doubt about MXMEMORY. = After I set=20 up </FONT></FONT><FONT size=3D2>SET MAXMEMOMORY=3D48000 </FONT><FONT = size=3D2>and=20 change the EDIT MENU to </FONT><FONT size=3D2>48000 MB, after the SPSS = is=20 re-estarted, it shows the followin message : </FONT></DIV> <DIV><FONT color=3D#000000 face=3D"Courier New" size=3D2> <P>********* message *********</P> <P>>Warning # 883 in column 72. Text: 48000</P> <P>>The specified value of WORKSPACE exceeds MXMEMORY (the maximum = amount=20 of</P> <P>>memory that can be allocated). WORKSPACE has been set to = MXMEMORY.=20 Use</P> <P>>SHOW MXMEMORY to find the maximum allocation and SET MXMEMORY to = change=20 it.</P></FONT></DIV> <DIV><FONT color=3D#000000 size=3D2>*********** end of message=20 *************</FONT> </DIV> <DIV><FONT color=3D#000000 size=3D2></FONT> </DIV> <DIV><FONT color=3D#000000 = size=3D2> <FONT=20 color=3D#000000>Then it sets up the memory to 14000 MB. Can = someone help.=20 Thanks.</FONT></FONT></DIV> <DIV><FONT color=3D#000000 size=3D2><FONT = color=3D#000000></FONT></FONT> </DIV> <DIV><FONT color=3D#000000=20 size=3D2> &nbs= p;  = ; = &= nbsp; &n= bsp; &nb= sp; &nbs= p; =20 Guilherme.</FONT></DIV> <DIV><FONT color=3D#000000 size=3D2></FONT> </DIV> <DIV><FONT color=3D#000000 size=3D2><FONT = color=3D#000000></FONT></FONT> </DIV> <DIV><FONT color=3D#000000=20 size=3D2> &nbs= p;  = ; =20 </FONT></DIV> <DIV> </DIV> <DIV><FONT color=3D#000000=20 size=3D2>----------------------------------------------------<BR>Guilherm= e Coelho=20 Rabello<BR>Ministério da Educação do=20 Brasil<BR>INEP/DAEB<BR>Brasília-DF, 71620-025<BR>Tel : (061) = 242-5399=20 <BR>E-mail : <A=20 href=3D"mailto:guilherm@inep.gov.br">guilherm@inep.gov.br</A><BR>--------= --------------------------------------------<BR></FONT> </DIV> <BLOCKQUOTE=20 style=3D"BORDER-LEFT: #000000 solid 2px; MARGIN-LEFT: 5px; PADDING-LEFT: = 5px"> <DIV><FONT face=3DArial size=3D2><B>-----Mensagem = original-----</B><BR><B>De:=20 </B>William M. Bailey <<A=20 = href=3D"mailto:WBailey@cse-online.com">WBailey@cse-online.com</A>><BR>= <B>Para:=20 </B>guilherme Coelho Rabello <<A=20 = href=3D"mailto:guilherm@INEP.GOV.BR">guilherm@INEP.GOV.BR</A>><BR><B>D= ata:=20 </B>Quarta-feira, 1 de Abril de 1998 15:14<BR><B>Assunto: </B>RE: = MXMEMORY=20 AND WORKING MEMORY<BR><BR></DIV></FONT> <DIV><SPAN class=3D680040618-01041998><FONT color=3D#000000 = face=3DArial size=3D3>Go=20 into the Edit Options where you can set memory. However, this is = usually not=20 necessary since Windows & SPSS work = together.</FONT></SPAN></DIV> <DIV><SPAN class=3D680040618-01041998><FONT color=3D#000000 = face=3DArial=20 size=3D3></FONT></SPAN> </DIV> <DIV class=3DOutlookMessageHeader><FONT face=3D"Times New Roman"=20 size=3D2>-----Original Message-----<BR><B>From:</B> SPSSX(r) = Discussion=20 [mailto:SPSSX-L@UGA.CC.UGA.EDU]<B>On Behalf Of</B> guilherme Coelho=20 Rabello<BR><B>Sent:</B> Wednesday, April 01, 1998 12:36 = PM<BR><B>To:</B>=20 SPSSX-L@UGA.CC.UGA.EDU<BR><B>Subject:</B> MXMEMORY AND WORKING=20 MEMORY<BR><BR></FONT></DIV> <DIV> HI. </DIV> <DIV> </DIV> <DIV> I want to set the working memory to 32 = MB RAM=20 in a Pentium 166 with 64 MB RAM. My SPSS 7.5 only accepts that = if I=20 run a SET MEMORY=3D command before the EDIT option in the MENU, = every session.=20 Can someone help me ? Thanks.</DIV> <DIV> </DIV> = <DIV> &n= bsp; &nb= sp; &nbs= p;  = ; =20 Guilherme.</DIV> <DIV> </DIV> = <DIV>----------------------------------------------------<BR>Guilherme=20 Coelho Rabello<BR>Ministério da Educação do=20 Brasil<BR>INEP/DAEB<BR>Brasília-DF, 71620-025<BR>Tel : (061) = 242-5399=20 <BR>E-mail : <A=20 = href=3D"mailto:guilherm@inep.gov.br">guilherm@inep.gov.br</A><BR>--------= --------------------------------------------<BR></DIV></BLOCKQUOTE></BODY= ></HTML>
------=_NextPart_001_001E_01BD5DA0.964CAD80--
------=_NextPart_000_001D_01BD5DA0.964CAD80 Content-Type: image/gif Content-Transfer-Encoding: base64 Content-ID: <001501bd5db9$bb70b2a0$df7813c8@daeb08.inep.gov.br>
R0lGODlhFAAUAPcAAP//////zP//mf//Zv//M///AP/M///MzP/Mmf/MZv/MM//MAP+Z//+ZzP+Z mf+ZZv+ZM/+ZAP9m//9mzP9mmf9mZv9mM/9mAP8z//8zzP8zmf8zZv8zM/8zAP8A//8AzP8Amf8A Zv8AM/8AAMz//8z/zMz/mcz/Zsz/M8z/AMzM/8zMzMzMmczMZszMM8zMAMyZ/8yZzMyZmcyZZsyZ M8yZAMxm/8xmzMxmmcxmZsxmM8xmAMwz/8wzzMwzmcwzZswzM8wzAMwA/8wAzMwAmcwAZswAM8wA AJn//5n/zJn/mZn/Zpn/M5n/AJnM/5nMzJnMmZnMZpnMM5nMAJmZ/5mZzJmZmZmZZpmZM5mZAJlm /5lmzJlmmZlmZplmM5lmAJkz/5kzzJkzmZkzZpkzM5kzAJkA/5kAzJkAmZkAZpkAM5kAAGb//2b/ zGb/mWb/Zmb/M2b/AGbM/2bMzGbMmWbMZmbMM2bMAGaZ/2aZzGaZmWaZZmaZM2aZAGZm/2ZmzGZm mWZmZmZmM2ZmAGYz/2YzzGYzmWYzZmYzM2YzAGYA/2YAzGYAmWYAZmYAM2YAADP//zP/zDP/mTP/ ZjP/MzP/ADPM/zPMzDPMmTPMZjPMMzPMADOZ/zOZzDOZmTOZZjOZMzOZADNm/zNmzDNmmTNmZjNm MzNmADMz/zMzzDMzmTMzZjMzMzMzADMA/zMAzDMAmTMAZjMAMzMAAAD//wD/zAD/mQD/ZgD/MwD/ AADM/wDMzADMmQDMZgDMMwDMAACZ/wCZzACZmQCZZgCZMwCZAABm/wBmzABmmQBmZgBmMwBmAAAz /wAzzAAzmQAzZgAzMwAzAAAA/wAAzAAAmQAAZgAAMwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACwAAAAAFAAUAEAIQwBJCBxI sKBBAAgTKlyYUCDDhwsdQpwoceLDihYjksh4cSNHjR9BhmzocSQAjCFRflTJkWVGlxZhUiw5UiZE gzhzBgQAOw==
------=_NextPart_000_001D_01BD5DA0.964CAD80--
Back to: Top of message | Previous page | Main SPSSX-L page
|
{
"url": "http://listserv.uga.edu/cgi-bin/wa?A2=ind9804&L=spssx-l&F=&S=&P=2444",
"source_domain": "listserv.uga.edu",
"snapshot_id": "crawl=CC-MAIN-2013-48",
"warc_metadata": {
"Content-Length": "22154",
"Content-Type": "application/http; msgtype=response",
"WARC-Block-Digest": "sha1:WQBJNKL42KOJX22WYWB2FVUAVKKR56IJ",
"WARC-Concurrent-To": "<urn:uuid:e05481e7-d87e-4034-9531-6b849bdcfee6>",
"WARC-Date": "2013-12-11T23:11:55Z",
"WARC-IP-Address": "128.192.1.75",
"WARC-Identified-Payload-Type": null,
"WARC-Payload-Digest": "sha1:666OR4DFPMVZYIW6CIVQKIQBTD5O2GY2",
"WARC-Record-ID": "<urn:uuid:7f7d3931-89d1-4d71-abd5-2897974739b0>",
"WARC-Target-URI": "http://listserv.uga.edu/cgi-bin/wa?A2=ind9804&L=spssx-l&F=&S=&P=2444",
"WARC-Truncated": "length",
"WARC-Type": "response",
"WARC-Warcinfo-ID": "<urn:uuid:05f07f22-1c21-4879-a445-2db63f945504>"
},
"warc_info": "robots: classic\r\nhostname: ip-10-33-133-15.ec2.internal\r\nsoftware: Nutch 1.6 (CC)/CC WarcExport 1.0\r\nisPartOf: CC-MAIN-2013-48\r\noperator: CommonCrawl Admin\r\ndescription: Wide crawl of the web with URLs provided by Blekko for Winter 2013\r\npublisher: CommonCrawl\r\nformat: WARC File Format 1.0\r\nconformsTo: http://bibnum.bnf.fr/WARC/WARC_ISO_28500_version1_latestdraft.pdf"
}
|
{
"line_start_idx": [
0,
38,
55,
99,
360,
405,
467,
528,
590,
636,
699,
700,
745,
746,
880,
881,
1016,
1017,
1241,
1242,
1283,
1284,
1360,
1361,
1433,
1434,
1513,
1514,
1555,
1556,
1624,
1625,
1638,
1639,
1643,
1644,
1903,
1904,
3020,
3021,
3155,
3156,
3219,
3220,
4484,
4485,
4625,
4626,
9841,
9842,
9888,
9889,
10055,
10056,
11224,
11225,
11271,
11272,
11273
],
"line_end_idx": [
38,
55,
99,
360,
405,
467,
528,
590,
636,
699,
700,
745,
746,
880,
881,
1016,
1017,
1241,
1242,
1283,
1284,
1360,
1361,
1433,
1434,
1513,
1514,
1555,
1556,
1624,
1625,
1638,
1639,
1643,
1644,
1903,
1904,
3020,
3021,
3155,
3156,
3219,
3220,
4484,
4485,
4625,
4626,
9841,
9842,
9888,
9889,
10055,
10056,
11224,
11225,
11271,
11272,
11273,
11332
]
}
|
{
"red_pajama_v2": {
"ccnet_original_length": 11332,
"ccnet_original_nlines": 58,
"rps_doc_curly_bracket": 0.003000349970534444,
"rps_doc_ldnoobw_words": 0,
"rps_doc_lorem_ipsum": 0,
"rps_doc_stop_word_fraction": 0.059154000133275986,
"rps_doc_ut1_blacklist": 0,
"rps_doc_frac_all_caps_words": 0.1764705926179886,
"rps_doc_frac_lines_end_with_ellipsis": 0,
"rps_doc_frac_no_alph_words": 0.49272969365119934,
"rps_doc_frac_unique_words": 0.4337899386882782,
"rps_doc_mean_word_length": 9.031963348388672,
"rps_doc_num_sentences": 100,
"rps_doc_symbol_to_word_ratio": 0.012557829730212688,
"rps_doc_unigram_entropy": 5.494808673858643,
"rps_doc_word_count": 876,
"rps_doc_frac_chars_dupe_10grams": 0.14332659542560577,
"rps_doc_frac_chars_dupe_5grams": 0.3480788767337799,
"rps_doc_frac_chars_dupe_6grams": 0.30889788269996643,
"rps_doc_frac_chars_dupe_7grams": 0.2113245725631714,
"rps_doc_frac_chars_dupe_8grams": 0.2113245725631714,
"rps_doc_frac_chars_dupe_9grams": 0.15318503975868225,
"rps_doc_frac_chars_top_2gram": 0.023634979501366615,
"rps_doc_frac_chars_top_3gram": 0.04512133076786995,
"rps_doc_frac_chars_top_4gram": 0.05586450919508934,
"rps_doc_books_importance": -1729.8154296875,
"rps_doc_books_importance_length_correction": -1729.8154296875,
"rps_doc_openwebtext_importance": -464.9584045410156,
"rps_doc_openwebtext_importance_length_correction": -464.9584045410156,
"rps_doc_wikipedia_importance": -937.768310546875,
"rps_doc_wikipedia_importance_length_correction": -937.768310546875
},
"fasttext": {
"dclm": 0.9523574113845825,
"english": 0.4336569905281067,
"fineweb_edu_approx": 2.619509696960449,
"eai_general_math": 0.3247417211532593,
"eai_open_web_math": 0.6864944696426392,
"eai_web_code": 0.0809057429432869
}
}
|
{
"free_decimal_correspondence": {
"primary": {
"code": "005.462",
"labels": {
"level_1": "General works, books and libraries, information sciences",
"level_2": "",
"level_3": "Computer programming"
}
},
"secondary": {
"code": "004.62",
"labels": {
"level_1": "General works, books and libraries, information sciences",
"level_2": "",
"level_3": "Computers and Computer science"
}
}
},
"bloom_cognitive_process": {
"primary": {
"code": "3",
"label": "Apply"
},
"secondary": {
"code": "2",
"label": "Understand"
}
},
"bloom_knowledge_domain": {
"primary": {
"code": "3",
"label": "Procedural"
},
"secondary": {
"code": "2",
"label": "Conceptual"
}
},
"document_type_v1": {
"primary": {
"code": "5",
"label": "Social/Forum"
},
"secondary": {
"code": "-1",
"label": "Abstain"
}
},
"extraction_artifacts": {
"primary": {
"code": "1",
"label": "Leftover HTML"
},
"secondary": {
"code": "3",
"label": "Irrelevant Content"
}
},
"missing_content": {
"primary": {
"code": "0",
"label": "No missing content"
},
"secondary": {
"code": "-1",
"label": "Abstain"
}
},
"document_type_v2": {
"primary": {
"code": "18",
"label": "Q&A Forum"
},
"secondary": {
"code": "21",
"label": "Customer Support"
}
},
"reasoning_depth": {
"primary": {
"code": "2",
"label": "Basic Reasoning"
},
"secondary": {
"code": "3",
"label": "Intermediate Reasoning"
}
},
"technical_correctness": {
"primary": {
"code": "3",
"label": "Mostly Correct"
},
"secondary": {
"code": "4",
"label": "Highly Correct"
}
},
"education_level": {
"primary": {
"code": "3",
"label": "Undergraduate Level"
},
"secondary": {
"code": "2",
"label": "High School Level"
}
}
}
|
672f1e42c33a7f9846924a2431ea77df
|
-1,222,857,392,339,659,300
|
2017-12-27 634 views
1
我試圖購買Lending club二級市場票據,並且不斷收到「內部服務器錯誤」。我也曾多次要求借助俱樂部支持,但他們無能爲力。我也嘗試過這個帖子,但沒有運氣LendingClub.com API 500 Error for Buying Notes on Secondary MarketLendingClub.com API內部服務器在二級市場上購買票據的錯誤
請幫
<?php
$invester_id = "516xxxxxx";
$api_key = "GVsZuxxxxxxxxx";
$ContentType = "application/json";
define("DEBUG_LENDING_API", true);
$buy = buy_notes($invester_id, $api_key);
print_r($buy);die;
function buy_notes($invester_id, $api_key){
$buy_notes_url = "https://api.lendingclub.com/api/investor/v1/accounts/$invester_id/trades/buy";
$note = array("loanId" => "97277470", "orderId" => "139320895", "noteID" => "149206918", "bidPrice" => "19.45");
$datas = array("aid" => "70654", "notes" => $note);
$buy_notes = call_curl($buy_notes_url, $api_key, json_encode($datas));
$notes = json_decode($buy_notes['data']);
return $notes;
}
function call_curl($url, $api_key, $post = "0"){
$invester_id = "516xxxxxx";
$ContentType = "application/json";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt ($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows; U; Windows NT 5.1; pl; rv:1.9) Gecko/2008052906 Firefox/3.0");
if($post != "0"){
curl_setopt($ch,CURLOPT_POST, 1);
curl_setopt($ch,CURLOPT_POSTFIELDS, $post);
}
curl_setopt ($ch, CURLOPT_AUTOREFERER, true);
curl_setopt ($ch, CURLOPT_FOLLOWLOCATION, true);
$headers = array();
$headers[] = "Authorization: $api_key";
$headers[] = "Content-type: $ContentType";
$headers[] = "Accept: $ContentType";
$headers[] = "X-LC-Application-Key: $invester_id";
//print_r(array_values($headers));
//exit;
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
$server_output = curl_exec ($ch);
echo $server_output. "<br>";
exit;
$info = curl_getinfo($ch);
curl_close ($ch);
if(DEBUG_LENDING_API == true){
return array("data" => $server_output, "response" => $info);
}else{
return json_decode($server_output);
}
}
?>
+1
你是從服務器上獲得500,還是他們的?我可以看到3個地方,你的代碼會在本地拋出500個地方,因爲'$ ContentType','$ invester_id'和'$ notes'沒有在函數範圍內定義。 – aynber
+1
這完全一樣。內部服務器錯誤返回HTTP狀態500. – aynber
+0
$ ContentType和$ invester_id已經在腳本的頂部定義。如果你向上滾動,你會看到它們。 $ notes被定義在$ notes = json_decode($ notes ['data']); – hdsouza
回答
1
我設法弄明白。我將「援助」設置爲$ invester_id,並最終做到了這一點。感謝Aynber爲你提供了一些提示。
|
{
"url": "http://hk.uwenku.com/question/p-keloufdr-eb.html",
"source_domain": "hk.uwenku.com",
"snapshot_id": "crawl=CC-MAIN-2021-17",
"warc_metadata": {
"Content-Length": "39243",
"Content-Type": "application/http; msgtype=response",
"WARC-Block-Digest": "sha1:G35K2ZNBBTR3UR54INKPIVV72BZZ5TO6",
"WARC-Concurrent-To": "<urn:uuid:280b5006-a21d-43f0-aa90-f9a66a361a72>",
"WARC-Date": "2021-04-21T21:04:56Z",
"WARC-IP-Address": "39.100.150.176",
"WARC-Identified-Payload-Type": "text/html",
"WARC-Payload-Digest": "sha1:E7KJ2II27HPOTZJWAKJIRFGXGEJ7PQFB",
"WARC-Record-ID": "<urn:uuid:12f5d681-e97a-4f54-b738-bdd5fe3a80b1>",
"WARC-Target-URI": "http://hk.uwenku.com/question/p-keloufdr-eb.html",
"WARC-Truncated": null,
"WARC-Type": "response",
"WARC-Warcinfo-ID": "<urn:uuid:a98acdf2-f626-4a0c-b329-ffd54afcf5a0>"
},
"warc_info": "isPartOf: CC-MAIN-2021-17\r\npublisher: Common Crawl\r\ndescription: Wide crawl of the web for April 2021\r\noperator: Common Crawl Admin (info@commoncrawl.org)\r\nhostname: ip-10-67-67-207.ec2.internal\r\nsoftware: Apache Nutch 1.18 (modified, https://github.com/commoncrawl/nutch/)\r\nrobots: checked via crawler-commons 1.2-SNAPSHOT (https://github.com/crawler-commons/crawler-commons)\r\nformat: WARC File Format 1.1\r\nconformsTo: https://iipc.github.io/warc-specifications/specifications/warc-format/warc-1.1/"
}
|
{
"line_start_idx": [
0,
21,
23,
24,
206,
207,
210,
211,
218,
220,
249,
251,
281,
283,
319,
321,
357,
359,
360,
362,
405,
407,
427,
429,
430,
432,
477,
479,
581,
583,
701,
703,
760,
762,
838,
840,
887,
889,
909,
911,
918,
920,
921,
923,
973,
975,
1008,
1010,
1050,
1052,
1076,
1078,
1120,
1122,
1250,
1252,
1275,
1277,
1316,
1318,
1367,
1369,
1376,
1378,
1429,
1431,
1485,
1487,
1512,
1514,
1559,
1561,
1609,
1611,
1653,
1655,
1711,
1713,
1753,
1755,
1768,
1770,
1823,
1825,
1864,
1866,
1900,
1902,
1913,
1915,
1947,
1949,
1972,
1974,
2010,
2012,
2078,
2080,
2092,
2094,
2135,
2137,
2144,
2146,
2153,
2155,
2158,
2159,
2162,
2163,
2273,
2274,
2277,
2278,
2313,
2314,
2317,
2318,
2434,
2435,
2438,
2439,
2441,
2442
],
"line_end_idx": [
21,
23,
24,
206,
207,
210,
211,
218,
220,
249,
251,
281,
283,
319,
321,
357,
359,
360,
362,
405,
407,
427,
429,
430,
432,
477,
479,
581,
583,
701,
703,
760,
762,
838,
840,
887,
889,
909,
911,
918,
920,
921,
923,
973,
975,
1008,
1010,
1050,
1052,
1076,
1078,
1120,
1122,
1250,
1252,
1275,
1277,
1316,
1318,
1367,
1369,
1376,
1378,
1429,
1431,
1485,
1487,
1512,
1514,
1559,
1561,
1609,
1611,
1653,
1655,
1711,
1713,
1753,
1755,
1768,
1770,
1823,
1825,
1864,
1866,
1900,
1902,
1913,
1915,
1947,
1949,
1972,
1974,
2010,
2012,
2078,
2080,
2092,
2094,
2135,
2137,
2144,
2146,
2153,
2155,
2158,
2159,
2162,
2163,
2273,
2274,
2277,
2278,
2313,
2314,
2317,
2318,
2434,
2435,
2438,
2439,
2441,
2442,
2500
]
}
|
{
"red_pajama_v2": {
"ccnet_original_length": 2500,
"ccnet_original_nlines": 123,
"rps_doc_curly_bracket": 0.004000000189989805,
"rps_doc_ldnoobw_words": 0,
"rps_doc_lorem_ipsum": 0,
"rps_doc_stop_word_fraction": 0.015325670130550861,
"rps_doc_ut1_blacklist": 0,
"rps_doc_frac_all_caps_words": 0.030651340261101723,
"rps_doc_frac_lines_end_with_ellipsis": 0,
"rps_doc_frac_no_alph_words": 0.6475095748901367,
"rps_doc_frac_unique_words": 0.6687116622924805,
"rps_doc_mean_word_length": 9.595091819763184,
"rps_doc_num_sentences": 15,
"rps_doc_symbol_to_word_ratio": 0,
"rps_doc_unigram_entropy": 4.482302188873291,
"rps_doc_word_count": 163,
"rps_doc_frac_chars_dupe_10grams": 0,
"rps_doc_frac_chars_dupe_5grams": 0,
"rps_doc_frac_chars_dupe_6grams": 0,
"rps_doc_frac_chars_dupe_7grams": 0,
"rps_doc_frac_chars_dupe_8grams": 0,
"rps_doc_frac_chars_dupe_9grams": 0,
"rps_doc_frac_chars_top_2gram": 0.023017900064587593,
"rps_doc_frac_chars_top_3gram": 0,
"rps_doc_frac_chars_top_4gram": 0,
"rps_doc_books_importance": -179.83401489257812,
"rps_doc_books_importance_length_correction": -179.83401489257812,
"rps_doc_openwebtext_importance": -121.84507751464844,
"rps_doc_openwebtext_importance_length_correction": -121.84507751464844,
"rps_doc_wikipedia_importance": -97.02729034423828,
"rps_doc_wikipedia_importance_length_correction": -97.02729034423828
},
"fasttext": {
"dclm": 0.9743817448616028,
"english": 0.20851339399814606,
"fineweb_edu_approx": 3.6957249641418457,
"eai_general_math": 0.47241079807281494,
"eai_open_web_math": 0.10801637172698975,
"eai_web_code": 0.24897074699401855
}
}
|
{
"free_decimal_correspondence": {
"primary": {
"code": "005.1",
"labels": {
"level_1": "General works, books and libraries, information sciences",
"level_2": "",
"level_3": "Computer programming"
}
},
"secondary": {
"code": "332.0285",
"labels": {
"level_1": "Social sciences",
"level_2": "Economics",
"level_3": "Finance"
}
}
},
"bloom_cognitive_process": {
"primary": {
"code": "3",
"label": "Apply"
},
"secondary": {
"code": "2",
"label": "Understand"
}
},
"bloom_knowledge_domain": {
"primary": {
"code": "3",
"label": "Procedural"
},
"secondary": {
"code": "2",
"label": "Conceptual"
}
},
"document_type_v1": {
"primary": {
"code": "5",
"label": "Social/Forum"
},
"secondary": {
"code": "4",
"label": "Code/Software"
}
},
"extraction_artifacts": {
"primary": {
"code": "0",
"label": "No Artifacts"
},
"secondary": {
"code": "3",
"label": "Irrelevant Content"
}
},
"missing_content": {
"primary": {
"code": "0",
"label": "No missing content"
},
"secondary": {
"code": "-1",
"label": "Abstain"
}
},
"document_type_v2": {
"primary": {
"code": "18",
"label": "Q&A Forum"
},
"secondary": {
"code": "8",
"label": "Documentation"
}
},
"reasoning_depth": {
"primary": {
"code": "2",
"label": "Basic Reasoning"
},
"secondary": {
"code": "3",
"label": "Intermediate Reasoning"
}
},
"technical_correctness": {
"primary": {
"code": "3",
"label": "Mostly Correct"
},
"secondary": {
"code": "4",
"label": "Highly Correct"
}
},
"education_level": {
"primary": {
"code": "3",
"label": "Undergraduate Level"
},
"secondary": {
"code": "4",
"label": "Graduate/Expert Level"
}
}
}
|
672f1e42c33a7f9846924a2431ea77df
|
7,224,204,505,639,811,000
|
Solved
Entity EJB Design question
Posted on 2004-08-29
8
286 Views
Last Modified: 2013-11-24
I'm creating an Entity EJB using Bean Managed Persistence, which could be fairly complex. It's would represent an object whose data spans multiple DB tables and the fields consist of some potentially large objects (input streams). The cost of storing and loading this info to and from the DB would be fairly high. This object is essentially representing a program whose code and associated include files are stored in the DB. There are certain attributes that will be used quite a bit more often than others, for example the name, description etc. will be looked up often to generate a list of these programs available to the end-user. Where as the large program files and include files will be used less often only when a user chooses to run the program. All the attributes will need to be modifiable. I want to avoid having to do the expensive reads and writes of the large attributes every time the ejbLoad and ejbStore methods are called, and only do them when needed. I have a few ideas but I wanted expert input:
1. Create two Entity Beans to model the object. One will contain the commonly used display attributes and the other will contain the less commonly used functional attributes. This will give an easy separation of the object and allow the expensive read/write calls to be used only when needed. I’m not sure if this will lead to integrity issues since a remove of one will necessitate a removal of the other, and this might cause problems.
2. Use only one Entity EJB and instead of having all the fields in the DB be instance variables of the EJB and be loaded and stored with each call of the ejbStore or ejbLoad. For the large and expensive fields I would create methods that pull and load those fields only when explicitly asked for or changed. To me this seems like the best solution but it doesn’t seem to fit in with the idea of Entity Beans but I’m not too sure, I’m very new to EJBs.
I’m sure there are other possible approaches too. Any input is greatly appreciated.
Thanks
David
0
Comment
Question by:NHBFighter
[X]
Welcome to Experts Exchange
Add your voice to the tech community where 5M+ people just like you are talking about what matters.
• Help others & share knowledge
• Earn cash & points
• Learn & ask questions
8 Comments
LVL 35
Expert Comment
by:girionis
ID: 11929075
We had a similar problem though not using EJBs but Hibernate. We did something similar to your first approach, we had one bean represent the commonest/less expensive data and a second bean representing the *all* data. Then it was matter of what we needed to load. The whole data represented binary stuff which was expensive to load up and most of the time we did not need to load it. So we were mainly calling the less expensive bean (the one that represented mainly primitive type data) and only called the "expensive" bean when we really had to. This was a good approach and saved us processing power and memory. The only drawback was that we had to write a separate class and a separate XML mapping for the "less expensive" bean, which was not a big deal if you think about it.
With regards to your approach two, you could do that but indeed it does break the concept of entity beans. If you want to strictly follow the EJB specification better avoid it, but if you really think it is the solution then you might as well go for it.
0
LVL 30
Expert Comment
by:Mayank S
ID: 11929092
Even I would say that the first approach sounds good to me. The idea of dividing the roles amongst two beans is more acceptible, mainly because:
>> allow the expensive read/write calls to be used only when needed
Do have a good hands-on with EJBs or do you also want some links to the EJB specification, tutorials, etc?
0
LVL 4
Author Comment
by:NHBFighter
ID: 11932284
Thankks for the input, I'm just learning EJBs but I'm getting a fairly good handle on it and I've done lots of reading on them but any links would help.
0
Guide to Performance: Optimization & Monitoring
Nowadays, monitoring is a mixture of tools, systems, and codes—making it a very complex process. And with this complexity, comes variables for failure. Get DZone’s new Guide to Performance to learn how to proactively find these variables and solve them before a disruption occurs.
LVL 35
Accepted Solution
by:
girionis earned 84 total points
ID: 11933146
I'd say the best place is this one: http://java.sun.com/j2ee/1.4/docs/tutorial/doc/
0
LVL 30
Assisted Solution
by:Mayank S
Mayank S earned 83 total points
ID: 11939314
You can also try: http://www.ejbtut.com
0
LVL 6
Assisted Solution
by:valipotor
valipotor earned 83 total points
ID: 11951320
The best book on ejbs i'v ever read is Mastering EJB, now second edition, available here
http://www.theserverside.com/
valipotor
0
Featured Post
Free Tool: Site Down Detector
Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.
One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.
Question has a verified solution.
If you are experiencing a similar issue, please ask a related question
Suggested Solutions
Title # Comments Views Activity
Java: anonymous class 4 39
batch vs regular insert in spring DAO 2 25
How to log java errors in tomcat 8 24
Java List 4 42
Java had always been an easily readable and understandable language. Some relatively recent changes in the language seem to be changing this pretty fast, and anyone that had not seen any Java code for the last 5 years will possibly have issues unde…
Are you developing a Java application and want to create Excel Spreadsheets? You have come to the right place, this article will describe how you can create Excel Spreadsheets from a Java Application. For the purposes of this article, I will be u…
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.
730 members asked questions and received personalized solutions in the past 7 days.
Join the community of 500,000 technology professionals and ask your questions.
Join & Ask a Question
|
{
"url": "https://www.experts-exchange.com/questions/21111651/Entity-EJB-Design-question.html",
"source_domain": "www.experts-exchange.com",
"snapshot_id": "crawl=CC-MAIN-2017-17",
"warc_metadata": {
"Content-Length": "178801",
"Content-Type": "application/http; msgtype=response",
"WARC-Block-Digest": "sha1:6V24JYX3FXE2DAQSWPZXXAOVYDR47EQE",
"WARC-Concurrent-To": "<urn:uuid:382a8ec6-6df6-42d9-9d8d-a9d50e463add>",
"WARC-Date": "2017-04-30T06:21:43Z",
"WARC-IP-Address": "104.20.169.10",
"WARC-Identified-Payload-Type": null,
"WARC-Payload-Digest": "sha1:XD2YYQAF3KOOEU546C2F6XMN7O4JCV76",
"WARC-Record-ID": "<urn:uuid:1f8e02ab-8ece-4a57-902d-cde4dafccbe8>",
"WARC-Target-URI": "https://www.experts-exchange.com/questions/21111651/Entity-EJB-Design-question.html",
"WARC-Truncated": "length",
"WARC-Type": "response",
"WARC-Warcinfo-ID": "<urn:uuid:f76db3f3-bff0-46d8-90f6-3088e361c4c0>"
},
"warc_info": "robots: classic\r\nhostname: ip-10-145-167-34.ec2.internal\r\nsoftware: Nutch 1.6 (CC)/CC WarcExport 1.0\r\nisPartOf: CC-MAIN-2017-17\r\noperator: CommonCrawl Admin\r\ndescription: Wide crawl of the web for April 2017\r\npublisher: CommonCrawl\r\nformat: WARC File Format 1.0\r\nconformsTo: http://bibnum.bnf.fr/WARC/WARC_ISO_28500_version1_latestdraft.pdf"
}
|
{
"line_start_idx": [
0,
7,
8,
35,
36,
57,
59,
69,
95,
1117,
1118,
1557,
1558,
2010,
2011,
2095,
2096,
2103,
2109,
2111,
2119,
2142,
2146,
2174,
2175,
2275,
2276,
2310,
2333,
2359,
2370,
2372,
2379,
2380,
2395,
2396,
2408,
2421,
3202,
3203,
3457,
3459,
3461,
3468,
3469,
3484,
3485,
3497,
3510,
3655,
3656,
3724,
3725,
3832,
3834,
3836,
3842,
3843,
3858,
3859,
3873,
3886,
4039,
4041,
4089,
4090,
4371,
4372,
4374,
4381,
4382,
4400,
4401,
4405,
4437,
4450,
4534,
4536,
4538,
4545,
4546,
4564,
4565,
4577,
4609,
4622,
4662,
4664,
4666,
4672,
4673,
4691,
4692,
4705,
4738,
4751,
4752,
4841,
4871,
4872,
4882,
4884,
4885,
4899,
4900,
4930,
4931,
5041,
5042,
5157,
5158,
5192,
5193,
5264,
5265,
5285,
5286,
5318,
5345,
5388,
5426,
5441,
5692,
5940,
6070,
6250,
6251,
6335,
6336,
6415,
6416
],
"line_end_idx": [
7,
8,
35,
36,
57,
59,
69,
95,
1117,
1118,
1557,
1558,
2010,
2011,
2095,
2096,
2103,
2109,
2111,
2119,
2142,
2146,
2174,
2175,
2275,
2276,
2310,
2333,
2359,
2370,
2372,
2379,
2380,
2395,
2396,
2408,
2421,
3202,
3203,
3457,
3459,
3461,
3468,
3469,
3484,
3485,
3497,
3510,
3655,
3656,
3724,
3725,
3832,
3834,
3836,
3842,
3843,
3858,
3859,
3873,
3886,
4039,
4041,
4089,
4090,
4371,
4372,
4374,
4381,
4382,
4400,
4401,
4405,
4437,
4450,
4534,
4536,
4538,
4545,
4546,
4564,
4565,
4577,
4609,
4622,
4662,
4664,
4666,
4672,
4673,
4691,
4692,
4705,
4738,
4751,
4752,
4841,
4871,
4872,
4882,
4884,
4885,
4899,
4900,
4930,
4931,
5041,
5042,
5157,
5158,
5192,
5193,
5264,
5265,
5285,
5286,
5318,
5345,
5388,
5426,
5441,
5692,
5940,
6070,
6250,
6251,
6335,
6336,
6415,
6416,
6437
]
}
|
{
"red_pajama_v2": {
"ccnet_original_length": 6437,
"ccnet_original_nlines": 130,
"rps_doc_curly_bracket": 0,
"rps_doc_ldnoobw_words": 0,
"rps_doc_lorem_ipsum": 0,
"rps_doc_stop_word_fraction": 0.4321839213371277,
"rps_doc_ut1_blacklist": 0,
"rps_doc_frac_all_caps_words": 0.03448275849223137,
"rps_doc_frac_lines_end_with_ellipsis": 0.015267180278897285,
"rps_doc_frac_no_alph_words": 0.16091954708099365,
"rps_doc_frac_unique_words": 0.42688465118408203,
"rps_doc_mean_word_length": 4.642143726348877,
"rps_doc_num_sentences": 55,
"rps_doc_symbol_to_word_ratio": 0.0022988501004874706,
"rps_doc_unigram_entropy": 5.567862033843994,
"rps_doc_word_count": 1101,
"rps_doc_frac_chars_dupe_10grams": 0.02073957957327366,
"rps_doc_frac_chars_dupe_5grams": 0.028957150876522064,
"rps_doc_frac_chars_dupe_6grams": 0.02073957957327366,
"rps_doc_frac_chars_dupe_7grams": 0.02073957957327366,
"rps_doc_frac_chars_dupe_8grams": 0.02073957957327366,
"rps_doc_frac_chars_dupe_9grams": 0.02073957957327366,
"rps_doc_frac_chars_top_2gram": 0.006847970187664032,
"rps_doc_frac_chars_top_3gram": 0.00763060012832284,
"rps_doc_frac_chars_top_4gram": 0.010174130089581013,
"rps_doc_books_importance": -603.0629272460938,
"rps_doc_books_importance_length_correction": -603.0629272460938,
"rps_doc_openwebtext_importance": -336.0362548828125,
"rps_doc_openwebtext_importance_length_correction": -336.0362548828125,
"rps_doc_wikipedia_importance": -277.45782470703125,
"rps_doc_wikipedia_importance_length_correction": -277.45782470703125
},
"fasttext": {
"dclm": 0.020138319581747055,
"english": 0.9417811632156372,
"fineweb_edu_approx": 1.7992528676986694,
"eai_general_math": 0.3308403491973877,
"eai_open_web_math": 0.18375277519226074,
"eai_web_code": 0.08132343739271164
}
}
|
{
"free_decimal_correspondence": {
"primary": {
"code": "005.452",
"labels": {
"level_1": "General works, books and libraries, information sciences",
"level_2": "",
"level_3": "Computer programming"
}
},
"secondary": {
"code": "005.1",
"labels": {
"level_1": "General works, books and libraries, information sciences",
"level_2": "",
"level_3": "Computer programming"
}
}
},
"bloom_cognitive_process": {
"primary": {
"code": "3",
"label": "Apply"
},
"secondary": {
"code": "4",
"label": "Analyze"
}
},
"bloom_knowledge_domain": {
"primary": {
"code": "3",
"label": "Procedural"
},
"secondary": {
"code": "2",
"label": "Conceptual"
}
},
"document_type_v1": {
"primary": {
"code": "5",
"label": "Social/Forum"
},
"secondary": {
"code": "-1",
"label": "Abstain"
}
},
"extraction_artifacts": {
"primary": {
"code": "3",
"label": "Irrelevant Content"
},
"secondary": {
"code": "0",
"label": "No Artifacts"
}
},
"missing_content": {
"primary": {
"code": "0",
"label": "No missing content"
},
"secondary": {
"code": "-1",
"label": "Abstain"
}
},
"document_type_v2": {
"primary": {
"code": "18",
"label": "Q&A Forum"
},
"secondary": {
"code": "8",
"label": "Documentation"
}
},
"reasoning_depth": {
"primary": {
"code": "3",
"label": "Intermediate Reasoning"
},
"secondary": {
"code": "2",
"label": "Basic Reasoning"
}
},
"technical_correctness": {
"primary": {
"code": "3",
"label": "Mostly Correct"
},
"secondary": {
"code": "4",
"label": "Highly Correct"
}
},
"education_level": {
"primary": {
"code": "3",
"label": "Undergraduate Level"
},
"secondary": {
"code": "4",
"label": "Graduate/Expert Level"
}
}
}
|
672f1e42c33a7f9846924a2431ea77df
|
4,312,026,837,164,094,500
|
Slipstreaming Guide To install Windows XP
In 2009, Serial ATA (SATA) has mostly replaced parallel ATA. So installing Windows XP will cause BSOD for certain model, to solve the problems we need to integrate SATA into windows XP Installation disk and this process called slipstream.
Content:
A :Materiel Needed
B: Sata Driver Download
C: Slipstream Guide
Material needed:
1.Nlite Software: Download Here
2. Windows XP CD
3. Empty CD-R/DVD-R
Sata Driver Download
Extract the driver using winrar.
Intel Sata Driver: Download Guide (Intel has moved the download link)
AMD Sata Driver: Download
Nvidia Sata Driver: Download
How to check my model need Intel, AMD or Nvidia sata drivers?
Install CPU-z and run the program, look at the chipset on mainboard tab.
it will show you what type of Chipset you have AMD/ATI, Intel or Nvidia, so select the Sata base on your chipset.
additional info:
If you want more details with pictures, you can read my post: Sata driver for slipstream process here.
If you download the sata directly from Intel (for Intel model), you can found the instruction to extract it here.
Slipstream Guide
1. create a new folder and name it as "WINXP" or any name you like, copy all the content in your xp installation disk (explore cd and press ctrl+A) and paste it in the new folder you just created.
2.Extract the sata driver you downloaded.
3. Intsall Nlite and run it. On the first screen just click next.
4. Now locate/browse to the folder "WINXP" you created.
5.Next and you will come to "Presets", ignore this and click "Next".
6. In "Task Selection", choose "Drivers" and "Bootable ISO" by high-lighting them.
7. For intel select single driver
For amd select multiple driver
8. For intel Browse to the SATA driver folder which you extracted earlier(I named it "Floppy32Bit") and select either one of the .INF file, i suggest "iaahci.inf".
-for amd browse to raid 7xx, slect x86 and select the inf files.
SELECT ONLY x86.
9) A screen like below will pop-up, make sure it's "Textmode driver" and select all of them by holding CTRL+A key and choose "OK", the pictures below for intel installation.
If you arrive at this step for installation its similar for both amd and intel.
10) You shall see something like this. Choose "Next" and you will be prompted.
11) Choose "Yes" to start the process.
12) Let it finish and choose "Next".
13) Finally, you can create your project as ISO image or burn it directly to CD-R under "Mode". choose "Direct Burn". You can put anything for "Label" but not too long. Choose "Burn" and you will be prompted again. You can also choose to create iso to burn using software such as nero.
14) Choose "Yes" to burn it to CD-R. Wait for it to finish and choose "Next"
15) Choose "Finish" to exit nLite.
Additional notes.
-If your slipstreaming process unsuccessful, you can repeat the process but create a new folder and DO NOT USE THE SAME FOLDER.
{ 0 komentarji... read them below or add one }
Objavite komentar
|
{
"url": "http://deascomisojos.blogspot.com/2009/10/slipstreaming-guide-to-install-windows.html",
"source_domain": "deascomisojos.blogspot.com",
"snapshot_id": "crawl=CC-MAIN-2017-34",
"warc_metadata": {
"Content-Length": "39279",
"Content-Type": "application/http; msgtype=response",
"WARC-Block-Digest": "sha1:OFI3EQ2GIWKYM6I5ZDG5BFMAJ7HLSC5Y",
"WARC-Concurrent-To": "<urn:uuid:91c96638-350e-4f7e-a72b-1542da712380>",
"WARC-Date": "2017-08-23T07:58:52Z",
"WARC-IP-Address": "172.217.7.161",
"WARC-Identified-Payload-Type": "application/xhtml+xml",
"WARC-Payload-Digest": "sha1:5NKE7WCW55ZO2CGM5RHJSVHNP6EKSSN5",
"WARC-Record-ID": "<urn:uuid:afd018da-920f-46be-a4ce-fa07c974e40e>",
"WARC-Target-URI": "http://deascomisojos.blogspot.com/2009/10/slipstreaming-guide-to-install-windows.html",
"WARC-Truncated": null,
"WARC-Type": "response",
"WARC-Warcinfo-ID": "<urn:uuid:a4d34ecb-15cf-4788-ad04-458ef683e1e7>"
},
"warc_info": "robots: classic\r\nhostname: ip-10-145-220-33.ec2.internal\r\nsoftware: Nutch 1.6 (CC)\r\nisPartOf: CC-MAIN-2017-34\r\noperator: Common Crawl Admin\r\ndescription: Wide crawl of the web for August 2017\r\npublisher: Common Crawl\r\nformat: WARC File Format 1.0\r\nconformsTo: http://bibnum.bnf.fr/WARC/WARC_ISO_28500_version1_latestdraft.pdf"
}
|
{
"line_start_idx": [
0,
42,
43,
282,
283,
292,
311,
335,
355,
356,
357,
374,
375,
407,
424,
444,
445,
466,
467,
500,
570,
596,
625,
626,
688,
761,
875,
876,
893,
997,
1111,
1112,
1113,
1130,
1131,
1132,
1133,
1330,
1372,
1438,
1439,
1440,
1496,
1497,
1566,
1567,
1650,
1651,
1685,
1716,
1717,
1881,
1882,
1947,
1964,
1965,
1966,
1967,
1968,
2142,
2143,
2223,
2224,
2225,
2226,
2305,
2306,
2307,
2346,
2347,
2348,
2385,
2386,
2387,
2673,
2674,
2675,
2752,
2753,
2754,
2789,
2807,
2935,
2936,
2983,
2984,
3002,
3003
],
"line_end_idx": [
42,
43,
282,
283,
292,
311,
335,
355,
356,
357,
374,
375,
407,
424,
444,
445,
466,
467,
500,
570,
596,
625,
626,
688,
761,
875,
876,
893,
997,
1111,
1112,
1113,
1130,
1131,
1132,
1133,
1330,
1372,
1438,
1439,
1440,
1496,
1497,
1566,
1567,
1650,
1651,
1685,
1716,
1717,
1881,
1882,
1947,
1964,
1965,
1966,
1967,
1968,
2142,
2143,
2223,
2224,
2225,
2226,
2305,
2306,
2307,
2346,
2347,
2348,
2385,
2386,
2387,
2673,
2674,
2675,
2752,
2753,
2754,
2789,
2807,
2935,
2936,
2983,
2984,
3002,
3003,
3004
]
}
|
{
"red_pajama_v2": {
"ccnet_original_length": 3004,
"ccnet_original_nlines": 87,
"rps_doc_curly_bracket": 0.0006657799822278321,
"rps_doc_ldnoobw_words": 0,
"rps_doc_lorem_ipsum": 0,
"rps_doc_stop_word_fraction": 0.30104321241378784,
"rps_doc_ut1_blacklist": 0,
"rps_doc_frac_all_caps_words": 0.06855440139770508,
"rps_doc_frac_lines_end_with_ellipsis": 0,
"rps_doc_frac_no_alph_words": 0.23994038999080658,
"rps_doc_frac_unique_words": 0.443359375,
"rps_doc_mean_word_length": 4.478515625,
"rps_doc_num_sentences": 48,
"rps_doc_symbol_to_word_ratio": 0.0014903099508956075,
"rps_doc_unigram_entropy": 4.953073024749756,
"rps_doc_word_count": 512,
"rps_doc_frac_chars_dupe_10grams": 0,
"rps_doc_frac_chars_dupe_5grams": 0.03401656821370125,
"rps_doc_frac_chars_dupe_6grams": 0,
"rps_doc_frac_chars_dupe_7grams": 0,
"rps_doc_frac_chars_dupe_8grams": 0,
"rps_doc_frac_chars_dupe_9grams": 0,
"rps_doc_frac_chars_top_2gram": 0.03488878905773163,
"rps_doc_frac_chars_top_3gram": 0.03924988955259323,
"rps_doc_frac_chars_top_4gram": 0.013955519534647465,
"rps_doc_books_importance": -285.7063903808594,
"rps_doc_books_importance_length_correction": -285.7063903808594,
"rps_doc_openwebtext_importance": -184.84732055664062,
"rps_doc_openwebtext_importance_length_correction": -184.84732055664062,
"rps_doc_wikipedia_importance": -131.02484130859375,
"rps_doc_wikipedia_importance_length_correction": -131.02484130859375
},
"fasttext": {
"dclm": 0.044287919998168945,
"english": 0.8469674587249756,
"fineweb_edu_approx": 1.2888603210449219,
"eai_general_math": 0.19042468070983887,
"eai_open_web_math": 0.21659350395202637,
"eai_web_code": 0.03235017880797386
}
}
|
{
"free_decimal_correspondence": {
"primary": {
"code": "004.162",
"labels": {
"level_1": "General works, books and libraries, information sciences",
"level_2": "",
"level_3": "Computers and Computer science"
}
},
"secondary": {
"code": "005.1",
"labels": {
"level_1": "General works, books and libraries, information sciences",
"level_2": "",
"level_3": "Computer programming"
}
}
},
"bloom_cognitive_process": {
"primary": {
"code": "3",
"label": "Apply"
},
"secondary": {
"code": "2",
"label": "Understand"
}
},
"bloom_knowledge_domain": {
"primary": {
"code": "3",
"label": "Procedural"
},
"secondary": {
"code": "2",
"label": "Conceptual"
}
},
"document_type_v1": {
"primary": {
"code": "3",
"label": "Reference/Encyclopedic/Educational"
},
"secondary": {
"code": "-1",
"label": "Abstain"
}
},
"extraction_artifacts": {
"primary": {
"code": "0",
"label": "No Artifacts"
},
"secondary": {
"code": "3",
"label": "Irrelevant Content"
}
},
"missing_content": {
"primary": {
"code": "0",
"label": "No missing content"
},
"secondary": {
"code": "2",
"label": "Click Here References"
}
},
"document_type_v2": {
"primary": {
"code": "23",
"label": "Tutorial"
},
"secondary": {
"code": "8",
"label": "Documentation"
}
},
"reasoning_depth": {
"primary": {
"code": "2",
"label": "Basic Reasoning"
},
"secondary": {
"code": "3",
"label": "Intermediate Reasoning"
}
},
"technical_correctness": {
"primary": {
"code": "3",
"label": "Mostly Correct"
},
"secondary": {
"code": "4",
"label": "Highly Correct"
}
},
"education_level": {
"primary": {
"code": "2",
"label": "High School Level"
},
"secondary": {
"code": "3",
"label": "Undergraduate Level"
}
}
}
|
672f1e42c33a7f9846924a2431ea77df
|
-7,870,976,476,469,752,000
|
more stories
small changes count
so many divisions, parallel worlds, horizontal lines, built up walls…. how would it feel to live in a world, where a person would simply be a person, period? a world where genders would be a vast spectrum of interchangeable and evolving identities, wearable like a fragrance or your favourite color? would that world be more confused or more compasionate? maybe both, with one certainty – more opportunities to grow as complex, wonderful human beings. don’t limit yourself – use any toilet you’d like!
Claus (c-7)
Technology expert, community builder, coffee addict red wine and food lover, traveller, photography enthusiast and a lot more. Recently experimenting AR/VR model and image generation and AI generated text and poems.
|
{
"url": "https://worldly.photos/item/small-changes-count/",
"source_domain": "worldly.photos",
"snapshot_id": "crawl=CC-MAIN-2022-21",
"warc_metadata": {
"Content-Length": "317213",
"Content-Type": "application/http; msgtype=response",
"WARC-Block-Digest": "sha1:4Q4NFGRYIW6NFFYW37HAPINHVS5K3PEW",
"WARC-Concurrent-To": "<urn:uuid:3a284c06-1885-45ac-8c4a-19756993ac7e>",
"WARC-Date": "2022-05-28T04:15:10Z",
"WARC-IP-Address": "46.4.87.30",
"WARC-Identified-Payload-Type": "text/html",
"WARC-Payload-Digest": "sha1:QGCSFCXCNO3BDUKG4TAH7X6ICEQWKT7R",
"WARC-Record-ID": "<urn:uuid:a1fc70ae-5cc1-4512-b6d4-70e3bafc5476>",
"WARC-Target-URI": "https://worldly.photos/item/small-changes-count/",
"WARC-Truncated": null,
"WARC-Type": "response",
"WARC-Warcinfo-ID": "<urn:uuid:7a1d601a-52a3-4b13-b5cf-023ae1350954>"
},
"warc_info": "isPartOf: CC-MAIN-2022-21\r\npublisher: Common Crawl\r\ndescription: Wide crawl of the web for May 2022\r\noperator: Common Crawl Admin (info@commoncrawl.org)\r\nhostname: ip-10-67-67-96\r\nsoftware: Apache Nutch 1.18 (modified, https://github.com/commoncrawl/nutch/)\r\nrobots: checked via crawler-commons 1.3-SNAPSHOT (https://github.com/crawler-commons/crawler-commons)\r\nformat: WARC File Format 1.1\r\nconformsTo: https://iipc.github.io/warc-specifications/specifications/warc-format/warc-1.1/"
}
|
{
"line_start_idx": [
0,
13,
14,
34,
35,
537,
538,
550,
551
],
"line_end_idx": [
13,
14,
34,
35,
537,
538,
550,
551,
766
]
}
|
{
"red_pajama_v2": {
"ccnet_original_length": 766,
"ccnet_original_nlines": 8,
"rps_doc_curly_bracket": 0,
"rps_doc_ldnoobw_words": 0,
"rps_doc_lorem_ipsum": 0,
"rps_doc_stop_word_fraction": 0.3642384111881256,
"rps_doc_ut1_blacklist": 0,
"rps_doc_frac_all_caps_words": 0.01986755058169365,
"rps_doc_frac_lines_end_with_ellipsis": 0,
"rps_doc_frac_no_alph_words": 0.19205297529697418,
"rps_doc_frac_unique_words": 0.7685950398445129,
"rps_doc_mean_word_length": 5.107438087463379,
"rps_doc_num_sentences": 8,
"rps_doc_symbol_to_word_ratio": 0.006622519809752703,
"rps_doc_unigram_entropy": 4.3588175773620605,
"rps_doc_word_count": 121,
"rps_doc_frac_chars_dupe_10grams": 0,
"rps_doc_frac_chars_dupe_5grams": 0,
"rps_doc_frac_chars_dupe_6grams": 0,
"rps_doc_frac_chars_dupe_7grams": 0,
"rps_doc_frac_chars_dupe_8grams": 0,
"rps_doc_frac_chars_dupe_9grams": 0,
"rps_doc_frac_chars_top_2gram": 0.019417479634284973,
"rps_doc_frac_chars_top_3gram": 0.03559871017932892,
"rps_doc_frac_chars_top_4gram": 0,
"rps_doc_books_importance": -55.806671142578125,
"rps_doc_books_importance_length_correction": -55.80667495727539,
"rps_doc_openwebtext_importance": -32.57404327392578,
"rps_doc_openwebtext_importance_length_correction": -32.57404327392578,
"rps_doc_wikipedia_importance": -19.565031051635742,
"rps_doc_wikipedia_importance_length_correction": -19.565031051635742
},
"fasttext": {
"dclm": 0.6581864953041077,
"english": 0.9190482497215271,
"fineweb_edu_approx": 2.4792356491088867,
"eai_general_math": 0.011519310064613819,
"eai_open_web_math": 0.05775744095444679,
"eai_web_code": 0.008541700430214405
}
}
|
{
"free_decimal_correspondence": {
"primary": {
"code": "004.019",
"labels": {
"level_1": "General works, books and libraries, information sciences",
"level_2": "",
"level_3": "Computers and Computer science"
}
},
"secondary": {
"code": "305.4",
"labels": {
"level_1": "Social sciences",
"level_2": "",
"level_3": "Social sciences — Periodicals"
}
}
},
"bloom_cognitive_process": {
"primary": {
"code": "5",
"label": "Evaluate"
},
"secondary": {
"code": "2",
"label": "Understand"
}
},
"bloom_knowledge_domain": {
"primary": {
"code": "2",
"label": "Conceptual"
},
"secondary": {
"code": "4",
"label": "Metacognitive"
}
},
"document_type_v1": {
"primary": {
"code": "9",
"label": "Personal/Misc"
},
"secondary": {
"code": "-1",
"label": "Abstain"
}
},
"extraction_artifacts": {
"primary": {
"code": "0",
"label": "No Artifacts"
},
"secondary": {
"code": "-1",
"label": "Abstain"
}
},
"missing_content": {
"primary": {
"code": "0",
"label": "No missing content"
},
"secondary": {
"code": "-1",
"label": "Abstain"
}
},
"document_type_v2": {
"primary": {
"code": "16",
"label": "Personal Blog"
},
"secondary": {
"code": "2",
"label": "About (Personal)"
}
},
"reasoning_depth": {
"primary": {
"code": "2",
"label": "Basic Reasoning"
},
"secondary": {
"code": "1",
"label": "No Reasoning"
}
},
"technical_correctness": {
"primary": {
"code": "6",
"label": "Not Applicable/Indeterminate"
},
"secondary": {
"code": "4",
"label": "Highly Correct"
}
},
"education_level": {
"primary": {
"code": "1",
"label": "General Audience"
},
"secondary": {
"code": "2",
"label": "High School Level"
}
}
}
|
672f1e42c33a7f9846924a2431ea77df
|
8,701,291,833,927,301,000
|
ArcGIS Pro 3.2 API Reference Guide
ArcGIS.Core.CIM Namespace / CIMMargin Class / Left Property
Example
In This Topic
Left Property (CIMMargin)
In This Topic
Gets or sets the left margin.
Syntax
public double Left {get; set;}
Public Property Left As Double
Example
Create report
//Note: Call within QueuedTask.Run()
//The fields in the datasource used for the report
//This uses a US Cities dataset
var listFields = new List<CIMReportField> {
//Grouping should be the first field
new CIMReportField{Name = "STATE_NAME", FieldOrder = 0, Group = true, SortInfo = FieldSortInfo.Desc}, //Group cities using STATES
new CIMReportField{Name = "CITY_NAME", FieldOrder = 1},
new CIMReportField{Name = "POP1990", FieldOrder = 2, },
};
//Definition query to use for the data source
var defQuery = "STATE_NAME LIKE 'C%'";
//Define the Datasource
//pass true to use the selection set
var reportDataSource = new ReportDataSource(featureLayer, defQuery, false, listFields);
//The CIMPage defintion - page size, units, etc
var cimReportPage = new CIMPage
{
Height = 11,
StretchElements = false,
Width = 6.5,
ShowRulers = true,
ShowGuides = true,
Margin = new CIMMargin { Bottom = 1, Left = 1, Right = 1, Top = 1 },
Units = LinearUnit.Inches
};
//Report template
var reportTemplates = await ReportTemplateManager.GetTemplatesAsync();
var reportTemplate = reportTemplates.Where(r => r.Name == "Attribute List with Grouping").First();
//Report Styling
var reportStyles = await ReportStylingManager.GetStylingsAsync();
var reportStyle = reportStyles.Where(s => s == "Cool Tones").First();
//Field Statistics
var fieldStatisticsList = new List<ReportFieldStatistic> {
new ReportFieldStatistic{ Field = "POP1990", Statistic = FieldStatisticsFlag.Sum}
//Note: NoStatistics option for FieldStatisticsFlag is not supported.
};
var report = ReportFactory.Instance.CreateReport("USAReport", reportDataSource, cimReportPage, fieldStatisticsList, reportTemplate, reportStyle);
Modify the report Page
//Note: Call within QueuedTask.Run()
var cimReportPage = new CIMPage
{
Height = 12,
StretchElements = false,
Width = 6.5,
ShowRulers = true,
ShowGuides = true,
Margin = new CIMMargin { Bottom = 1, Left = 1, Right = 1, Top = 1 },
Units = LinearUnit.Inches
};
report.SetPage(cimReportPage);
//Change only the report's page height
report.SetPageHeight(12);
Requirements
Target Platforms: Windows 11, Windows 10
ArcGIS Pro version: 3 or higher.
See Also
|
{
"url": "https://pro.arcgis.com/en/pro-app/latest/sdk/api-reference/topic19719.html",
"source_domain": "pro.arcgis.com",
"snapshot_id": "CC-MAIN-2024-10",
"warc_metadata": {
"Content-Length": "28834",
"Content-Type": "application/http; msgtype=response",
"WARC-Block-Digest": "sha1:7GTZRGZWGEOOWTE7M6ZTG4QE73UQU7T2",
"WARC-Concurrent-To": "<urn:uuid:46852220-095a-410b-a67a-192dee7e5ecf>",
"WARC-Date": "2024-02-25T08:37:44Z",
"WARC-IP-Address": "198.102.60.60",
"WARC-Identified-Payload-Type": "application/xhtml+xml",
"WARC-Payload-Digest": "sha1:N6FO4ZBUJX7NVPTJGLEAAVTZZBDFAXYR",
"WARC-Record-ID": "<urn:uuid:9aeefd5e-1156-4d79-b79c-b39616d95370>",
"WARC-Target-URI": "https://pro.arcgis.com/en/pro-app/latest/sdk/api-reference/topic19719.html",
"WARC-Truncated": null,
"WARC-Type": "response",
"WARC-Warcinfo-ID": "<urn:uuid:e7d0fd4c-ad96-4d9e-91a4-72921f40bb5c>"
},
"warc_info": "isPartOf: CC-MAIN-2024-10\r\npublisher: Common Crawl\r\ndescription: Wide crawl of the web for February/March 2024\r\noperator: Common Crawl Admin (info@commoncrawl.org)\r\nhostname: ip-10-67-67-79\r\nsoftware: Apache Nutch 1.19 (modified, https://github.com/commoncrawl/nutch/)\r\nrobots: checked via crawler-commons 1.5-SNAPSHOT (https://github.com/crawler-commons/crawler-commons)\r\nformat: WARC File Format 1.1\r\nconformsTo: https://iipc.github.io/warc-specifications/specifications/warc-format/warc-1.1/"
}
|
{
"line_start_idx": [
0,
35,
95,
103,
104,
118,
148,
166,
200,
211,
246,
281,
293,
311,
352,
407,
443,
491,
542,
686,
756,
826,
839,
889,
932,
960,
1001,
1093,
1145,
1181,
1187,
1206,
1237,
1256,
1281,
1306,
1381,
1413,
1420,
1425,
1447,
1522,
1625,
1630,
1651,
1721,
1795,
1800,
1823,
1886,
1982,
2066,
2079,
2229,
2256,
2297,
2333,
2339,
2358,
2389,
2408,
2433,
2458,
2533,
2565,
2572,
2607,
2650,
2680,
2697,
2698,
2743,
2744,
2781
],
"line_end_idx": [
35,
95,
103,
104,
118,
148,
166,
200,
211,
246,
281,
293,
311,
352,
407,
443,
491,
542,
686,
756,
826,
839,
889,
932,
960,
1001,
1093,
1145,
1181,
1187,
1206,
1237,
1256,
1281,
1306,
1381,
1413,
1420,
1425,
1447,
1522,
1625,
1630,
1651,
1721,
1795,
1800,
1823,
1886,
1982,
2066,
2079,
2229,
2256,
2297,
2333,
2339,
2358,
2389,
2408,
2433,
2458,
2533,
2565,
2572,
2607,
2650,
2680,
2697,
2698,
2743,
2744,
2781,
2793
]
}
|
{
"red_pajama_v2": {
"ccnet_original_length": 2793,
"ccnet_original_nlines": 73,
"rps_doc_curly_bracket": 0.00787683017551899,
"rps_doc_ldnoobw_words": 0,
"rps_doc_lorem_ipsum": 0,
"rps_doc_stop_word_fraction": 0.10245902091264725,
"rps_doc_ut1_blacklist": 0,
"rps_doc_frac_all_caps_words": 0.022540979087352753,
"rps_doc_frac_lines_end_with_ellipsis": 0,
"rps_doc_frac_no_alph_words": 0.4241803288459778,
"rps_doc_frac_unique_words": 0.5444444417953491,
"rps_doc_mean_word_length": 6.829629421234131,
"rps_doc_num_sentences": 26,
"rps_doc_symbol_to_word_ratio": 0,
"rps_doc_unigram_entropy": 4.713542938232422,
"rps_doc_word_count": 270,
"rps_doc_frac_chars_dupe_10grams": 0.12581345438957214,
"rps_doc_frac_chars_dupe_5grams": 0.16052061319351196,
"rps_doc_frac_chars_dupe_6grams": 0.12581345438957214,
"rps_doc_frac_chars_dupe_7grams": 0.12581345438957214,
"rps_doc_frac_chars_dupe_8grams": 0.12581345438957214,
"rps_doc_frac_chars_dupe_9grams": 0.12581345438957214,
"rps_doc_frac_chars_top_2gram": 0.03416486084461212,
"rps_doc_frac_chars_top_3gram": 0.011930589564144611,
"rps_doc_frac_chars_top_4gram": 0.02928416058421135,
"rps_doc_books_importance": -186.65281677246094,
"rps_doc_books_importance_length_correction": -186.65281677246094,
"rps_doc_openwebtext_importance": -101.89297485351562,
"rps_doc_openwebtext_importance_length_correction": -101.89297485351562,
"rps_doc_wikipedia_importance": -85.87810516357422,
"rps_doc_wikipedia_importance_length_correction": -85.87810516357422
},
"fasttext": {
"dclm": 0.741801381111145,
"english": 0.5950079560279846,
"fineweb_edu_approx": 3.506969928741455,
"eai_general_math": 0.13084620237350464,
"eai_open_web_math": 0.015977859497070312,
"eai_web_code": 0.8674166202545166
}
}
|
{
"free_decimal_correspondence": {
"primary": {
"code": "005.1",
"labels": {
"level_1": "General works, books and libraries, information sciences",
"level_2": "",
"level_3": "Computer programming"
}
},
"secondary": {
"code": "910.285",
"labels": {
"level_1": "History and Geography",
"level_2": "Geography and Voyages and travels",
"level_3": ""
}
}
},
"bloom_cognitive_process": {
"primary": {
"code": "3",
"label": "Apply"
},
"secondary": {
"code": "2",
"label": "Understand"
}
},
"bloom_knowledge_domain": {
"primary": {
"code": "3",
"label": "Procedural"
},
"secondary": {
"code": "2",
"label": "Conceptual"
}
},
"document_type_v1": {
"primary": {
"code": "4",
"label": "Code/Software"
},
"secondary": {
"code": "3",
"label": "Reference/Encyclopedic/Educational"
}
},
"extraction_artifacts": {
"primary": {
"code": "0",
"label": "No Artifacts"
},
"secondary": {
"code": "3",
"label": "Irrelevant Content"
}
},
"missing_content": {
"primary": {
"code": "0",
"label": "No missing content"
},
"secondary": {
"code": "4",
"label": "Missing Images or Figures"
}
},
"document_type_v2": {
"primary": {
"code": "8",
"label": "Documentation"
},
"secondary": {
"code": "23",
"label": "Tutorial"
}
},
"reasoning_depth": {
"primary": {
"code": "2",
"label": "Basic Reasoning"
},
"secondary": {
"code": "3",
"label": "Intermediate Reasoning"
}
},
"technical_correctness": {
"primary": {
"code": "4",
"label": "Highly Correct"
},
"secondary": {
"code": "5",
"label": "Exceptionally Correct"
}
},
"education_level": {
"primary": {
"code": "3",
"label": "Undergraduate Level"
},
"secondary": {
"code": "4",
"label": "Graduate/Expert Level"
}
}
}
|
672f1e42c33a7f9846924a2431ea77df
|
653,022,212,545,107,700
|
May 16, 2017
Why you shouldn't use the System Ruby
When you are getting started with Ruby development, and possibly using a *nix system for the first time, it will seem great that Ruby is already installed there for you. It’s just right there, ready to use and get going, right?
Unfortunately, it’s not the Ruby that you should be using. It will be out of date by the time you even get the operating system most likely, upgrading it would mean that you have to mess with the guts of your computer’s operating system and then even if you do you will likely need to install gems for system wide use with sudo.
But what’s wrong with this?
If you attempt to upgrade your system ruby, you are going to be moving from one version of it to another. There is a very good chance that there are programs on your computer that rely on this version of the system ruby setup the way that it is. This is not the only problem you are likely to face. There is also all the gems that you need. Any time you use the system ruby, you are likely going to need to install your gems like this:
> sudo gem install GEM_NAME
This means that the gem that you are installing will be installed by the root user of your computer, giving it license to run as that user potentially. Do you read and understand all the code in Ruby gems that you install all of the time??? I know I don’t, so you want to limit the reach of these gems to only the things that they need to be able to run and access, your application.
More than one Ruby
And now the main reason you want to avoid your system ruby. You are going to need to run more than one of them. As you work on more projects, there is likely going to be a time when you need to come back to a project that uses an older version of ruby than the one you are using now. You aren’t going to stop working on the other project, and you don’t want to hamstring a new one by hanging onto an older version of Ruby because it came with your computer. Wouldn’t it be great if you could have multiple versions of Ruby that are available to you, installed under your user account that you can switch between as needed?
There’s an app for that
Luckily the multiple version of Ruby future is the world that we live in now. There are several different pieces of open source software available to you that allow you to do this, the most notable being Ruby Version Manager (RVM) and Rbenv. I have used RVM in the past, but after having some issues (that are likely not a problem anymore, this was a few years back) I have moved to using Rbenv, so I am going to go through how to get your personal Ruby development environment up and running using Rbenv.
Install Rbenv
There is great detail on the Rbenv Github Page about how it works and how to install it, and I will quickly go over the installation steps from there here. First, you want to switch to your home directory so that you can install the rbenv software:
> cd
Once you are there, you want to clone the repository:
> git clone https://github.com/rbenv/rbenv.git .rbenv
Once your clone has finished, you have most of what you need. Now you need to run a command:
> ~/.rbenv/bin/rbenv init
to get specific instructions on how to initialize rbenv for your shell. Once you have done that you need to run:
> type rbenv
#=> "rbenv is a function"
And rbenv is setup and ready to go.
Ruby build
Now that you have rbenv we have an optional step, but one that I recommend. Installing Ruby build. This will help simplify the installation of new Ruby versions by providing the rbenv install command:
> rbenv install RUBY_VERSION
The easiest way to do this is to install Ruby build as an rbenv plugin:
git clone https://github.com/rbenv/ruby-build.git ~/.rbenv/plugins/ruby-build
This will give you the latest version. Whenever a new Ruby is released, you will just need to do a git pull on the ruby build plugin, and you will then be able to install a new Ruby.
Install a Ruby
Now that you have rbenv and ruby-build, you are ready to install whatever version of Ruby you need. For me this week it was 2.3.3, so all I needed to do to get that was:
> rbenv install 2.3.3
ruby-build: use openssl from homebrew
Downloading ruby-2.3.3.tar.bz2...
-> https://cache.ruby-lang.org/pub/ruby/2.3/ruby-2.3.3.tar.bz2
Installing ruby-2.3.3...
ruby-build: use readline from homebrew
Installed ruby-2.3.3 to /Users/chris/.rbenv/versions/2.3.3
To start using it, all you have to do is:
> rbenv local 2.3.3
> ruby -v
ruby 2.3.3p222 (2016-11-21 revision 56859) [x86_64-darwin16]
Very simple. Now all we need is bundler to get going with our ruby version and your ruby app:
> gem install bundler
Fetching: bundler-1.14.6.gem (100%)
Successfully installed bundler-1.14.6
Parsing documentation for bundler-1.14.6
Installing ri documentation for bundler-1.14.6
Done installing documentation for bundler after 4 seconds
1 gem installed
> rbenv rehash
Done. We run rbenv rehash after installing a gem that includes executables as it will update what executables are available to Ruby via rbenv.
All Done
Great news, you now have a working ruby development environment on your computer, capable of running more that one version of ruby so you can switch between them as you need to. And because all of this is install into your home directory, if you ever make a mistake and get your ruby versions messed up and into a state that you can’t predict or repair, you can delete everything under ~/.rbenv and just start again by installing the ruby version(s) you need and bundler and getting going again, all without causing any harm to your operating system or the software that depends on it.
I hope this helps you get moving with your Ruby environment. If you have any questions about it or any problems, please feel free to send me an email, or a message on Twitter, I’d love to help if you need it.
Comments?
I've changed how I run my blog now and have decided to not integrate comments into this new version. I am happy to answer any questions though, feel free to send me an email through the link at the top of the screen. Happy Programming.
|
{
"url": "https://chrisherring.co/posts/why-you-shouldn-t-use-the-system-ruby",
"source_domain": "chrisherring.co",
"snapshot_id": "CC-MAIN-2024-33",
"warc_metadata": {
"Content-Length": "11910",
"Content-Type": "application/http; msgtype=response",
"WARC-Block-Digest": "sha1:FOCD5SW55KAWLWG6WLRYHCVNIAFOZ3JJ",
"WARC-Concurrent-To": "<urn:uuid:814f68c4-f238-4ce7-a764-3a2eb88fcb7f>",
"WARC-Date": "2024-08-09T21:58:23Z",
"WARC-IP-Address": "104.21.63.154",
"WARC-Identified-Payload-Type": "text/html",
"WARC-Payload-Digest": "sha1:NTWX3DGNQEV5T6L6GTHYVZ4XQWPZDFP3",
"WARC-Record-ID": "<urn:uuid:25746947-81a4-46e0-b594-f3356f6855ed>",
"WARC-Target-URI": "https://chrisherring.co/posts/why-you-shouldn-t-use-the-system-ruby",
"WARC-Truncated": null,
"WARC-Type": "response",
"WARC-Warcinfo-ID": "<urn:uuid:9b83e580-664b-4758-a447-b30682640edf>"
},
"warc_info": "isPartOf: CC-MAIN-2024-33\r\npublisher: Common Crawl\r\ndescription: Wide crawl of the web for August 2024\r\noperator: Common Crawl Admin (info@commoncrawl.org)\r\nhostname: ip-10-67-67-156\r\nsoftware: Apache Nutch 1.20 (modified, https://github.com/commoncrawl/nutch/)\r\nrobots: checked via crawler-commons 1.5-SNAPSHOT (https://github.com/crawler-commons/crawler-commons)\r\nformat: WARC File Format 1.1\r\nconformsTo: https://iipc.github.io/warc-specifications/specifications/warc-format/warc-1.1/"
}
|
{
"line_start_idx": [
0,
13,
14,
52,
53,
281,
282,
611,
612,
640,
641,
1077,
1078,
1106,
1107,
1491,
1492,
1511,
1512,
2135,
2136,
2160,
2161,
2667,
2668,
2682,
2683,
2932,
2933,
2938,
2939,
2993,
2994,
3048,
3049,
3142,
3143,
3169,
3170,
3283,
3284,
3297,
3323,
3324,
3360,
3361,
3372,
3373,
3574,
3575,
3604,
3605,
3677,
3678,
3756,
3757,
3940,
3941,
3956,
3957,
4127,
4128,
4150,
4188,
4222,
4285,
4310,
4349,
4408,
4409,
4451,
4452,
4472,
4473,
4483,
4544,
4545,
4639,
4640,
4662,
4698,
4736,
4777,
4824,
4882,
4898,
4899,
4914,
4915,
5058,
5059,
5068,
5069,
5655,
5656,
5865,
5866,
5876,
5877
],
"line_end_idx": [
13,
14,
52,
53,
281,
282,
611,
612,
640,
641,
1077,
1078,
1106,
1107,
1491,
1492,
1511,
1512,
2135,
2136,
2160,
2161,
2667,
2668,
2682,
2683,
2932,
2933,
2938,
2939,
2993,
2994,
3048,
3049,
3142,
3143,
3169,
3170,
3283,
3284,
3297,
3323,
3324,
3360,
3361,
3372,
3373,
3574,
3575,
3604,
3605,
3677,
3678,
3756,
3757,
3940,
3941,
3956,
3957,
4127,
4128,
4150,
4188,
4222,
4285,
4310,
4349,
4408,
4409,
4451,
4452,
4472,
4473,
4483,
4544,
4545,
4639,
4640,
4662,
4698,
4736,
4777,
4824,
4882,
4898,
4899,
4914,
4915,
5058,
5059,
5068,
5069,
5655,
5656,
5865,
5866,
5876,
5877,
6112
]
}
|
{
"red_pajama_v2": {
"ccnet_original_length": 6112,
"ccnet_original_nlines": 98,
"rps_doc_curly_bracket": 0,
"rps_doc_ldnoobw_words": 0,
"rps_doc_lorem_ipsum": 0,
"rps_doc_stop_word_fraction": 0.4648805260658264,
"rps_doc_ut1_blacklist": 0,
"rps_doc_frac_all_caps_words": 0.01230992004275322,
"rps_doc_frac_lines_end_with_ellipsis": 0.020202020183205605,
"rps_doc_frac_no_alph_words": 0.19044171273708344,
"rps_doc_frac_unique_words": 0.3076923191547394,
"rps_doc_mean_word_length": 4.402224063873291,
"rps_doc_num_sentences": 85,
"rps_doc_symbol_to_word_ratio": 0.002172339940443635,
"rps_doc_unigram_entropy": 5.035742282867432,
"rps_doc_word_count": 1079,
"rps_doc_frac_chars_dupe_10grams": 0,
"rps_doc_frac_chars_dupe_5grams": 0.03747367858886719,
"rps_doc_frac_chars_dupe_6grams": 0.021052630618214607,
"rps_doc_frac_chars_dupe_7grams": 0.021052630618214607,
"rps_doc_frac_chars_dupe_8grams": 0,
"rps_doc_frac_chars_dupe_9grams": 0,
"rps_doc_frac_chars_top_2gram": 0.01621052995324135,
"rps_doc_frac_chars_top_3gram": 0.013684210367500782,
"rps_doc_frac_chars_top_4gram": 0.010105259716510773,
"rps_doc_books_importance": -596.6231079101562,
"rps_doc_books_importance_length_correction": -596.6231079101562,
"rps_doc_openwebtext_importance": -432.2496032714844,
"rps_doc_openwebtext_importance_length_correction": -432.2496032714844,
"rps_doc_wikipedia_importance": -259.19122314453125,
"rps_doc_wikipedia_importance_length_correction": -259.19122314453125
},
"fasttext": {
"dclm": 0.03857063874602318,
"english": 0.943475067615509,
"fineweb_edu_approx": 1.4915752410888672,
"eai_general_math": 0.18828833103179932,
"eai_open_web_math": 0.10605376958847046,
"eai_web_code": 0.6693593859672546
}
}
|
{
"free_decimal_correspondence": {
"primary": {
"code": "005.133",
"labels": {
"level_1": "General works, books and libraries, information sciences",
"level_2": "",
"level_3": "Computer programming"
}
},
"secondary": {
"code": "004.028",
"labels": {
"level_1": "General works, books and libraries, information sciences",
"level_2": "",
"level_3": "Computers and Computer science"
}
}
},
"bloom_cognitive_process": {
"primary": {
"code": "3",
"label": "Apply"
},
"secondary": {
"code": "2",
"label": "Understand"
}
},
"bloom_knowledge_domain": {
"primary": {
"code": "3",
"label": "Procedural"
},
"secondary": {
"code": "2",
"label": "Conceptual"
}
},
"document_type_v1": {
"primary": {
"code": "3",
"label": "Reference/Encyclopedic/Educational"
},
"secondary": {
"code": "4",
"label": "Code/Software"
}
},
"extraction_artifacts": {
"primary": {
"code": "0",
"label": "No Artifacts"
},
"secondary": {
"code": "-1",
"label": "Abstain"
}
},
"missing_content": {
"primary": {
"code": "0",
"label": "No missing content"
},
"secondary": {
"code": "-1",
"label": "Abstain"
}
},
"document_type_v2": {
"primary": {
"code": "23",
"label": "Tutorial"
},
"secondary": {
"code": "16",
"label": "Personal Blog"
}
},
"reasoning_depth": {
"primary": {
"code": "2",
"label": "Basic Reasoning"
},
"secondary": {
"code": "3",
"label": "Intermediate Reasoning"
}
},
"technical_correctness": {
"primary": {
"code": "4",
"label": "Highly Correct"
},
"secondary": {
"code": "3",
"label": "Mostly Correct"
}
},
"education_level": {
"primary": {
"code": "3",
"label": "Undergraduate Level"
},
"secondary": {
"code": "2",
"label": "High School Level"
}
}
}
|
672f1e42c33a7f9846924a2431ea77df
|
2,281,194,097,660,724,700
|
ietf
[Top] [All Lists]
Re: RFC 2434 term "IESG approval"
2005-07-07 22:25:42
On Thu, 7 Jul 2005, Robert Elze wrote:
The question is what the words in 2434 (to which 2780 refers)
actually mean.
To me, and apparently to some others, it is clear that 2434 is
all about what amount of documentation is required to get IANA
to register an option, and who gets to judge that documentation.
There's no suggestion in 2434 that anything else should be
subject to scrutiny. Read the whole doc, not just the two
sentences that directly apply in isolation.
I have read the whole doc, and I am unable to understand how you
(and those others) come to that conclusion _based on the words that
are actually in the document_.
Would it be unreasonable to ask that you point to some text in the
document to support your claim? Or lacking that, to point to some
publically archived discussion (e.g. last call comments) that
support your position?
Mike Heard
_______________________________________________
Ietf mailing list
Ietf(_at_)ietf(_dot_)org
https://www1.ietf.org/mailman/listinfo/ietf
<Prev in Thread] Current Thread [Next in Thread>
|
{
"url": "http://www.mhonarc.org/archive/html/ietf/2005-07/msg00172.html",
"source_domain": "www.mhonarc.org",
"snapshot_id": "crawl=CC-MAIN-2013-20",
"warc_metadata": {
"Content-Length": "7507",
"Content-Type": "application/http; msgtype=response",
"WARC-Block-Digest": "sha1:ZSYKNFSD7WXA6X7DHAWVYJFZRTVXIJPW",
"WARC-Concurrent-To": "<urn:uuid:9fb20a1b-6d4a-4ce7-9438-98210230fcc3>",
"WARC-Date": "2013-05-25T05:18:39Z",
"WARC-IP-Address": "96.126.125.14",
"WARC-Identified-Payload-Type": null,
"WARC-Payload-Digest": "sha1:FJKIMUHEH53T544RURLO3KPQVUSYEXL5",
"WARC-Record-ID": "<urn:uuid:a9dfe06b-defb-4278-9143-c843ee7684cd>",
"WARC-Target-URI": "http://www.mhonarc.org/archive/html/ietf/2005-07/msg00172.html",
"WARC-Truncated": null,
"WARC-Type": "response",
"WARC-Warcinfo-ID": "<urn:uuid:5e7416e7-f9f8-4cc4-a5e7-5148b7b57747>"
},
"warc_info": "robots: classic\r\nhostname: ip-10-60-113-184.ec2.internal\r\nsoftware: Nutch 1.6 (CC)/CC WarcExport 1.0\r\nisPartOf: CC-MAIN-2013-20\r\noperator: CommonCrawl Admin\r\ndescription: Wide crawl of the web with URLs provided by Blekko for Spring 2013\r\npublisher: CommonCrawl\r\nformat: WARC File Format 1.0\r\nconformsTo: http://bibnum.bnf.fr/WARC/WARC_ISO_28500_version1_latestdraft.pdf"
}
|
{
"line_start_idx": [
0,
5,
23,
24,
58,
59,
79,
118,
180,
195,
196,
259,
322,
389,
448,
507,
551,
552,
617,
685,
716,
717,
784,
851,
913,
936,
937,
948,
949,
950,
998,
1016,
1041,
1085,
1086,
1087,
1088
],
"line_end_idx": [
5,
23,
24,
58,
59,
79,
118,
180,
195,
196,
259,
322,
389,
448,
507,
551,
552,
617,
685,
716,
717,
784,
851,
913,
936,
937,
948,
949,
950,
998,
1016,
1041,
1085,
1086,
1087,
1088,
1136
]
}
|
{
"red_pajama_v2": {
"ccnet_original_length": 1136,
"ccnet_original_nlines": 36,
"rps_doc_curly_bracket": 0,
"rps_doc_ldnoobw_words": 0,
"rps_doc_lorem_ipsum": 0,
"rps_doc_stop_word_fraction": 0.3739837408065796,
"rps_doc_ut1_blacklist": 0,
"rps_doc_frac_all_caps_words": 0.020325200632214546,
"rps_doc_frac_lines_end_with_ellipsis": 0,
"rps_doc_frac_no_alph_words": 0.2601625919342041,
"rps_doc_frac_unique_words": 0.6312848925590515,
"rps_doc_mean_word_length": 4.67597770690918,
"rps_doc_num_sentences": 12,
"rps_doc_symbol_to_word_ratio": 0,
"rps_doc_unigram_entropy": 4.424561500549316,
"rps_doc_word_count": 179,
"rps_doc_frac_chars_dupe_10grams": 0,
"rps_doc_frac_chars_dupe_5grams": 0,
"rps_doc_frac_chars_dupe_6grams": 0,
"rps_doc_frac_chars_dupe_7grams": 0,
"rps_doc_frac_chars_dupe_8grams": 0,
"rps_doc_frac_chars_dupe_9grams": 0,
"rps_doc_frac_chars_top_2gram": 0.021505380049347878,
"rps_doc_frac_chars_top_3gram": 0.028673840686678886,
"rps_doc_frac_chars_top_4gram": 0.03584228828549385,
"rps_doc_books_importance": -111.34949493408203,
"rps_doc_books_importance_length_correction": -111.34949493408203,
"rps_doc_openwebtext_importance": -81.35137176513672,
"rps_doc_openwebtext_importance_length_correction": -76.66329193115234,
"rps_doc_wikipedia_importance": -57.67979431152344,
"rps_doc_wikipedia_importance_length_correction": -57.67979431152344
},
"fasttext": {
"dclm": 0.06415235996246338,
"english": 0.8837246298789978,
"fineweb_edu_approx": 1.3245431184768677,
"eai_general_math": 0.5114539265632629,
"eai_open_web_math": 0.3477036952972412,
"eai_web_code": 0.2343253493309021
}
}
|
{
"free_decimal_correspondence": {
"primary": {
"code": "004.67",
"labels": {
"level_1": "General works, books and libraries, information sciences",
"level_2": "",
"level_3": "Computers and Computer science"
}
},
"secondary": {
"code": "351.4",
"labels": {
"level_1": "Social sciences",
"level_2": "Public administration and Military art and science",
"level_3": "Public administration"
}
}
},
"bloom_cognitive_process": {
"primary": {
"code": "5",
"label": "Evaluate"
},
"secondary": {
"code": "2",
"label": "Understand"
}
},
"bloom_knowledge_domain": {
"primary": {
"code": "2",
"label": "Conceptual"
},
"secondary": {
"code": "3",
"label": "Procedural"
}
},
"document_type_v1": {
"primary": {
"code": "5",
"label": "Social/Forum"
},
"secondary": {
"code": "-1",
"label": "Abstain"
}
},
"extraction_artifacts": {
"primary": {
"code": "3",
"label": "Irrelevant Content"
},
"secondary": {
"code": "-1",
"label": "Abstain"
}
},
"missing_content": {
"primary": {
"code": "0",
"label": "No missing content"
},
"secondary": {
"code": "-1",
"label": "Abstain"
}
},
"document_type_v2": {
"primary": {
"code": "8",
"label": "Documentation"
},
"secondary": {
"code": "18",
"label": "Q&A Forum"
}
},
"reasoning_depth": {
"primary": {
"code": "3",
"label": "Intermediate Reasoning"
},
"secondary": {
"code": "2",
"label": "Basic Reasoning"
}
},
"technical_correctness": {
"primary": {
"code": "6",
"label": "Not Applicable/Indeterminate"
},
"secondary": {
"code": "3",
"label": "Mostly Correct"
}
},
"education_level": {
"primary": {
"code": "4",
"label": "Graduate/Expert Level"
},
"secondary": {
"code": "3",
"label": "Undergraduate Level"
}
}
}
|
672f1e42c33a7f9846924a2431ea77df
|
512,742,126,265,178,750
|
Demo entry 6659053
UNO
Submitted by anonymous on Nov 08, 2017 at 23:42
Language: C++. Code size: 775 Bytes.
#include <iostream>
using namespace std;
void k_PrimerosPrimos(int n);
int main()
{
k_PrimerosPrimos(9);
return 0;
}
// Ejer1: Escriba un porgrama que reciba un numero k>=5 y retorne los k primeros numero primos.
void k_PrimerosPrimos(int k)
{
int contador=0;
int aux=0;
if (k>=5)
{
cout<<1<<" - "<<2<<" - "<<3<<" - "<<5<<" - ";
for (int i=6;contador<=k;i++)
{
for (int j=2;j<=5;j++)
{
if (i%j==0) break;
{
cout<<i<<" - ";
contador++;
}
}
}
cout<<endl;
}
else
cout<<"El numero ingresado debe ser mayo que 5"<<endl;
}
This snippet took 0.00 seconds to highlight.
Back to the Entry List or Home.
Delete this entry (admin only).
|
{
"url": "http://pygments.org/demo/6659053/",
"source_domain": "pygments.org",
"snapshot_id": "crawl=CC-MAIN-2018-13",
"warc_metadata": {
"Content-Length": "10110",
"Content-Type": "application/http; msgtype=response",
"WARC-Block-Digest": "sha1:6XSXCGT532P747VA7SU4QFCRKYSWOCE5",
"WARC-Concurrent-To": "<urn:uuid:9d7e6994-293b-4350-925f-761b28bf284f>",
"WARC-Date": "2018-03-24T17:56:33Z",
"WARC-IP-Address": "148.251.50.164",
"WARC-Identified-Payload-Type": "application/xhtml+xml",
"WARC-Payload-Digest": "sha1:D66MVWR22CN2EEWZCONAJHNDLZYXGRYX",
"WARC-Record-ID": "<urn:uuid:19fc885e-8118-482b-9953-1898795dfe61>",
"WARC-Target-URI": "http://pygments.org/demo/6659053/",
"WARC-Truncated": "length",
"WARC-Type": "response",
"WARC-Warcinfo-ID": "<urn:uuid:5e819e7a-4566-4f33-96dc-2456abf2d6d2>"
},
"warc_info": "robots: classic\r\nhostname: ip-10-142-73-130.ec2.internal\r\nsoftware: Nutch 1.6 (CC)\r\nisPartOf: CC-MAIN-2018-13\r\noperator: Common Crawl Admin\r\ndescription: Wide crawl of the web for March 2018\r\npublisher: Common Crawl\r\nformat: WARC File Format 1.0\r\nconformsTo: http://bibnum.bnf.fr/WARC/WARC_ISO_28500_version1_latestdraft.pdf"
}
|
{
"line_start_idx": [
0,
19,
20,
24,
25,
29,
30,
78,
115,
116,
136,
137,
158,
188,
189,
200,
202,
227,
241,
243,
339,
368,
370,
390,
405,
419,
425,
479,
517,
527,
562,
576,
611,
612,
634,
671,
704,
726,
740,
741,
751,
771,
777,
786,
849,
850,
851,
853,
854,
899,
900,
932,
933
],
"line_end_idx": [
19,
20,
24,
25,
29,
30,
78,
115,
116,
136,
137,
158,
188,
189,
200,
202,
227,
241,
243,
339,
368,
370,
390,
405,
419,
425,
479,
517,
527,
562,
576,
611,
612,
634,
671,
704,
726,
740,
741,
751,
771,
777,
786,
849,
850,
851,
853,
854,
899,
900,
932,
933,
964
]
}
|
{
"red_pajama_v2": {
"ccnet_original_length": 964,
"ccnet_original_nlines": 52,
"rps_doc_curly_bracket": 0.012448130175471306,
"rps_doc_ldnoobw_words": 0,
"rps_doc_lorem_ipsum": 0,
"rps_doc_stop_word_fraction": 0.16587677597999573,
"rps_doc_ut1_blacklist": 0,
"rps_doc_frac_all_caps_words": 0.009478669613599777,
"rps_doc_frac_lines_end_with_ellipsis": 0,
"rps_doc_frac_no_alph_words": 0.5165876746177673,
"rps_doc_frac_unique_words": 0.8217821717262268,
"rps_doc_mean_word_length": 4.762376308441162,
"rps_doc_num_sentences": 7,
"rps_doc_symbol_to_word_ratio": 0.004739339929074049,
"rps_doc_unigram_entropy": 4.3329243659973145,
"rps_doc_word_count": 101,
"rps_doc_frac_chars_dupe_10grams": 0,
"rps_doc_frac_chars_dupe_5grams": 0,
"rps_doc_frac_chars_dupe_6grams": 0,
"rps_doc_frac_chars_dupe_7grams": 0,
"rps_doc_frac_chars_dupe_8grams": 0,
"rps_doc_frac_chars_dupe_9grams": 0,
"rps_doc_frac_chars_top_2gram": 0.09147609025239944,
"rps_doc_frac_chars_top_3gram": 0,
"rps_doc_frac_chars_top_4gram": 0,
"rps_doc_books_importance": -102.30278015136719,
"rps_doc_books_importance_length_correction": -102.30278015136719,
"rps_doc_openwebtext_importance": -77.95211791992188,
"rps_doc_openwebtext_importance_length_correction": -64.4295425415039,
"rps_doc_wikipedia_importance": -72.85865783691406,
"rps_doc_wikipedia_importance_length_correction": -72.85865783691406
},
"fasttext": {
"dclm": 0.11184954643249512,
"english": 0.16425687074661255,
"fineweb_edu_approx": 1.3816137313842773,
"eai_general_math": 0.016749199479818344,
"eai_open_web_math": 0.2823023796081543,
"eai_web_code": 0.3705712556838989
}
}
|
{
"free_decimal_correspondence": {
"primary": {
"code": "005.1",
"labels": {
"level_1": "General works, books and libraries, information sciences",
"level_2": "",
"level_3": "Computer programming"
}
},
"secondary": {
"code": "512.7",
"labels": {
"level_1": "Science and Natural history",
"level_2": "Mathematics",
"level_3": "Algebra"
}
}
},
"bloom_cognitive_process": {
"primary": {
"code": "3",
"label": "Apply"
},
"secondary": {
"code": "2",
"label": "Understand"
}
},
"bloom_knowledge_domain": {
"primary": {
"code": "3",
"label": "Procedural"
},
"secondary": {
"code": "2",
"label": "Conceptual"
}
},
"document_type_v1": {
"primary": {
"code": "4",
"label": "Code/Software"
},
"secondary": {
"code": "3",
"label": "Reference/Encyclopedic/Educational"
}
},
"extraction_artifacts": {
"primary": {
"code": "0",
"label": "No Artifacts"
},
"secondary": {
"code": "3",
"label": "Irrelevant Content"
}
},
"missing_content": {
"primary": {
"code": "0",
"label": "No missing content"
},
"secondary": {
"code": "-1",
"label": "Abstain"
}
},
"document_type_v2": {
"primary": {
"code": "8",
"label": "Documentation"
},
"secondary": {
"code": "23",
"label": "Tutorial"
}
},
"reasoning_depth": {
"primary": {
"code": "2",
"label": "Basic Reasoning"
},
"secondary": {
"code": "3",
"label": "Intermediate Reasoning"
}
},
"technical_correctness": {
"primary": {
"code": "4",
"label": "Highly Correct"
},
"secondary": {
"code": "3",
"label": "Mostly Correct"
}
},
"education_level": {
"primary": {
"code": "2",
"label": "High School Level"
},
"secondary": {
"code": "3",
"label": "Undergraduate Level"
}
}
}
|
672f1e42c33a7f9846924a2431ea77df
|
3,127,833,847,270,969,000
|
February 2013
Volume 28 Number 02
StreamInsight - Taming the Event Stream: Fast Approximate Counting
By Michael Meijer | February 2013
So you have a voluminous and potentially infinite stream of events such as a clickstream, sensor data, credit-card transaction data or Internet traffic. It’s infeasible to store all events or analyze them in multiple passes. Why not resort to a window of recent events to simplify analysis?
Suppose you want to count the number of interesting events in a large window covering the latest N events of the stream. A naïve approach to counting requires all N events to be in memory and a full iteration over them. As the window slides upon the arrival of a new event, its oldest event expires and the new event is inserted. Counting over the new window from scratch wastes the processing time spent on N-2 events shared. Yuck! This article explains a data structure to reduce memory space usage and processing time to a small fraction of what would be required with that method, while supporting an event rate exceeding many thousands of events per second on commodity hardware. This article also shows how to embed the data structure in a user-defined stream operator in C# for the Microsoft streaming data processor, StreamInsight 2.1. Intermediate programming skills are required to follow along, and some experience with StreamInsight can come in handy.
A Tale of Counting
Before diving into StreamInsight, I’ll investigate the seemingly trivial problem of counting. For simplicity, assume the stream has events with payloads of 0 or 1—uninteresting and interesting events, respectively (regardless of what constitutes “interesting” in your specific scenario). The number of 1s is counted over a (fixed-size) count-based window containing the most recent N events. Naïve counting takes O(N) time and space.
As an astute reader, you probably came up with the idea of maintaining the count between consecutive windows and incrementing it for new 1s and decrementing it for expired 1s, sharing the N-2 events already processed. Good thinking! Maintaining the count now takes O(1) time. However, should you decrement for an expired event or not? Unless you know the actual event, the count can’t be maintained. Unfortunately, to know the events until they have expired requires the entire window in memory—that is, it takes O(N) space. Another strategy might be to filter out the uninteresting events and count only the remaining interesting events. But that doesn’t reduce computational complexity and leaves you with a variable-size window.
Can the memory beast be tamed? Yes, it can! However, it requires a compromise between processing time and memory space at the expense of accuracy. The seminal paper by Mayur Datar, Aristides Gionis, Piotr Indyk and Rajeev Motwani titled “Maintaining Stream Statistics over Sliding Windows” (stanford.io/SRjWT0) describes a data structure called the exponential histogram. It maintains an approximate count over the last N events with a bounded relative error ε. This means that at all times:
Conceptually, the histogram stores events in buckets. Every bucket initially covers one event, so it has a count of 1 and a timestamp of the event it covers. When an event arrives, expired buckets (covering expired events) are removed. A bucket is created only for an interesting event. As buckets are created over time, they’re merged to save memory. Buckets are merged so they have exponentially growing counts from the most recent to the last bucket, that is, 1, 1, ..., 2, 2, ..., 4, 4, ..., 8, 8 and so on. This way, the number of buckets is logarithmic in the window size N. More precisely, it requires O(1⁄ε log N) time and space for maintenance. All but the last bucket cover only non-expired events. The last bucket covers at least one non-expired event. Its count must be estimated, which causes the error in approximating the overall count. Hence, the last bucket must be kept small enough to respect the relative error upper bound.
In the next section, the implementation of the exponential histogram in C# is discussed with a bare minimum of math. Read the aforementioned paper for the intricate details. I’ll explain the code and follow up with a pen-and-paper example. The histogram is a building block for the StreamInsight user-defined stream operator developed later in this article.
To Bucket or Not to Bucket
Here’s the bucket class:
[DataContract]
public class Bucket
{
[DataMember]
private long timestamp;
[DataMember]
private long count;
public long Timestamp {
get { return timestamp; }
set { timestamp = value; } }
public long Count { get { return count; } set { count = value; } }
}
It has a count of the (interesting) events it covers and a timestamp of the most recent event it covers. Only the last bucket can cover expired events, as mentioned, but it must cover at least one non-expired event. Hence, all but the last bucket counts are exact. The last bucket count must be estimated by the histogram. Buckets containing only expired events are themselves expired and can be removed from the histogram.
Using just two operations, the exponential histogram ensures a relative error upper bound ε on the count of interesting events over the N most recent events. One operation is for updating the histogram with new and expired events, maintaining the buckets. The other is for querying the approximate count from the buckets. The histogram class outline is shown in Figure 1. Next to the linked list of buckets, its key variables are the window size (n), the relative error upper bound (epsilon) and the cached sum of all bucket counts (total). In the constructor, the given window size, the given relative error upper bound and an initial empty list of buckets are set.
Figure 1 The Exponential Histogram Class Outline
[DataContract]
public class ExponentialHistogram
{
[DataMember]
private long n;
[DataMember]
private double epsilon;
[DataMember]
private long total;
[DataMember]
private LinkedList<Bucket> buckets;
public ExponentialHistogram(long n, double epsilon)
{
this.n = n;
this.epsilon = epsilon;
this.buckets = new LinkedList<Bucket>();
}
public void Update(long timestamp, bool e) { ... }
protected void ExpireBuckets(long timestamp) { ... }
protected void PrependNewBucket(long timestamp) { ... }
protected void MergeBuckets() { ... }
public long Query() { ... }
}
The maintenance of the histogram is performed by this update method:
public void Update(long timestamp, bool eventPayload)
{
RemoveExpiredBuckets(timestamp);
// No new bucket required; done processing
if (!eventPayload)
return;
PrependNewBucket(timestamp);
MergeBuckets();
}
It accepts a discrete timestamp, as opposed to wall-clock time, to determine what the latest N events are. This is used to find and remove expired buckets. If the new event has a payload of 0 (false), processing stops. When the new event has a payload of 1 (true), a new bucket is created and prepended to the list of buckets. The real fireworks are in merging the buckets. The methods called by the update method are discussed in sequence.
Here’s the code for the removal of buckets:
protected void RemoveExpiredBuckets(long timestamp)
{
LinkedListNode<Bucket> node = buckets.Last;
// A bucket expires if its timestamp
// is before or at the current timestamp - n
while (node != null && node.Value.Timestamp <= timestamp - n)
{
total -= node.Value.Count;
buckets.RemoveLast();
node = buckets.Last;
}
}
The traversal starts from the oldest (last) bucket and ends at the first non-expired bucket. Each bucket whose most recent event’s timestamp is expired—that is, whose timestamp is no greater than the current timestamp minus the window size—is removed from the list. This is where the discrete timestamp comes in. The sum of all bucket counts (total) is decremented by the count of each expired bucket.
After expired events and buckets are accounted for, the new event is processed:
protected void PrependNewBucket(long timestamp)
{
Bucket newBucket = new Bucket()
{
Timestamp = timestamp,
Count = 1
};
buckets.AddFirst(newBucket);
total++;
}
A new bucket for the event with a payload of 1 (true) is created with a count of 1 and a timestamp equal to the current timestamp. The new bucket is prepended to the list of buckets and the sum of all bucket counts (total) is incremented.
The memory space-saving and error-bounding magic is in the merging of buckets. The code is listed in Figure 2. Buckets are merged so that consecutive buckets have exponentially growing counts, that is, 1, 1, ..., 2, 2, ..., 4, 4, ..., 8, 8 and so on. The number of buckets with the same count is determined by the choice of the relative error upper bound ε. The total number of buckets grows logarithmically with the size of the window n, which explains the memory space savings. As many buckets as possible are merged, but the last bucket’s count is kept small enough (compared to the sum of the other bucket counts) to ensure the relative error is bounded.
Figure 2 Merging Buckets in the Histogram
protected void MergeBuckets()
{
LinkedListNode<Bucket> current = buckets.First;
LinkedListNode<Bucket> previous = null;
int k = (int)Math.Ceiling(1 / epsilon);
int kDiv2Add2 = (int)(Math.Ceiling(0.5 * k) + 2);
int numberOfSameCount = 0;
// Traverse buckets from first to last, hence in order of
// descending timestamp and ascending count
while (current != null)
{
if (previous != null && previous.Value.Count == current.Value.Count)
numberOfSameCount++;
else
numberOfSameCount = 1;
// Found k/2+2 buckets of the same count?
if (numberOfSameCount == kDiv2Add2)
{
// Merge oldest (current and previous) into current
current.Value.Timestamp = previous.Value.Timestamp;
current.Value.Count = previous.Value.Count + current.Value.Count;
buckets.Remove(previous);
// A merged bucket can cause a cascade of merges due to
// its new count, continue iteration from merged bucket
// otherwise the cascade might go unnoticed
previous = current.Previous;
}
else
{
// No merge, continue iteration with next bucket
previous = current;
current = current.Next;
}
}
}
More formally, buckets have non-decreasing counts from the first (most recent) to the last (oldest) bucket in the list. The bucket counts are constrained to powers of two. Let k = 1⁄ε and k⁄2 be an integer, or else replace the latter by . Except for the last bucket’s count, let there be at least k⁄2 and at most k⁄2 + 1 buckets of the same count. Whenever there are k⁄2 + 2 buckets of the same count, the oldest two are merged into one bucket with twice the count of the oldest bucket and the most recent of their timestamps. Whenever two buckets are merged, traversal continues from the merged bucket. The merge can cause a cascade of merges. Otherwise traversal continues from the next bucket.
To get a feeling for the count approximation, look at the histogram’s query method:
public long Query()
{
long last = buckets.Last != null ? buckets.Last.Value.Count : 0;
return (long)Math.Ceiling(total - last / 2.0);
}
The sum of the bucket counts up to the last bucket is exact. The last bucket must cover at least one non-expired event, otherwise the bucket is expired and removed. Its count must be estimated because it can cover expired events. By estimating the actual count of the last bucket as half the last bucket’s count, the absolute error of that estimate is no larger than half that bucket’s count. The overall count is estimated by the sum of all bucket counts (total) minus half the last bucket’s count. To ensure the absolute error is within bounds of the relative error, the last bucket’s influence must be small enough compared to the sum of the other bucket counts. Thankfully, this is ensured by the merge procedure.
Do the code listings and explanations up to this point leave you puzzled about the workings of the histogram? Read through the following example.
Suppose you have a newly initialized histogram with window size n = 7 and relative error upper bound ε = 0.5, so k = 2. The histogram develops as shown in Figure 3, and a schematic overview of this histogram is depicted in Figure 4. In Figure 3, merges are at timestamps 5, 7 and 9. A cascaded merge is at timestamp 9. An expired bucket is at timestamp 13. I’ll go into more detail about this.
Figure 3 Example of the Exponential Histogram
Timestamp Event
Buckets (Timestamp, Count)
Newest … Oldest
Total Query Exact
Relative
Error
1 0 0 0 0 0
2 1 (2,1) 1 1 1 0
3 1 (3,1) (2,1) 2 2 2 0
4 0 (3,1) (2,1) 2 2 2 0
5
(merge)
1 (5,1) (3,1) (2,1) 3 2 3 0.333...
(5,1) (3,2)
6 1 (6,1) (5,1) (3,2) 4 3 4 0.25
7
(merge)
1 (7,1) (6,1) (5,1) (3,2) 5 4 5 0.2
(7,1) (6,2) (3,2)
8 1 (8,1) (7,1) (6,2) (3,2) 6 5 6 0.166...
9
(merge)
(cascaded merge)
1 (9,1) (8,1) (7,1) (6,2) (3,2) 7 5 6 0.166...
(9,1) (8,2) (6,2) (3,2)
(9,1) (8,2) (6,4)
10 0 (9,1) (8,2) (6,4) 7 5 5 0
11 0 (9,1) (8,2) (6,4) 7 5 5 0
12 0 (9,1) (8,2) (6,4) 7 5 4 0.25
13 0 (9,1) (8,2) 3 2 3 0.333...
A Schematic Overview of the Histogram Depicted in Figure 3
Figure 4 A Schematic Overview of the Histogram Depicted in Figure 3
The first event has no effect. At the fifth event, a merge of the oldest buckets occurs because there are Text Box: k⁄2 + 2 buckets with the same count of 1. Again, a merge happens at the seventh event. At the ninth event, a merge cascades into another merge. Note that after the seventh event, the first event expires. No bucket carries an expired timestamp until the 13th event. At the 13th event, the bucket with timestamp 6 no longer covers at least one non-expired event and thus expires. Note that the observed relative error is clearly less than the relative error upper bound.
In Figure 4, a dotted box is the window size at that point; it contains the buckets and implies the span of events covered. A solid box is a bucket with timestamp on top and count on bottom. Situation A shows the histogram at timestamp 7 with arrows to the counted events. Situation B shows the histogram at timestamp 9. The last bucket covers expired events. Situation C shows the histogram at timestamp 13. The bucket with timestamp 6 expired.
After putting it all together, I wrote a small demonstration program for the exponential histogram (check out the source code download for this article). The results are shown in Figure 5. It simulates a stream of 100 million events with a count-based window size N of 1 million events. Each event has a payload of 0 or 1 with 50 percent chance. It estimates the approximate count of 1s with an arbitrarily chosen relative error upper bound ε of 1 percent, or 99 percent accuracy. The memory savings of the histogram are huge compared to windows; the number of buckets is far less than the number of events in the window. An event rate of a few hundred thousand events per second is achieved on a machine with an Intel 2.4 GHz dual-core processor and 3GB of RAM running Windows 7.
Empirical Results for the Exponential Histogram
Figure 5 Empirical Results for the Exponential Histogram
A Beauty Called StreamInsight
Perhaps you’re wondering what Microsoft StreamInsight is and where it fits in. This section provides some basics. StreamInsight is a robust, high-performance, low-overhead, near-zero-latency and extremely flexible engine for processing on streams. It’s currently at version 2.1. The full version requires a SQL Server license, though a trial version is available. It’s run either as a stand-alone service or embedded in-process.
At the heart of streaming data processing is a model with temporal streams of events. Conceptually, it’s a potentially infinite and voluminous collection of data arriving over time. Think of stock exchange prices, weather telemetry, power monitoring, Web clicks, Internet traffic, toll booths and so on. Each event in the stream has a header with metadata and a payload of data. In the header of the event, a timestamp is kept, at a minimum. Events can arrive steadily, intermittently or perhaps in bursts of up to many thousands per second. Events come in three flavors: An event can be confined to a point in time; be valid for a certain interval; or be valid for an open-ended interval (edge). Besides events from the stream, a special punctuation event is issued by the engine called the Common Time Increment (CTI). Events can’t be inserted into the stream with a timestamp less than the CTI’s timestamp. Effectively, CTI events determine the extent to which events can arrive out of order. Thankfully, StreamInsight takes care of this.
Heterogeneous sources of input and sinks of output streams must somehow be adapted to fit into this model. The events in the (queryable) temporal streams are captured in an IQStreamable<TPayload>. Event payloads are conceptually pulled by enumeration or pushed by observation into the stream. Hence, underlying data can be exposed through an IEnumerable<T>/IQueryable<T> (Reactive Extension) or IObservable<T>/IQbservable<T> (Reactive Extension), respectively, parameterized with the type of data exposed. They leave the maintenance of temporal aspects to the processing engine. Conversion from and to the various interfaces is possible.
The sources and sinks just discussed live on the boundaries, whereas the actual processing happens within queries. A query is a basic unit of composition written in LINQ. It continuously processes events from one or more streams and outputs another stream. Queries are used to project, filter, group-apply, multicast, operate/aggregate, join, union and window events. Operators can be user-defined. They work on events (incremental) or on windows (non-incremental) as they arrive.
A note on windowing is in order. Windowing partitions a stream into finite subsets of events that might overlap between consecutive windows. Windowing effectively produces a stream of windows, reflected by an IQWindowedStreamable<TPayload> in StreamInsight. Currently, three different kinds of windowing constructs are supported: count-based, time-based and snapshot windows. Count-based windows cover the most recent N events and slide upon the arrival of a new event, expiring the oldest and inserting the newest. Time-based windows cover the most recent events in the most recent interval of time and slide by some interval (also called hopping or tumbling). Snapshot windows are driven by event start and end times; that is, for every pair of closest event start and end times, a window is created. In contrast to time-based windows driven by intervals along the timeline, regardless of events, snapshot windows aren’t fixed along the timeline.
That just scratches the surface. More information is available from several sources, including the online Developer’s Guide (bit.ly/T7Trrx), “A Hitchhiker’s Guide to StreamInsight 2.1 Queries” (bit.ly/NbybvY), CodePlex examples, the StreamInsight team blog (blogs.msdn.com/b/streaminsight) and others.
Putting It All Together
The foundations are laid. At this point, you’re probably wondering how approximate counting is brought to life in StreamInsight. In short, some (temporal) source stream of point-in-time events, carrying a payload of 0 or 1, is required. It’s fed into a query that computes the approximate count of 1s over the N most recent events using the exponential histogram. The query produces some (temporal) stream of point-in-time events—carrying the approximate count—that’s fed into a sink.
Let’s start with a user-defined operator for approximate counting. You might be tempted to capture the N most recent events using the count-based windowing construct. Think again! That would defy the memory-saving benefits of the exponential histogram. Why? The construct forces entire windows of events to be kept in memory. It’s not required by the exponential histogram, because it has an equivalent implicit notion of windowing through the maintenance of buckets. Moreover, having an operator over windows is non-incremental, that is, with no processing of events as they arrive, but only when a (next) window is available. The solution is a user-defined stream operator without explicit windowing constructs on the query. The code is listed in Figure 6.
Figure 6 User-Defined Stream Operator Implementation
[DataContract]
public class ApproximateCountUDSO : CepPointStreamOperator<bool, long>
{
[DataMember]
private ExponentialHistogram histogram;
[DataMember]
private long currentTimestamp; // Current (discrete) timestamp
public ApproximateCountUDSO(long n, double epsilon)
{
histogram = new ExponentialHistogram(n, epsilon);
}
public override IEnumerable<long> ProcessEvent(
PointEvent<bool> inputEvent)
{
currentTimestamp++;
histogram.Update(currentTimestamp, inputEvent.Payload);
yield return histogram.Query();
}
public override bool IsEmpty
{
get { return false; }
}
}
The operator derives from the abstract CepPointStreamOperator<TInputPayload, TOutputPayload>. It has an exponential histogram instance variable. Note the decoration with DataContract and DataMember attributes. This informs StreamInsight how to serialize the operator—for example, for resiliency purposes. The operator overrides the IsEmpty operator to indicate it’s non-empty, that is, the operator is stateful. This prevents StreamInsight from messing with the operator when minimizing memory utilization. The ProcessEvent method is the operator’s core. It increments the current (discrete) timestamp and passes it along with the event payload to the histogram’s update method. The histogram handles the bucketing and is queried for the approximate count. Make sure to use the yield-return syntax, which makes the operator enumerable. Operators are generally wrapped in some extension method hidden in a utility class. This code shows how it’s done:
public static partial class Utility
{
public static IQStreamable<long> ApproximateCount(
this IQStreamable<bool> source, long n, double epsilon)
{
return source.Scan(() => new ApproximateCountUDSO(n, epsilon));
}
}
That’s it! Plug the operator into a query via the extension method. A bit of extra code is required to actually demonstrate its use. Here’s a trivial source stream:
public static partial class Utility
{
private static Random random = new Random((int)DateTime.Now.Ticks);
public static IEnumerable<bool> EnumeratePayloads()
{
while (true) // ad infinitum
{
bool payload = random.NextDouble() >= 0.5;
yield return payload;
}
}
}
This generates random payloads of 0s and 1s. The yield-return syntax turns it into an enumerable source. Put it in a utility class, if you will.
The infamous Program class is shown in Figure 7. It creates the in-process embedded StreamInsight server instance. A so-called application instance named ApproximateCountDemo is created as a streaming processing (metadata) container, for example, for named streams, queries and so on. An enumerable source of point-in-time events is defined, using the payload-generating utility method described earlier. It’s transformed into a temporal stream of point-in-time events. The query is defined with LINQ and selects the operator approximate counts computed over the source stream. This is where the extension method for the user-defined operator comes in handy. It’s bootstrapped with a window size and relative error upper bound. Next, the query output is transformed into an enumerable sink, stripping the temporal properties. Finally, the sink is iterated over, thereby actively pulling the events through the pipeline. Execute the program and enjoy its number-crunching output on the screen.
Figure 7 Embedding and Executing in StreamInsight
class Program
{
public const long N = 10000;
public const double Epsilon = 0.05;
static void Main(string[] args)
{
using (Server server = Server.Create("StreamInsight21"))
{
var app = server.CreateApplication("ApproximateCountDemo");
// Define an enumerable source
var source = app.DefineEnumerable(() =>
Utility.EnumeratePayloads());
// Wrap the source in a (temporal) point-in-time event stream
// The time settings determine when CTI events
// are generated by StreamInsight
var sourceStream = source.ToPointStreamable(e =>
PointEvent.CreateInsert(DateTime.Now, e),
AdvanceTimeSettings.IncreasingStartTime);
// Produces a stream of approximate counts
// over the latest N events with relative error bound Epsilon
var query =
from e in sourceStream.ApproximateCount(N, Epsilon) select e;
// Unwrap the query's (temporal) point-in-time
// stream to an enumerable sink
var sink = query.ToEnumerable<long>();
foreach (long estimatedCount in sink)
{
Console.WriteLine(string.Format(
"Enumerated Approximate count: {0}", estimatedCount));
}
}
}
}
To briefly recap, this article explains how to approximate the count over a window of events in logarithmic time and space with upper-bounded error using an exponential histogram data structure. The histogram is embedded in a StreamInsight user-defined operator.
The histogram and operator can be extended to support variable-size windows, such as time-based windows. This requires the histogram to know the window interval/timespan rather than the window size. Buckets are expired when their timestamp is before the new event’s timestamp minus the window timespan. An extension to compute variance is proposed in the paper, “Maintaining Variance and k–Medians over Data Stream Windows,” by Brian Babcock, Mayur Datar, Rajeev Motwani and Liadan O’Callaghan (stanford.io/UEUG0i). Apart from histograms, other so-called synopsis structures are described in literature. You can think of random samples, heavy hitters, quantiles and so on.
The source code accompanying this article is written in C# 4.0 with Visual Studio 2010 and requires StreamInsight 2.1. The code is free for use under the Microsoft Public License (Ms-PL). Note that it was developed for educational purposes and was neither optimized nor tested for production environments.
Michael Meijer is a software engineer at CIMSOLUTIONS BV, where he provides IT consulting services and software development solutions to companies throughout the Netherlands. His interests in StreamInsight and streaming data processing started during his research at the University of Twente, Enschede, Netherlands, where he received a Master of Science degree in Computer Science–Information Systems Engineering.
Thanks to the following technical experts for reviewing this article: Erik Hegeman, Roman Schindlauer and Bas Stemerdink
|
{
"url": "https://docs.microsoft.com/en-us/archive/msdn-magazine/2013/february/streaminsight-taming-the-event-stream-fast-approximate-counting",
"source_domain": "docs.microsoft.com",
"snapshot_id": "crawl=CC-MAIN-2020-10",
"warc_metadata": {
"Content-Length": "58148",
"Content-Type": "application/http; msgtype=response",
"WARC-Block-Digest": "sha1:AUJVEO5JOBHDH4VIXFDX55KI7QEB346L",
"WARC-Concurrent-To": "<urn:uuid:c7bbf8ba-2553-4f1d-9b38-6b39c8704395>",
"WARC-Date": "2020-02-17T23:10:29Z",
"WARC-IP-Address": "23.218.77.154",
"WARC-Identified-Payload-Type": "text/html",
"WARC-Payload-Digest": "sha1:4O4A3T2WPVPPA7RPHL6UUTJJRWH2SQXC",
"WARC-Record-ID": "<urn:uuid:b241a5d4-2272-40de-ba53-720eae7f37a6>",
"WARC-Target-URI": "https://docs.microsoft.com/en-us/archive/msdn-magazine/2013/february/streaminsight-taming-the-event-stream-fast-approximate-counting",
"WARC-Truncated": null,
"WARC-Type": "response",
"WARC-Warcinfo-ID": "<urn:uuid:cc8946d1-9af9-4c43-a697-cc3cadda5a6f>"
},
"warc_info": "isPartOf: CC-MAIN-2020-10\r\npublisher: Common Crawl\r\ndescription: Wide crawl of the web for February 2020\r\noperator: Common Crawl Admin (info@commoncrawl.org)\r\nhostname: ip-10-67-67-128.ec2.internal\r\nsoftware: Apache Nutch 1.16 (modified, https://github.com/commoncrawl/nutch/)\r\nrobots: checked via crawler-commons 1.1-SNAPSHOT (https://github.com/crawler-commons/crawler-commons)\r\nformat: WARC File Format 1.1\r\nconformsTo: http://iipc.github.io/warc-specifications/specifications/warc-format/warc-1.1/"
}
|
{
"line_start_idx": [
0,
1,
15,
16,
36,
37,
104,
105,
139,
140,
431,
432,
1396,
1397,
1416,
1417,
1852,
1853,
2585,
2586,
3078,
3079,
4024,
4025,
4383,
4384,
4411,
4412,
4437,
4438,
4453,
4473,
4475,
4490,
4516,
4531,
4553,
4579,
4609,
4642,
4711,
4713,
4714,
5138,
5139,
5806,
5807,
5856,
5857,
5872,
5906,
5908,
5923,
5941,
5956,
5982,
5997,
6019,
6034,
6072,
6126,
6130,
6146,
6174,
6219,
6223,
6276,
6331,
6389,
6429,
6459,
6461,
6462,
6531,
6532,
6586,
6588,
6623,
6668,
6689,
6701,
6732,
6750,
6752,
6753,
7194,
7195,
7239,
7240,
7292,
7294,
7340,
7379,
7426,
7490,
7494,
7525,
7551,
7576,
7580,
7582,
7583,
7985,
7986,
8066,
8067,
8115,
8117,
8151,
8155,
8182,
8196,
8201,
8232,
8243,
8245,
8246,
8485,
8486,
9145,
9146,
9188,
9189,
9219,
9221,
9271,
9313,
9355,
9407,
9436,
9496,
9542,
9568,
9572,
9645,
9672,
9681,
9710,
9756,
9796,
9802,
9860,
9918,
9990,
10022,
10084,
10146,
10196,
10231,
10237,
10246,
10252,
10308,
10334,
10364,
10370,
10374,
10376,
10377,
11075,
11076,
11160,
11161,
11181,
11183,
11250,
11299,
11301,
11302,
12020,
12021,
12167,
12168,
12563,
12564,
12610,
12611,
12627,
12628,
12655,
12656,
12676,
12677,
12695,
12696,
12705,
12706,
12712,
12713,
12727,
12745,
12771,
12797,
12798,
12800,
12801,
12809,
12810,
12849,
12863,
12900,
12901,
12903,
12904,
12912,
12913,
12955,
12977,
13026,
13027,
13029,
13030,
13038,
13039,
13056,
13057,
13112,
13142,
13164,
13199,
13234,
13272,
13306,
13307,
13366,
13434,
13435,
14020,
14021,
14467,
14468,
15249,
15250,
15298,
15355,
15356,
15386,
15387,
15816,
15817,
16859,
16860,
17498,
17499,
17980,
17981,
18931,
18932,
19234,
19235,
19259,
19260,
19745,
19746,
20505,
20506,
20559,
20560,
20575,
20646,
20648,
20663,
20705,
20720,
20786,
20840,
20844,
20898,
20902,
20952,
20985,
20989,
21013,
21073,
21109,
21113,
21144,
21148,
21174,
21178,
21180,
21181,
22132,
22133,
22169,
22171,
22224,
22284,
22288,
22356,
22360,
22362,
22363,
22528,
22529,
22565,
22567,
22637,
22691,
22695,
22729,
22735,
22784,
22812,
22818,
22822,
22824,
22825,
22970,
22971,
23964,
23965,
24015,
24016,
24030,
24032,
24063,
24101,
24135,
24139,
24200,
24206,
24272,
24309,
24355,
24393,
24461,
24514,
24554,
24609,
24659,
24709,
24758,
24826,
24844,
24914,
24967,
25005,
25050,
25094,
25102,
25143,
25208,
25216,
25222,
25226,
25228,
25229,
25492,
25493,
26166,
26167,
26473,
26474,
26475,
26889,
26890
],
"line_end_idx": [
1,
15,
16,
36,
37,
104,
105,
139,
140,
431,
432,
1396,
1397,
1416,
1417,
1852,
1853,
2585,
2586,
3078,
3079,
4024,
4025,
4383,
4384,
4411,
4412,
4437,
4438,
4453,
4473,
4475,
4490,
4516,
4531,
4553,
4579,
4609,
4642,
4711,
4713,
4714,
5138,
5139,
5806,
5807,
5856,
5857,
5872,
5906,
5908,
5923,
5941,
5956,
5982,
5997,
6019,
6034,
6072,
6126,
6130,
6146,
6174,
6219,
6223,
6276,
6331,
6389,
6429,
6459,
6461,
6462,
6531,
6532,
6586,
6588,
6623,
6668,
6689,
6701,
6732,
6750,
6752,
6753,
7194,
7195,
7239,
7240,
7292,
7294,
7340,
7379,
7426,
7490,
7494,
7525,
7551,
7576,
7580,
7582,
7583,
7985,
7986,
8066,
8067,
8115,
8117,
8151,
8155,
8182,
8196,
8201,
8232,
8243,
8245,
8246,
8485,
8486,
9145,
9146,
9188,
9189,
9219,
9221,
9271,
9313,
9355,
9407,
9436,
9496,
9542,
9568,
9572,
9645,
9672,
9681,
9710,
9756,
9796,
9802,
9860,
9918,
9990,
10022,
10084,
10146,
10196,
10231,
10237,
10246,
10252,
10308,
10334,
10364,
10370,
10374,
10376,
10377,
11075,
11076,
11160,
11161,
11181,
11183,
11250,
11299,
11301,
11302,
12020,
12021,
12167,
12168,
12563,
12564,
12610,
12611,
12627,
12628,
12655,
12656,
12676,
12677,
12695,
12696,
12705,
12706,
12712,
12713,
12727,
12745,
12771,
12797,
12798,
12800,
12801,
12809,
12810,
12849,
12863,
12900,
12901,
12903,
12904,
12912,
12913,
12955,
12977,
13026,
13027,
13029,
13030,
13038,
13039,
13056,
13057,
13112,
13142,
13164,
13199,
13234,
13272,
13306,
13307,
13366,
13434,
13435,
14020,
14021,
14467,
14468,
15249,
15250,
15298,
15355,
15356,
15386,
15387,
15816,
15817,
16859,
16860,
17498,
17499,
17980,
17981,
18931,
18932,
19234,
19235,
19259,
19260,
19745,
19746,
20505,
20506,
20559,
20560,
20575,
20646,
20648,
20663,
20705,
20720,
20786,
20840,
20844,
20898,
20902,
20952,
20985,
20989,
21013,
21073,
21109,
21113,
21144,
21148,
21174,
21178,
21180,
21181,
22132,
22133,
22169,
22171,
22224,
22284,
22288,
22356,
22360,
22362,
22363,
22528,
22529,
22565,
22567,
22637,
22691,
22695,
22729,
22735,
22784,
22812,
22818,
22822,
22824,
22825,
22970,
22971,
23964,
23965,
24015,
24016,
24030,
24032,
24063,
24101,
24135,
24139,
24200,
24206,
24272,
24309,
24355,
24393,
24461,
24514,
24554,
24609,
24659,
24709,
24758,
24826,
24844,
24914,
24967,
25005,
25050,
25094,
25102,
25143,
25208,
25216,
25222,
25226,
25228,
25229,
25492,
25493,
26166,
26167,
26473,
26474,
26475,
26889,
26890,
27010
]
}
|
{
"red_pajama_v2": {
"ccnet_original_length": 27010,
"ccnet_original_nlines": 356,
"rps_doc_curly_bracket": 0.002887819893658161,
"rps_doc_ldnoobw_words": 0,
"rps_doc_lorem_ipsum": 0,
"rps_doc_stop_word_fraction": 0.28766876459121704,
"rps_doc_ut1_blacklist": 0,
"rps_doc_frac_all_caps_words": 0.012061210349202156,
"rps_doc_frac_lines_end_with_ellipsis": 0.011204480193555355,
"rps_doc_frac_no_alph_words": 0.28262826800346375,
"rps_doc_frac_unique_words": 0.25699999928474426,
"rps_doc_mean_word_length": 5.22475004196167,
"rps_doc_num_sentences": 315,
"rps_doc_symbol_to_word_ratio": 0.003420339897274971,
"rps_doc_unigram_entropy": 5.80294132232666,
"rps_doc_word_count": 4000,
"rps_doc_frac_chars_dupe_10grams": 0.012632180005311966,
"rps_doc_frac_chars_dupe_5grams": 0.1003875806927681,
"rps_doc_frac_chars_dupe_6grams": 0.0530647411942482,
"rps_doc_frac_chars_dupe_7grams": 0.03201109915971756,
"rps_doc_frac_chars_dupe_8grams": 0.0160294808447361,
"rps_doc_frac_chars_dupe_9grams": 0.012632180005311966,
"rps_doc_frac_chars_top_2gram": 0.005981150083243847,
"rps_doc_frac_chars_top_3gram": 0.012105840258300304,
"rps_doc_frac_chars_top_4gram": 0.009904780425131321,
"rps_doc_books_importance": -2423.481201171875,
"rps_doc_books_importance_length_correction": -2423.481201171875,
"rps_doc_openwebtext_importance": -1273.7227783203125,
"rps_doc_openwebtext_importance_length_correction": -1273.7227783203125,
"rps_doc_wikipedia_importance": -1058.3475341796875,
"rps_doc_wikipedia_importance_length_correction": -1058.3475341796875
},
"fasttext": {
"dclm": 0.19202685356140137,
"english": 0.8621720671653748,
"fineweb_edu_approx": 2.138789176940918,
"eai_general_math": 0.4658791422843933,
"eai_open_web_math": 0.2244167923927307,
"eai_web_code": 0.1958187222480774
}
}
|
{
"free_decimal_correspondence": {
"primary": {
"code": "005.72",
"labels": {
"level_1": "General works, books and libraries, information sciences",
"level_2": "",
"level_3": "Computer programming"
}
},
"secondary": {
"code": "004.02",
"labels": {
"level_1": "General works, books and libraries, information sciences",
"level_2": "",
"level_3": "Computers and Computer science"
}
}
},
"bloom_cognitive_process": {
"primary": {
"code": "3",
"label": "Apply"
},
"secondary": {
"code": "4",
"label": "Analyze"
}
},
"bloom_knowledge_domain": {
"primary": {
"code": "3",
"label": "Procedural"
},
"secondary": {
"code": "2",
"label": "Conceptual"
}
},
"document_type_v1": {
"primary": {
"code": "3",
"label": "Reference/Encyclopedic/Educational"
},
"secondary": {
"code": "-1",
"label": "Abstain"
}
},
"extraction_artifacts": {
"primary": {
"code": "0",
"label": "No Artifacts"
},
"secondary": {
"code": "3",
"label": "Irrelevant Content"
}
},
"missing_content": {
"primary": {
"code": "4",
"label": "Missing Images or Figures"
},
"secondary": {
"code": "-1",
"label": "Abstain"
}
},
"document_type_v2": {
"primary": {
"code": "8",
"label": "Documentation"
},
"secondary": {
"code": "10",
"label": "Knowledge Article"
}
},
"reasoning_depth": {
"primary": {
"code": "4",
"label": "Advanced Reasoning"
},
"secondary": {
"code": "3",
"label": "Intermediate Reasoning"
}
},
"technical_correctness": {
"primary": {
"code": "4",
"label": "Highly Correct"
},
"secondary": {
"code": "3",
"label": "Mostly Correct"
}
},
"education_level": {
"primary": {
"code": "4",
"label": "Graduate/Expert Level"
},
"secondary": {
"code": "3",
"label": "Undergraduate Level"
}
}
}
|
672f1e42c33a7f9846924a2431ea77df
|
-1,474,909,855,681,761,800
|
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.
Sign up
Here's how it works:
1. Anybody can ask a question
2. Anybody can answer
3. The best answers are voted up and rise to the top
I've always been amazed with the TI-$89$'s ability to deal with symbolic expressions so effortlessly. I've attempted to build several CASs in the past (mostly for fun, they are one of the most difficult and interesting programming challenge I'm aware of) and I've never been able to come close to achieving the level of the TI-$89$'s abilities.
Today, I'm working on a domain specific CAS to solve a particular problem. Given a system of equations describing a dynamic system, containing linear and non-linear algebraic equations, and linear differential and integral equations, find an expression for each unknown function $f(t)$ that describes $f(t + h)$ given $f(t)$. I need implicit integration methods, hence the CAS difficulties :). I'm approaching this with a CAS because I need to be able to run the system simulation really, really fast, and I don't know what the system equations are ahead of time to analyze and optimize them, such as finding closed form solutions for parts of the system, only using numerical solutions when absolutely necessary. Once the timestep expressions are found and simplified, I JIT compile them to native machine code to be executed on my input samples.
To solve this problem I really need some capabilities I've never been able to squeeze out of my previous CAS attempts. I've just been sitting here playing with my TI-$89$ and comparing it to Mathematica. The guys that did the TI-$89$ really did some amazing things.
Consider this almost trivial expression:
(x^2-1)/(x-1)
Of course, this simplifies to
x+1
Now, the TI-89 will do this 'natively', just plug in the first expression and it will come back with the second pretty much instantly. However, every CAS I've ever tried this with (Mathematica being the most reliable and reputable) will not simplify this expression without some convincing. For example, in Mathematica, you need to use Cancel[].
I don't think this is just a matter of Mathematica attempting to be more correct by avoiding changing the domain of the function. Entering:
((x + 1)*(x - 1))/(x - 1)
will happily simplify to the expected result without any extra nudges.
This is only a simple example. This trend continues to many other types of expressions and simplifications, especially trig simplifications.
In my own CAS development experience, I've found it nearly impossible to do what the TI-$89$ does, that is, automatically perform these simplifications without wrapping them in a 'hint' function. I've found that both in terms of computational cost, and in pure software engineering difficulty, this is basically impossible to do. Every CAS I've ever built has involved horrendous debugging of infinite recursion and similar bugs due to attempting to match the TI-$89$'s level of automation.
The fact that Mathematica, Sage, etc. also will not perform these simplifications without a 'hint' makes me feel a little better, but the question remains: How on earth did the TI engineers manage to do this with literally a tiny, tiny fraction of the computing power a desktop has? Are there shortcuts the TI-$89$ is taking that couldn't be scaled to the types of expressions Mathematica et al support or something?
For what its worth, this question is mainly asked out of curiosity that's been burning me ever since I tried to build my first CAS a long time ago.
share|cite|improve this question
1
Wild guess: someone among those engineers had decent Lisp exposure. – Kaz Apr 2 '13 at 7:23
Note that all you're asking the TI to do is to divide one polynomial by another. You need the CAS to recognize and handle the case that a polynomial is being divided by one of the same variable, and a lower rank, and then bring in the long division. – Kaz Apr 2 '13 at 7:26
@Kaz Yes, I understand how such an expression might be simplified (and that it isn't that difficult), that isn't the point. I was only using that as an example of where the TI-89 and Mathematica and such differ. As for lisp, yes, lisp is very helpful for solving problems like this, but I don't see how it fundamentally changes the question. Lisp isn't magic: assuming smart algorithms all around, the algorithmic complexity of any given operation in lisp or in another system should be the same. – dsharlet Apr 2 '13 at 7:32
2
The original version of Macsyma ran in MacLisp in 1 MB (256K 36 bit words on a PDP10). Now you can run a version (Maxima) on Androiod cell phones. Stoutemayer's Derive/muMath (bought by TI) were implemented in a tiny Lisp (muLisp) specially designed to fit well on calculators. – Math Gems Apr 2 '13 at 15:32
@MathGems Thanks for the info! That is new information to me. – dsharlet Apr 3 '13 at 0:02
The fact that the TI-89 simplifies $(x^2-1)/(x-1)$ to $x+1$ while Mathematica, Maple, and Maxima do not reflects nothing more than a design decision on the part of the creators of the software. Likely, this has everything to do with the intended audience and use.
TI products are largely intended to help students studying calculus or pre-calculus level mathematics and typically allows short input. For such users, that specific simplification probably makes some sense.
The designs of Mathematica, Maple, and Maxima are aimed at users with more mathematical experience who might enter much more complicated, programmatic input. In that context, perhaps they want that simplification but maybe not.
More generally, simplification takes time. Why waste time performing computations that the user might not want when the user could certainly specify what they want?
Today, of course, Wolfram Research has a product that gets a lot of student use: WolframAlpha. If you enter $(x^2-1)/(x-1)$ into WolframAlpha, you'll see $x+1$ listed as an alternate form so, clearly, Mathematica could take the expression to that point if the designers thought it was a good idea.
What does the TI-89 do with $(x^{10000}-1)/(x-1)$, incidentally? Mathematica wisely leaves it alone but quickly returns a condensed rendition of the expansion, if you ask for it.
enter image description here
share|cite|improve this answer
Your Answer
discard
By posting your answer, you agree to the privacy policy and terms of service.
Not the answer you're looking for? Browse other questions tagged or ask your own question.
|
{
"url": "http://math.stackexchange.com/questions/348809/computer-algebra-how-does-the-ti-89-do-it",
"source_domain": "math.stackexchange.com",
"snapshot_id": "crawl=CC-MAIN-2016-22",
"warc_metadata": {
"Content-Length": "81443",
"Content-Type": "application/http; msgtype=response",
"WARC-Block-Digest": "sha1:RCOWXWPS4CWYSNP7NHMIPUR4XYMSRLZK",
"WARC-Concurrent-To": "<urn:uuid:0b45c0c2-78a7-48eb-806f-fae8e95fcd94>",
"WARC-Date": "2016-05-31T16:11:11Z",
"WARC-IP-Address": "104.16.119.182",
"WARC-Identified-Payload-Type": null,
"WARC-Payload-Digest": "sha1:WHYQKBRX3ZJERAWVU4ZPMBYSRX2VUSGT",
"WARC-Record-ID": "<urn:uuid:c3707e9f-04a1-4b86-9c67-518680479eac>",
"WARC-Target-URI": "http://math.stackexchange.com/questions/348809/computer-algebra-how-does-the-ti-89-do-it",
"WARC-Truncated": null,
"WARC-Type": "response",
"WARC-Warcinfo-ID": "<urn:uuid:681828b8-85b3-4c13-a4ca-1a11e7039607>"
},
"warc_info": "robots: classic\r\nhostname: ip-10-185-217-139.ec2.internal\r\nsoftware: Nutch 1.6 (CC)/CC WarcExport 1.0\r\nisPartOf: CC-MAIN-2016-22\r\noperator: CommonCrawl Admin\r\ndescription: Wide crawl of the web for May 2016\r\npublisher: CommonCrawl\r\nformat: WARC File Format 1.0\r\nconformsTo: http://bibnum.bnf.fr/WARC/WARC_ISO_28500_version1_latestdraft.pdf"
}
|
{
"line_start_idx": [
0,
174,
175,
183,
204,
236,
260,
315,
316,
661,
662,
1510,
1511,
1777,
1778,
1819,
1820,
1834,
1835,
1865,
1866,
1870,
1871,
2217,
2218,
2358,
2359,
2385,
2386,
2457,
2458,
2599,
2600,
3091,
3092,
3509,
3510,
3658,
3659,
3692,
3696,
3788,
3793,
4067,
4072,
4598,
4602,
4911,
4916,
5007,
5008,
5272,
5273,
5481,
5482,
5710,
5711,
5876,
5877,
6175,
6176,
6355,
6356,
6385,
6386,
6417,
6418,
6430,
6431,
6433,
6441,
6442,
6520,
6521
],
"line_end_idx": [
174,
175,
183,
204,
236,
260,
315,
316,
661,
662,
1510,
1511,
1777,
1778,
1819,
1820,
1834,
1835,
1865,
1866,
1870,
1871,
2217,
2218,
2358,
2359,
2385,
2386,
2457,
2458,
2599,
2600,
3091,
3092,
3509,
3510,
3658,
3659,
3692,
3696,
3788,
3793,
4067,
4072,
4598,
4602,
4911,
4916,
5007,
5008,
5272,
5273,
5481,
5482,
5710,
5711,
5876,
5877,
6175,
6176,
6355,
6356,
6385,
6386,
6417,
6418,
6430,
6431,
6433,
6441,
6442,
6520,
6521,
6611
]
}
|
{
"red_pajama_v2": {
"ccnet_original_length": 6611,
"ccnet_original_nlines": 73,
"rps_doc_curly_bracket": 0.00030253001023083925,
"rps_doc_ldnoobw_words": 0,
"rps_doc_lorem_ipsum": 0,
"rps_doc_stop_word_fraction": 0.40909090638160706,
"rps_doc_ut1_blacklist": 0,
"rps_doc_frac_all_caps_words": 0.035511359572410583,
"rps_doc_frac_lines_end_with_ellipsis": 0,
"rps_doc_frac_no_alph_words": 0.21732954680919647,
"rps_doc_frac_unique_words": 0.45036765933036804,
"rps_doc_mean_word_length": 4.756433963775635,
"rps_doc_num_sentences": 56,
"rps_doc_symbol_to_word_ratio": 0,
"rps_doc_unigram_entropy": 5.597668647766113,
"rps_doc_word_count": 1088,
"rps_doc_frac_chars_dupe_10grams": 0,
"rps_doc_frac_chars_dupe_5grams": 0.011594199575483799,
"rps_doc_frac_chars_dupe_6grams": 0.0046376800164580345,
"rps_doc_frac_chars_dupe_7grams": 0,
"rps_doc_frac_chars_dupe_8grams": 0,
"rps_doc_frac_chars_dupe_9grams": 0,
"rps_doc_frac_chars_top_2gram": 0.008695649914443493,
"rps_doc_frac_chars_top_3gram": 0.0046376800164580345,
"rps_doc_frac_chars_top_4gram": 0.00618356978520751,
"rps_doc_books_importance": -556.2836303710938,
"rps_doc_books_importance_length_correction": -556.2836303710938,
"rps_doc_openwebtext_importance": -357.0362854003906,
"rps_doc_openwebtext_importance_length_correction": -357.0362854003906,
"rps_doc_wikipedia_importance": -308.9905090332031,
"rps_doc_wikipedia_importance_length_correction": -308.9905090332031
},
"fasttext": {
"dclm": 0.7443190217018127,
"english": 0.9439612030982971,
"fineweb_edu_approx": 1.6180810928344727,
"eai_general_math": 0.647079348564148,
"eai_open_web_math": 0.5143104195594788,
"eai_web_code": 0.0935015082359314
}
}
|
{
"free_decimal_correspondence": {
"primary": {
"code": "004.0151",
"labels": {
"level_1": "General works, books and libraries, information sciences",
"level_2": "",
"level_3": "Computers and Computer science"
}
},
"secondary": {
"code": "510",
"labels": {
"level_1": "Science and Natural history",
"level_2": "Mathematics",
"level_3": ""
}
}
},
"bloom_cognitive_process": {
"primary": {
"code": "4",
"label": "Analyze"
},
"secondary": {
"code": "5",
"label": "Evaluate"
}
},
"bloom_knowledge_domain": {
"primary": {
"code": "2",
"label": "Conceptual"
},
"secondary": {
"code": "3",
"label": "Procedural"
}
},
"document_type_v1": {
"primary": {
"code": "5",
"label": "Social/Forum"
},
"secondary": {
"code": "-1",
"label": "Abstain"
}
},
"extraction_artifacts": {
"primary": {
"code": "3",
"label": "Irrelevant Content"
},
"secondary": {
"code": "-1",
"label": "Abstain"
}
},
"missing_content": {
"primary": {
"code": "4",
"label": "Missing Images or Figures"
},
"secondary": {
"code": "-1",
"label": "Abstain"
}
},
"document_type_v2": {
"primary": {
"code": "18",
"label": "Q&A Forum"
},
"secondary": {
"code": "10",
"label": "Knowledge Article"
}
},
"reasoning_depth": {
"primary": {
"code": "3",
"label": "Intermediate Reasoning"
},
"secondary": {
"code": "2",
"label": "Basic Reasoning"
}
},
"technical_correctness": {
"primary": {
"code": "3",
"label": "Mostly Correct"
},
"secondary": {
"code": "4",
"label": "Highly Correct"
}
},
"education_level": {
"primary": {
"code": "3",
"label": "Undergraduate Level"
},
"secondary": {
"code": "2",
"label": "High School Level"
}
}
}
|
672f1e42c33a7f9846924a2431ea77df
|
-8,626,165,918,519,495,000
|
Abrir menú principal
La unidad de gestión de memoria,[1]unidad de administración de memoria o unidad de manejo de memoria[2] (del inglés Memory Management Unit, MMU) es un dispositivo de hardware formado por un grupo de circuitos integrados, responsable del manejo de los accesos a la memoria por parte de la Unidad de Procesamiento Central (CPU) o procesador.
Entre las funciones de este dispositivo se encuentran la traducción de las direcciones lógicas (o virtuales) a direcciones físicas (o reales), la protección de la memoria, el control de caché y, en arquitecturas de computadoras más simples (especialmente en sistemas de 8 bits), bank switching.
Cuando la CPU intenta acceder a una dirección de memoria lógica, la MMU realiza una búsqueda en una memoria caché especial llamada Buffer de Traducción Adelantada (TLB, Translation Lookaside Buffer), que mantiene la parte de la tabla de páginas usada hace menos tiempo. En esta memoria se mantienen "entradas de la tabla de páginas" (llamadas PTE, por sus siglas en inglés Page Table Entry), donde se pueden rescatar las direcciones físicas correspondientes a algunas direcciones lógicas, de forma directa. Cuando la dirección requerida por la CPU se encuentra en el TLB, su traducción a dirección real o física es entregada, en lo que se conoce como "acierto en el TLB" (TLB hit). En otro caso, cuando la dirección buscada no se encuentra en el TLB (fallo en el TLB), la MMU busca en la tabla de páginas del proceso utilizando el número de página como entrada a la misma. En la entrada de la tabla de páginas del proceso se encuentra un bit de presencia, que indica si la página buscada está en memoria principal. Si el bit de presencia está activado, se carga esta PTE en el TLB y se devuelve la dirección física. En caso contrario, se informa al sistema operativo de la situación, mediante un "fallo de página". Es el sistema operativo el encargado de realizar los ajustes necesarios (esto es, cargar la página en memoria física) usando uno de los algoritmos de reemplazo de páginas, para continuar con la ejecución desde la instrucción que causó el fallo.
Un beneficio fundamental de la MMU es la posibilidad de implementar protección de memoria, evitando que los programas accedan a porciones de memoria prohibidas. Por ejemplo, se puede evitar que un programa acceda o modifique sectores de memoria de otros programas.
Notas y referenciasEditar
1. Término utilizado en España.[cita requerida]
2. Término utilizado en Latinoamérica.[cita requerida]
Véase tambiénEditar
Enlaces externosEditar
|
{
"url": "https://es.m.wikipedia.org/wiki/Unidad_de_gesti%C3%B3n_de_memoria",
"source_domain": "es.m.wikipedia.org",
"snapshot_id": "crawl=CC-MAIN-2019-43",
"warc_metadata": {
"Content-Length": "27766",
"Content-Type": "application/http; msgtype=response",
"WARC-Block-Digest": "sha1:JSEBVFZIDAAYD4QS4DVDGPPDRFYDWAAL",
"WARC-Concurrent-To": "<urn:uuid:767f1305-7a10-408d-9f53-fb5e9c81c34c>",
"WARC-Date": "2019-10-17T04:22:33Z",
"WARC-IP-Address": "208.80.154.224",
"WARC-Identified-Payload-Type": "text/html",
"WARC-Payload-Digest": "sha1:IFAO2E3XFJ5NNXMIODHFTILXYRXJXNOG",
"WARC-Record-ID": "<urn:uuid:557cdc6a-ab27-4550-9ccd-0ec56e19f938>",
"WARC-Target-URI": "https://es.m.wikipedia.org/wiki/Unidad_de_gesti%C3%B3n_de_memoria",
"WARC-Truncated": null,
"WARC-Type": "response",
"WARC-Warcinfo-ID": "<urn:uuid:17e21142-2675-48c1-a308-d8abf01dd3af>"
},
"warc_info": "isPartOf: CC-MAIN-2019-43\r\npublisher: Common Crawl\r\ndescription: Wide crawl of the web for October 2019\r\noperator: Common Crawl Admin (info@commoncrawl.org)\r\nhostname: ip-10-67-67-201.ec2.internal\r\nsoftware: Apache Nutch 1.16 (modified, https://github.com/commoncrawl/nutch/)\r\nrobots: checked via crawler-commons 1.1-SNAPSHOT (https://github.com/crawler-commons/crawler-commons)\r\nformat: WARC File Format 1.1\r\nconformsTo: http://iipc.github.io/warc-specifications/specifications/warc-format/warc-1.1/"
}
|
{
"line_start_idx": [
0,
21,
22,
363,
364,
659,
660,
2120,
2121,
2386,
2387,
2413,
2414,
2464,
2521,
2522,
2542,
2543
],
"line_end_idx": [
21,
22,
363,
364,
659,
660,
2120,
2121,
2386,
2387,
2413,
2414,
2464,
2521,
2522,
2542,
2543,
2565
]
}
|
{
"red_pajama_v2": {
"ccnet_original_length": 2565,
"ccnet_original_nlines": 17,
"rps_doc_curly_bracket": 0,
"rps_doc_ldnoobw_words": 0,
"rps_doc_lorem_ipsum": 0,
"rps_doc_stop_word_fraction": 0.057971011847257614,
"rps_doc_ut1_blacklist": 0,
"rps_doc_frac_all_caps_words": 0.03312629088759422,
"rps_doc_frac_lines_end_with_ellipsis": 0,
"rps_doc_frac_no_alph_words": 0.14492754638195038,
"rps_doc_frac_unique_words": 0.4576271176338196,
"rps_doc_mean_word_length": 5.121065616607666,
"rps_doc_num_sentences": 17,
"rps_doc_symbol_to_word_ratio": 0,
"rps_doc_unigram_entropy": 4.623213291168213,
"rps_doc_word_count": 413,
"rps_doc_frac_chars_dupe_10grams": 0,
"rps_doc_frac_chars_dupe_5grams": 0.06146572157740593,
"rps_doc_frac_chars_dupe_6grams": 0.025531910359859467,
"rps_doc_frac_chars_dupe_7grams": 0,
"rps_doc_frac_chars_dupe_8grams": 0,
"rps_doc_frac_chars_dupe_9grams": 0,
"rps_doc_frac_chars_top_2gram": 0.013238769955933094,
"rps_doc_frac_chars_top_3gram": 0.016548460349440575,
"rps_doc_frac_chars_top_4gram": 0.032151300460100174,
"rps_doc_books_importance": -213.973876953125,
"rps_doc_books_importance_length_correction": -213.973876953125,
"rps_doc_openwebtext_importance": -114.02226257324219,
"rps_doc_openwebtext_importance_length_correction": -114.02226257324219,
"rps_doc_wikipedia_importance": -98.31825256347656,
"rps_doc_wikipedia_importance_length_correction": -98.31825256347656
},
"fasttext": {
"dclm": 0.9745036959648132,
"english": 0.0004427900130394846,
"fineweb_edu_approx": 1.105495810508728,
"eai_general_math": 0.0001406700030202046,
"eai_open_web_math": 0.7272650599479675,
"eai_web_code": 0.4178573489189148
}
}
|
{
"free_decimal_correspondence": {
"primary": {
"code": "004.222",
"labels": {
"level_1": "General works, books and libraries, information sciences",
"level_2": "",
"level_3": "Computers and Computer science"
}
},
"secondary": {
"code": "004.22",
"labels": {
"level_1": "General works, books and libraries, information sciences",
"level_2": "",
"level_3": "Computers and Computer science"
}
}
},
"bloom_cognitive_process": {
"primary": {
"code": "2",
"label": "Understand"
},
"secondary": {
"code": "3",
"label": "Apply"
}
},
"bloom_knowledge_domain": {
"primary": {
"code": "2",
"label": "Conceptual"
},
"secondary": {
"code": "3",
"label": "Procedural"
}
},
"document_type_v1": {
"primary": {
"code": "3",
"label": "Reference/Encyclopedic/Educational"
},
"secondary": {
"code": "-1",
"label": "Abstain"
}
},
"extraction_artifacts": {
"primary": {
"code": "3",
"label": "Irrelevant Content"
},
"secondary": {
"code": "0",
"label": "No Artifacts"
}
},
"missing_content": {
"primary": {
"code": "4",
"label": "Missing Images or Figures"
},
"secondary": {
"code": "0",
"label": "No missing content"
}
},
"document_type_v2": {
"primary": {
"code": "10",
"label": "Knowledge Article"
},
"secondary": {
"code": "8",
"label": "Documentation"
}
},
"reasoning_depth": {
"primary": {
"code": "2",
"label": "Basic Reasoning"
},
"secondary": {
"code": "3",
"label": "Intermediate Reasoning"
}
},
"technical_correctness": {
"primary": {
"code": "4",
"label": "Highly Correct"
},
"secondary": {
"code": "3",
"label": "Mostly Correct"
}
},
"education_level": {
"primary": {
"code": "3",
"label": "Undergraduate Level"
},
"secondary": {
"code": "2",
"label": "High School Level"
}
}
}
|
672f1e42c33a7f9846924a2431ea77df
|
-2,871,361,013,738,318,300
|
Translate Algebraic Expressions Worksheet Pdf
Translate Algebraic Expressions Worksheet Pdf. Web translating key words and phrases into algebraic expressions. The verbal phrase into an algebraic expression:
Evaluating Algebraic Expressions Worksheet Pdf Kidsworksheetfun
5 more than 2 times a number 7 less than 5 times a number 5 times a number, decreased by 2 2 diminished by 7 times a number 2. Web translating algebraic expressions wbcristobal member for 2 years 1 month age: Web translating key words and phrases into algebraic expressions.
10 More Than B Date________________ Period____ The Product Of 11 And N.
Web translating words into algebraic expressions we don’t only use the terms, add/subtract/multiply/divide when talking about operations. The table below lists some key words and phrases that are used to describe common. Web algebra 1 translating algebraic expressions name_____ id:
Each Expression In This Set Of Pdf Translating Phrases Into Algebraic Expressions Worksheets Is Of The Form:
Web worksheet by kuta software llc math 8ib translating words to algebraic expressions name_____ id: Web writing/translating expressions and equations to translate statements into expressions and equations: Write the phrase as a.
Variables And Expressions Worksheet, Notes, And Slide.
You can access all of them for free. Web if you experience display problems with your math worksheet. Web 1.12 translating algebraic expression 3 multiple choice.
Write The Phrase As A.
1 date_____ period____ ©i y2j0c1e6q wkyuqtqag `sdovfjthwsazrien ulklkcb.y u jatllle rrmiqglhzt^sj. Fill in the chart with other. 1) identify key words that indicate the operation.
Translating Linear Phrases If Translating.
Web translate the phrases to algebraic expressions. Web translating key words and phrases into algebraic expressions. Choose the one alternative that best completes the statement or answers the question.
|
{
"url": "https://haravgipdf.com/translate-algebraic-expressions-worksheet-pdf/",
"source_domain": "haravgipdf.com",
"snapshot_id": "CC-MAIN-2024-18",
"warc_metadata": {
"Content-Length": "77086",
"Content-Type": "application/http; msgtype=response",
"WARC-Block-Digest": "sha1:3J6Z675U7I2RFSGJFTD7MSCP4OF366FR",
"WARC-Concurrent-To": "<urn:uuid:e6988a67-1ec3-488f-8e33-bbcb91a92c53>",
"WARC-Date": "2024-04-23T22:47:42Z",
"WARC-IP-Address": "104.21.58.208",
"WARC-Identified-Payload-Type": "text/html",
"WARC-Payload-Digest": "sha1:XD2JVLCZUIFOY2QS5SDKAGHU2AK34VDK",
"WARC-Record-ID": "<urn:uuid:56792038-165b-46b1-93f2-bf201e29dc16>",
"WARC-Target-URI": "https://haravgipdf.com/translate-algebraic-expressions-worksheet-pdf/",
"WARC-Truncated": null,
"WARC-Type": "response",
"WARC-Warcinfo-ID": "<urn:uuid:174aaf84-a84e-4ff2-bdd3-619104090c77>"
},
"warc_info": "isPartOf: CC-MAIN-2024-18\r\npublisher: Common Crawl\r\ndescription: Wide crawl of the web for April 2024\r\noperator: Common Crawl Admin (info@commoncrawl.org)\r\nhostname: ip-10-67-67-180\r\nsoftware: Apache Nutch 1.19 (modified, https://github.com/commoncrawl/nutch/)\r\nrobots: checked via crawler-commons 1.5-SNAPSHOT (https://github.com/crawler-commons/crawler-commons)\r\nformat: WARC File Format 1.1\r\nconformsTo: https://iipc.github.io/warc-specifications/specifications/warc-format/warc-1.1/"
}
|
{
"line_start_idx": [
0,
46,
47,
208,
209,
273,
274,
549,
550,
622,
623,
906,
907,
1016,
1017,
1247,
1248,
1303,
1304,
1467,
1468,
1491,
1492,
1672,
1673,
1716,
1717
],
"line_end_idx": [
46,
47,
208,
209,
273,
274,
549,
550,
622,
623,
906,
907,
1016,
1017,
1247,
1248,
1303,
1304,
1467,
1468,
1491,
1492,
1672,
1673,
1716,
1717,
1920
]
}
|
{
"red_pajama_v2": {
"ccnet_original_length": 1920,
"ccnet_original_nlines": 26,
"rps_doc_curly_bracket": 0,
"rps_doc_ldnoobw_words": 0,
"rps_doc_lorem_ipsum": 0,
"rps_doc_stop_word_fraction": 0.21580547094345093,
"rps_doc_ut1_blacklist": 0,
"rps_doc_frac_all_caps_words": 0.009118540212512016,
"rps_doc_frac_lines_end_with_ellipsis": 0,
"rps_doc_frac_no_alph_words": 0.18237082660198212,
"rps_doc_frac_unique_words": 0.46071428060531616,
"rps_doc_mean_word_length": 5.535714149475098,
"rps_doc_num_sentences": 22,
"rps_doc_symbol_to_word_ratio": 0,
"rps_doc_unigram_entropy": 4.4159111976623535,
"rps_doc_word_count": 280,
"rps_doc_frac_chars_dupe_10grams": 0,
"rps_doc_frac_chars_dupe_5grams": 0.1832258105278015,
"rps_doc_frac_chars_dupe_6grams": 0.10838709771633148,
"rps_doc_frac_chars_dupe_7grams": 0.10838709771633148,
"rps_doc_frac_chars_dupe_8grams": 0.10838709771633148,
"rps_doc_frac_chars_dupe_9grams": 0.10838709771633148,
"rps_doc_frac_chars_top_2gram": 0.1548387110233307,
"rps_doc_frac_chars_top_3gram": 0.07741934806108475,
"rps_doc_frac_chars_top_4gram": 0.04645160958170891,
"rps_doc_books_importance": -171.3533935546875,
"rps_doc_books_importance_length_correction": -171.3533935546875,
"rps_doc_openwebtext_importance": -89.78604888916016,
"rps_doc_openwebtext_importance_length_correction": -89.78604888916016,
"rps_doc_wikipedia_importance": -72.55329132080078,
"rps_doc_wikipedia_importance_length_correction": -72.55329132080078
},
"fasttext": {
"dclm": 0.027168329805135727,
"english": 0.7078522443771362,
"fineweb_edu_approx": 3.3875668048858643,
"eai_general_math": 0.9199816584587097,
"eai_open_web_math": 0.1409517526626587,
"eai_web_code": 0.05618482828140259
}
}
|
{
"free_decimal_correspondence": {
"primary": {
"code": "512",
"labels": {
"level_1": "Science and Natural history",
"level_2": "Mathematics",
"level_3": "Algebra"
}
},
"secondary": {
"code": "372.7",
"labels": {
"level_1": "Social sciences",
"level_2": "Education",
"level_3": "Education, Elementary and Kindergarten"
}
}
},
"bloom_cognitive_process": {
"primary": {
"code": "3",
"label": "Apply"
},
"secondary": {
"code": "2",
"label": "Understand"
}
},
"bloom_knowledge_domain": {
"primary": {
"code": "3",
"label": "Procedural"
},
"secondary": {
"code": "2",
"label": "Conceptual"
}
},
"document_type_v1": {
"primary": {
"code": "3",
"label": "Reference/Encyclopedic/Educational"
},
"secondary": {
"code": "-1",
"label": "Abstain"
}
},
"extraction_artifacts": {
"primary": {
"code": "3",
"label": "Irrelevant Content"
},
"secondary": {
"code": "0",
"label": "No Artifacts"
}
},
"missing_content": {
"primary": {
"code": "0",
"label": "No missing content"
},
"secondary": {
"code": "-1",
"label": "Abstain"
}
},
"document_type_v2": {
"primary": {
"code": "23",
"label": "Tutorial"
},
"secondary": {
"code": "8",
"label": "Documentation"
}
},
"reasoning_depth": {
"primary": {
"code": "2",
"label": "Basic Reasoning"
},
"secondary": {
"code": "1",
"label": "No Reasoning"
}
},
"technical_correctness": {
"primary": {
"code": "4",
"label": "Highly Correct"
},
"secondary": {
"code": "3",
"label": "Mostly Correct"
}
},
"education_level": {
"primary": {
"code": "2",
"label": "High School Level"
},
"secondary": {
"code": "1",
"label": "General Audience"
}
}
}
|
672f1e42c33a7f9846924a2431ea77df
|
3,856,570,860,728,371,700
|
Jump to content
Sign in to follow this
SMark
Is it possible to get cursor info from more than 1 mouse cursor?
Recommended Posts
SMark
Let me try to explain what I mean...
There is a proprietary program called "ISBoxer" that's used for 'Multiboxing' Online games. It works by loading a game client into seperate video feeds and relaying mouse/keyboard commands to each video feed simultaneously.
Here's my dilemma:
I can grab each client's Windows handle by using:
Local $hWnd1 = WinGetHandle("is1")
Local $hWnd2 = WinGetHandle("is2")
Local $hWnd3 = WinGetHandle("is3")
Local $hWnd4 = WinGetHandle("is4")
But I can not grab multple mouse infos, because there is no way to tell which handle's mouse info to grab:
$mouseposition = MouseGetPos()
$cursor = _WinAPI_GetCursorInfo()
This just grabs the 'default' mouse info.
I realize that the ISBoxer programmer has done some specialized relaying to multiple video feeds programming, but, there must be a way to figure out what the memory data of these extra mouse cursors is, and which handle is using each.
Here is a snippet of the code I'm working with so you can kind of see what I mean:
#include <WinAPI.au3>
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Test", 615, 438, 180, 130)
$LabelWin1Handle = GUICtrlCreateLabel("Window 1", 56, 40, 70, 17)
$LabelWin2Handle = GUICtrlCreateLabel("Window 2", 56, 72, 70, 17)
$LabelWin3Handle = GUICtrlCreateLabel("Window 3", 56, 104, 70, 17)
$LabelWin4Handle = GUICtrlCreateLabel("Window 4", 56, 136, 70, 17)
$ButtonSetHandles = GUICtrlCreateButton("Set Handles", 160, 72, 75, 25)
$GroupMousePosition = GUICtrlCreateGroup("Mouse Position", 306, 16, 201, 41)
$LabelMouseX = GUICtrlCreateLabel("MouseX:", 314, 32, 46, 17)
$LabelMouseValue = GUICtrlCreateLabel(", MouseY:", 394, 32, 64, 17)
$LabelMouseXValue = GUICtrlCreateLabel("x", 364, 32, 30, 17)
$LabelMouseYValue = GUICtrlCreateLabel("y", 458, 32, 30, 17)
GUICtrlCreateGroup("", -99, -99, 1, 1)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
Local $hWnd1 = WinGetHandle("is1")
Local $hWnd2 = WinGetHandle("is2")
Local $hWnd3 = WinGetHandle("is3")
Local $hWnd4 = WinGetHandle("is4")
Local $mouseposition = 0
Local $cursorinfo = 0
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $ButtonSetHandles
GUICtrlSetData($LabelWin1Handle, $hWnd1)
GUICtrlSetData($LabelWin2Handle, $hWnd2)
GUICtrlSetData($LabelWin3Handle, $hWnd3)
GUICtrlSetData($LabelWin4Handle, $hWnd4)
EndSwitch
$mouseposition = MouseGetPos()
$cursorinfo = _WinAPI_GetCursorInfo()
If GUICtrlRead($LabelMouseXValue) <> $mouseposition[0] Then
GUICtrlSetData($LabelMouseXValue, $mouseposition[0])
EndIf
If GUICtrlRead($LabelMouseYValue) <> $mouseposition[1] Then
GUICtrlSetData($LabelMouseYValue, $mouseposition[1])
EndIf
WEnd
As you can see, I've set the label of the mouse position to the mouse's current position, but I can't get the mouse info of each Window Handle's mouse, yet each windows has a unique mouse that's changing it's info independently of the other 3.
Any ideas how I might be able to use AutoIt to get this info?
Please and Thanks!
Share this post
Link to post
Share on other sites
Melba23
SMark,
Welcome to the AutoIt forum. :)
Unfortunately you appear to have missed the Forum rules on your way in. Please read them now (there is also a link at bottom right of each page) - particularly the bit about not discussing game automation - and then you will understand why you will get no help and this thread will now be locked. :naughty:
And to make it worse, the "Developer Chat" section where you started this thread is not for general support questions. I have moved the thread, but would ask you to be more careful when you return with a legitimate question. :)
M23
Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:
Spoiler
ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area
Share this post
Link to post
Share on other sites
SMark
First, I apologize the post was made in the wrong section. The description of the 'Developers' section is: "General Coding / Programming". I thought that was pretty much what I was asking, which is why I put it there. My bad.
Second, I said nothing about automation. My question was a legitimate question about accessing windows controls. The program I mentioned, ISBoxer, is even a completely legal program to run in the game RIFT, which is what I'm exploring... It was even very clearly validated by both the Lead Community Manager, Elrar, here:
http://forums.riftgame.com/general-discussions/general-discussion/379448-multiboxers-unwanted-rift-should-we-pack-up-get-out-42.html#post4445551
and the Lead Creative Designer, Daglar, here:
http://forums.riftgame.com/general-discussions/general-discussion/379204-follow-disabled-warfronts-conquest.html
My question was about getting *Windows* cursor information from windows handles where there are multiple mouse icons in those windows.
This is an information access question... Not an automation question. I would still like an answer if someone has one, regardless of what you might *think* it's for, It is a very valid question.
Again, thanks for any info in this matter, and a thread unlock should be in order. : (
Share this post
Link to post
Share on other sites
Melba23
SMark,
The program I mentioned, ISBoxer, is even a completely legal program to run in the game RIFT
I do not care if the app is legal to run in the game - it is against our Forum rules to discuss game automation - which as you yourself quite clearly state in the quote above, is exactly what this is. So the thread stays locked and this one joins it. :)
Please do not post about this a third time. :naughty:
M23
Edit: Threads merged.
Edited by Melba23
Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:
Spoiler
ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area
Share this post
Link to post
Share on other sites
Guest
This topic is now closed to further replies.
Sign in to follow this
×
|
{
"url": "https://www.autoitscript.com/forum/topic/158304-is-it-possible-to-get-cursor-info-from-more-than-1-mouse-cursor/",
"source_domain": "www.autoitscript.com",
"snapshot_id": "crawl=CC-MAIN-2018-30",
"warc_metadata": {
"Content-Length": "104288",
"Content-Type": "application/http; msgtype=response",
"WARC-Block-Digest": "sha1:DVOATWP4PC7DQC4CHUCEINGN35L4NXIM",
"WARC-Concurrent-To": "<urn:uuid:b211b1cf-47c0-4faf-b72c-b12604557dd9>",
"WARC-Date": "2018-07-19T06:28:48Z",
"WARC-IP-Address": "212.227.91.231",
"WARC-Identified-Payload-Type": "text/html",
"WARC-Payload-Digest": "sha1:HPQKDBACFJY3I2RSUARLG6BCNTMMZ7D3",
"WARC-Record-ID": "<urn:uuid:ea47a84b-48c5-4e56-9c6f-c06fc9490c86>",
"WARC-Target-URI": "https://www.autoitscript.com/forum/topic/158304-is-it-possible-to-get-cursor-info-from-more-than-1-mouse-cursor/",
"WARC-Truncated": null,
"WARC-Type": "response",
"WARC-Warcinfo-ID": "<urn:uuid:6a295a57-e768-4723-8541-747bc96eba69>"
},
"warc_info": "robots: classic\r\nhostname: ip-10-179-103-175.ec2.internal\r\nsoftware: Nutch 1.6 (CC)\r\nisPartOf: CC-MAIN-2018-30\r\noperator: Common Crawl Admin\r\ndescription: Wide crawl of the web for July 2018\r\npublisher: Common Crawl\r\nformat: WARC File Format 1.0\r\nconformsTo: http://bibnum.bnf.fr/WARC/WARC_ISO_28500_version1_latestdraft.pdf"
}
|
{
"line_start_idx": [
0,
16,
41,
47,
48,
113,
114,
132,
133,
139,
140,
177,
178,
403,
404,
423,
424,
474,
475,
510,
545,
580,
615,
616,
723,
724,
756,
791,
792,
834,
835,
1070,
1071,
1154,
1155,
1177,
1208,
1238,
1269,
1301,
1346,
1393,
1459,
1525,
1592,
1659,
1731,
1732,
1809,
1871,
1943,
2004,
2065,
2104,
2105,
2127,
2167,
2168,
2203,
2238,
2273,
2308,
2309,
2334,
2356,
2357,
2365,
2389,
2406,
2436,
2453,
2466,
2497,
2550,
2603,
2656,
2709,
2710,
2724,
2729,
2763,
2804,
2805,
2868,
2927,
2936,
2999,
3058,
3067,
3072,
3077,
3078,
3322,
3323,
3385,
3386,
3405,
3406,
3408,
3409,
3425,
3426,
3427,
3440,
3461,
3469,
3470,
3477,
3478,
3510,
3511,
3818,
3819,
4047,
4048,
4052,
4053,
4054,
4185,
4186,
4194,
4195,
4250,
4340,
4423,
4488,
4559,
4622,
4709,
4784,
4830,
4926,
4994,
5068,
5130,
5201,
5202,
5204,
5205,
5221,
5222,
5223,
5236,
5257,
5263,
5264,
5490,
5491,
5813,
5814,
5959,
5960,
6006,
6007,
6120,
6121,
6256,
6257,
6452,
6453,
6540,
6541,
6557,
6558,
6559,
6572,
6593,
6601,
6602,
6609,
6610,
6612,
6613,
6706,
6707,
6961,
6962,
7016,
7017,
7021,
7022,
7044,
7045,
7063,
7064,
7195,
7196,
7204,
7205,
7260,
7350,
7433,
7498,
7569,
7632,
7719,
7794,
7840,
7936,
8004,
8078,
8140,
8211,
8212,
8214,
8215,
8231,
8232,
8233,
8246,
8267,
8273,
8318,
8343,
8344
],
"line_end_idx": [
16,
41,
47,
48,
113,
114,
132,
133,
139,
140,
177,
178,
403,
404,
423,
424,
474,
475,
510,
545,
580,
615,
616,
723,
724,
756,
791,
792,
834,
835,
1070,
1071,
1154,
1155,
1177,
1208,
1238,
1269,
1301,
1346,
1393,
1459,
1525,
1592,
1659,
1731,
1732,
1809,
1871,
1943,
2004,
2065,
2104,
2105,
2127,
2167,
2168,
2203,
2238,
2273,
2308,
2309,
2334,
2356,
2357,
2365,
2389,
2406,
2436,
2453,
2466,
2497,
2550,
2603,
2656,
2709,
2710,
2724,
2729,
2763,
2804,
2805,
2868,
2927,
2936,
2999,
3058,
3067,
3072,
3077,
3078,
3322,
3323,
3385,
3386,
3405,
3406,
3408,
3409,
3425,
3426,
3427,
3440,
3461,
3469,
3470,
3477,
3478,
3510,
3511,
3818,
3819,
4047,
4048,
4052,
4053,
4054,
4185,
4186,
4194,
4195,
4250,
4340,
4423,
4488,
4559,
4622,
4709,
4784,
4830,
4926,
4994,
5068,
5130,
5201,
5202,
5204,
5205,
5221,
5222,
5223,
5236,
5257,
5263,
5264,
5490,
5491,
5813,
5814,
5959,
5960,
6006,
6007,
6120,
6121,
6256,
6257,
6452,
6453,
6540,
6541,
6557,
6558,
6559,
6572,
6593,
6601,
6602,
6609,
6610,
6612,
6613,
6706,
6707,
6961,
6962,
7016,
7017,
7021,
7022,
7044,
7045,
7063,
7064,
7195,
7196,
7204,
7205,
7260,
7350,
7433,
7498,
7569,
7632,
7719,
7794,
7840,
7936,
8004,
8078,
8140,
8211,
8212,
8214,
8215,
8231,
8232,
8233,
8246,
8267,
8273,
8318,
8343,
8344,
8345
]
}
|
{
"red_pajama_v2": {
"ccnet_original_length": 8345,
"ccnet_original_nlines": 214,
"rps_doc_curly_bracket": 0,
"rps_doc_ldnoobw_words": 0,
"rps_doc_lorem_ipsum": 0,
"rps_doc_stop_word_fraction": 0.27573299407958984,
"rps_doc_ut1_blacklist": 0,
"rps_doc_frac_all_caps_words": 0.021210230886936188,
"rps_doc_frac_lines_end_with_ellipsis": 0.004651159979403019,
"rps_doc_frac_no_alph_words": 0.2981908917427063,
"rps_doc_frac_unique_words": 0.41416895389556885,
"rps_doc_mean_word_length": 5.653951168060303,
"rps_doc_num_sentences": 45,
"rps_doc_symbol_to_word_ratio": 0.014348099939525127,
"rps_doc_unigram_entropy": 5.669088363647461,
"rps_doc_word_count": 1101,
"rps_doc_frac_chars_dupe_10grams": 0.3598393499851227,
"rps_doc_frac_chars_dupe_5grams": 0.36787149310112,
"rps_doc_frac_chars_dupe_6grams": 0.3598393499851227,
"rps_doc_frac_chars_dupe_7grams": 0.3598393499851227,
"rps_doc_frac_chars_dupe_8grams": 0.3598393499851227,
"rps_doc_frac_chars_dupe_9grams": 0.3598393499851227,
"rps_doc_frac_chars_top_2gram": 0.0064257001504302025,
"rps_doc_frac_chars_top_3gram": 0.00835341028869152,
"rps_doc_frac_chars_top_4gram": 0.010923690162599087,
"rps_doc_books_importance": -639.6539306640625,
"rps_doc_books_importance_length_correction": -639.6539306640625,
"rps_doc_openwebtext_importance": -371.33367919921875,
"rps_doc_openwebtext_importance_length_correction": -371.33367919921875,
"rps_doc_wikipedia_importance": -289.351318359375,
"rps_doc_wikipedia_importance_length_correction": -289.351318359375
},
"fasttext": {
"dclm": 0.026678919792175293,
"english": 0.7719557881355286,
"fineweb_edu_approx": 1.425999402999878,
"eai_general_math": 0.03390109911561012,
"eai_open_web_math": 0.1744820475578308,
"eai_web_code": 0.6638143062591553
}
}
|
{
"free_decimal_correspondence": {
"primary": {
"code": "005.1",
"labels": {
"level_1": "General works, books and libraries, information sciences",
"level_2": "",
"level_3": "Computer programming"
}
},
"secondary": {
"code": "794.8",
"labels": {
"level_1": "Arts",
"level_2": "Amusements and Recreation",
"level_3": ""
}
}
},
"bloom_cognitive_process": {
"primary": {
"code": "3",
"label": "Apply"
},
"secondary": {
"code": "4",
"label": "Analyze"
}
},
"bloom_knowledge_domain": {
"primary": {
"code": "3",
"label": "Procedural"
},
"secondary": {
"code": "2",
"label": "Conceptual"
}
},
"document_type_v1": {
"primary": {
"code": "5",
"label": "Social/Forum"
},
"secondary": {
"code": "4",
"label": "Code/Software"
}
},
"extraction_artifacts": {
"primary": {
"code": "3",
"label": "Irrelevant Content"
},
"secondary": {
"code": "-1",
"label": "Abstain"
}
},
"missing_content": {
"primary": {
"code": "0",
"label": "No missing content"
},
"secondary": {
"code": "-1",
"label": "Abstain"
}
},
"document_type_v2": {
"primary": {
"code": "18",
"label": "Q&A Forum"
},
"secondary": {
"code": "8",
"label": "Documentation"
}
},
"reasoning_depth": {
"primary": {
"code": "2",
"label": "Basic Reasoning"
},
"secondary": {
"code": "3",
"label": "Intermediate Reasoning"
}
},
"technical_correctness": {
"primary": {
"code": "6",
"label": "Not Applicable/Indeterminate"
},
"secondary": {
"code": "3",
"label": "Mostly Correct"
}
},
"education_level": {
"primary": {
"code": "3",
"label": "Undergraduate Level"
},
"secondary": {
"code": "2",
"label": "High School Level"
}
}
}
|
672f1e42c33a7f9846924a2431ea77df
|
6,330,818,370,211,012,000
|
Home Intro Announce FAQ Docs Download Mail Status Bugs Users Related FM Tools
PVS Bug 978
Synopsis: circular proofchains
Severity: serious
Priority: medium
Responsible: owre (Sam Owre)
State: closed
Class: sw-bug
Arrival-Date: Wed Jan 10 15:10:01 2007
Originator: Hendrik Tews
Organization: cs.ru.nl
Release: PVS 4.0
Environment:
System:
Architecture:
Description:
--g4AlWPTQws
Content-Type: text/plain; charset=us-ascii
Content-Description: message body text
Content-Transfer-Encoding: 7bit
Hi,
I get the following from status-proofchain
***Warning***: The proof chain for data_type_length is CIRCULAR in the follow
ing:
General.Byte
See README for how to reproduce.
Bye,
Hendrik
--g4AlWPTQws
Content-Type: application/octet-stream
Content-Disposition: attachment;
filename="circular.tar.gz"
Content-Transfer-Encoding: base64
H4sIAPhvpUUAA+19+XfbOJJw/2r9FVjn+a3UUdyWnGPG3emskzg93sk1OaZ7Ns+PQ0mUzZgiFZKy
456d//2rAwABEjykOD2981nvxZFIoFCoC4VCAZiG6XQV+el333y9zx58Hty7h/8/uH93BP+P9kYP
RvRcfr4Z7d27Nxrff/Dg7t1v9kaj8d0H34h7XxEn/VlluZ8K8U0eXGZN5bKk8fX/1c9U8d+fZHnq
T3Nv5uf+7vLiGnuLDL6PfHXz/96D8V3N//27Y+D/3XsPgP9714dC/ef/c/73eu/jMM6DdJkGeTDz
ngL3xYF4dxYk6VXvcXAaxj0hjhfLJM3D+FQcH+6Pe/DEroUy4+VXywCr4n8PoYgQH271trLwV3wa
+/mwt3XhR+HsEfz8EIVZ/uHxVR6cDMXhbJYGWSbu/CgmSRKdUN1bJ9jMyt0Mgnj95ujphxo0TiQC
z/3FZOb3V+Eshxo1hQfioEelheg/S1I/ivoRlDYxRJJILKG06G3FSS6iID7Nz/rRQDwU2EtqZoC0
isIg623J3vLjfjT0seAzP8qCAba3I5ZpkswFyF++ysTBnQH2t0DLY/jQ3PNgsfAFoSjxkx3q15Fn
MBRtXeAOV1GU6Nf0rtc7imeiKjK9Xu+49OiDEiXiR0mkUKZevH715t3xy58c4LRMeO/zMKLSnaRN
yE8zw4e6XJ54EyAPCqTVLIpiQbyTosI8TRa6So0MR+E8J3AnpiQ72b0j3Pzz3j15MsLePXkiXk2i
8NTPw4So1qwOTiqVlIFJ4yyJmiAJWCNYWPvvLOeHL59qsuwI6PwqygV0UNE0zFi6RN8HkTnzlUiR
NA1KCjcDlJgDtpzqFkxJRSQGg75siH71ZyC7UHnAeBmIFRyb+2GUiSQGGjJiWb6az9fS/CZ0Imxe
HD97Bpq/Wj7q64b7UrkQO0AvnrnRA3rlZwEQaZ4jhkGaBQY5jSpitGtUmyWgrGiOsHvYO0V/5gjY
oR0W9TNoYJ5EUXKZUXVqDRh8ESYgj/llAiVV4Va2yHIoKdWuuhlT4YwY7xIOUnRk/zN/EawtHLPk
Mu6GBVizmRiIHiKyTL6qDtVrkKk8tYI3gn/jmv7WiN+I5K/m5Xgw6LEhylYTsp4fV7PTYBHEICT0
HMk/D9MsR2kQfhpgF1ZBHl4E0ZVIw9OzfCgmq5xeocj502mwhO6JSTD1VyCvBAaFFhm5mqTBNElR
z9LVNF+lQc9t8sLMq9ob6Pl/K/yoGpCqZrATb98/fve310feq2cNQ6I0wsDzcNaxPVtA1munauyp
6cxrabil2dpGqVUcLcP8CtV6Fk79PCDOsrT+Fdzc2upC+CBmspSUOHi48D/bz4TgQchbBAsYzUma
h1h1CEXRr0AHDnSMoN0uHAeWQ/HDQwQpQUwiAAh4mKCo4hCGDDn8p358GijNlDicDIqGiGAgaVmQ
P9KVJlEyPe8zpBIGA25Bg2Z7jEAaMfaiMA78tJa1tU6bU7nd/pdWVcSkxQ/jsuyMlf2uXm8d/1/P
/6ZJDF0CW3C9cz/8tMz/7t+7Ny7mfw9o/rc3Ht/M/36Lz444DeIAhFRoARDor6EwZ6K3gyZjGq1m
OPfz0+lZmAdkysUsWAbxDGwW+BxBBrL4k4SjPf0du0IYF1UcbTnmmi9Xi0mQeq/TZEl2bBLmmbeE
J9IBXyYZTCvxzQLNSektvAKV+UOlogeFw8VqgUPr5xD8ILvijw+r0HpsCm3Iwedl3h8P7er11n9H
oO7XO/aPGfZLoOZimV95PLGBkRUctr5qfICUy33oAJBnr7YtNKxefuaDmS6wtgxSzN1QTkUsftD9
+UNhe/CxgtADforD9+9eeW+Ofn5z/O7ojn7lgRWD1ztMpEsc8g0ijfuj+wPrLZbXCOkqDwUYgv37
VPJnhlFPDKxRIsbOjq7qXQRTPTcUE/j1YXT/RJWodgKhDS302LRKkcbJ7eH+uFayO8q1nu9qsLWi
oma/tdKyQ8DR1ZLDGXALZljKs4PnQP8VqmNMSoSD+WSVeZcwcJxp7uyPpWDz8GZzTRcf1OFZ1Kxw
VAJ8KO6O/3j3j/cfjP94366A0lZfS8ni/hjbUb5Hk0BwVZd+kFdL8x58WPF90R1Nk9lqGuDcMAAq
LoGtQEFdmcoHn1ZMfHYNNU4PFRIlmjHR8oQgvP7rW4YyPQum50G6K45zmBHHM1BUZO5/Zsppnifp
QjXx7NWbw+fPyY8pZgEH7Kj80JVHytvB4l7RacPn1F0x3MyaLlEjJNlyoob4KmYxr9qQyDdAQonC
gI1MIfsgrTA3AdEBZQTWofLKEpdAaz8WfpQlQHRyImkCDMyGmQ3abDAKOSAvy/fDORfI/AtUJTEP
LhH8eHKBIoWzcWB+VtixRdXMGcywSlXEfCHtnaEbQKQXl21GzynjsqKHLj904wC7OGD3mEz7Q7GH
TmyIU074+4PlzkqLyBCqRlP3qMZ26vdDA+qwZBeGUHFLd3to06W3EUjGRrIObLL2YZarFJwCDCmc
greNZg/LvJG/7Jgh91oCmYUghcTi3d1deqZAeDG5CsznB/YrGvyKADey1C5gm1uD8lKOAfUY1ChD
Q4GT6YxiIAvRxzf74zsgp7JAEsMUXE6zlYyfBTEWv6L5ODyfoRxG4TTMoWyOb6kWjAsSlCbLwKJL
VtDkH0eHvwzF0WP88wT/PKU/x/DnLf55/PqfNkn9FttskfFbB+kQFRmWAJMRTtF+ICFAN/vwT+r2
wBhk5wEObUFGlfrQu2SJTJ8pazu7ApIBIFUOHgL5TxNWfijBBlZZDWw2YNP1M1gNGCnQ/hMbQrAg
QgYxfGINEBqJ/WkFgz+8i5Jc20RCH1SSaoKPJWuAvyCWfgpMhG6TUQIuJgtsKZ6vMqiBvgG4F57G
V3Pjwy01TwSzenaVwZQ+Ejxdls9RpJaLIkpEyFz4YeTD7LpSRwO7CNN85Xj+5M0eekriDnT9LESR
yVbg2l6EyI7LNKQOEhlB3FKRfpdA306JFQQAiwRgihJ0jeQkfSg0/GUWwBiQs6bp19js3Q93sdUg
JrzfYqMWYPxzB6iHLDvV4PzcDe71++On/RFJ70D2B6EJP8/TcLLKeTLyWQN/9/yxTdad5WkVU1EF
vY+gT6NkgrYH8S2I3+PAP0/RcdHsXz3Tc3/0/J/7f/2T/2/a5v/3Hozv3dPz/3t3H8D8f39/f+9m
/v9bfHo9c6XNsfKrZy1q5Xfnyz4IgW2mtFgUrcvU4y8Erp32LMhLsyNymx+C0f7BjPUZ3mkRNizs
KQcQ9WTZjkOChTYXBUorrEWD6HmVm62f+1noeBzb9EZNU0EYh8i3jINgBsNgSF4BmrjVFAvxSNzm
m9vNleMFjVQx46cjy8NE8Xl+fPRWmlV3oHYE1YpgrRGhNeO4I0k4mljR4o0c2zzN4j5Hqw0WlLn1
D3MBSfwvMQUr/bOWHUyVMPagOQxUK7KYdBkKq+EG4tALjih3ooxFFXeHeVbGOuTNwuxjAsMzwxmV
cRrJPAzR24IPFhmXi4wLUTcC7AzttgTyA4f3x+LVG/12LN+O1dtRM0kLXPUXJXIEk8nL6wCjoXDi
OiqjLGnpJoauQ7Bk1SJbQ68kWrVsVigYThHVIOtDgBIxkCYYcE/BCUYj9WW9HhoWrrxKoglSL1zV
HgVZsSTSVFN3t6bmWkzQ1C9zoyMGs3A+B9c8ngZ9jYyLR7q7au3EzjLp9V6QE/ThLU4JqqkrOxgP
Zz8JV6t9cOEXC7Cv8pHKoEO7vCNCjAbizO0yhClgGvgzmiWQhyzmq5jKwfy0t8OBBzlVmAVzsJy8
FB4nZL5BjFQLAADKZzh9WMmlPg3qOxoEEGJ17Db7ORQv/PPAe5f6cYbhpiBFi3p947rElToSqpDZ
9QztzB6P15Nrkn+4eY8IfiCUNmBejmQrfHtDGQf8eyg4x0cn+UgAzKgCApdrgvMeunti5fxkcvGU
CuCYtZAPrI6QZZAvikXCuiVZObjgQ1r8kMGA12rFVyQXMDPLzzAMomQVVwjn/lRNhWcJrd7LuBjN
f1UcDMQNKQeTrF3Rz4KAI2iHKjf0Dbzz3sdcc8ZRhOWCiO2t1GOdSWH1EjModnYKd0n0iRpWGTRZ
OzKzRA6wSEJJ31LyhyooxKs/PwJgfzc43/cH/WwwKMqo0baoFMP0zqO+u+viciuahGvUDJ4dI4vF
d0Rm+n6dnq/ToTQFmlps8iW7Qxg7IVSKAnUH7MhMIiTsAWjNdJVmGLh16I9U5yc+jmigFolK0IpX
ESrJqz/3QRVXUHQwVHEFXHXpT4YijdBv6ff7JhJG+wNx6xb5PiFPDIDFRlxV3BkNKGqGJYSAMilm
MlC7xWMMuYD1TM69vDCgVg/6hByXDqIssOrVVRL9Z37uR6paDCMafi3q19P19oh6TsVlPWxuIASJ
8cGBi8ycfwdD4BQJjab16PDt+zdHKt0AeNVrFwgtw5tKlAXALVBrANj/UgB3m0RalyTKoxlmFwOF
WtRLtZFGKmUbJIuMOEbmSbBIiLdYslHcmDnEexbw4ALc/nAOUtc3DZWSANCELWVUJ4AKtjboFwZO
mVAj70TiIbXAUgIDp6KgRHikNGEHFBH8riT+z5x9G8AqsCqRXTaQGGo1pS4OrMJGX4sPOEYweOUJ
NzAJzmBGa6H6ozhK0yQtVyRNssGTXtjNCUd7cmnNaAMmtN8LXENK4jyMV4FCp7dV4ku9lABJh3IC
OEJOcWOKXzCaUXErP6gPCDeyrvYDJNd1C4qrRkpUN2Vk0Nuy6YRirYwEPVQWgsMXdYpVUSuwlHZO
VI/xfNTvoFeMgT1VlhbqNOCtKp3AqOQphtCGvDHOmdhHLuxdA53gkc6FvAwEFFbWkWB2Td6G6Qgb
w06Gfl2eFbMKKvGfxOxr8kPMKSn6qda0tBKiYzm3MCQvladMeQGtJF1mDaC9NQ9FZcEYB7Xc4q/b
mb2f0OVvrGCo4tFn4HvmCvxxfManRF9wOT6B/OUJZp3mVQuu83KRKMmE87HTgCcgHNkTXdTNJIhn
T4MaYnm6OwbaqDYO4e1I/X5tTxGu7u2LBCYhSYzLlVcb9A9qO2InxfzfGxk4eWNHdERxsRRiqFQd
aDJsqaLdKOGRvd/qSjivKXZUSwigNK1QbU4JY89HEq/RNXKlu3etGL8eGqNQY33GqJYvg2udnVnz
/kaDSUWu1WJ+qUHkUeh3aRFhNFQuKRbjuLNlHtE4VmdsMF37YrNYJYtncdm1ta680mFhv5adbGVK
zTxVTDayka7O/h6MZBsZylaytTwpPriqMnakw7beE4o/fVDxIvf+w6aAqw5h2bFcR0DVDBSfDIUR
TPWO4ws/Df0YZpSJhwrSq4/8obNUjfCVooaf5O86JZRbDWUE772rDwfiaZBN03CiQoBkbsp2RnxS
2VBqT5lOnaN0lRy3CuHyogpHa1sk/F2Q1ZT2k03DLIiuDiQoTVJwpR+RjH8aZrjP9CyJZhlOLQt4
QCSVSAPYUasSShXVPEgXYYw7XMAbp2o8naWIM8g4JUAJSn0GNCUYhW1o9m7G+V61iOo9LTJ4iM7/
Jwqt4Cau4lnVr+tWyAhEElirjhCueU5DVUJzq6kSx0WN5DllW8mmHojjOUgcUIgIwvQYcjbZVbKS
U35caVY5bIlYBilyBZc81GwdRaNMV42LbXxrCV+O2X4VSlCYPic5Ai07fMMGkPUaXlmjsDGbadZF
FbxvmAT1GnT1Geal4vs7AnNY00kI70A/uAtD/c5yGDL3Y7sHPq3PWaVMb2Knyq1QWbNHWmMlBNkq
cd7nTbVUUFym+S4lwAUR7y6k5GYDDYUCBlZN7KLAv2Bjc+FHK8zZyDmRTpNSo9dzCFaBKg0YjN/Q
aqLkEhlL3EYpE5ALSLF7s7pG0eQssWzU7cTnlvoM3Wqv/4mflR2nngr5GPZIGA8bDFJjoaouyfK2
l7O+QmKIqYs+7qhcWBVxcR+VUMv/YinK5fxcC7e+WPgKLlwP43/PfBedGL8+mwuTY7L5i1ljJyGs
YxgcTvumIlznulv+/chunxz4XussT45RQ3Mu1j4RKM0DmvGw5Lt15lCU3YR33tgG19vSM5ENAY7s
2UlPbVtX0rYpT0k3knPg6tGLF4fMVdrjI/pZYZPaTJIRr7k2G9TBCGlro6pIKquqFcVXcXaequNG
IQ5VuZyBdc07wPFKrtnamkLrql0UxTwV5Qul6VplfTNJx25zXK1Fha2WiEuHsaAdHnoehS6kniv6
qzxZ4A4Omn2FYEQxYanFqxzqoyOkO0m7y0zOLlacIiEdTWsSWKhk39xdjF5trLEc7G4gYtxPU6ro
ibL7A/HqjXpiu4b69Kcv108zyCFjG6VQhzeuTVXr7Yg/4W4VR1hDZgXjcTCrFPe0CNzyGPpR+CtN
hhFGSufRUPKPLxyTFNFHhZbzdprP4Z4i0SefHqMrUz9GoaBdN6WTZjjuovgOTOkZ+yyLrTIUvqEt
NwPqjoSDNNGt4DRV7vwB/l7oQ28A1WSF037kXHmBUPhzhF9ZwOvRPp4udYrcnR3XeVYWj4YUGPHe
BnnmPecMvdp4kJp3Xu+ctMhL6zAnvaZgupQoQ/QKeZHB1+uMnr+z9vhSbiapmsqf1HitYSehePeg
5GAoyxvqq9p8RxNahU0oI3BhLoLPeLKCjD3KKEyE6pRAJygx56Cn8sbo/AUQQ+Ex+plnxN5ctowx
rulc3SxYDp2XrUFwMwxOpQeVWUJHQsN4hJvgoiAvFp+KgPilzNyiEHEKby8C+czog8vv7mzzS3Qi
x9szFeVLoufX4QJ3Y6Q3Ls/WtjaFNJL0nCZxjNv4WuFwirN7orQxH5zgmid6HUW+ZlbbMtFrNASW
LK5FPKZdg64o3wcjdiRGaM+MEd0K321C6Pq2ncIfGRtQhgZ04yG6mJXH9dqxJh9NBFzzTCdK1Vrl
ha1OlWSdYleDs7HKo4099ebRp9oOVXLg1KbRBcvR/25jSE/G/X3B+1ia4HU3xKX5nXNjTMqmeSjS
S/llkXA3G5Yu1xjxhWijuWwYKC1xMTe9rCfJCpRjv43qVVFIm6nqFpmu/WvumGpyMOyUaEhaoHfd
8ISyzJ2BAfV6czVoB0wpIENLEUaO/XX6l5dp7h4f6qTbWdiYa7hMa9XrKp8JqUPXhnS3DFu9rj6s
3CYlnasiQbEIAztC1pZd47kXHUSipsk1WZKXdpqkJnHT6hMaJpp38SsWgyCQm1uvU7hc011j9oJI
fGf26/oErZseb7iE1TF7T+ZpKWZ/iVdUD7Vxc49zumEHKBtWRJyZRGsvgNRC+dJFkQbAeGZKfWL1
2isFXyXJp6DhmrLqmJ+sC0HOS65JywsXWsaMrnO8wM1Dha3COX9yzjkURUSJHtZx25FG78xWS8tj
hnHcvjVcdB0tOiV0yrEiZTPO2/Kro4QVT8bcjutopW7hVD5jelg77dVWjrL4tW5CIFjNi5OObURy
kadpR1S9dGBlmbeRzG1ZCWPZ4c4iIzG5kZvrlZvqelcnGVpfiAj4GnLkytqTr0i4soSKYP5WJY6N
4F7pCKSM18N0kfPpMjr0ig4Tm6+ieRjxKSMXAYBWkV6KV8rcJPSWQjoJc8pHBJYOotrtlO9fosRX
lWMdgZRz6K8pzdfW1mbyu67gyo3Q5WzBYvwsFniryyPuBEBl1jRHOcVvLZ4OKb1va6tTerrOIbyW
NXMFrNZQVbPFVBX3cRYmW2tbW2fviUtcmGBVzEuttCUC6JJNIqfKlFM4nemYNaJXm9Lp9rU3Gr3r
ZXPtHc3NoNbY29xFXzbRls66sp6m9FQ6wcZyiZgVRvHTQG4HMNfSxFpOAr7f3KhWox3r66xLl4y5
Zzlrr7v1vi412lCJwOPgqX7VdTViW11mNtYeW6dgV8JhhjBPKhcqdI+GfYV4WIMwfpX2XB7spZSh
uq3FzfOflgDdGmbPtbD0BUePbAB/rXMkNoBfd8xEKR5dyXgoPG2f6nPCEt1I5VKKjRZOqhi3pEBL
M9YWe95kOaVlJaVV7hFEMS6kchlhDd377fS8ksGgo38S7dZhYV31FfJTG3aUphuGw5roY522t2ds
l0eFYipQDAvWjhAzlrGBWFccoHKY0+3+fInMdvEbbOe6kl/QQWw6h+SLFcJ6T6HLqX0Of6VGrtZJ
J60m8NQexjEwDp8029/Msb7OcaUOat1o4pr/yqPTZLKgTNta3893WO9mz6hxoXBtFVjLeXbZ7d5W
+VBdR6mKlqy3eG5K0RqNrLXmUA+3+3zky8m5trv5lf3NLxuxWqYuBTDpk+AIZh3W13kIm0Ty9PVS
ynQ5h1ru0jaT/qv51EWWr76dqpSY/WU5vdoeujNzmz1VTk/gQ1c2GF619fYkDGfqTfteuY3GW3v4
UCfHfLJHVHXQ9jqgzYiCnVXvEAq9U39n5+fUXy4BOheQXcZ1UP5Cw8HfXh+ZufY7LB1yU3U5D7z0
0DwqgKnoScgKwNSHIQA6JwWoP0WheIIPTYkyUDoZFhE381M9YPODqoG8euFP08T5flQc1tm/ZZ+o
+pDRY12cZoPS4ZmDYYGJqamNFamEPqzzltyejlyymfE7vULh//RH3/9wMQ/9bJrcWaYBJqVf50UQ
zfc/7I/37u/p+x/u7t/7Zm90b+/+g5v7H36Lzw7fxxtTltOjR73eex4A0KTjhhy5N4eGBdqg0/fP
8eyABRjccIozu4sknA30ESly/MD/Hqm74vGU4j/52Zn3JIHRM6MlxQ+Hw8fDJ46NS/JAFnEL78/p
z0L/NPVpW9lAH3WNB2srOLrhuTol5RDHp8c4qJ6qR4/x0ZOT7ymQdas/H54O+IgiNINPYHQ57c/x
HLbvectVGVeoZvzyDrMsmX74efjL8G/D/6lzFUyTX4VnoPsz4vaLhe4v+Ohv+OhMPfobPvqf+ovk
z7AJHxHTM4b+HGh4Cv/OcPykX33+KQ8/r/SpxzOxF7hf6Wl4Ec74LqKSBxQPlZ8jL990IkRXvc00
EPsAOqHu7qTj8sSPYoSzV7xuEhxIffskoSNB8DVw/lDEMJir74uGtR1Zj6+cO83LKIRD8VFY9wZ8
lLekAR5Wm+OhCAfYrsar/PojvZZuhUE79DSwdd71VRUQcFZi9gWRkEDYvc/SN4x/hbEUjzA9zUef
h/j3il/8IyXK4VvxvyJFyjXcXZHkZ+DcGVQYeVFg7j5eYJ9jujOcOsPNLciRNx7E9WQmwMtoVfCY
6kFXCM63xs94oC525LcwdVBUM8gERDOvfXWoVeGAG7QelmDUoMuXYXoZMLIiEkj8EHekWuJJdPqM
N1pDZ2Jgff8z3iMPyKfBAnP7PtcTx2zNwztZK4oAM5ahWPJBFOZ1IeIHsSxleoPW3BYTQGJJL7+F
Osi3Cfz61HDlBLRc3/6noYBJ08ehOLfbT43rYM/LByLATOBb8+1tuzj8/kjX0OOpl8Xzjw26CpT0
wOp7QPQyhhPNi6H4XA7rqRVQeLBIZv3JYHBAXJkgV4BlKVFIHkmnSHxA3JwQAQH1RqTgn4tlJZzw
wkVJOGUasFSZblJeNIKEYasMKTuWh4uqIQ0NTCQXHciE0NePzEggh35KT0xzB2VIwM/R4jVINZTx
5lGSpC67Tho0sQw8AcU0V+gw1ev7301a4GdBNG8eNiRUH6HWXzZDwNA+Oa40YjwJ4WlF5RVRpqTt
Nie5aVRHqIntS1ymqAz0fQLfO+A03hininRdG06gSbV8nRryNpFaNx1ohdyEZqIrUg5iOdGCafFk
vCluIws5fDJux3ARxl+Fl3ccvLxT5qWBwQjXXRar6Rl4g+ksSIuzFWCwW4SnZzmn3XVtQNwZ9XSa
4QKICXYLPI49geuaBA5vJ01ynDU00YdMl/QFY9fdYl+qiN86+vEt5tKvgdX1s6/ASrsOjSqIAw48
nnn7lUFQyXTNqMOD3ghbHKuhj57QD/ZU8I1yX+AFEajFbDKF6tVu4iKMUmscYAuW6KeDRnUyPFbC
IMrXFBZ0nCbWoFbPIJSSHzryBUvVD0eNKMkhXrYjpgNNFFIqIJOPitVIF6nm5CdBv7JwEjUmBtdx
1ALgoGzZvjucCVZDpPCULzd0kFZ2mTslhbEw95oW0wYng+YVY+8P9rQCjPEfEOD43v3mju7V+5Ha
d9gjyXioromvA1WRwFAThuGAIzVCOGEznEl4iltlS8BiITP1FhaCrEp4FYWedbIe0ayqFec0wPvs
O7hnzHJ6OHMo07diJn3lqVuFJlqYp8NZq/wSU+nPBrKrKzfpYcyELDrBwQULd0K3JpxQHE1+/EzS
/x0mt+3p9YcjvDpE14bhcqG35vJFGSqKT0jX2Q3WsOHUZjoHwB0G03CX2K6qRh4H+WUQxH1wALAf
fA+lBIerFHTnpZQx8b8wasc848dlvJhmZ3z9JYDDebg586abxZ4np651DgpMTCgw8bkhMCGRJM6x
+Hv5mR97i1VU4aJWBOzBP1JRBVekcRP5MaIAY9sYXZLP6OMCYWAOfweU0Wr4NE0u8c5FeR9dEF1V
bAM0euDsgSjalLPIuKDvZzW7nfDtpLFuN45iaDbw6dpzeSv6Ro2qyo/6/4gVD6vN/tNsuF9wBpE0
uc/58iquMxnGFOfBkmTP6csPongv4ttg2P5p9gqIWMO4EnfWaEApp1o3KncC5LVYEAKBJMF8HOYX
wTRPpLB+eMlYOFflzFDs5OLDyxPVowmA2PPmIV0sxp2iRzhPhYf9uQ/KPjBLj6qlR6p0nq5UYQwi
lzDkFxxbNc6C+vBOLifCf386evXmb73HRz8dv1RtqoDgO7Axvva48EkW5B/e6Z4sAlJcf1bM3fgR
qAk8xL/Fqc+yMGVtjxzl9VE+xTN5EQMexFMBMa6CmLSCaIh3yGth8W7NFbzBG7XM9WjjRlE5gBdP
JuicNCTWY6Sbk6P2ZRi0yJVSt00QjHog8oJkac4YZBTM7TVzA2jhfDqbavKBXE2lNO+qaWu6eVsM
nYxNtTsMgV4CUHIAwfMr4t3W2Wa9QxjPYzz3uSl2a480jkUFH6EEs0f9WF/kTPqtLnFmk1YKxeNo
7g/4OmcJgOvzRaF4PJ2GWk8LWcj7NUj1xmoTn/5efV2s48my1bp74Pu2t1vjKcIkMC7ddRzTdcsx
r54UGMK8b1GIQvF8jM97eMCdaooNxn+vZqd0Ure43fcPCsKB9Opf6Bz1dihdY+tPh2898i70yzAG
17RpOUY1aC0V9IwgLvLUatn4vaAwju6Hbo0jNN0a9WJ3s3ZLsd1S3NrEjm6EYzDrObZW3Q3J0tsC
Hxed9Aq/TTrd6UIn9MvYzx5b+u/ExSYUUAnPMjBWBrpIgyO+HtoSbrLCKdMcUC9W6rCYutxZGSK5
pPkcUyvZXXgn6jO8nBhzXpoXZh7eqVdGWqdfvtNbUWQiW8QRM4U3Vn7Uj5rkSbY0naVrClNRcVP0
5ERGvgNA8B5NfVH4Doba0QGgNNXgcx7EGd23EVY93AgMVjS2m5Y+XoROE7zDVSL5SGX+RSOzxbG9
5dCQETr2xahE8hjT92FITiPVH4aF3xMlMQ6khDodUgO1C3eehhiJ6klx20fElyDZJET80PJqwjia
sKGrAciFQ4EhjNpUNZnPM8rJlAC4eQM2FuDUS+r3m6Mn79+8Pf7rkcJRp2+FcwKDV43KJ3zOwCqK
lLuOV28qAtOFkUS5ocA2wOKYOAm8axbh3YEhJtL3K/O1kfjduEW21KfSJZAO0eQWzW5rgSm6a1G9
sr1UvrHIiDQq5Fhhdfj+3SvvzdHPb47fHd0u4VjGvEXMnT0AU9S1EzgXD2FehC/KHYpreoOWTsk4
t3o7LG67Zhcdrxu2BXEoyCdrlpjjZ2WJgYnJS1Nijp6/PWJJwbiV2QzedJprsTh6+fT4WZ1YSGul
q1fIWkVaaSRTzmqYmpUcLvzSwuD3KkOAN9aDwFC8Vho6T5OFeDcUf1EGof96cOIaJAI8+wDnEpQT
1W5vqTz87stL1bhP0AhbgZxDqn+BL8jeIt+VZG/2QQsYfXkNX/Dcp6F4hjPUkz5Df33S/wtVd5IA
E5+BgvT0pZ8bb9xzZlaBPA2neXTlJbigFMhEbd0/9MhtaZLHUTGn6EgIEfERz0qi+RpvnCwPbbMT
Dvn+bnebaaSGAtrfKyld5PCoieZHgqLGW9Srj0oc1WXXJJGBn63SoGrB6ZBEXILAAzdJMPsHfLr4
Z8y4xa0sdPfh7u6uGKoXsXyBc42BBBPG4vIsnJ4x69VdOGKm7+FS9yedBSKl8zoEAwsJtvrOW33g
y52RUQGFJpxiLnaceAk0EPlLOlkYyIr7CTNcBWT8h3QxFhBdVudXKfSfDvVQk2cO8WhgBY+RyUNk
tJPTYiNWY/PqunajzRKPzRF/mFU4jQ8HDKUwm3RXep/Ihlb29ZtX/+2NqL0BntmuS5gvoDDowUdv
LH9iHtjAKTT2HemRZXFlgMqhXz1SPGwDXTbg/jLnswrlSejPk1Oybeof/N51xkwP+JDzGbhhmAEZ
BcD/D9lZAm7g+Ul/b/fuPZENFJT+9jahhyK6muZiO95mfPv97dG2yu7OzpMsXCy/FQcoUtkjsKPq
lZ9lQVr8BIzwCL5txGx7o6e8T2rbWOTjFcZlknmn+bgoiEfH4EXk25//Y7St/o62y5jJ3/3tcZfu
WDhxkFg39kj/iv1FILZ/3eZyfWh6KMaY0vQfo0GBQBosI3+KN3vDhCdK9XMUFcIXHv8KnjXWp4g0
QPi1qI4MKPfC6gf8OAMCiTv3xLgQss4ELJEQMdjmTo3MMjaD4QGmCmyH8RSNQxif8lTQX312VKKP
U2ir8fZWsd13iW0dKxUVnBqiRFx3fxqEEXSFGPFdfyLZMQBSwHeXQlDNckVR1MQb4W1OduXPyMkf
AozscTXImNpPtssMw3WmKZ60FI23xQEG/mDM2v6sFSfe+3VbtzMwatdIcUXByqIpuynXLTxK0pHf
w0x9rRNGAxWXUBUqLXvX1kq5simPrnWYNmHcc9rQWmFkq/ItUFkt1aDpUF94pFJiRv2p0REH5yQx
6ttmy+XsNUYO2nq67+wp3uJyR13RuO2ioKVj7JSIbenWToZNy3e4/tj/R7EgZS5lYQRpNPinEu/6
XkOnlg69RT8cSwLRqRHdBgibagWNuVoyK482464VTdHtZMl5UOgIHKZdpmIw/LKilgez8aCKg1Ki
sr2uPnfJDwhms/iMd/cerKUoBX/U+h72G1f4ipFVkspRABN13Pa6anONXHdr8CrMEAPfdqMCT237
VGKyk362F1LfjR+NbnQYPnRXToPyONypMzyymE127Y5LfPDpzRa8f7OP3v83CfPsOjf9GZ/m/X/j
8f27Y73/797dB9/sjcYP7o1u9v/9Fp/HwPamhVpjEQVXaSmsaSzTYhQAt43DT8qxw98DOcA/xMjD
hAPOI4oziz0ZK65PANXgPIrwW6uT7sb0aiQvCYxpcQUBQEksQRkq6p1xnXfcvHEAMcD2wiwpx/dK
HdUNWfip87yFmK5wopJj8l5otI/rViopNx4KYwmreUuDBGcvT6s29mRkmAKD8tKPVS7OcSNQJvBO
NAAX0y75VN0pFRZAM0LS3A8kOalTWYuNP27U29DOHHyta7xnrjUzB43m21sqr8OrlfRSF6lvIYZ9
zjmx1UBnj3bJPDSW8PTSY9hpMV8BcyPxUcW4K9jc5g2J5/bS/jm2WVquK1HvY3N+qJIeC6eeAUeK
6UNcCCiBpqW5EWdEUqSRkiEpS0olP7axxBLaYi+mIW+6zT1mU3N3KN+imcYG7HOTkz0H8Vpa2yk6
or+st0hbqe9aaEdcwIk7h38hynqR9SHKPLfwpzoDVYku3AYmhmPMDziXfNvrbQHXwDCHGNYC0D/q
VzYseEtwMO4R4q26xGx3GXrdRQC6d7uuy3U9dveWzaCFuoF5gTVmW52Fc8kbTIDS1prtX2xkNoRN
y/clMLTtck0ZcYHoZMPOseuh2kptbMm8g12xrYa7u+a2z1bTZoAwjvB02TfLyH4sYWIaVAdWTRtH
d1y4cPL7hpk4FTgd+/UjPLIsdQhE/+iw1t16a6KBGX9laawOvA00wuUVPi6pzWDZJWm3gRpT6L0M
RGTKn9BeBK2bhrTmlaQofVScrrYrF0WHQxdcYMG6VstOCKe8AV2tjB+0YgMidG/rdkWstbWQIHnl
HEuW04YaxvISAWv0UbZQEY7Y2gVNUkJIu3ShlhQDC0ivjJQqWXbb6uCNOna2pa/1HT1XHf0BSjX0
UQErmx5bHDOUIRabmKVqYmOKjjdBU/6UctGrNOk5cSjLje3K8xEQDXa/ioqbcg70roGMuveUId5C
S6WQREtURlxohhb4Dk+8RzdMMz1jIMWOrR4WpLKlrkZhqyJYpvVCktfAtpHEVv3fQBWrHXYqZOO4
4sR+kaTuWy183slUIq29O4s2O6rhXo8qvjXkbJnP2zoEZrHDQFvLhqZxBcVKZY4yhnxFM90fktN1
x36WrRZLumxkyJ52lGRBitdMxgEMORmmXl0mq2gGM0FhooQQZwHFp1mwsQ6z9c6IxHywEXdM2Vqf
Oaiyvos39iNyzYzM1utkmZ5rlB3Kdc9KbQJUdzzq0wTvmaFLYKKoFgKe8YQrTkKuODHrwdZP/Rj5
rKKTlC4xDXFytiveZ3y3jbz1keMJ2FLgz3ZbJ15lDKrWIwPaTvFfyTBrX8Lht2VowbhSsYnweI44
30ZAoKlZqGZg/JanYVMUFHglH9oTMWdDuCCDre1RYwUwe3I2xXJZaJXpNkUvMzlZ5bga4TRUDdQS
pb6X7y3tTs1uE/IK2pxUtOn8vAbc5lT4EYlA4SXJcfndzL/eWkPEttpIWJKTDUgYxtdFvdC9+6KN
cD9akrMpdcra0Ku/lNg5EJgxKxP7X2v8YCF+teJMW04z/qvhShC+TVOXPTV1aQ6EuRqqibRUpljn
HXA23R/cllkvU8W5U+tJkK7XMeDxgyvgUQl2xNZUyOhQJdQrj6Q1n+NxSCA9+E5/7Ry7aQlNOiIJ
DyuRBO02WH2keW9LUKcS3ZTh4bjhmlGlwqVJr8wTLaLpVXlKoInkXDlFbqVOEO+E+AY6+So1B4nE
perOGSy3ZI0RtrY3mzxXH9W0rbmf1flbUmu/ErTza3fSnsslYXsn1+XkNIlzvwsnmzpG7JMjmNE1
4u3mTLTM9mIjRhoqoFKb64aeRW2YXfnwGCY+H5GRGYtXb3TMHB+MGvtZNZqV4DxaGktBZSS9w0Dt
7K7m66aDdjPUhnGkjYhMP5ptWwQk4l4nFRe0cnCHi3UhpbvPG9Fv3cG3utKh/B65TtGNDHrdo0Tm
HzSBe1vmpMKg0cCxMFJaycHbROMgmOFt6PGVwIDFUNHAx+Qwvn29Rji1UXUJ0U6LWa0fRzg/aXpO
i5HY3QRHzak5xdgR6xtXrlZKaWi1PY7udhw5qssILt5XgntyCNfzKOQ9OQ3E5Yl+Xmbtx9Y1OneM
KkhPA1ePyDzjeXnnI+XF41l55/AnyQpHwPTnRzRUjIhZY/O+mlC/SDLjOQDDR+cg4MpI1MTlmnxn
heWAJwm2f7co8B4oxDv44wom4T1myD15s8BjKENbPsT3338vd310Uo47Iwpz4N0Aq8gnOLudKsqm
ZsEFaOMStIxiuTJXEx5PQ9y9iCyfBrNVirtZOGOzLmHT2C5RbXe7toB+p/OHW32Q2gol6styesuC
zrKchpSZn+B/MnlWJ1aiDDmy3Okx768YDcql7lmlVCcVWtvlF2qHS/3DIpeaThOrPsdD2RbJjPK9
hSM99+vmf+n8P7qY4Y5xW8z1JQO2nP9/d3zPyP+7P8bz/+/ev3eT//dbfHrmfSSvzr3noHYf1OWA
h8JxPn8UYtyWNvLldNkh1jg8wai7dS2Ml9Pe2sMTx4n4XI6WMc89BND3vZTON5bQBsUdhbTt0Lpu
5vBEh1if0L5DrpzM9eA3SfI8wbMlnvm5H4HNXy3x8NID8erPfbwvywiJ8va+2jGR0XMkOJQQtu/c
4uF5tXzExQalS5CsTuONRWC6GLNZchnLx3Ibr4M/MLiYT/F6Ac0yvLcBN6rS/2MX/+T9CogALd3D
kEO6b10r5eCZExFBR5fTFQVv6+8G8sYnJyrqhjcVUOO4AqRvdPik/LpGMPsEZgdFTZd3ttZSn/4c
z3ldKj1dURYi3Vo75HTVT7RAtUSnYzbk1FV6lJ2HeB/NLnYcO9L/NODreRyNjU6qkqvQs8V3mtG+
2S0QgeKiK5AFgoJAPhnP6Yadrdf+aeDNfQDdX8598Mn1b28e+aeZPE9wq70ggXv3/DE/REFR3+nN
T6/1C/UV1InUSqlXseVEHKdBbuJaaCCCSvLE6mDkw/QBy9S8KZSU6VRVCBR90Aa2N+YL86aRrppR
6IZxvwixxqEfO8aVYLUXfQwryA7lfSgd9WZEApt2VzFfFXUCa9POW7f6n4Zpo+3VEoz3ANwCPwq1
gC44BTP2PR0u9V//RVBE831h2CpAASC3RCpvZsHmfarouJu8EUxvCxGRL7D4UHYZb62/JXjmYqC3
WSuErI9w6iaFwHsvxN1ylWNjK8NDn7suzT9LON7QLV49k4Iv7cHwwo9WwUCq2IFI6alx01ZZx+eg
VFDO8bioo7WcttqXtJ6LaNU3P6YZ4CdsC0qfsmmoGAajkNGisgPDaMBomU96HcbrggGVc6t5uLZ4
Sxy3+UE3NBBH+EgDy7GoYYjfZwM9aOEJlnQ8b+CK39dPBq2M8fvqxaCFN36fXgza2KPKNXEIWjWe
kc02uRRc4IbdOThQrTcIorXD9Rc8YvQDP8CCbUak7CvynYJ0gETT4DstFK6Ov1tbB2Le5x/tOkej
7pZL7dQwW+HxVne9kxxxKh8B6qBvWw0KJ4dchFR5SG0VTMVBuHHEbRuRvbF7TFZeWtexmbNCaHPq
56Yx2hyiWxCHEXS0+RDqjxvqtnilmW63fZTPxl3KIlweVf3RMBs7RrzmPu3LkRUocksYw6tklizT
B8j26PolrWFbt6B/3xeY+1+IuT+uoLcxSEbPH9d7AHQR2yKJ/ZlnSqq1BFWm5aigpez+oOzSmOXG
WG4geULkbx8NK3dKOEZDY9ZC46HiRWlE9Ef8u21UzMZd/JR/SzdlHT/l7sac8QvO+OO+ZMugg32m
o8Be4PlpRoGmoM+aZhThywPoknPzAuri0kW+e7bOfB2eqFFanithDfAUKeFznqkNs4G0TLpD46pb
9Aw2azLtMGM7ZHNbXGFc7+6Q39nQnhUdkC5KU3yg9ALb/23DBEqfvjBawNpWfnxNwQP8VaeOkmmO
MF+FLa/+/Mi4phpvG6dr1fAxcqrxEgyNpLppe92LMCoAOqH7ibG0QpDGjeql3jw033FVpBzxDbDy
6ZZyHydGyOj8LE1Wp3jYnKGGVBZLWrrZ5P+zRmhVNYSk8uELXhv0uDjLUqoWWx2bNqoBS8dQ0Fy6
VFUx/3ekX60KVYTgLE3cUK9Uc4VmFQhIIZn6+fQM3gSfpwHn9AtcGEuDeAZ+OYZYF2KujQGV9nRZ
j940SsthR1ExpabR7lvispGc+F8mJAVD1pGBkl/yLxMAzX66PrnsWaDpMD0F9h3wQntRucpe+h7C
eZEHtvyEL5HHy+qFvuPmwy1GCldPtNhw9EDBPZFkWi1LBT6oErowBl2h7C15u0Y55lygz+936GJ7
XErB5YRpgd/u7m5tz2u6r77sN9KB1My9MFNGTkz1vNKgXKXdEy46ri1aYKbuHKGOGr3tY1NDAoLC
09DavtK4/i3JsYdS9UShe+zYALS/05IYwOYvmRkuI266K/epM7JBaYYbDQS2sFoC/D42Ct/MJnGW
JQX/1qBNLCqygcOltTI6ojXMPLGfjmmx1JYYLsDAP4iquLhWaJ0X31SU0n7t7olTTqimHteln0Ax
O+FQpUHFJed+mra1y2dry0FB+6DhlC0zl3dOSqU5hHdzOTfl1yhRLYE94Y6oq6G7Ml+tdKBkzdcL
9qnSzkmsLK28a1nWORSosvRybr42e1EJAJo44TtFPXtEMM7KZXNStSb4/FRY8ygWl6qAWHaGhWwK
ynk6KNnvqlhouVB2QRiGgYxTWXqnGas+gMfvSutrNN3USS5R99YbO3V2KB53VdtaW+AAe9KZ8I/L
A5+D/I30NwHUcaHCBkx9fDxYjxuTwZoM8cZchoyvUQgGZz+n1YgV+oF06jYnoezsyPrVYEgTl9rt
K5WYt0RqeeKjSlM8IwTlNCdOreESHU6odWNZ4bOBpo3yukMyBE1rte3AtXViMzyv9ZExYGE7u1/P
Nda2E6YjixX4WpNgmiwCaUFx46UP09bc6RMrcDXedG20pd6VtiMfgXmouHl4eFUQS6k+x/GFn4Z+
XExfugTrimwrc3lECiZdc1Af0qLlBvxhlafXJ3rviTqMviWnSEiV4zsPGKq+eqXcsB0dcwRFD0+K
SJm1VlsfJ+MmN0qmUafYW0JoH21vyR+/0rKFP9slqwa/ermqVuiVRKwulGRwwhH1cpCbfTZ1EFyF
jRyJxmx8jDhxzpu9N62MqgpX82UJUq6zetkxfnq6/CPZ/tAqbZyyZ6asa6M1FA3RBRlcsNHO+J4W
sxGM8KqY2paLIkY4UOPLm9Zrw5CuLnpEMoNHm3ZJ9mgtOuJ1DF0IUZQrAo7ygaZRVQI+8aBO5HiR
xCDmcTgN86v16LOAml7JslW2K5jv0UGxfo+VEWqwgwUB1d2KzSBNmqxBcm+s7xMuRWzXBaTO+KHb
G3EBoaRPa1CYb4f8DUm8Xj//BZTmKzFbJEBtzqRTdfAyFBAbSiyNLv0rDIkWdmE9fsBoUlyl1WtA
F1vFm2J5vC4pt8QOz+ewWAtj0yqNQZFLDgPYoDZz+3WtbW9L2xJRXnDxp3hIDJvX+mUeuzeGUV0f
cVFnVJvo1NWc6n6WermmkaRO/p8yj/XE66yuDSAajj1zUk07vlUZoTd0IxR/0zRiVauSo1qjAwlw
Lm7r7NokKJNekoAVBZ0tMmVdyfKvHAkaGfsbiVNHu48wqtnqevZWN6vz3iUezrc/mNGHhklery5U
pCEOHasxa08DZQygeSp4PW5ueRX+d+frFovl1+H0WqMWZzPGF0GaB7N1vTWlnfnvdFAz6VY3umXL
YBrCdFmmFlymuUrM6EoAvLYqCnI0UXZ+hEmKL++/bsbsVnHuV6ean66l14b+fLW+uzRnHQo01//k
2uhWsYhgMf/VOyX/PT96/y+L31e5AaR5/+/e/v7d+8X+3we4/3d/f3z3Zv/vb/F5ESzAn/B4IDoQ
Tw/fHWJSRe/x0U/HL0mb3wT+jIKB/uwRPfiZ9q0f8P+Pekdg6i0omGidn8E8dxbO5wGGEukU2Sev
34MxCy/CKDjFwxsvgohOoaWFGZgipwFdSJrE0ZXIL5OehFlUcWL3drUM0oswS3CZpPjBmL7PaPUE
/7Pw1DAxNQWjvxzslXf56lZ2drgdjtu+TOIldCaI8wPj+yO00Rz0nVwJX8T6DYWRZd3XaZIHtNP1
wPherosVmDBo9WUhcREmEacF7uxgH2x81VIXPpWwKGZ9YPXsGTxqzRCweOh8V9DNfl1ByXx5fLg/
VotORcG5xMhO4BHLuTf18aI8udpeQB0WJaTXdGCjbBRYJDOAUBSw8TYTe2wS0akdQCRxGsRBWozJ
1KtedVeA4ZfjTypWiIyLPtwKn6VOoMFb49M6VtgHHfvmdDkqgcsXPWGvOhXO3GmQezNG5alcXgOv
SmVr4vk9/asgH4gzgBiBW7nUcqIZIpc+NPl8OYQfiMPZLDUpW1oXsXiET+x0/kc9fafyu+ePQdXp
ZuUsR92gPk9XaaoUBYxFCgLP4mnmURhLfQZAxSBDT7h4HywKnQySJYtgksyuxCUtK+SJJAGYmiQL
1C3Nv/zyCx6UgscKYxzMSFgEwuos10dU2rG6aGAko2Z8En6cB2m6Wuby3WGOnSbtJ8MoOSvXJeVS
pAgXi2AW+ngd5K44lq+BgxKI8YE6lIc70+m3CRpQx7rJf7Ak2stN5YVh6gUd2J/g0d9EvmmKW6tV
xolcwXxENxm3fMST27dlDzPRWFJ2bPs0Ae7QmtY27mmB7gUxsCKYrnI83GZHlFMRC/GnWoIvDY9P
VdYidQhtpVr5/FePsr/fj/b/3hwdPn1x9FXaaPH/9u6OR9r/e4DlRuPRjf/323x6OIBNz4LpufAn
oEX+NL+D4wlOBHbFz2Cm8dIwP74CwxWf8lEYs3AZ+VfyInqYnfamZ37IuzFprR3HQY8vSRf9CBNd
KcAx2MVZqFgEeMB35l+Bo3iMhhL8JdBzD4ev3Up9sJbvX75+8+qvR093e71vv/32Zz+NARP4Rv6M
nB83YAAQnhy/efL++eEbdjdh/EuiKLkEKDTb/YnHkt3HV3lwYypuPjefm8/N5+Zz87n53HxuPjef
m8/N5+Zz87n53HxuPjefm8+/zef/ARhdjSgAQAEA
--g4AlWPTQws--
How-To-Repeat:
Fix:
Modified the status to properly check for circularities.
----------------
(eval-when (eval compile load)
(fmakunbound 'get-judgement-tcc))
(defvar *possible-judgements* nil)
(defun pc-complete (decl)
(let* ((*dependings* nil)
(*proved-dependings* nil)
(*unproved-dependings* nil)
(*defn-dependings* nil)
(*axiom-dependings* nil)
(*assumption-dependings* nil)
(*depending-chain* nil)
(*depending-cycles* nil)
(*in-checker* nil)
(*current-context* (context decl))
(*possible-judgements* (possible-judgements decl))
(fdecls (union (union (refers-to decl)
(proof-refers-to decl))
(assuming-tccs decl)))
(decls (union fdecls *possible-judgements*)))
(pc-analyze* decls)
(mapc #'(lambda (y)
(cond ((typep y 'formula-decl)
(if (axiom? y)
(push y *axiom-dependings*)
(if (assumption? y)
(push y *assumption-dependings*)
(if (proved? y)
(push y *proved-dependings*)
(push y *unproved-dependings*)))))
((and (or (typep y 'const-decl)
(typep y 'def-decl))
(definition y))
(push y *defn-dependings*))))
*dependings*)
(cond (*depending-cycles* "circular")
((and (null *unproved-dependings*)
(proved? decl))
"complete")
(t "incomplete"))))
(defmethod pc-analyze ((decl formula-decl))
(let* ((*dependings* nil)
(*proved-dependings* nil)
(*unproved-dependings* nil)
(*defn-dependings* nil)
(*axiom-dependings* nil)
(*assumption-dependings* nil)
(*depending-chain* nil)
(*depending-cycles* nil)
(*current-context* (context decl))
(*possible-judgements* (possible-judgements decl))
(fdecls (union (union (refers-to decl)
(proof-refers-to decl))
(assuming-tccs decl)))
(decls (union fdecls *possible-judgements*)))
(pc-analyze* decls)
(mapc #'(lambda (y)
(cond ((typep y 'formula-decl)
(if (axiom? y)
(push y *axiom-dependings*)
(if (assumption? y)
(push y *assumption-dependings*)
(if (proved? y)
(push y *proved-dependings*)
(push y *unproved-dependings*)))))
((and (or (typep y 'const-decl)
(typep y 'def-decl))
(definition y))
(push y *defn-dependings*))
(t)))
*dependings*)
(if (axiom? decl)
(format t "~%~a.~a is an axiom." (id (module decl)) (id decl))
(if (proved? decl)
(format t "~%~a.~a has been PROVED." (id (module decl)) (id decl))
(format t "~%~a.~a is UNPROVED." (id (module decl)) (id decl))))
(when *depending-cycles*
(format t "~%~%***Warning***: The proof chain for ~a is CIRCULAR in the following:"
(id decl))
(loop for x in *depending-cycles*
do (format t "~% ~a.~a" (id (module x))(id x))))
(cond
((and (null *unproved-dependings*) (proved? decl))
(format t "~%~% The proof chain for ~a is COMPLETE." (id decl)))
((proved? decl)
(format t "~%~% The proof chain for ~a is INCOMPLETE.~
~% It depends on the following unproved conjectures:"
(id decl))
(loop for x in (pc-sort *unproved-dependings*)
do
(format t "~% ~a.~a" (id (module x)) (id x)))))
(when *proved-dependings*
(format t "~%~% ~a depends on the following proved theorems:"
(id decl))
(loop for x in (pc-sort *proved-dependings*)
do
(format t "~% ~a.~a" (id (module x)) (id x))))
(when *axiom-dependings*
(format t "~%~% ~a depends on the following axioms:"
(id decl))
(loop for x in (pc-sort *axiom-dependings*)
do
(format t "~% ~a.~a" (id (module x)) (id x))))
(when *defn-dependings*
(format t "~%~% ~a depends on the following definitions:"
(id decl))
(loop for x in (pc-sort *defn-dependings*)
do
(format t "~% ~a.~a" (id (module x)) (id x))))
(when *assumption-dependings*
(format t "~%~% ~a depends on the following assumptions:"
(id decl))
(loop for x in (pc-sort *assumption-dependings*)
do
(format t "~% ~a.~a" (id (module x)) (id x))))
(when *possible-judgements*
(format t "~%~% ~a may depend on the following judgements:"
(id decl))
(loop for x in (pc-sort *possible-judgements*)
do
(format t "~% ~a.~a" (id (module x)) (id x))))))
(defun possible-judgements (decl)
;;; We collect all judgements of the current context that might be
;;; involved in the proof of the decl. This includes all subtype and
;;; number judgements, as well as any name or application judgements
;;; whose decl is in decls.
;;; [owre - 2005-09-11] Now just collect subtype judgements.
(let ((jtccs nil))
(dolist (jdecl (if (from-prelude? decl)
(judgement-declarations
(judgements (context decl)))
(remove-if #'from-prelude?
(judgement-declarations
(judgements (context decl))))))
(let ((tcc (get-judgement-tcc jdecl decl)))
(when tcc (push tcc jtccs))))
;; (do-all-declarations #'(lambda (decl)
;; (let ((tcc (get-judgement-tcc decl decls)))
;; (when tcc (push tcc jtccs)))))
jtccs))
(defmethod get-judgement-tcc ((jdecl subtype-judgement) decl)
;; This one is difficult, since it is not obvious when the judgement comes
;; into play. Just collect them all.
(if (generated-by jdecl)
(get-judgement-tcc (generated-by jdecl) decl)
(find-if #'judgement-tcc? (generated jdecl))))
(defmethod get-judgement-tcc ((jdecl number-judgement) decl)
;; Similarly, don't really know when a number-judgement kicked in.
;; (if (generated-by jdecl)
;; (get-judgement-tcc (generated-by jdecl) decls)
;; (find-if #'judgement-tcc? (generated jdecl)))
)
(defmethod get-judgement-tcc ((jdecl name-judgement) decl)
;; Ignore it, if the associated declaration is not in decls
;; (when (memq (declaration (name jdecl)) decls)
;; (if (generated-by jdecl)
;; (get-judgement-tcc (generated-by jdecl) decls)
;; (when (memq (declaration (name jdecl)) decls)
;; (find-if #'judgement-tcc? (generated jdecl)))))
)
(defmethod get-judgement-tcc ((jdecl application-judgement) decl)
;; (when (memq (declaration (name jdecl)) decls)
;; (if (generated-by jdecl)
;; (get-judgement-tcc (generated-by jdecl) decls)
;; (find-if #'judgement-tcc? (generated jdecl))))
)
(defmethod get-judgement-tcc ((jtcc judgement-tcc) decl)
(get-judgement-tcc (generated-by jtcc) decl))
(defmethod get-judgement-tcc (decl fdecl)
(declare (ignore decl fdecl))
nil)
(defmethod pc-analyze* ((fdecl formula-decl))
(let ((*depending-chain* *depending-chain*))
(cond ((and (not (judgement-tcc? fdecl))
(memq fdecl *depending-chain*))
(pushnew fdecl *depending-cycles*)
*dependings*)
((memq fdecl *dependings*)
*dependings*)
(t (push fdecl *dependings*)
(push fdecl *depending-chain*)
(cond ((from-prelude? fdecl)
*dependings*)
((or (axiom? fdecl)
(assumption? fdecl))
;; No need to include proof-refers-to in this case
(let ((decls (union (refers-to fdecl)
(remove-if-not #'tcc?
(generated fdecl)))))
(pc-analyze* (union decls (possible-judgements fdecl)))))
(t (let ((decls (union (union (refers-to fdecl)
(proof-refers-to fdecl))
(remove-if-not #'tcc?
(generated fdecl)))))
(pc-analyze* (union decls (possible-judgements fdecl))))))))))
Home Intro Announce FAQ Docs Download Mail Status Bugs Users Related FM Tools
|
{
"url": "http://pvs.csl.sri.com/cgi-bin/pvs-bug?id=978",
"source_domain": "pvs.csl.sri.com",
"snapshot_id": "crawl=CC-MAIN-2013-20",
"warc_metadata": {
"Content-Length": "33188",
"Content-Type": "application/http; msgtype=response",
"WARC-Block-Digest": "sha1:7VFLWK5KBEDMEFSLN5E7U72GQVC6WHVF",
"WARC-Concurrent-To": "<urn:uuid:48498cde-460f-43f8-a77e-52a3f8402b2d>",
"WARC-Date": "2013-05-19T07:11:51Z",
"WARC-IP-Address": "130.107.1.243",
"WARC-Identified-Payload-Type": null,
"WARC-Payload-Digest": "sha1:OMJB2MCCCXYLGLF23VUR2LFRSFINEEWJ",
"WARC-Record-ID": "<urn:uuid:1cfb7b51-2557-4354-9807-0249c7309a75>",
"WARC-Target-URI": "http://pvs.csl.sri.com/cgi-bin/pvs-bug?id=978",
"WARC-Truncated": null,
"WARC-Type": "response",
"WARC-Warcinfo-ID": "<urn:uuid:5f6aa4eb-ee25-42ae-87e5-c9120aac08fc>"
},
"warc_info": "robots: classic\r\nhostname: ip-10-60-113-184.ec2.internal\r\nsoftware: Nutch 1.6 (CC)/CC WarcExport 1.0\r\nisPartOf: CC-MAIN-2013-20\r\noperator: CommonCrawl Admin\r\ndescription: Wide crawl of the web with URLs provided by Blekko for Spring 2013\r\npublisher: CommonCrawl\r\nformat: WARC File Format 1.0\r\nconformsTo: http://bibnum.bnf.fr/WARC/WARC_ISO_28500_version1_latestdraft.pdf"
}
|
{
"line_start_idx": [
0,
78,
79,
91,
92,
93,
131,
156,
180,
213,
237,
261,
303,
333,
359,
384,
398,
417,
433,
434,
448,
451,
466,
511,
552,
586,
589,
595,
598,
643,
646,
726,
732,
750,
753,
788,
791,
798,
801,
811,
814,
817,
832,
873,
908,
938,
974,
977,
1056,
1135,
1214,
1293,
1372,
1451,
1530,
1609,
1688,
1767,
1846,
1925,
2004,
2083,
2162,
2241,
2320,
2399,
2478,
2557,
2636,
2715,
2794,
2873,
2952,
3031,
3110,
3189,
3268,
3347,
3426,
3505,
3584,
3663,
3742,
3821,
3900,
3979,
4058,
4137,
4216,
4295,
4374,
4453,
4532,
4611,
4690,
4769,
4848,
4927,
5006,
5085,
5164,
5243,
5322,
5401,
5480,
5559,
5638,
5717,
5796,
5875,
5954,
6033,
6112,
6191,
6270,
6349,
6428,
6507,
6586,
6665,
6744,
6823,
6902,
6981,
7060,
7139,
7218,
7297,
7376,
7455,
7534,
7613,
7692,
7771,
7850,
7929,
8008,
8087,
8166,
8245,
8324,
8403,
8482,
8561,
8640,
8719,
8798,
8877,
8956,
9035,
9114,
9193,
9272,
9351,
9430,
9509,
9588,
9667,
9746,
9825,
9904,
9983,
10062,
10141,
10220,
10299,
10378,
10457,
10536,
10615,
10694,
10773,
10852,
10931,
11010,
11089,
11168,
11247,
11326,
11405,
11484,
11563,
11642,
11721,
11800,
11879,
11958,
12037,
12116,
12195,
12274,
12353,
12432,
12511,
12590,
12669,
12748,
12827,
12906,
12985,
13064,
13143,
13222,
13301,
13380,
13459,
13538,
13617,
13696,
13775,
13854,
13933,
14012,
14091,
14170,
14249,
14328,
14407,
14486,
14565,
14644,
14723,
14802,
14881,
14960,
15039,
15118,
15197,
15276,
15355,
15434,
15513,
15592,
15671,
15750,
15829,
15908,
15987,
16066,
16145,
16224,
16303,
16382,
16461,
16540,
16619,
16698,
16777,
16856,
16935,
17014,
17093,
17172,
17251,
17330,
17409,
17488,
17567,
17646,
17725,
17804,
17883,
17962,
18041,
18120,
18199,
18278,
18357,
18436,
18515,
18594,
18673,
18752,
18831,
18910,
18989,
19068,
19147,
19226,
19305,
19384,
19463,
19542,
19621,
19700,
19779,
19858,
19937,
20016,
20095,
20174,
20253,
20332,
20411,
20490,
20569,
20648,
20727,
20806,
20885,
20964,
21043,
21122,
21201,
21280,
21359,
21438,
21517,
21596,
21675,
21754,
21833,
21912,
21991,
22070,
22149,
22192,
22209,
22210,
22226,
22227,
22233,
22290,
22291,
22308,
22309,
22340,
22376,
22377,
22412,
22413,
22439,
22467,
22495,
22525,
22551,
22578,
22610,
22636,
22663,
22684,
22721,
22774,
22815,
22849,
22875,
22923,
22947,
22971,
23009,
23031,
23063,
23087,
23128,
23152,
23186,
23226,
23264,
23294,
23315,
23352,
23372,
23414,
23452,
23470,
23486,
23509,
23510,
23554,
23582,
23610,
23640,
23666,
23693,
23725,
23751,
23778,
23815,
23868,
23909,
23943,
23969,
24017,
24041,
24065,
24103,
24125,
24157,
24181,
24222,
24246,
24280,
24320,
24358,
24388,
24409,
24444,
24456,
24473,
24495,
24559,
24579,
24651,
24721,
24750,
24840,
24852,
24892,
24948,
24958,
25015,
25088,
25110,
25173,
25246,
25259,
25313,
25322,
25379,
25409,
25478,
25490,
25541,
25550,
25606,
25635,
25695,
25707,
25757,
25766,
25822,
25850,
25915,
25927,
25976,
25985,
26041,
26075,
26140,
26152,
26207,
26216,
26272,
26304,
26371,
26383,
26436,
26445,
26503,
26504,
26538,
26607,
26679,
26750,
26780,
26843,
26864,
26908,
26941,
26973,
27009,
27037,
27074,
27124,
27155,
27200,
27255,
27299,
27311,
27312,
27313,
27375,
27452,
27492,
27519,
27571,
27624,
27625,
27686,
27755,
27785,
27841,
27896,
27900,
27901,
27960,
28022,
28072,
28104,
28155,
28205,
28259,
28263,
28264,
28330,
28381,
28413,
28464,
28515,
28519,
28520,
28577,
28625,
28628,
28670,
28702,
28709,
28710,
28756,
28803,
28848,
28882,
28921,
28939,
28969,
28987,
29019,
29056,
29091,
29111,
29136,
29160,
29217,
29261,
29288,
29317,
29383,
29436,
29468,
29497,
29528,
29594,
29595
],
"line_end_idx": [
78,
79,
91,
92,
93,
131,
156,
180,
213,
237,
261,
303,
333,
359,
384,
398,
417,
433,
434,
448,
451,
466,
511,
552,
586,
589,
595,
598,
643,
646,
726,
732,
750,
753,
788,
791,
798,
801,
811,
814,
817,
832,
873,
908,
938,
974,
977,
1056,
1135,
1214,
1293,
1372,
1451,
1530,
1609,
1688,
1767,
1846,
1925,
2004,
2083,
2162,
2241,
2320,
2399,
2478,
2557,
2636,
2715,
2794,
2873,
2952,
3031,
3110,
3189,
3268,
3347,
3426,
3505,
3584,
3663,
3742,
3821,
3900,
3979,
4058,
4137,
4216,
4295,
4374,
4453,
4532,
4611,
4690,
4769,
4848,
4927,
5006,
5085,
5164,
5243,
5322,
5401,
5480,
5559,
5638,
5717,
5796,
5875,
5954,
6033,
6112,
6191,
6270,
6349,
6428,
6507,
6586,
6665,
6744,
6823,
6902,
6981,
7060,
7139,
7218,
7297,
7376,
7455,
7534,
7613,
7692,
7771,
7850,
7929,
8008,
8087,
8166,
8245,
8324,
8403,
8482,
8561,
8640,
8719,
8798,
8877,
8956,
9035,
9114,
9193,
9272,
9351,
9430,
9509,
9588,
9667,
9746,
9825,
9904,
9983,
10062,
10141,
10220,
10299,
10378,
10457,
10536,
10615,
10694,
10773,
10852,
10931,
11010,
11089,
11168,
11247,
11326,
11405,
11484,
11563,
11642,
11721,
11800,
11879,
11958,
12037,
12116,
12195,
12274,
12353,
12432,
12511,
12590,
12669,
12748,
12827,
12906,
12985,
13064,
13143,
13222,
13301,
13380,
13459,
13538,
13617,
13696,
13775,
13854,
13933,
14012,
14091,
14170,
14249,
14328,
14407,
14486,
14565,
14644,
14723,
14802,
14881,
14960,
15039,
15118,
15197,
15276,
15355,
15434,
15513,
15592,
15671,
15750,
15829,
15908,
15987,
16066,
16145,
16224,
16303,
16382,
16461,
16540,
16619,
16698,
16777,
16856,
16935,
17014,
17093,
17172,
17251,
17330,
17409,
17488,
17567,
17646,
17725,
17804,
17883,
17962,
18041,
18120,
18199,
18278,
18357,
18436,
18515,
18594,
18673,
18752,
18831,
18910,
18989,
19068,
19147,
19226,
19305,
19384,
19463,
19542,
19621,
19700,
19779,
19858,
19937,
20016,
20095,
20174,
20253,
20332,
20411,
20490,
20569,
20648,
20727,
20806,
20885,
20964,
21043,
21122,
21201,
21280,
21359,
21438,
21517,
21596,
21675,
21754,
21833,
21912,
21991,
22070,
22149,
22192,
22209,
22210,
22226,
22227,
22233,
22290,
22291,
22308,
22309,
22340,
22376,
22377,
22412,
22413,
22439,
22467,
22495,
22525,
22551,
22578,
22610,
22636,
22663,
22684,
22721,
22774,
22815,
22849,
22875,
22923,
22947,
22971,
23009,
23031,
23063,
23087,
23128,
23152,
23186,
23226,
23264,
23294,
23315,
23352,
23372,
23414,
23452,
23470,
23486,
23509,
23510,
23554,
23582,
23610,
23640,
23666,
23693,
23725,
23751,
23778,
23815,
23868,
23909,
23943,
23969,
24017,
24041,
24065,
24103,
24125,
24157,
24181,
24222,
24246,
24280,
24320,
24358,
24388,
24409,
24444,
24456,
24473,
24495,
24559,
24579,
24651,
24721,
24750,
24840,
24852,
24892,
24948,
24958,
25015,
25088,
25110,
25173,
25246,
25259,
25313,
25322,
25379,
25409,
25478,
25490,
25541,
25550,
25606,
25635,
25695,
25707,
25757,
25766,
25822,
25850,
25915,
25927,
25976,
25985,
26041,
26075,
26140,
26152,
26207,
26216,
26272,
26304,
26371,
26383,
26436,
26445,
26503,
26504,
26538,
26607,
26679,
26750,
26780,
26843,
26864,
26908,
26941,
26973,
27009,
27037,
27074,
27124,
27155,
27200,
27255,
27299,
27311,
27312,
27313,
27375,
27452,
27492,
27519,
27571,
27624,
27625,
27686,
27755,
27785,
27841,
27896,
27900,
27901,
27960,
28022,
28072,
28104,
28155,
28205,
28259,
28263,
28264,
28330,
28381,
28413,
28464,
28515,
28519,
28520,
28577,
28625,
28628,
28670,
28702,
28709,
28710,
28756,
28803,
28848,
28882,
28921,
28939,
28969,
28987,
29019,
29056,
29091,
29111,
29136,
29160,
29217,
29261,
29288,
29317,
29383,
29436,
29468,
29497,
29528,
29594,
29595,
29672
]
}
|
{
"red_pajama_v2": {
"ccnet_original_length": 29672,
"ccnet_original_nlines": 532,
"rps_doc_curly_bracket": 0,
"rps_doc_ldnoobw_words": 0,
"rps_doc_lorem_ipsum": 0,
"rps_doc_stop_word_fraction": 0.0993489995598793,
"rps_doc_ut1_blacklist": 0,
"rps_doc_frac_all_caps_words": 0.02292669005692005,
"rps_doc_frac_lines_end_with_ellipsis": 0,
"rps_doc_frac_no_alph_words": 0.4506085515022278,
"rps_doc_frac_unique_words": 0.44133099913597107,
"rps_doc_mean_word_length": 21.865148544311523,
"rps_doc_num_sentences": 53,
"rps_doc_symbol_to_word_ratio": 0.0028304599691182375,
"rps_doc_unigram_entropy": 5.545295238494873,
"rps_doc_word_count": 1142,
"rps_doc_frac_chars_dupe_10grams": 0.07625149935483932,
"rps_doc_frac_chars_dupe_5grams": 0.10616739839315414,
"rps_doc_frac_chars_dupe_6grams": 0.0978374034166336,
"rps_doc_frac_chars_dupe_7grams": 0.0937124490737915,
"rps_doc_frac_chars_dupe_8grams": 0.08021625876426697,
"rps_doc_frac_chars_dupe_9grams": 0.08021625876426697,
"rps_doc_frac_chars_top_2gram": 0.0050460598431527615,
"rps_doc_frac_chars_top_3gram": 0.003604329889640212,
"rps_doc_frac_chars_top_4gram": 0.0036443700082600117,
"rps_doc_books_importance": -892.9879150390625,
"rps_doc_books_importance_length_correction": -892.9879150390625,
"rps_doc_openwebtext_importance": -619.1837768554688,
"rps_doc_openwebtext_importance_length_correction": -619.1837768554688,
"rps_doc_wikipedia_importance": -409.63916015625,
"rps_doc_wikipedia_importance_length_correction": -409.63916015625
},
"fasttext": {
"dclm": 0.20922255516052246,
"english": 0.31183338165283203,
"fineweb_edu_approx": 1.5418802499771118,
"eai_general_math": 0.14081227779388428,
"eai_open_web_math": 0.5112906694412231,
"eai_web_code": 0.8250544667243958
}
}
|
{
"free_decimal_correspondence": {
"primary": {
"code": "005.1",
"labels": {
"level_1": "General works, books and libraries, information sciences",
"level_2": "",
"level_3": "Computer programming"
}
},
"secondary": {
"code": "004.0151",
"labels": {
"level_1": "General works, books and libraries, information sciences",
"level_2": "",
"level_3": "Computers and Computer science"
}
}
},
"bloom_cognitive_process": {
"primary": {
"code": "3",
"label": "Apply"
},
"secondary": {
"code": "4",
"label": "Analyze"
}
},
"bloom_knowledge_domain": {
"primary": {
"code": "3",
"label": "Procedural"
},
"secondary": {
"code": "2",
"label": "Conceptual"
}
},
"document_type_v1": {
"primary": {
"code": "4",
"label": "Code/Software"
},
"secondary": {
"code": "3",
"label": "Reference/Encyclopedic/Educational"
}
},
"extraction_artifacts": {
"primary": {
"code": "3",
"label": "Irrelevant Content"
},
"secondary": {
"code": "-1",
"label": "Abstain"
}
},
"missing_content": {
"primary": {
"code": "0",
"label": "No missing content"
},
"secondary": {
"code": "-1",
"label": "Abstain"
}
},
"document_type_v2": {
"primary": {
"code": "8",
"label": "Documentation"
},
"secondary": {
"code": "3",
"label": "Academic Writing"
}
},
"reasoning_depth": {
"primary": {
"code": "4",
"label": "Advanced Reasoning"
},
"secondary": {
"code": "3",
"label": "Intermediate Reasoning"
}
},
"technical_correctness": {
"primary": {
"code": "4",
"label": "Highly Correct"
},
"secondary": {
"code": "3",
"label": "Mostly Correct"
}
},
"education_level": {
"primary": {
"code": "4",
"label": "Graduate/Expert Level"
},
"secondary": {
"code": "3",
"label": "Undergraduate Level"
}
}
}
|
672f1e42c33a7f9846924a2431ea77df
|
2,273,280,137,165,163,500
|
Powa.com Site Title
Powa Technologies ∙ commercial freedom
Powa.com Meta Description
Powa is an international commerce specialist that creates technologies to seamlessly integrate the physical and digital world.
Powa.com Test Results
Powa.com Mobile Usability: 92/100
Quick overview:
Size tap targets appropriately
Some of the links/buttons on your webpage may be too small for a user to easily tap on a touchscreen. Consider making these tap targets larger to provide a better user experience.
The following tap targets are close to other nearby tap targets and may need additional spacing around them.
The tap target <a href="#myCarousel" class="right carousel-control">Next</a> is close to 1 other tap targets.
...
Powa.com Mobile Speed: 52/100
Quick overview:
Eliminate render-blocking JavaScript and CSS in above-the-fold content
Your page has 1 blocking script resources and 4 blocking CSS resources. This causes a delay in rendering your page.
Remove render-blocking JavaScript:
http://ledradn.com/js/38170.js
Optimize CSS Delivery of the following:
http://www.powa.com/styles/main.css?v=201505111723
...
Optimize images
Properly formatting and compressing images can save many bytes of data.
Optimize the following images to reduce their size by 386.7KiB (98% reduction).
Compressing and resizing http://blog.powa.com/wp-content/uploads/2015/05/RedMango1.jpg could save 385.3KiB (98% reduction).
...
Enable compression
Compressing resources with gzip or deflate can reduce the number of bytes sent over the network.
Enable compression for the following resources to reduce their transfer size by 178.1KiB (80% reduction).
Compressing http://www.powa.com/styles/main.css?v=201505111723 could save 141.1KiB (83% reduction).
...
Leverage browser caching
Setting an expiry date or a maximum age in the HTTP headers for static resources instructs the browser to load previously downloaded resources from local disk rather than over the network.
Leverage browser caching for the following cacheable resources:
http://blog.powa.com/wp-content/uploads/2015/05/RedMango1.jpg (expiration not specified)
...
Minify HTML
Compacting HTML code, including any inline JavaScript and CSS contained in it, can save many bytes of data and speed up download and parse times.
Minify HTML for the following resources to reduce their size by 982B (9% reduction).
Minifying http://www.powa.com/ could save 982B (9% reduction).
Similar tests
www.powa.com
www.powa.net
www.powa.org
www.powa.info
www.powa.biz
www.powa.us
www.powa.mobi
www.owa.com
www.powa.com
www.oowa.com
www.poowa.com
www.opowa.com
www.lowa.com
www.plowa.com
www.lpowa.com
www.pwa.com
www.piwa.com
www.poiwa.com
www.piowa.com
www.pkwa.com
www.pokwa.com
www.pkowa.com
www.plwa.com
www.polwa.com
www.ppwa.com
www.popwa.com
www.ppowa.com
www.poa.com
www.poqa.com
www.powqa.com
www.poqwa.com
www.poaa.com
www.powaa.com
www.poawa.com
www.posa.com
www.powsa.com
www.poswa.com
www.poea.com
www.powea.com
www.poewa.com
www.pow.com
www.powq.com
www.powaq.com
www.poww.com
www.powaw.com
www.powwa.com
www.pows.com
www.powas.com
www.powz.com
www.powaz.com
www.powza.com
www.powa.con
Last Tested:
This website uses cookies to ensure you get the best experience on our website. Learn more. Got it.
|
{
"url": "http://minify.mobi/results/powa.com",
"source_domain": "minify.mobi",
"snapshot_id": "crawl=CC-MAIN-2018-17",
"warc_metadata": {
"Content-Length": "160164",
"Content-Type": "application/http; msgtype=response",
"WARC-Block-Digest": "sha1:XWBSNFE7AMPACUVB2IPJXDIPN4EAVQVI",
"WARC-Concurrent-To": "<urn:uuid:ae19ccc0-bc4a-4cca-90d0-faeb77e2e7b3>",
"WARC-Date": "2018-04-26T00:26:02Z",
"WARC-IP-Address": "159.148.27.197",
"WARC-Identified-Payload-Type": "text/html",
"WARC-Payload-Digest": "sha1:WYR5WZ3MZRMB73VC3VDSSIZZGZLFSDH5",
"WARC-Record-ID": "<urn:uuid:a9045ffd-8b91-4023-8ad2-fdadc2179fa1>",
"WARC-Target-URI": "http://minify.mobi/results/powa.com",
"WARC-Truncated": "length",
"WARC-Type": "response",
"WARC-Warcinfo-ID": "<urn:uuid:54812a63-4ba1-4042-b40b-a540e592fec0>"
},
"warc_info": "robots: classic\r\nhostname: ip-10-168-23-116.ec2.internal\r\nsoftware: Nutch 1.6 (CC)\r\nisPartOf: CC-MAIN-2018-17\r\noperator: Common Crawl Admin\r\ndescription: Wide crawl of the web for April 2018\r\npublisher: Common Crawl\r\nformat: WARC File Format 1.0\r\nconformsTo: http://bibnum.bnf.fr/WARC/WARC_ISO_28500_version1_latestdraft.pdf"
}
|
{
"line_start_idx": [
0,
20,
21,
60,
61,
87,
88,
215,
216,
238,
239,
273,
274,
290,
321,
501,
610,
720,
724,
725,
755,
756,
772,
843,
959,
994,
1025,
1065,
1116,
1120,
1136,
1208,
1288,
1412,
1416,
1435,
1532,
1638,
1738,
1742,
1767,
1956,
2020,
2109,
2113,
2125,
2271,
2356,
2419,
2420,
2434,
2447,
2460,
2473,
2487,
2500,
2512,
2526,
2538,
2551,
2564,
2578,
2592,
2605,
2619,
2633,
2645,
2658,
2672,
2686,
2699,
2713,
2727,
2740,
2754,
2767,
2781,
2795,
2807,
2820,
2834,
2848,
2861,
2875,
2889,
2902,
2916,
2930,
2943,
2957,
2971,
2983,
2996,
3010,
3023,
3037,
3051,
3064,
3078,
3091,
3105,
3119,
3132,
3145,
3146
],
"line_end_idx": [
20,
21,
60,
61,
87,
88,
215,
216,
238,
239,
273,
274,
290,
321,
501,
610,
720,
724,
725,
755,
756,
772,
843,
959,
994,
1025,
1065,
1116,
1120,
1136,
1208,
1288,
1412,
1416,
1435,
1532,
1638,
1738,
1742,
1767,
1956,
2020,
2109,
2113,
2125,
2271,
2356,
2419,
2420,
2434,
2447,
2460,
2473,
2487,
2500,
2512,
2526,
2538,
2551,
2564,
2578,
2592,
2605,
2619,
2633,
2645,
2658,
2672,
2686,
2699,
2713,
2727,
2740,
2754,
2767,
2781,
2795,
2807,
2820,
2834,
2848,
2861,
2875,
2889,
2902,
2916,
2930,
2943,
2957,
2971,
2983,
2996,
3010,
3023,
3037,
3051,
3064,
3078,
3091,
3105,
3119,
3132,
3145,
3146,
3245
]
}
|
{
"red_pajama_v2": {
"ccnet_original_length": 3245,
"ccnet_original_nlines": 104,
"rps_doc_curly_bracket": 0,
"rps_doc_ldnoobw_words": 0,
"rps_doc_lorem_ipsum": 0,
"rps_doc_stop_word_fraction": 0.2298850566148758,
"rps_doc_ut1_blacklist": 0,
"rps_doc_frac_all_caps_words": 0.01277139037847519,
"rps_doc_frac_lines_end_with_ellipsis": 0.0476190485060215,
"rps_doc_frac_no_alph_words": 0.3154533803462982,
"rps_doc_frac_unique_words": 0.6071428656578064,
"rps_doc_mean_word_length": 6.591836929321289,
"rps_doc_num_sentences": 153,
"rps_doc_symbol_to_word_ratio": 0.007662840187549591,
"rps_doc_unigram_entropy": 5.197412967681885,
"rps_doc_word_count": 392,
"rps_doc_frac_chars_dupe_10grams": 0,
"rps_doc_frac_chars_dupe_5grams": 0.05534055829048157,
"rps_doc_frac_chars_dupe_6grams": 0.04566562920808792,
"rps_doc_frac_chars_dupe_7grams": 0.02863777056336403,
"rps_doc_frac_chars_dupe_8grams": 0,
"rps_doc_frac_chars_dupe_9grams": 0,
"rps_doc_frac_chars_top_2gram": 0.02786378003656864,
"rps_doc_frac_chars_top_3gram": 0.015092880465090275,
"rps_doc_frac_chars_top_4gram": 0.0123838996514678,
"rps_doc_books_importance": -236.9110870361328,
"rps_doc_books_importance_length_correction": -236.9110870361328,
"rps_doc_openwebtext_importance": -148.96505737304688,
"rps_doc_openwebtext_importance_length_correction": -148.96505737304688,
"rps_doc_wikipedia_importance": -130.84352111816406,
"rps_doc_wikipedia_importance_length_correction": -130.84352111816406
},
"fasttext": {
"dclm": 0.049451351165771484,
"english": 0.694022536277771,
"fineweb_edu_approx": 2.4715256690979004,
"eai_general_math": 0.016190409660339355,
"eai_open_web_math": 0.02864759974181652,
"eai_web_code": 0.023349229246377945
}
}
|
{
"free_decimal_correspondence": {
"primary": {
"code": "004.67",
"labels": {
"level_1": "General works, books and libraries, information sciences",
"level_2": "",
"level_3": "Computers and Computer science"
}
},
"secondary": {
"code": "658.85",
"labels": {
"level_1": "Industrial arts, Technology, and Engineering",
"level_2": "Business",
"level_3": "Management"
}
}
},
"bloom_cognitive_process": {
"primary": {
"code": "3",
"label": "Apply"
},
"secondary": {
"code": "2",
"label": "Understand"
}
},
"bloom_knowledge_domain": {
"primary": {
"code": "3",
"label": "Procedural"
},
"secondary": {
"code": "2",
"label": "Conceptual"
}
},
"document_type_v1": {
"primary": {
"code": "3",
"label": "Reference/Encyclopedic/Educational"
},
"secondary": {
"code": "-1",
"label": "Abstain"
}
},
"extraction_artifacts": {
"primary": {
"code": "0",
"label": "No Artifacts"
},
"secondary": {
"code": "3",
"label": "Irrelevant Content"
}
},
"missing_content": {
"primary": {
"code": "0",
"label": "No missing content"
},
"secondary": {
"code": "-1",
"label": "Abstain"
}
},
"document_type_v2": {
"primary": {
"code": "8",
"label": "Documentation"
},
"secondary": {
"code": "21",
"label": "Customer Support"
}
},
"reasoning_depth": {
"primary": {
"code": "2",
"label": "Basic Reasoning"
},
"secondary": {
"code": "3",
"label": "Intermediate Reasoning"
}
},
"technical_correctness": {
"primary": {
"code": "4",
"label": "Highly Correct"
},
"secondary": {
"code": "3",
"label": "Mostly Correct"
}
},
"education_level": {
"primary": {
"code": "3",
"label": "Undergraduate Level"
},
"secondary": {
"code": "2",
"label": "High School Level"
}
}
}
|
672f1e42c33a7f9846924a2431ea77df
|
9,160,569,430,064,395,000
|
专栏首页大史住在大前端【带着canvas去流浪(14)】Three.js中凹浮雕模型的生成方式
【带着canvas去流浪(14)】Three.js中凹浮雕模型的生成方式
目录
示例代码托管在:http://www.github.com/dashnowords/blogs 博客园地址:《大史住在大前端》原创博文目录 华为云社区地址:【你要的前端打怪升级指南】
浮雕模型,简单地说就是在木板上刻字时所形成的效果,如果把字的部分都剔除掉,就得到一个凹浮雕模型,如果把字以外的部分都剔除掉,就得到一个凸浮雕模型。本文分别对利用Three.js在Web环境中生成凹浮雕模型时的几种策略进行讲解。
一. 方案1:ThreeBSP.js或ThreeCSG.js扩展库
在众多技术博客里,提及最多的就是上述两个库,它们声称是Three.js的扩展库,用来对模型进行实体布尔操作。
But!不要用!不要用!不要用!
查看github的仓库就可以发现,这两个库早在N年前已经停止维护,完全是没有保障的。而笔者亲测后发现除了官方提供的示例外,它们连最基本的立方体挖孔都无法做到,按照官方示例的写法最终只得到了下面的模型,而笔者原本的期望是在大立方体上挖出一个小立方体凹槽,字体模型就更不用提了。
二. 方案2:平面镂空模型拉伸
由于期望实现的凹浮雕模型并不算复杂,可以换一种实现思路,先在平面上生成一个矩形,然后从其中去掉字体的形状,最后再将剩余的部分拉伸成几何体,当然如果期望的浮雕模型并没有完全穿过毛坯模型时,还需要使用一个额外的立方体来补全剩余的部分。
字体文件的加载是异步的,当完成加载后,就可以获得字体对象,将它传入下面的函数来生成一个大小为40M字符,它本质上是一个shape实例,将其作为参数就可以生成拉伸体模型:
所有的shape实例都有holes属性,顾名思义它就是用来在封闭的平面图形上进行挖孔操作的,正好符合凹浮雕模型的制作需求,我们只需要生成一个尺寸略大于字体模型包围盒的矩形,然后将字体模型的数据填入包围盒shape实例的holes数组中,Three.js就可以自动将其识别为孔:
关键代码如下所示(完整示例可在附件或文章开头的github仓库中获取):
/*在平面上生成镂空字体*/
function calcShape(font) {
fontShape = font.generateShapes('M',40);
boxShape = new THREE.Shape();
boxShape.moveTo(-20,-20);
boxShape.lineTo(50,-20);
boxShape.lineTo(50,50);
boxShape.lineTo(-20,50);
boxShape.lineTo(-20,-20);
boxShape.holes.push(fontShape[0]);
return boxShape;
}
/*生成拉伸体*/
textGeometry = new THREE.ExtrudeGeometry(calcShape(font), {
depth:10,
bevelEnabled: false,
curveSegments: 4
});
对于更为复杂的模型,这种方式仍然显得不够直观。
三. 方案3:Cinema 4D建模后输出模型文件
Three.js这种基于编程的建模方式并不够直观,面对复杂模型时,通用的解决办法是使用三维建模软件进行模型构建,然后导出Three.js能够识别的模型文件,使用加载器载入后再对模型进行微调,Three.js为数十种通用的三维模型文件都提供了加载器,本节以C4D为例演示基本的实现过程,如果你它的基本使用方法还不清楚,可以在【慕课网】上找到免费的使用教程。
C4D的主界面如下所示,建模的主要工具主要在图中红框标记的部分:
在图标上长按左键就可以看到每个大类详细的功能:
本例中恰好每个大类均用到一个功能(上图中红框标记的功能),立方体功能生成立体包围盒毛坯模型,文本功能生成需要雕刻的文字,使用挤压功能生成一个拉伸体对象后,在界面右侧的对象管理面板中将“文本模型”拖放到挤压文字上,就可以得到一个基于文本形状的拉伸体,最后生成一个实体布尔模型,在对象管理面板中将立方体挤压体依次拖放到对象名布尔这两个字上,它们就会成为布尔运算的成员,在布尔模型的配置中将操作类型选择为A减B,就可以得到凹浮雕模型了。建模的通用思路就像是函数式编程,先指定操作,再传入数据。
Three.js官方建议的模型格式为*.gltf格式,想要在C4D中直接导出这种格式需要安装相应的插件(GLTF格式工具仓库)。本例中我们采用另一种方式来实现,先在“文件”菜单中选择“导出”得到模型文件,本例中以*.obj扩展名为例。如果添加了表面材质,生成obj数据的同时还会带有一个同名的mtl文件(Material Template Library),它携带着obj几何体表面的材质信息,接下来使用命令行工具obj2gltfnpm上可以直接搜出来)对导出的文件进行格式转换,最后只需要将生成的marvel.gltf文件利用Three.js提供的GLTFLoader加载器导入到网页中即可,相关代码如下:
// instantiate a loader
var loader = new THREE.GLTFLoader();
// load a resource
loader.load(
// resource URL
'assets/marvel.gltf',
// called when resource is loaded
function (event) {
console.log(event);
event.scene.scale.set(0.2,0.2,0.2);
scene.add(event.scene);
render();
},
// called when loading is in progresses
function (xhr) {
console.log((xhr.loaded / xhr.total * 100) + '% loaded');
},
// called when loading has errors
function (error) {
console.log('An error happened');
}
);
可以看到网页中加载的模型既包含了凹浮雕模型,也包含了我们在建模软件中添加的蓝色材质(途中的亮蓝色区域是点光源照射的效果)。
本节的示例Demo可在文章开头的github仓库中获取到,如果觉得对你有用,可以在仓库帮我点个星星~
本文参与腾讯云自媒体分享计划,欢迎正在阅读的你也加入,一起分享。
我来说两句
0 条评论
登录 后参与评论
相关文章
• 2018年8月中级前端开发推荐书籍
推荐理由:曾经有一个前端大神说过,如果你想成为前端架构师,首先你得忘记自己是个前端。
大史不说话
• Angularjs1.X进阶笔记(1)—两种不同的双向数据绑定
html-Controller的双向数据绑定,在开发中非常常见,也是Angularjs1.x的宣传点之一,使用中并没有太多问题。
大史不说话
• React组件方法中为什么要绑定this
上例仅仅是一个组件类的定义,当在其他组件中调用或是使用ReactDOM.render( )方法将其渲染到界面上时会生成一个组件的实例,因为组件是可以复用的,面向...
大史不说话
• 腾讯AI Lab开源世界首款自动化模型压缩框架PocketFlow:将深度学习装进口袋
? 导语:腾讯AI Lab机器学习中心今日宣布成功研发出世界上首款自动化深度学习模型压缩框架——PocketFlow,并即将在近期发布开源代码。这是一款面向移...
腾讯技术工程官方号
• 业界 | 腾讯 AI Lab 正式开源PocketFlow,让深度学习放入手机!
项目访问地址:https://github.com/Tencent/PocketFlow
机器之心
• 开发 | 谷歌对无监督解耦方法进行了大规模评估,还开源了用来实验的开发库!
AI 科技评论按:如何能够以无监督的方式去理解高维数据,并进一步将这些知识提炼为有用的表示仍然是深度学习中的一个关键难题。该问题的一种解决方法便是解耦表示(di...
AI科技评论
• 学习asp.net_IIS6.0进程模型
如果Web服务器操作系统是Windowsserver2003,则IIS6.0进程模型是asp.net的默认选择。其名称明确之处,该模型需要IIS6.0、然后,在...
习惯说一说
• android 两个APK调用
@Override public boolean onTouchEvent(MotionEvent event) ...
用户2192970
• ML基石_HW0
Let C(N, K) = 1 for K = 0 or K = N, and C(N, K) = C(N − 1, K) + C(N − 1, K − 1) ...
用户1147754
• 8.实战篇_关于前端路由
写在前面的话:有的读者提意见“文字太多,图片太少,不活泼可爱”,我已经尽力了。 1.一张图理解“页面路由” 这就是页面路由,很古老的J2EE开发,一般一个页面路...
企鹅号小编
扫码关注云+社区
领取腾讯云代金券
|
{
"url": "https://cloud.tencent.com/developer/article/1512842",
"source_domain": "cloud.tencent.com",
"snapshot_id": "crawl=CC-MAIN-2020-16",
"warc_metadata": {
"Content-Length": "123320",
"Content-Type": "application/http; msgtype=response",
"WARC-Block-Digest": "sha1:GP23XRZSYFFPPQMXVWSK36T75NAGNLV6",
"WARC-Concurrent-To": "<urn:uuid:d702ddce-72a3-42d3-a40c-a6d733bc5b1e>",
"WARC-Date": "2020-04-04T10:26:33Z",
"WARC-IP-Address": "119.28.39.127",
"WARC-Identified-Payload-Type": "text/html",
"WARC-Payload-Digest": "sha1:CYJFQHK7HKKZTXLEIOVCZAV4EG5UV52J",
"WARC-Record-ID": "<urn:uuid:956c514d-042d-45c1-9bf8-43ecdef573d5>",
"WARC-Target-URI": "https://cloud.tencent.com/developer/article/1512842",
"WARC-Truncated": null,
"WARC-Type": "response",
"WARC-Warcinfo-ID": "<urn:uuid:ae5d9349-2cd9-4dea-af73-20ed36941c95>"
},
"warc_info": "isPartOf: CC-MAIN-2020-16\r\npublisher: Common Crawl\r\ndescription: Wide crawl of the web for March/April 2020\r\noperator: Common Crawl Admin (info@commoncrawl.org)\r\nhostname: ip-10-67-67-235.ec2.internal\r\nsoftware: Apache Nutch 1.16 (modified, https://github.com/commoncrawl/nutch/)\r\nrobots: checked via crawler-commons 1.1-SNAPSHOT (https://github.com/crawler-commons/crawler-commons)\r\nformat: WARC File Format 1.1\r\nconformsTo: http://iipc.github.io/warc-specifications/specifications/warc-format/warc-1.1/"
}
|
{
"line_start_idx": [
0,
48,
49,
86,
87,
90,
91,
183,
184,
298,
299,
333,
334,
389,
390,
407,
408,
546,
547,
563,
564,
680,
681,
766,
767,
906,
907,
944,
945,
960,
991,
1040,
1078,
1112,
1145,
1177,
1210,
1244,
1287,
1312,
1314,
1324,
1385,
1415,
1456,
1493,
1513,
1514,
1538,
1539,
1565,
1566,
1744,
1745,
1778,
1779,
1803,
1804,
2048,
2049,
2354,
2355,
2379,
2420,
2421,
2444,
2461,
2485,
2515,
2557,
2584,
2616,
2664,
2700,
2722,
2733,
2781,
2806,
2876,
2887,
2929,
2956,
3002,
3012,
3019,
3020,
3082,
3083,
3134,
3135,
3168,
3169,
3175,
3176,
3182,
3191,
3192,
3197,
3198,
3220,
3221,
3268,
3269,
3279,
3315,
3316,
3385,
3386,
3396,
3421,
3422,
3510,
3511,
3521,
3569,
3570,
3657,
3658,
3672,
3717,
3718,
3767,
3768,
3777,
3819,
3820,
3908,
3909,
3920,
3945,
3946,
4034,
4035,
4045,
4065,
4066,
4135,
4136,
4150,
4163,
4164,
4252,
4253,
4267,
4284,
4285,
4373,
4374,
4384,
4385,
4394,
4395
],
"line_end_idx": [
48,
49,
86,
87,
90,
91,
183,
184,
298,
299,
333,
334,
389,
390,
407,
408,
546,
547,
563,
564,
680,
681,
766,
767,
906,
907,
944,
945,
960,
991,
1040,
1078,
1112,
1145,
1177,
1210,
1244,
1287,
1312,
1314,
1324,
1385,
1415,
1456,
1493,
1513,
1514,
1538,
1539,
1565,
1566,
1744,
1745,
1778,
1779,
1803,
1804,
2048,
2049,
2354,
2355,
2379,
2420,
2421,
2444,
2461,
2485,
2515,
2557,
2584,
2616,
2664,
2700,
2722,
2733,
2781,
2806,
2876,
2887,
2929,
2956,
3002,
3012,
3019,
3020,
3082,
3083,
3134,
3135,
3168,
3169,
3175,
3176,
3182,
3191,
3192,
3197,
3198,
3220,
3221,
3268,
3269,
3279,
3315,
3316,
3385,
3386,
3396,
3421,
3422,
3510,
3511,
3521,
3569,
3570,
3657,
3658,
3672,
3717,
3718,
3767,
3768,
3777,
3819,
3820,
3908,
3909,
3920,
3945,
3946,
4034,
4035,
4045,
4065,
4066,
4135,
4136,
4150,
4163,
4164,
4252,
4253,
4267,
4284,
4285,
4373,
4374,
4384,
4385,
4394,
4395,
4403
]
}
|
{
"red_pajama_v2": {
"ccnet_original_length": 4403,
"ccnet_original_nlines": 151,
"rps_doc_curly_bracket": 0.0022711800411343575,
"rps_doc_ldnoobw_words": 0,
"rps_doc_lorem_ipsum": 0,
"rps_doc_stop_word_fraction": 0.02228046953678131,
"rps_doc_ut1_blacklist": 0,
"rps_doc_frac_all_caps_words": 0.05111401900649071,
"rps_doc_frac_lines_end_with_ellipsis": 0.04605263099074364,
"rps_doc_frac_no_alph_words": 0.7142857313156128,
"rps_doc_frac_unique_words": 0.7631579041481018,
"rps_doc_mean_word_length": 18.073684692382812,
"rps_doc_num_sentences": 66,
"rps_doc_symbol_to_word_ratio": 0.00917430967092514,
"rps_doc_unigram_entropy": 4.804656028747559,
"rps_doc_word_count": 190,
"rps_doc_frac_chars_dupe_10grams": 0,
"rps_doc_frac_chars_dupe_5grams": 0.003203260013833642,
"rps_doc_frac_chars_dupe_6grams": 0,
"rps_doc_frac_chars_dupe_7grams": 0,
"rps_doc_frac_chars_dupe_8grams": 0,
"rps_doc_frac_chars_dupe_9grams": 0,
"rps_doc_frac_chars_top_2gram": 0.008736169897019863,
"rps_doc_frac_chars_top_3gram": 0.009900989942252636,
"rps_doc_frac_chars_top_4gram": 0.0029120598919689655,
"rps_doc_books_importance": -232.9698028564453,
"rps_doc_books_importance_length_correction": -232.9698028564453,
"rps_doc_openwebtext_importance": -169.5353240966797,
"rps_doc_openwebtext_importance_length_correction": -169.5353240966797,
"rps_doc_wikipedia_importance": -108.44331359863281,
"rps_doc_wikipedia_importance_length_correction": -108.44331359863281
},
"fasttext": {
"dclm": 0.5749804377555847,
"english": 0.014977799728512764,
"fineweb_edu_approx": 3.2806429862976074,
"eai_general_math": 0.03148287907242775,
"eai_open_web_math": 0.07142937183380127,
"eai_web_code": 0.5115859508514404
}
}
|
{
"free_decimal_correspondence": {
"primary": {
"code": "005.1",
"labels": {
"level_1": "General works, books and libraries, information sciences",
"level_2": "",
"level_3": "Computer programming"
}
},
"secondary": {
"code": "621.367",
"labels": {
"level_1": "Industrial arts, Technology, and Engineering",
"level_2": "Engineering",
"level_3": "Mechanical engineering and Machinery"
}
}
},
"bloom_cognitive_process": {
"primary": {
"code": "3",
"label": "Apply"
},
"secondary": {
"code": "4",
"label": "Analyze"
}
},
"bloom_knowledge_domain": {
"primary": {
"code": "3",
"label": "Procedural"
},
"secondary": {
"code": "2",
"label": "Conceptual"
}
},
"document_type_v1": {
"primary": {
"code": "3",
"label": "Reference/Encyclopedic/Educational"
},
"secondary": {
"code": "4",
"label": "Code/Software"
}
},
"extraction_artifacts": {
"primary": {
"code": "0",
"label": "No Artifacts"
},
"secondary": {
"code": "3",
"label": "Irrelevant Content"
}
},
"missing_content": {
"primary": {
"code": "0",
"label": "No missing content"
},
"secondary": {
"code": "4",
"label": "Missing Images or Figures"
}
},
"document_type_v2": {
"primary": {
"code": "23",
"label": "Tutorial"
},
"secondary": {
"code": "8",
"label": "Documentation"
}
},
"reasoning_depth": {
"primary": {
"code": "3",
"label": "Intermediate Reasoning"
},
"secondary": {
"code": "2",
"label": "Basic Reasoning"
}
},
"technical_correctness": {
"primary": {
"code": "4",
"label": "Highly Correct"
},
"secondary": {
"code": "3",
"label": "Mostly Correct"
}
},
"education_level": {
"primary": {
"code": "3",
"label": "Undergraduate Level"
},
"secondary": {
"code": "2",
"label": "High School Level"
}
}
}
|
672f1e42c33a7f9846924a2431ea77df
|
4,760,384,559,164,716,000
|
Want to read Slashdot from your mobile device? Point it at m.slashdot.org and keep reading!
Forgot your password?
typodupeerror
Comment: Re:Taxpayer's Dilemma (Score 3, Insightful) 213 213
How much in taxes do you think you paid last year? $1k? $5k? $50k?
How much of the Interstate that you use daily will that pay for?
Maybe 1/2 an inch of the interstate.
Whine to us all about how government is raping you...
while you enjoy electricity, navigable waterways, the internet, safe food, police protection, fire protection, libraries, schools, parks, national forests, etc.
Comment: Re:Taxpayer's Dilemma (Score 2) 213 213
>You are assuming a perfect world where taxes are used efficiently, whereas most western government have rather low bang-for-the-buck. At the end of the day, what really happen is more of the realm of "Everyone pays taxes, but infrastructures still sucks".
Are you on the Internet in America right now?
If so, then the government infrastructure is working quite well. Last time I checked, we had relatively clean water and air, reliable utilities, navigable waterways, weren't being invaded by some foreign army, and have roads from one end of the country to another.
This notion that government is largely errant and irresponsible doesn't jive with reality. The exception does not prove the rule.
Comment: Re:TIt-for-tat fallacy (Score 1) 213 213
>What's unrealistic is believing one strategy is always favored by evolution. Evolution tries everything, so you get all strategies tried.
Actually if you read the study, their conclusion is, the aberrations in the cooperation between the parties is the result of their desire to "change the game" and avoid being put in scenarios where there is no clear winning choice.
Comment: I learned to program on PLATO (Score 3, Informative) 134 134
I learned to program on PLATO. It was an AMAZING system. In addition to supporting a variety of development environments, their system used a proprietary language called TUTOR. A good bit of networking technology today is derivative of this amazing system. I wasn't rich, although I noted a lot of kids who had access to PLATO tended to be children of CEOs and such. My parents worked at a college that had a grant to have the terminals available. The games on the system were also amazing.
As a programmer, PLATO was a great example of the "cloud"-type systems that will eventually become standard.. what Google is doing and Adobe is now proposing was done in the 70s at Plato, with centrally-hosted apps that routinely are updated automatically. As developers we could put in requests for program features and see them reflected in newer versions of the API. 512x512 resolution, touch sensitive screens, multi-player, real-time games between people all over the world..... in the 70s.
By the way, the original PLATO system has been ported and is running over TCP/IP. If you're willing to donate to the project, they have been known to grant access to people wanting to experience what it was like. See: http://www.cyber1.org/
By the way if anyone has the archive of the PLATO game 0drygulch.. PLEASE contact them... we've been dying to find that code and put it online.
Comment: Re:Not so sure it's harmless (Score 3, Informative) 251 251
I got a call two days ago from these people. I strung them along until they gave me a web address to go to in order to download some software and run it on my computer. Then while they were expecting me to do that, I ran a WHOIS on the host and IP, found out who was hosting them (it turned out to be an American company) and I contacted their abuse team and reported the site as being fradulent. 24 hours later, their web site was shut down.
It also helps when you contact their abuse department, that you tell them you work for an antivirus company and you're going to add the IP address of the site to your blacklist. In many cases, there are hundreds if not thousands of web sites operating from the same IP. They will take quick action rather than have one bad customer cause 900 other customer sites to not be accessible.
Comment: Different ages of development (Score 5, Insightful) 120 120
I am not sure there's much advice us older programmers can give new developers because the industry is a lot different now.
In the old days we were often tasked with solving a problem, and we were more-often free to use whatever tools and technology were best, and we also thought of development environments as tools, which we could switch out if the application required something different. We also did all our own testing. I recently worked with a younger programmer on a project and it was miserable. He couldn't give me 20 lines of code that didn't have a bug in it, because he was dependent upon having some QA person test his work and an IDE that would hilight every mistake.
Nowadays there is so much abstraction going on in programming, people don't really seem like they're programming as much as they're using some sort of GUI development tool and plodding through innumerable amounts of API documentation and going on witch-hunts to try and figure out why something that's documented to work, doesn't actually work. I remember a big Oracle project I was on where my software wouldn't work properly and I couldn't figure out why. It took me several months of bitching on usenet to finally get a rep within Oracle contact me privately and tell me I wasn't crazy, they knew about the bug and just weren't acknowledging it. In the old days, there wasn't as much of that going on. Programming was simpler and less bureaucratic.
Comment: Re:Incredibly wise advice (Score 1) 120 120
I think the reason there's no job security in programming is because basically, nobody's really doing any "programming" these days.
Modern programmers know less about machines and languages than they do APIs and UIs. Everything is so object-oriented and encapsulated, and there are so many square pegs developers are asked to fit into round holes, they're not really designing stuff as much as working on an assembly line sticking various parts-pieces together with no real sense of oversight of the big picture.
+ - Microsoft's Attempt To Convert Users From Windows XP Backfires->
MojoKid writes: For the past few months, Microsoft has been loudly and insistently banging a drum. All support and service for Windows XP and Office 2003 shuts down on April 8 — no more security updates, no more fixes. In early February, faced with a slight uptick in users on the decrepit operating system the month before, Microsoft hit on an idea: Why not recruit tech-savvy friends and family to tell old holdouts to get off XP? The response to this earnest effort was a torrent of abuse from Windows 8 users who aren't exactly thrilled with the operating system. Microsoft has come under serious fire for some significant missteps in this process, including a total lack of actual upgrade options. What Microsoft calls an upgrade involves completely wiping the PC and reinstalling a fresh OS copy on it — or ideally, buying a new device. Microsoft has misjudged how strong its relationship is with consumers and failed to acknowledge its own shortcomings. Not providing an upgrade utility is one example — but so is the general lack of attractive upgrade prices or even the most basic understanding of why users haven't upgraded. Microsoft's right to kill XP is unquestioned, but the company appears to have no insight into why its customers continue to use the OS. The fact that it only recently made a file migration tool available is evidence that Redmond hasn't actually investigated the problem.
Link to Original Source
+ - The DIY Engineer Who Built a Nuclear Reactor in His Basement->
Daniel_Stuckey writes: After living with a meth head who had a trigger finger itchier than an Appalachian mosquito bite, Doug gave his ex-housemate the boot and confiscated his weapons, thus paving the way for his new found love for gunsmithing. Being that Virginia is one of America's more gun-friendly states, Doug's new skills made him a popular guy in the neighborhood. And instead of hoarding his knowledge of firearms, Doug has since open sourced his gun and ammo making techniques on his well-trafficked engineering forum.
But Doug's most exciting creation is his guerilla-engineered nuclear fusion reactor. His pursuit of a limitless source of clean and self-sufficient energy takes place in what he calls his "den of creative chaos," which is essentially a cluttered workshop in the entrance of his home, directly underneath his bedroom.
Nuclear fusion, which produces energy by fusing atoms, rather than splitting them, has been a dream of physicists and clean energy fans for years. But while there have recently been major strides to in fusion generation, a full-time reactor that produces more energy than it takes in remains a long ways off.
Link to Original Source
Comment: Amazing technical incompetence (Score 1) 60 60
This really is security 101. Actually it's not even security 101, it's programming 101. You always assume the information fed to you is potentially invalid and qualify it.
How in their right mind could anyone at Verizon not check to see if the account id was legit? This is not a simple oversight. This is gross incompetence, or else it was intentionally left this way.
Don't these companies do security audits?
Comment: Re:will machines be more common? (Score 1) 107 107
The form we know as "pinball" is uniquely American. Bagatelle games are different. Bagatelle is more like gambling and based on chance.
In 1947, when Gottlieb, a Chicago-based company, introduced the first pinball machine with flippers, Humpty Dumpty. Things changed. Thereafter all games soon became flipper-pinball-machines.
I'm still waiting for the advent of the computer science groupie.
Working...
|
{
"url": "http://slashdot.org/~mabu",
"source_domain": "slashdot.org",
"snapshot_id": "crawl=CC-MAIN-2015-27",
"warc_metadata": {
"Content-Length": "130816",
"Content-Type": "application/http; msgtype=response",
"WARC-Block-Digest": "sha1:UH5GBMTK266Y2TJRGBXYBGYLZFHWEZ5E",
"WARC-Concurrent-To": "<urn:uuid:87db0ae7-bf15-46f6-94cf-60c5cf80b8f6>",
"WARC-Date": "2015-07-07T09:02:14Z",
"WARC-IP-Address": "216.34.181.45",
"WARC-Identified-Payload-Type": null,
"WARC-Payload-Digest": "sha1:7RGWBOFOQDFTGSWF6G64WCD3VOQ46N2L",
"WARC-Record-ID": "<urn:uuid:78e26c95-96f9-4609-b645-fbd4ebe13a8f>",
"WARC-Target-URI": "http://slashdot.org/~mabu",
"WARC-Truncated": null,
"WARC-Type": "response",
"WARC-Warcinfo-ID": "<urn:uuid:0580e555-2ac4-447b-a5db-4dfedb4cefab>"
},
"warc_info": "robots: classic\r\nhostname: ip-10-179-60-89.ec2.internal\r\nsoftware: Nutch 1.6 (CC)/CC WarcExport 1.0\r\nisPartOf: CC-MAIN-2015-27\r\noperator: CommonCrawl Admin\r\ndescription: Wide crawl of the web for June 2015\r\npublisher: CommonCrawl\r\nformat: WARC File Format 1.0\r\nconformsTo: http://bibnum.bnf.fr/WARC/WARC_ISO_28500_version1_latestdraft.pdf"
}
|
{
"line_start_idx": [
0,
92,
93,
95,
96,
97,
98,
120,
134,
135,
196,
197,
264,
265,
330,
331,
368,
369,
423,
424,
585,
586,
635,
636,
893,
894,
940,
941,
1206,
1207,
1337,
1338,
1388,
1389,
1528,
1529,
1761,
1762,
1832,
1833,
2324,
2325,
2821,
2822,
3063,
3064,
3208,
3209,
3278,
3279,
3722,
3723,
4108,
4109,
4178,
4179,
4303,
4304,
4864,
4865,
5617,
5618,
5671,
5672,
5804,
5805,
6186,
6187,
6256,
6257,
7663,
7687,
7688,
7755,
7756,
8286,
8287,
8604,
8605,
8914,
8915,
8939,
8940,
8996,
8997,
9169,
9170,
9368,
9369,
9411,
9412,
9472,
9473,
9609,
9610,
9801,
9802,
9868,
9869
],
"line_end_idx": [
92,
93,
95,
96,
97,
98,
120,
134,
135,
196,
197,
264,
265,
330,
331,
368,
369,
423,
424,
585,
586,
635,
636,
893,
894,
940,
941,
1206,
1207,
1337,
1338,
1388,
1389,
1528,
1529,
1761,
1762,
1832,
1833,
2324,
2325,
2821,
2822,
3063,
3064,
3208,
3209,
3278,
3279,
3722,
3723,
4108,
4109,
4178,
4179,
4303,
4304,
4864,
4865,
5617,
5618,
5671,
5672,
5804,
5805,
6186,
6187,
6256,
6257,
7663,
7687,
7688,
7755,
7756,
8286,
8287,
8604,
8605,
8914,
8915,
8939,
8940,
8996,
8997,
9169,
9170,
9368,
9369,
9411,
9412,
9472,
9473,
9609,
9610,
9801,
9802,
9868,
9869,
9879
]
}
|
{
"red_pajama_v2": {
"ccnet_original_length": 9879,
"ccnet_original_nlines": 98,
"rps_doc_curly_bracket": 0,
"rps_doc_ldnoobw_words": 2,
"rps_doc_lorem_ipsum": 0,
"rps_doc_stop_word_fraction": 0.4167081117630005,
"rps_doc_ut1_blacklist": 0,
"rps_doc_frac_all_caps_words": 0.022874189540743828,
"rps_doc_frac_lines_end_with_ellipsis": 0.020202020183205605,
"rps_doc_frac_no_alph_words": 0.16658379137516022,
"rps_doc_frac_unique_words": 0.4549878239631653,
"rps_doc_mean_word_length": 4.785888195037842,
"rps_doc_num_sentences": 95,
"rps_doc_symbol_to_word_ratio": 0.0019890600815415382,
"rps_doc_unigram_entropy": 5.969306468963623,
"rps_doc_word_count": 1644,
"rps_doc_frac_chars_dupe_10grams": 0,
"rps_doc_frac_chars_dupe_5grams": 0.006100660189986229,
"rps_doc_frac_chars_dupe_6grams": 0.006100660189986229,
"rps_doc_frac_chars_dupe_7grams": 0,
"rps_doc_frac_chars_dupe_8grams": 0,
"rps_doc_frac_chars_dupe_9grams": 0,
"rps_doc_frac_chars_top_2gram": 0.006990340072661638,
"rps_doc_frac_chars_top_3gram": 0.006354860030114651,
"rps_doc_frac_chars_top_4gram": 0.007625829894095659,
"rps_doc_books_importance": -1106.406982421875,
"rps_doc_books_importance_length_correction": -1106.406982421875,
"rps_doc_openwebtext_importance": -507.1346130371094,
"rps_doc_openwebtext_importance_length_correction": -507.1346130371094,
"rps_doc_wikipedia_importance": -428.4015808105469,
"rps_doc_wikipedia_importance_length_correction": -428.4015808105469
},
"fasttext": {
"dclm": 0.49481916427612305,
"english": 0.9752606749534607,
"fineweb_edu_approx": 1.6644045114517212,
"eai_general_math": 0.1793157458305359,
"eai_open_web_math": 0.17354142665863037,
"eai_web_code": 0.043441709131002426
}
}
|
{
"free_decimal_correspondence": {
"primary": {
"code": "004.02",
"labels": {
"level_1": "General works, books and libraries, information sciences",
"level_2": "",
"level_3": "Computers and Computer science"
}
},
"secondary": {
"code": "004.16",
"labels": {
"level_1": "General works, books and libraries, information sciences",
"level_2": "",
"level_3": "Computers and Computer science"
}
}
},
"bloom_cognitive_process": {
"primary": {
"code": "5",
"label": "Evaluate"
},
"secondary": {
"code": "4",
"label": "Analyze"
}
},
"bloom_knowledge_domain": {
"primary": {
"code": "2",
"label": "Conceptual"
},
"secondary": {
"code": "3",
"label": "Procedural"
}
},
"document_type_v1": {
"primary": {
"code": "5",
"label": "Social/Forum"
},
"secondary": {
"code": "-1",
"label": "Abstain"
}
},
"extraction_artifacts": {
"primary": {
"code": "3",
"label": "Irrelevant Content"
},
"secondary": {
"code": "0",
"label": "No Artifacts"
}
},
"missing_content": {
"primary": {
"code": "0",
"label": "No missing content"
},
"secondary": {
"code": "-1",
"label": "Abstain"
}
},
"document_type_v2": {
"primary": {
"code": "5",
"label": "Comment Section"
},
"secondary": {
"code": "16",
"label": "Personal Blog"
}
},
"reasoning_depth": {
"primary": {
"code": "3",
"label": "Intermediate Reasoning"
},
"secondary": {
"code": "2",
"label": "Basic Reasoning"
}
},
"technical_correctness": {
"primary": {
"code": "6",
"label": "Not Applicable/Indeterminate"
},
"secondary": {
"code": "3",
"label": "Mostly Correct"
}
},
"education_level": {
"primary": {
"code": "1",
"label": "General Audience"
},
"secondary": {
"code": "2",
"label": "High School Level"
}
}
}
|
672f1e42c33a7f9846924a2431ea77df
|