What is the origin of magic number 42, indispensable in coding? [closed]

It’s from The Hitch Hiker’s Guide to the Galaxy. In The Hitchhiker’s Guide to the Galaxy (published in 1979), the characters visit the legendary planet Magrathea, home to the now-collapsed planet-building industry, and meet Slartibartfast, a planetary coastline designer who was responsible for the fjords of Norway. Through archival recordings, he relates the story of … Read more

Code Golf – Banner Generation

J, 133 135 79 83 84 88 characters (utf-8 encoding) ;/5 3$”1(‘ ‘,.s){~”1#:3 u:(ucp’翇篭篯礧歮禧禤祯寭璗牯宭䤧彭忭筯篤筿殭秏璒孯孪寿咕寏犧’){~0>.64-~a.i.s=: Usage: ;/5 3$”1(‘ ‘,.s){~”1#:3 u:(ucp’翇篭篯礧歮禧禤祯寭璗牯宭䤧彭忭筯篤筿殭秏璒孯孪寿咕寏犧’){~0>.64-~a.i.s=:’ABCDEFGHIJKLMNOPQRSTUVWXYZ !’ ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┐ │AAA│BBB│CCC│DD │EEE│FFF│GGG│H H│III│JJJ│K K│L │M M│N N│OOO│PPP│QQQ│RR │SSS│TTT│U U│V V│W W│X X│Y Y│ZZZ│ │!!!│ │A A│B B│C │D D│E │F │G │H H│ I │ J│K K│L │MMM│NNN│O O│P P│Q Q│R R│S │ T … Read more

Code Golf: Spider webs

Perl, 164 chars 195 184 171 167 164 print@o=((map{$z=_ x($x=1+$N-$_);$”x$x.”https://stackoverflow.com/”x$_.”\\$z|$z/”.’\ ‘x$_.$/}0..($N=<>)), “_/”x++$N.” “.’\_’x$N.$/); y’/\\’\/’,@o||y#_# #,$t++||y#_ # _#,print while$_=pop@o First statement prints out the top half of the spider web. Second statement uses transliteration operations to create a reflection of the top half. This next one weighs in closer to 314 chars (of productive code), but … Read more

Code Golf: Seven Segments

Perl, 134 characters All linebreaks may be removed. @s=unpack”C*”,~”P\xdbLI\xc3a`[\@AB\xe0t\xc8df”; $_=<>;for$s(6,3,0){print map$s[hex$&]&1<<$_+$s?$_%2?”_”:”|”:” “, 0..2while/./g;print$/} Explanation @s stores the bits for each segment. The entries are in order from 0 to F (thanks to hex()) and the bits map to segments in this order: 6 7 x 3 4 5 0 1 2 with 0 being the … Read more

Most harmful misconception of beginners about programming? [closed]

Re-inventing standard library functions/classes. After going through a language book/tutorial, most beginners – knowing how to handle strings and numbers – will invent their own date functions, their own ‘compression algorithms’, their own SORT implementations. Oh, and they always spend their first day searching for clrscr();.

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)