Cody

Problem 1. Times 2 - START HERE

Solution 514761

Submitted on 20 Oct 2014 by Aslak Grinsted
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

Test Suite

Test Status Code Input and Output
1   Pass
assert(isequal(times2(1),2));

ans = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><!-- Browser headers CTTL 1296000 --><html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en_US" lang="en_US" dir="ltr"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><meta name="Description" content="Display your browser's request headers" /><title>Browser HTTP request headers</title><link rel="canonical" href="http://www.procato.com/my+headers/" /><script type="text/javascript" src="./../_pub/jquery.min.js"></script><script type="text/javascript" src="./../_pub/advertisement.js?0.58"></script><script type="text/javascript" src="./../_pub/jquery/jquery.droppy.js"></script><script type="text/javascript" src="./../_pub/animatedcollapse.js"></script><script type="text/javascript">/* <![CDATA[ */$(function() {$(document).ready(function() {  $('#navsite').droppy({speed:250});});$("a.active").click(function(event){event.preventDefault();}); $('.cmenucs').each(function() { var html = $(this).html();var htmlo = '';html = html.split(',');var strPattern = /^([0-9A-F]){6}$/;for (var i in html) {if (strPattern.test(html[i])) {var cl= "W";if (rgblum(rgbhex2rgb(html[i])) >= 50) var cl= "B";htmlo += '<div onclick="lc(\''+ html[i] +'\');" class="lc '+cl+'" style="background: #' + html[i] + ';color: #' + html[i] + '" onmouseover="this.style.color=\'\';" onmouseout="this.style.color=\'#' + html[i] + '\';">' + html[i] + '</div>';} else {htmlo += '<br style="clear:left;"/>';};};$(this).html(htmlo);$(this).show("slow"); }); $('.lc').hover(function () { var hex = $(this).html();var strPattern = /^([0-9A-F]){6}$/;if (strPattern.test(hex)) {var rgb = [parseInt('0x' + hex.substring(0, 2)),parseInt('0x' + hex.substring(2, 4)),parseInt('0x' + hex.substring(4, 6))];sel(this);} }); });var AeaRO = 0; function alx() { return true;};function pIncomp() {return true};var lsgrp=new Array();var myxheaders7_bt = 'Send message';var myxheaders7_plw = 'Please wait ...'; lsgrp['myxheaders7'] = ['myxheaders7_n','myxheaders7_e','myxheaders7_m'];var myxheaders18_bt = 'Update';var myxheaders18_plw = 'Please wait ...'; function initmyip() { get(document.getElementById("myxheaders18"));};eval(unescape('%0a%76%61%72%20%6f%72%65%71%75%72%69%20%3d%20%22%68%74%74%70%3a%2f%2f%77%77%77%2e%70%72%6f%63%61%74%6f%2e%63%6f%6d%2f%6d%79%2b%68%65%61%64%65%72%73%2f%22%3b%0a%76%61%72%20%6f%68%6f%73%74%6e%61%6d%65%20%3d%20%22%77%77%77%2e%70%72%6f%63%61%74%6f%2e%63%6f%6d%22%3b%0a%69%66%20%28%74%6f%70%2e%6c%6f%63%61%74%69%6f%6e%20%21%3d%20%6c%6f%63%61%74%69%6f%6e%29%20%74%6f%70%2e%6c%6f%63%61%74%69%6f%6e%2e%68%72%65%66%20%3d%20%64%6f%63%75%6d%65%6e%74%2e%6c%6f%63%61%74%69%6f%6e%2e%68%72%65%66%3b%0a%65%6c%73%65%20%69%66%20%28%64%6f%63%75%6d%65%6e%74%2e%6c%6f%63%61%74%69%6f%6e%2e%68%6f%73%74%6e%61%6d%65%20%21%3d%20%6f%68%6f%73%74%6e%61%6d%65%29%20%74%6f%70%2e%6c%6f%63%61%74%69%6f%6e%2e%68%72%65%66%20%3d%20%6f%72%65%71%75%72%69%3b%0a'));var btnreset = 'Reset';var btnsearch = 'Search';var lhits = 'Hits';var lsearching = 'Please wait ...';var webbase = './../';var orcapiaAppId = 'my+headers';var drx_error400 = "Bad Request";var drx_nomatchfound = "No match found";var drx_gwtimeout = "The server is overloaded. Please try again later.";function base() {return "http://www.procato.com/";};function lc(rgb) {top.location = (base()+"rgb/" + rgb +"/");};$(document).ready(function(){$("#main input:text:visible:first").focus();});animatedcollapse.addDiv('myxheaders2', 'fade=1,persist=0,speed=400,hide=0');animatedcollapse.addDiv('myxheaders5', 'fade=1,persist=0,speed=400,hide=0');animatedcollapse.addDiv('myxheaders9', 'fade=1,persist=0,speed=400,hide=0');animatedcollapse.addDiv('myxheaders11', 'fade=1,persist=0,speed=400,hide=0');animatedcollapse.addDiv('myxheaders13', 'fade=1,persist=0,speed=400,hide=0');animatedcollapse.addDiv('myxheaders15', 'fade=1,persist=0,speed=400,hide=0');animatedcollapse.addDiv('myxheaders17', 'fade=1,persist=0,speed=400,hide=0');animatedcollapse.ontoggle=function($, divobj, state){ if (state == "block") document.getElementById(divobj.id+'_h').className= "containerNav active";else document.getElementById(divobj.id+'_h').className= "containerNav"; };animatedcollapse.init();var togst = new Array();togst['myxheaders1'] = ['myxheaders2'];togst['myxheaders4'] = ['myxheaders5'];togst['myxheaders8'] = ['myxheaders9'];togst['myxheaders10'] = ['myxheaders11'];togst['myxheaders12'] = ['myxheaders13'];togst['myxheaders14'] = ['myxheaders15'];togst['myxheaders16'] = ['myxheaders17'];function animate(id,gr) {var act = 0;if (id != "+" && id != "-") if (document.getElementById(id).style.display == "none") var act = 1;for(i=0;i<togst[gr].length;i++) {if (id == "+") {animatediv(togst[gr][i],"show");} else if (togst[gr][i] == id) {if (act == 1) animatediv(id,"show");else animatediv(id,"hide");} else {animatediv(togst[gr][i],"hide");};};return false;};function animatefocus(id,gr,obj) {if (id.match(/^\+/g)) {animate('+',gr);} else if (id.match(/^\-/g)) {animate('-',gr);} else {for(i=0;i<togst[gr].length;i++) {if (togst[gr][i] == id) {animatediv(id,"show");} else {animatediv(togst[gr][i],"hide");};};};id = id.replace(/^\-|\+/, '');setTimeout('$(\'#'+id+'_h\').slideto();',400);return false;};function animatediv(id,a) {if (typeof id != "object") {animatedivex(id,a);} else {for(i=0;i<id.length;i++) {animatedivex(id[i],a);};};return false;};function animatedivex(id,a) {if (a == "show") {document.getElementById(id+"_h").className= "containerNav active";animatedcollapse.show(id);} else {document.getElementById(id+"_h").className= "containerNav";animatedcollapse.hide(id);};}/* ]]> */</script><link rel="stylesheet" href="./../_pub/css/css7.php?q[rgb]=994433&amp;q[rgb_st]=6" type="text/css" media="all" /></head><body onload="get(document.getElementById('myxheaders3'));initmyip();"><a name="top"></a><div class="flb"><a href="#feedback">Feedback | Contact | Report error</a></div><div class="themebody" style="height:1.7em;width:100%;position:fixed;top:0;z-index:999999999999;padding: 5px 0;box-shadow: 0 0 5px 5px rgba(0,0,0,.25);"><div class="pgimin"><!-- google_ad_section_start(weight=ignore) --><div style="float:right;" class="drx_share"></div><div style="float:left;"><ul id="navsite"><li><a href="http://www.procato.com/superformula/" target="_parent">Design</a><ul><li><a title="Super-formula shape explorer and template generator for complex shapes in nature" href="http://www.procato.com/superformula/" target="_parent">Super shapes</a></li><li><a title="Super-ellipse / Lamé-curve calculator, plotter, and template maker" href="http://www.procato.com/superellipse/" target="_parent">Superellipse</a></li></ul></li><li><a href="http://www.procato.com/rgbfind/" target="_parent">Color</a><ul><li><a title="Find for RGB colors by name. Simple color search." href="http://www.procato.com/rgbfind/" target="_parent">Color Search</a></li><li><a title="Detailed information for each RGB color. Includes conversions, schemes and much more." href="http://www.perbang.dk/rgb/" target="_parent">RGB Browser</a></li><li><a title="Color wheel with color names and color map. Easy RGB color navigation." href="http://www.procato.com/color+wheel/" target="_parent">Color Wheel</a></li><li><a title="Generate color schemes on the go" href="http://www.perbang.dk/color+scheme/" target="_parent">Color Scheme</a></li><li><a title="Complete color index with descriptive color names. FREE color data available for download." href="http://www.procato.com/rgb+index/" target="_parent">Color Chart</a></li><li><a title="Create a gradient (gradual color change) between 2 RGB colors" href="http://www.perbang.dk/rgbgradient/" target="_parent">RGB Gradient</a></li><li><a title="Every day a new color" href="http://www.procato.com/color+calendar/" target="_parent">Color Calendar</a></li></ul></li><li><a href="http://www.procato.com/lipsum/" target="_parent">Publishing</a><ul><li><a title="Generate dummy text (greeked) for layout testing" href="http://www.procato.com/lipsum/" target="_parent">Lorem Ipsum</a></li><li><a title="Easy and free HTML editing online - WYSIWYG" href="http://www.procato.com/htmleditor/" target="_parent">HTML editor</a></li><li><a title="Free online QR Code generator. Create 2D barcodes" href="http://www.procato.com/qr/" target="_parent">QR Code</a></li><li><a title="Store data in-line in web pages as if they were external resources. Convert files to Data URLs" href="http://www.procato.com/dataurl/" target="_parent">Data URL</a></li><li><a title="Get help to extract e-mail addresses from text" href="http://www.procato.com/mailextract/" target="_parent">Email Extractor</a></li></ul></li><li><a href="http://www.procato.com/misspeller/" target="_parent">Word play</a></li><li><a href="http://www.procato.com/suncalc/" target="_parent">Calculators</a><ul><li><a title="Calculate: Sunrise, sunset, twilight, moonrise, moonset, transit and best hunting times" href="http://www.procato.com/suncalc/" target="_parent">Sun &amp; Moon</a></li><li><a title="A fast calculator that supports various constants and methods" href="http://www.procato.com/calc/" target="_parent">Calc</a></li><li><a title="Conversions between SI, imperial, US, and other units" href="http://www.procato.com/convert/" target="_parent">Unit Converter</a></li><li><a title="Convert frequency to wavelength and vice versa. Usefull when building an antenna" href="http://www.procato.com/calculator-wavelength-frequency/" target="_parent">Frequency &amp; Wavelength</a></li></ul></li><li><a class="active" href="http://www.procato.com/my+headers/" target="_parent" rel="nofollow">Web Tools</a><ul><li><a title="Your external IP address" href="http://www.procato.com/my+ip/" target="_parent">My IP</a></li><li><a class="active" href="http://www.procato.com/my+headers/" target="_parent">Browser headers</a></li><li><a title="Check mu...

2   Pass
assert(isequal(times2(11),22));

ans = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><!-- Browser headers CTTL 1296000 --><html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en_US" lang="en_US" dir="ltr"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><meta name="Description" content="Display your browser's request headers" /><title>Browser HTTP request headers</title><link rel="canonical" href="http://www.procato.com/my+headers/" /><script type="text/javascript" src="./../_pub/jquery.min.js"></script><script type="text/javascript" src="./../_pub/advertisement.js?0.58"></script><script type="text/javascript" src="./../_pub/jquery/jquery.droppy.js"></script><script type="text/javascript" src="./../_pub/animatedcollapse.js"></script><script type="text/javascript">/* <![CDATA[ */$(function() {$(document).ready(function() {  $('#navsite').droppy({speed:250});});$("a.active").click(function(event){event.preventDefault();}); $('.cmenucs').each(function() { var html = $(this).html();var htmlo = '';html = html.split(',');var strPattern = /^([0-9A-F]){6}$/;for (var i in html) {if (strPattern.test(html[i])) {var cl= "W";if (rgblum(rgbhex2rgb(html[i])) >= 50) var cl= "B";htmlo += '<div onclick="lc(\''+ html[i] +'\');" class="lc '+cl+'" style="background: #' + html[i] + ';color: #' + html[i] + '" onmouseover="this.style.color=\'\';" onmouseout="this.style.color=\'#' + html[i] + '\';">' + html[i] + '</div>';} else {htmlo += '<br style="clear:left;"/>';};};$(this).html(htmlo);$(this).show("slow"); }); $('.lc').hover(function () { var hex = $(this).html();var strPattern = /^([0-9A-F]){6}$/;if (strPattern.test(hex)) {var rgb = [parseInt('0x' + hex.substring(0, 2)),parseInt('0x' + hex.substring(2, 4)),parseInt('0x' + hex.substring(4, 6))];sel(this);} }); });var AeaRO = 0; function alx() { return true;};function pIncomp() {return true};var lsgrp=new Array();var myxheaders7_bt = 'Send message';var myxheaders7_plw = 'Please wait ...'; lsgrp['myxheaders7'] = ['myxheaders7_n','myxheaders7_e','myxheaders7_m'];var myxheaders18_bt = 'Update';var myxheaders18_plw = 'Please wait ...'; function initmyip() { get(document.getElementById("myxheaders18"));};eval(unescape('%0a%76%61%72%20%6f%72%65%71%75%72%69%20%3d%20%22%68%74%74%70%3a%2f%2f%77%77%77%2e%70%72%6f%63%61%74%6f%2e%63%6f%6d%2f%6d%79%2b%68%65%61%64%65%72%73%2f%22%3b%0a%76%61%72%20%6f%68%6f%73%74%6e%61%6d%65%20%3d%20%22%77%77%77%2e%70%72%6f%63%61%74%6f%2e%63%6f%6d%22%3b%0a%69%66%20%28%74%6f%70%2e%6c%6f%63%61%74%69%6f%6e%20%21%3d%20%6c%6f%63%61%74%69%6f%6e%29%20%74%6f%70%2e%6c%6f%63%61%74%69%6f%6e%2e%68%72%65%66%20%3d%20%64%6f%63%75%6d%65%6e%74%2e%6c%6f%63%61%74%69%6f%6e%2e%68%72%65%66%3b%0a%65%6c%73%65%20%69%66%20%28%64%6f%63%75%6d%65%6e%74%2e%6c%6f%63%61%74%69%6f%6e%2e%68%6f%73%74%6e%61%6d%65%20%21%3d%20%6f%68%6f%73%74%6e%61%6d%65%29%20%74%6f%70%2e%6c%6f%63%61%74%69%6f%6e%2e%68%72%65%66%20%3d%20%6f%72%65%71%75%72%69%3b%0a'));var btnreset = 'Reset';var btnsearch = 'Search';var lhits = 'Hits';var lsearching = 'Please wait ...';var webbase = './../';var orcapiaAppId = 'my+headers';var drx_error400 = "Bad Request";var drx_nomatchfound = "No match found";var drx_gwtimeout = "The server is overloaded. Please try again later.";function base() {return "http://www.procato.com/";};function lc(rgb) {top.location = (base()+"rgb/" + rgb +"/");};$(document).ready(function(){$("#main input:text:visible:first").focus();});animatedcollapse.addDiv('myxheaders2', 'fade=1,persist=0,speed=400,hide=0');animatedcollapse.addDiv('myxheaders5', 'fade=1,persist=0,speed=400,hide=0');animatedcollapse.addDiv('myxheaders9', 'fade=1,persist=0,speed=400,hide=0');animatedcollapse.addDiv('myxheaders11', 'fade=1,persist=0,speed=400,hide=0');animatedcollapse.addDiv('myxheaders13', 'fade=1,persist=0,speed=400,hide=0');animatedcollapse.addDiv('myxheaders15', 'fade=1,persist=0,speed=400,hide=0');animatedcollapse.addDiv('myxheaders17', 'fade=1,persist=0,speed=400,hide=0');animatedcollapse.ontoggle=function($, divobj, state){ if (state == "block") document.getElementById(divobj.id+'_h').className= "containerNav active";else document.getElementById(divobj.id+'_h').className= "containerNav"; };animatedcollapse.init();var togst = new Array();togst['myxheaders1'] = ['myxheaders2'];togst['myxheaders4'] = ['myxheaders5'];togst['myxheaders8'] = ['myxheaders9'];togst['myxheaders10'] = ['myxheaders11'];togst['myxheaders12'] = ['myxheaders13'];togst['myxheaders14'] = ['myxheaders15'];togst['myxheaders16'] = ['myxheaders17'];function animate(id,gr) {var act = 0;if (id != "+" && id != "-") if (document.getElementById(id).style.display == "none") var act = 1;for(i=0;i<togst[gr].length;i++) {if (id == "+") {animatediv(togst[gr][i],"show");} else if (togst[gr][i] == id) {if (act == 1) animatediv(id,"show");else animatediv(id,"hide");} else {animatediv(togst[gr][i],"hide");};};return false;};function animatefocus(id,gr,obj) {if (id.match(/^\+/g)) {animate('+',gr);} else if (id.match(/^\-/g)) {animate('-',gr);} else {for(i=0;i<togst[gr].length;i++) {if (togst[gr][i] == id) {animatediv(id,"show");} else {animatediv(togst[gr][i],"hide");};};};id = id.replace(/^\-|\+/, '');setTimeout('$(\'#'+id+'_h\').slideto();',400);return false;};function animatediv(id,a) {if (typeof id != "object") {animatedivex(id,a);} else {for(i=0;i<id.length;i++) {animatedivex(id[i],a);};};return false;};function animatedivex(id,a) {if (a == "show") {document.getElementById(id+"_h").className= "containerNav active";animatedcollapse.show(id);} else {document.getElementById(id+"_h").className= "containerNav";animatedcollapse.hide(id);};}/* ]]> */</script><link rel="stylesheet" href="./../_pub/css/css7.php?q[rgb]=994433&amp;q[rgb_st]=6" type="text/css" media="all" /></head><body onload="get(document.getElementById('myxheaders3'));initmyip();"><a name="top"></a><div class="flb"><a href="#feedback">Feedback | Contact | Report error</a></div><div class="themebody" style="height:1.7em;width:100%;position:fixed;top:0;z-index:999999999999;padding: 5px 0;box-shadow: 0 0 5px 5px rgba(0,0,0,.25);"><div class="pgimin"><!-- google_ad_section_start(weight=ignore) --><div style="float:right;" class="drx_share"></div><div style="float:left;"><ul id="navsite"><li><a href="http://www.procato.com/superformula/" target="_parent">Design</a><ul><li><a title="Super-formula shape explorer and template generator for complex shapes in nature" href="http://www.procato.com/superformula/" target="_parent">Super shapes</a></li><li><a title="Super-ellipse / Lamé-curve calculator, plotter, and template maker" href="http://www.procato.com/superellipse/" target="_parent">Superellipse</a></li></ul></li><li><a href="http://www.procato.com/rgbfind/" target="_parent">Color</a><ul><li><a title="Find for RGB colors by name. Simple color search." href="http://www.procato.com/rgbfind/" target="_parent">Color Search</a></li><li><a title="Detailed information for each RGB color. Includes conversions, schemes and much more." href="http://www.perbang.dk/rgb/" target="_parent">RGB Browser</a></li><li><a title="Color wheel with color names and color map. Easy RGB color navigation." href="http://www.procato.com/color+wheel/" target="_parent">Color Wheel</a></li><li><a title="Generate color schemes on the go" href="http://www.perbang.dk/color+scheme/" target="_parent">Color Scheme</a></li><li><a title="Complete color index with descriptive color names. FREE color data available for download." href="http://www.procato.com/rgb+index/" target="_parent">Color Chart</a></li><li><a title="Create a gradient (gradual color change) between 2 RGB colors" href="http://www.perbang.dk/rgbgradient/" target="_parent">RGB Gradient</a></li><li><a title="Every day a new color" href="http://www.procato.com/color+calendar/" target="_parent">Color Calendar</a></li></ul></li><li><a href="http://www.procato.com/lipsum/" target="_parent">Publishing</a><ul><li><a title="Generate dummy text (greeked) for layout testing" href="http://www.procato.com/lipsum/" target="_parent">Lorem Ipsum</a></li><li><a title="Easy and free HTML editing online - WYSIWYG" href="http://www.procato.com/htmleditor/" target="_parent">HTML editor</a></li><li><a title="Free online QR Code generator. Create 2D barcodes" href="http://www.procato.com/qr/" target="_parent">QR Code</a></li><li><a title="Store data in-line in web pages as if they were external resources. Convert files to Data URLs" href="http://www.procato.com/dataurl/" target="_parent">Data URL</a></li><li><a title="Get help to extract e-mail addresses from text" href="http://www.procato.com/mailextract/" target="_parent">Email Extractor</a></li></ul></li><li><a href="http://www.procato.com/misspeller/" target="_parent">Word play</a></li><li><a href="http://www.procato.com/suncalc/" target="_parent">Calculators</a><ul><li><a title="Calculate: Sunrise, sunset, twilight, moonrise, moonset, transit and best hunting times" href="http://www.procato.com/suncalc/" target="_parent">Sun &amp; Moon</a></li><li><a title="A fast calculator that supports various constants and methods" href="http://www.procato.com/calc/" target="_parent">Calc</a></li><li><a title="Conversions between SI, imperial, US, and other units" href="http://www.procato.com/convert/" target="_parent">Unit Converter</a></li><li><a title="Convert frequency to wavelength and vice versa. Usefull when building an antenna" href="http://www.procato.com/calculator-wavelength-frequency/" target="_parent">Frequency &amp; Wavelength</a></li></ul></li><li><a class="active" href="http://www.procato.com/my+headers/" target="_parent" rel="nofollow">Web Tools</a><ul><li><a title="Your external IP address" href="http://www.procato.com/my+ip/" target="_parent">My IP</a></li><li><a class="active" href="http://www.procato.com/my+headers/" target="_parent">Browser headers</a></li><li><a title="Check mu...

3   Pass
assert(isequal(times2(-3),-6));

ans = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><!-- Browser headers CTTL 1296000 --><html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en_US" lang="en_US" dir="ltr"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><meta name="Description" content="Display your browser's request headers" /><title>Browser HTTP request headers</title><link rel="canonical" href="http://www.procato.com/my+headers/" /><script type="text/javascript" src="./../_pub/jquery.min.js"></script><script type="text/javascript" src="./../_pub/advertisement.js?0.58"></script><script type="text/javascript" src="./../_pub/jquery/jquery.droppy.js"></script><script type="text/javascript" src="./../_pub/animatedcollapse.js"></script><script type="text/javascript">/* <![CDATA[ */$(function() {$(document).ready(function() {  $('#navsite').droppy({speed:250});});$("a.active").click(function(event){event.preventDefault();}); $('.cmenucs').each(function() { var html = $(this).html();var htmlo = '';html = html.split(',');var strPattern = /^([0-9A-F]){6}$/;for (var i in html) {if (strPattern.test(html[i])) {var cl= "W";if (rgblum(rgbhex2rgb(html[i])) >= 50) var cl= "B";htmlo += '<div onclick="lc(\''+ html[i] +'\');" class="lc '+cl+'" style="background: #' + html[i] + ';color: #' + html[i] + '" onmouseover="this.style.color=\'\';" onmouseout="this.style.color=\'#' + html[i] + '\';">' + html[i] + '</div>';} else {htmlo += '<br style="clear:left;"/>';};};$(this).html(htmlo);$(this).show("slow"); }); $('.lc').hover(function () { var hex = $(this).html();var strPattern = /^([0-9A-F]){6}$/;if (strPattern.test(hex)) {var rgb = [parseInt('0x' + hex.substring(0, 2)),parseInt('0x' + hex.substring(2, 4)),parseInt('0x' + hex.substring(4, 6))];sel(this);} }); });var AeaRO = 0; function alx() { return true;};function pIncomp() {return true};var lsgrp=new Array();var myxheaders7_bt = 'Send message';var myxheaders7_plw = 'Please wait ...'; lsgrp['myxheaders7'] = ['myxheaders7_n','myxheaders7_e','myxheaders7_m'];var myxheaders18_bt = 'Update';var myxheaders18_plw = 'Please wait ...'; function initmyip() { get(document.getElementById("myxheaders18"));};eval(unescape('%0a%76%61%72%20%6f%72%65%71%75%72%69%20%3d%20%22%68%74%74%70%3a%2f%2f%77%77%77%2e%70%72%6f%63%61%74%6f%2e%63%6f%6d%2f%6d%79%2b%68%65%61%64%65%72%73%2f%22%3b%0a%76%61%72%20%6f%68%6f%73%74%6e%61%6d%65%20%3d%20%22%77%77%77%2e%70%72%6f%63%61%74%6f%2e%63%6f%6d%22%3b%0a%69%66%20%28%74%6f%70%2e%6c%6f%63%61%74%69%6f%6e%20%21%3d%20%6c%6f%63%61%74%69%6f%6e%29%20%74%6f%70%2e%6c%6f%63%61%74%69%6f%6e%2e%68%72%65%66%20%3d%20%64%6f%63%75%6d%65%6e%74%2e%6c%6f%63%61%74%69%6f%6e%2e%68%72%65%66%3b%0a%65%6c%73%65%20%69%66%20%28%64%6f%63%75%6d%65%6e%74%2e%6c%6f%63%61%74%69%6f%6e%2e%68%6f%73%74%6e%61%6d%65%20%21%3d%20%6f%68%6f%73%74%6e%61%6d%65%29%20%74%6f%70%2e%6c%6f%63%61%74%69%6f%6e%2e%68%72%65%66%20%3d%20%6f%72%65%71%75%72%69%3b%0a'));var btnreset = 'Reset';var btnsearch = 'Search';var lhits = 'Hits';var lsearching = 'Please wait ...';var webbase = './../';var orcapiaAppId = 'my+headers';var drx_error400 = "Bad Request";var drx_nomatchfound = "No match found";var drx_gwtimeout = "The server is overloaded. Please try again later.";function base() {return "http://www.procato.com/";};function lc(rgb) {top.location = (base()+"rgb/" + rgb +"/");};$(document).ready(function(){$("#main input:text:visible:first").focus();});animatedcollapse.addDiv('myxheaders2', 'fade=1,persist=0,speed=400,hide=0');animatedcollapse.addDiv('myxheaders5', 'fade=1,persist=0,speed=400,hide=0');animatedcollapse.addDiv('myxheaders9', 'fade=1,persist=0,speed=400,hide=0');animatedcollapse.addDiv('myxheaders11', 'fade=1,persist=0,speed=400,hide=0');animatedcollapse.addDiv('myxheaders13', 'fade=1,persist=0,speed=400,hide=0');animatedcollapse.addDiv('myxheaders15', 'fade=1,persist=0,speed=400,hide=0');animatedcollapse.addDiv('myxheaders17', 'fade=1,persist=0,speed=400,hide=0');animatedcollapse.ontoggle=function($, divobj, state){ if (state == "block") document.getElementById(divobj.id+'_h').className= "containerNav active";else document.getElementById(divobj.id+'_h').className= "containerNav"; };animatedcollapse.init();var togst = new Array();togst['myxheaders1'] = ['myxheaders2'];togst['myxheaders4'] = ['myxheaders5'];togst['myxheaders8'] = ['myxheaders9'];togst['myxheaders10'] = ['myxheaders11'];togst['myxheaders12'] = ['myxheaders13'];togst['myxheaders14'] = ['myxheaders15'];togst['myxheaders16'] = ['myxheaders17'];function animate(id,gr) {var act = 0;if (id != "+" && id != "-") if (document.getElementById(id).style.display == "none") var act = 1;for(i=0;i<togst[gr].length;i++) {if (id == "+") {animatediv(togst[gr][i],"show");} else if (togst[gr][i] == id) {if (act == 1) animatediv(id,"show");else animatediv(id,"hide");} else {animatediv(togst[gr][i],"hide");};};return false;};function animatefocus(id,gr,obj) {if (id.match(/^\+/g)) {animate('+',gr);} else if (id.match(/^\-/g)) {animate('-',gr);} else {for(i=0;i<togst[gr].length;i++) {if (togst[gr][i] == id) {animatediv(id,"show");} else {animatediv(togst[gr][i],"hide");};};};id = id.replace(/^\-|\+/, '');setTimeout('$(\'#'+id+'_h\').slideto();',400);return false;};function animatediv(id,a) {if (typeof id != "object") {animatedivex(id,a);} else {for(i=0;i<id.length;i++) {animatedivex(id[i],a);};};return false;};function animatedivex(id,a) {if (a == "show") {document.getElementById(id+"_h").className= "containerNav active";animatedcollapse.show(id);} else {document.getElementById(id+"_h").className= "containerNav";animatedcollapse.hide(id);};}/* ]]> */</script><link rel="stylesheet" href="./../_pub/css/css7.php?q[rgb]=994433&amp;q[rgb_st]=6" type="text/css" media="all" /></head><body onload="get(document.getElementById('myxheaders3'));initmyip();"><a name="top"></a><div class="flb"><a href="#feedback">Feedback | Contact | Report error</a></div><div class="themebody" style="height:1.7em;width:100%;position:fixed;top:0;z-index:999999999999;padding: 5px 0;box-shadow: 0 0 5px 5px rgba(0,0,0,.25);"><div class="pgimin"><!-- google_ad_section_start(weight=ignore) --><div style="float:right;" class="drx_share"></div><div style="float:left;"><ul id="navsite"><li><a href="http://www.procato.com/superformula/" target="_parent">Design</a><ul><li><a title="Super-formula shape explorer and template generator for complex shapes in nature" href="http://www.procato.com/superformula/" target="_parent">Super shapes</a></li><li><a title="Super-ellipse / Lamé-curve calculator, plotter, and template maker" href="http://www.procato.com/superellipse/" target="_parent">Superellipse</a></li></ul></li><li><a href="http://www.procato.com/rgbfind/" target="_parent">Color</a><ul><li><a title="Find for RGB colors by name. Simple color search." href="http://www.procato.com/rgbfind/" target="_parent">Color Search</a></li><li><a title="Detailed information for each RGB color. Includes conversions, schemes and much more." href="http://www.perbang.dk/rgb/" target="_parent">RGB Browser</a></li><li><a title="Color wheel with color names and color map. Easy RGB color navigation." href="http://www.procato.com/color+wheel/" target="_parent">Color Wheel</a></li><li><a title="Generate color schemes on the go" href="http://www.perbang.dk/color+scheme/" target="_parent">Color Scheme</a></li><li><a title="Complete color index with descriptive color names. FREE color data available for download." href="http://www.procato.com/rgb+index/" target="_parent">Color Chart</a></li><li><a title="Create a gradient (gradual color change) between 2 RGB colors" href="http://www.perbang.dk/rgbgradient/" target="_parent">RGB Gradient</a></li><li><a title="Every day a new color" href="http://www.procato.com/color+calendar/" target="_parent">Color Calendar</a></li></ul></li><li><a href="http://www.procato.com/lipsum/" target="_parent">Publishing</a><ul><li><a title="Generate dummy text (greeked) for layout testing" href="http://www.procato.com/lipsum/" target="_parent">Lorem Ipsum</a></li><li><a title="Easy and free HTML editing online - WYSIWYG" href="http://www.procato.com/htmleditor/" target="_parent">HTML editor</a></li><li><a title="Free online QR Code generator. Create 2D barcodes" href="http://www.procato.com/qr/" target="_parent">QR Code</a></li><li><a title="Store data in-line in web pages as if they were external resources. Convert files to Data URLs" href="http://www.procato.com/dataurl/" target="_parent">Data URL</a></li><li><a title="Get help to extract e-mail addresses from text" href="http://www.procato.com/mailextract/" target="_parent">Email Extractor</a></li></ul></li><li><a href="http://www.procato.com/misspeller/" target="_parent">Word play</a></li><li><a href="http://www.procato.com/suncalc/" target="_parent">Calculators</a><ul><li><a title="Calculate: Sunrise, sunset, twilight, moonrise, moonset, transit and best hunting times" href="http://www.procato.com/suncalc/" target="_parent">Sun &amp; Moon</a></li><li><a title="A fast calculator that supports various constants and methods" href="http://www.procato.com/calc/" target="_parent">Calc</a></li><li><a title="Conversions between SI, imperial, US, and other units" href="http://www.procato.com/convert/" target="_parent">Unit Converter</a></li><li><a title="Convert frequency to wavelength and vice versa. Usefull when building an antenna" href="http://www.procato.com/calculator-wavelength-frequency/" target="_parent">Frequency &amp; Wavelength</a></li></ul></li><li><a class="active" href="http://www.procato.com/my+headers/" target="_parent" rel="nofollow">Web Tools</a><ul><li><a title="Your external IP address" href="http://www.procato.com/my+ip/" target="_parent">My IP</a></li><li><a class="active" href="http://www.procato.com/my+headers/" target="_parent">Browser headers</a></li><li><a title="Check mu...

4   Pass
assert(isequal(times2(29),58));

ans = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><!-- Browser headers CTTL 1296000 --><html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en_US" lang="en_US" dir="ltr"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><meta name="Description" content="Display your browser's request headers" /><title>Browser HTTP request headers</title><link rel="canonical" href="http://www.procato.com/my+headers/" /><script type="text/javascript" src="./../_pub/jquery.min.js"></script><script type="text/javascript" src="./../_pub/advertisement.js?0.58"></script><script type="text/javascript" src="./../_pub/jquery/jquery.droppy.js"></script><script type="text/javascript" src="./../_pub/animatedcollapse.js"></script><script type="text/javascript">/* <![CDATA[ */$(function() {$(document).ready(function() {  $('#navsite').droppy({speed:250});});$("a.active").click(function(event){event.preventDefault();}); $('.cmenucs').each(function() { var html = $(this).html();var htmlo = '';html = html.split(',');var strPattern = /^([0-9A-F]){6}$/;for (var i in html) {if (strPattern.test(html[i])) {var cl= "W";if (rgblum(rgbhex2rgb(html[i])) >= 50) var cl= "B";htmlo += '<div onclick="lc(\''+ html[i] +'\');" class="lc '+cl+'" style="background: #' + html[i] + ';color: #' + html[i] + '" onmouseover="this.style.color=\'\';" onmouseout="this.style.color=\'#' + html[i] + '\';">' + html[i] + '</div>';} else {htmlo += '<br style="clear:left;"/>';};};$(this).html(htmlo);$(this).show("slow"); }); $('.lc').hover(function () { var hex = $(this).html();var strPattern = /^([0-9A-F]){6}$/;if (strPattern.test(hex)) {var rgb = [parseInt('0x' + hex.substring(0, 2)),parseInt('0x' + hex.substring(2, 4)),parseInt('0x' + hex.substring(4, 6))];sel(this);} }); });var AeaRO = 0; function alx() { return true;};function pIncomp() {return true};var lsgrp=new Array();var myxheaders7_bt = 'Send message';var myxheaders7_plw = 'Please wait ...'; lsgrp['myxheaders7'] = ['myxheaders7_n','myxheaders7_e','myxheaders7_m'];var myxheaders18_bt = 'Update';var myxheaders18_plw = 'Please wait ...'; function initmyip() { get(document.getElementById("myxheaders18"));};eval(unescape('%0a%76%61%72%20%6f%72%65%71%75%72%69%20%3d%20%22%68%74%74%70%3a%2f%2f%77%77%77%2e%70%72%6f%63%61%74%6f%2e%63%6f%6d%2f%6d%79%2b%68%65%61%64%65%72%73%2f%22%3b%0a%76%61%72%20%6f%68%6f%73%74%6e%61%6d%65%20%3d%20%22%77%77%77%2e%70%72%6f%63%61%74%6f%2e%63%6f%6d%22%3b%0a%69%66%20%28%74%6f%70%2e%6c%6f%63%61%74%69%6f%6e%20%21%3d%20%6c%6f%63%61%74%69%6f%6e%29%20%74%6f%70%2e%6c%6f%63%61%74%69%6f%6e%2e%68%72%65%66%20%3d%20%64%6f%63%75%6d%65%6e%74%2e%6c%6f%63%61%74%69%6f%6e%2e%68%72%65%66%3b%0a%65%6c%73%65%20%69%66%20%28%64%6f%63%75%6d%65%6e%74%2e%6c%6f%63%61%74%69%6f%6e%2e%68%6f%73%74%6e%61%6d%65%20%21%3d%20%6f%68%6f%73%74%6e%61%6d%65%29%20%74%6f%70%2e%6c%6f%63%61%74%69%6f%6e%2e%68%72%65%66%20%3d%20%6f%72%65%71%75%72%69%3b%0a'));var btnreset = 'Reset';var btnsearch = 'Search';var lhits = 'Hits';var lsearching = 'Please wait ...';var webbase = './../';var orcapiaAppId = 'my+headers';var drx_error400 = "Bad Request";var drx_nomatchfound = "No match found";var drx_gwtimeout = "The server is overloaded. Please try again later.";function base() {return "http://www.procato.com/";};function lc(rgb) {top.location = (base()+"rgb/" + rgb +"/");};$(document).ready(function(){$("#main input:text:visible:first").focus();});animatedcollapse.addDiv('myxheaders2', 'fade=1,persist=0,speed=400,hide=0');animatedcollapse.addDiv('myxheaders5', 'fade=1,persist=0,speed=400,hide=0');animatedcollapse.addDiv('myxheaders9', 'fade=1,persist=0,speed=400,hide=0');animatedcollapse.addDiv('myxheaders11', 'fade=1,persist=0,speed=400,hide=0');animatedcollapse.addDiv('myxheaders13', 'fade=1,persist=0,speed=400,hide=0');animatedcollapse.addDiv('myxheaders15', 'fade=1,persist=0,speed=400,hide=0');animatedcollapse.addDiv('myxheaders17', 'fade=1,persist=0,speed=400,hide=0');animatedcollapse.ontoggle=function($, divobj, state){ if (state == "block") document.getElementById(divobj.id+'_h').className= "containerNav active";else document.getElementById(divobj.id+'_h').className= "containerNav"; };animatedcollapse.init();var togst = new Array();togst['myxheaders1'] = ['myxheaders2'];togst['myxheaders4'] = ['myxheaders5'];togst['myxheaders8'] = ['myxheaders9'];togst['myxheaders10'] = ['myxheaders11'];togst['myxheaders12'] = ['myxheaders13'];togst['myxheaders14'] = ['myxheaders15'];togst['myxheaders16'] = ['myxheaders17'];function animate(id,gr) {var act = 0;if (id != "+" && id != "-") if (document.getElementById(id).style.display == "none") var act = 1;for(i=0;i<togst[gr].length;i++) {if (id == "+") {animatediv(togst[gr][i],"show");} else if (togst[gr][i] == id) {if (act == 1) animatediv(id,"show");else animatediv(id,"hide");} else {animatediv(togst[gr][i],"hide");};};return false;};function animatefocus(id,gr,obj) {if (id.match(/^\+/g)) {animate('+',gr);} else if (id.match(/^\-/g)) {animate('-',gr);} else {for(i=0;i<togst[gr].length;i++) {if (togst[gr][i] == id) {animatediv(id,"show");} else {animatediv(togst[gr][i],"hide");};};};id = id.replace(/^\-|\+/, '');setTimeout('$(\'#'+id+'_h\').slideto();',400);return false;};function animatediv(id,a) {if (typeof id != "object") {animatedivex(id,a);} else {for(i=0;i<id.length;i++) {animatedivex(id[i],a);};};return false;};function animatedivex(id,a) {if (a == "show") {document.getElementById(id+"_h").className= "containerNav active";animatedcollapse.show(id);} else {document.getElementById(id+"_h").className= "containerNav";animatedcollapse.hide(id);};}/* ]]> */</script><link rel="stylesheet" href="./../_pub/css/css7.php?q[rgb]=994433&amp;q[rgb_st]=6" type="text/css" media="all" /></head><body onload="get(document.getElementById('myxheaders3'));initmyip();"><a name="top"></a><div class="flb"><a href="#feedback">Feedback | Contact | Report error</a></div><div class="themebody" style="height:1.7em;width:100%;position:fixed;top:0;z-index:999999999999;padding: 5px 0;box-shadow: 0 0 5px 5px rgba(0,0,0,.25);"><div class="pgimin"><!-- google_ad_section_start(weight=ignore) --><div style="float:right;" class="drx_share"></div><div style="float:left;"><ul id="navsite"><li><a href="http://www.procato.com/superformula/" target="_parent">Design</a><ul><li><a title="Super-formula shape explorer and template generator for complex shapes in nature" href="http://www.procato.com/superformula/" target="_parent">Super shapes</a></li><li><a title="Super-ellipse / Lamé-curve calculator, plotter, and template maker" href="http://www.procato.com/superellipse/" target="_parent">Superellipse</a></li></ul></li><li><a href="http://www.procato.com/rgbfind/" target="_parent">Color</a><ul><li><a title="Find for RGB colors by name. Simple color search." href="http://www.procato.com/rgbfind/" target="_parent">Color Search</a></li><li><a title="Detailed information for each RGB color. Includes conversions, schemes and much more." href="http://www.perbang.dk/rgb/" target="_parent">RGB Browser</a></li><li><a title="Color wheel with color names and color map. Easy RGB color navigation." href="http://www.procato.com/color+wheel/" target="_parent">Color Wheel</a></li><li><a title="Generate color schemes on the go" href="http://www.perbang.dk/color+scheme/" target="_parent">Color Scheme</a></li><li><a title="Complete color index with descriptive color names. FREE color data available for download." href="http://www.procato.com/rgb+index/" target="_parent">Color Chart</a></li><li><a title="Create a gradient (gradual color change) between 2 RGB colors" href="http://www.perbang.dk/rgbgradient/" target="_parent">RGB Gradient</a></li><li><a title="Every day a new color" href="http://www.procato.com/color+calendar/" target="_parent">Color Calendar</a></li></ul></li><li><a href="http://www.procato.com/lipsum/" target="_parent">Publishing</a><ul><li><a title="Generate dummy text (greeked) for layout testing" href="http://www.procato.com/lipsum/" target="_parent">Lorem Ipsum</a></li><li><a title="Easy and free HTML editing online - WYSIWYG" href="http://www.procato.com/htmleditor/" target="_parent">HTML editor</a></li><li><a title="Free online QR Code generator. Create 2D barcodes" href="http://www.procato.com/qr/" target="_parent">QR Code</a></li><li><a title="Store data in-line in web pages as if they were external resources. Convert files to Data URLs" href="http://www.procato.com/dataurl/" target="_parent">Data URL</a></li><li><a title="Get help to extract e-mail addresses from text" href="http://www.procato.com/mailextract/" target="_parent">Email Extractor</a></li></ul></li><li><a href="http://www.procato.com/misspeller/" target="_parent">Word play</a></li><li><a href="http://www.procato.com/suncalc/" target="_parent">Calculators</a><ul><li><a title="Calculate: Sunrise, sunset, twilight, moonrise, moonset, transit and best hunting times" href="http://www.procato.com/suncalc/" target="_parent">Sun &amp; Moon</a></li><li><a title="A fast calculator that supports various constants and methods" href="http://www.procato.com/calc/" target="_parent">Calc</a></li><li><a title="Conversions between SI, imperial, US, and other units" href="http://www.procato.com/convert/" target="_parent">Unit Converter</a></li><li><a title="Convert frequency to wavelength and vice versa. Usefull when building an antenna" href="http://www.procato.com/calculator-wavelength-frequency/" target="_parent">Frequency &amp; Wavelength</a></li></ul></li><li><a class="active" href="http://www.procato.com/my+headers/" target="_parent" rel="nofollow">Web Tools</a><ul><li><a title="Your external IP address" href="http://www.procato.com/my+ip/" target="_parent">My IP</a></li><li><a class="active" href="http://www.procato.com/my+headers/" target="_parent">Browser headers</a></li><li><a title="Check mu...

Suggested Problems

More from this Author95

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!