2011-03-19

Scientists Say High-Heels Good for Your Health

Perm URL with updates: http://xahlee.org/Periodic_dosage_dir/high-heels_healthy.html

Scientist discovered that women's high-heels not only make your feet look sexy, but have health benefits.

Major news outlets have all reported this discovery.

high heels pretty feet
High heels are good for your health as well as make you sexy. img src

Many other news outlets reported it, with photos of sexy celebrity women wearing high-heels to prove it. e.g.

  • http://fashion.telegraph.co.uk/news-features/TMG8296453/Why-stilettos-are-the-secret-to-shapely-legs.html
  • http://www.dailymail.co.uk/femail/article-1352831/Victoria-Beckham-Stilettos-women-shapelier-legs-flats.html
  • http://www.express.co.uk/posts/view/226658/Stilettos-tone-up-your-legs/Stilettos-tone-up-your-legs
o rly owl ya rly owl
O RLY Owl and Ya RLY Owl — the correct response.

References

Adobe Reader Update Failure

Idiotic Adobe Reader (aka Adobe Acrobat).

When in Google Chrome browsing a pdf file, Chrome tells me: “Parts of this PDF document could not be displayed. Open in Adobe Reader?”. So i clicked Yes. Then, Chrome tells me: “Adobe Reader is out of date and may be insecure”, with a option to update. That's a bit strange, because i thought i have it up-to-date. So, i manually opened Adobe Reader, then clicked on the “Check for Update…” under the Help menu. It says: “No updates available”. I then checked version, it's “9.4.2”. Then i went back to Chrome and get the update, the download is “Adobe Reader X (10.0.1)”. Fucking idiotic Adobe Reader.

See also: The Complexity & Tedium of Software Engineering.

and Google Chrome is really fantastic. See: Google Chrome & Browser War II.

html, javascript, ad network, porn, fraud

A fascinating story.

Uncovering an advertising fraud scheme. Or “the Internet is for porn” (2011-03-16) By Panos Ipeirotis. @ Source behind-the-enemy-lines.blogspot.com

This guy, goes over thru tech details on a ad fraud scheme that makes $50k to $700k per month!

I spend 2 hours to read thru. You'll learn quite a few things. ① A detailed scene of online advertising and scams. ② Some of the actual names of ad networks. (if you are interested in monetizing your site. (but though some of them may be shady.)) ② Some of the web technologies.

2011-03-18

What's the Max Number of Directories a Directory Can Have?

Perm url with updates: http://xahlee.org/UnixResource_dir/writ/unix_max_num_dir.html

What's the Max Number of Directories a Directory Can Have?

Xah Lee, 2011-03-18

Randal L Schwartz (famous perl coder) wrote a nice blog about using perl to delete a dir with huge number of files. The numbers of files are so large that the unix commmands “ls”, “rm”, etc are not responsive. The blog is: Perl to the rescue: case study of deleting a large directory (2011-03-17) By Randal L Schwartz. @ Source blogs.perl.org.

Basically, the unix tools are trying to gather the list first before doing anything. But the perl code does not wait for the whole list first before doing anything. Here's his code:

perl -e 'chdir "BADnew" or die; opendir D, "."; while ($n = readdir D) { unlink $n }'

It's a interesting article. This reminds me, in 2002, we had a huge dir on our e-commerce app to the point that it maxed out the max allowed. (i don't remember the details, but it was not inode.) I dug up this old post of mine.

Newsgroups: comp.unix.solaris
From: xah@xahlee.org (Xah Lee)
Date: 19 Apr 2002 17:59:02 -0700
Local: Fri, Apr 19 2002 5:59 pm
Subject: max number of directories inside a dir

what's is the maximum number of directories one can create under a directory?

On our production box on NetApp with UFS we have a directory that has about 38000 first level subdirectories. When this is tarred up and transfered to my personal dev box Ulta 5, and i tried to untar it, i get an error like "too many links" after about 3 hours of untar.

I wrote a perl script that creates directoris just to see what's the maximum, and it turns out to be 32765. my disk has sufficient space and inode. (see below my sig)

can anyone tell me, what's the the factor that control the number of directories one can create immediate below a given dir?

and whether this file system config can be dynamically updated or do i have to create a new file system? (or if this is entirely somethnig else)

 Xah
 xah@xahlee.org
 http://xahlee.org/PageTwo_dir/more.html

dir making perl script

#!/usr/local/bin/perl
use strict;
my $path = ('/www/super_bucket/massive_files/');
chdir($path);
for (1..10) {system(mkdir $_);}

shell session that shows the maxed out dir

[xah@hypatia ~][Fri Apr 19,17:46:32]
mkdir /www/super_bucket/massive_dirs/t
mkdir: cannot make directory `/www/super_bucket/massive_dirs/t': Too
many links

[xah@hypatia ~][Fri Apr 19,17:46:47]
rmdir /www/super_bucket/massive_dirs/1

[xah@hypatia ~][Fri Apr 19,17:46:55]
mkdir /www/super_bucket/massive_dirs/t

[xah@hypatia ~][Fri Apr 19,17:46:58]
ls -d /www/super_bucket/massive_dirs/t
/www/super_bucket/massive_dirs/t

[xah@hypatia ~][Fri Apr 19,17:47:35]
mkdir /www/super_bucket/massive_dirs/1
mkdir: cannot make directory `/www/super_bucket/massive_dirs/1': Too
many links

[xah@hypatia ~][Fri Apr 19,17:48:21]
rmdir /www/super_bucket/massive_dirs/t

[xah@hypatia ~][Fri Apr 19,17:48:29]
mkdir /www/super_bucket/massive_dirs/1

[xah@hypatia ~][Fri Apr 19,17:48:35]
/usr/bin/df -k
Filesystem            kbytes    used   avail capacity  Mounted on
/dev/dsk/c0t0d0s0    15457218 8802041 6500605    58%    /
/proc                      0       0       0     0%    /proc
fd                         0       0       0     0%    /dev/fd
mnttab                     0       0       0     0%    /etc/mnttab
swap                  843096      16  843080     1%    /var/run
swap                  843784     704  843080     1%    /tmp
/dev/dsk/c0t0d0s7    3117942  538955 2516629    18%    /export/home

[xah@hypatia ~][Fri Apr 19,17:50:00]
/usr/bin/df -F ufs -o i
Filesystem             iused   ifree  %iused  Mounted on
/dev/dsk/c0t0d0s0     305639 1648281    16%   /
/dev/dsk/c0t0d0s7      27314  368974     7%   /export/home

[xah@hypatia ~][Fri Apr 19,17:50:27]

Source groups.google.com

Emacs: Remapping Keys Using key-translation-map

Perm url with updates: http://xahlee.org/emacs/emacs_key-translation-map.html

Emacs: Remapping Keys Using key-translation-map

Xah Lee, 2011-03-17

This page shows you how to remap keys to input unicode symbols using the elisp function “key-translation-map”, and discuss some related issues.

Recently i wrote a article on How to Create a APL or Math Symbols Keyboard Layout. In the article, i described several ways to remap keys on keyboard to input symbols for Mac, Windows, Linux. Some are OS-wide thru OS's user-configurable mechanisms. Some are using key-macro software for that OS. And there's emacs for just within emacs. I've used them all in the past 2 decades, but in the past few years, i find the most practical and flexible way is just emacs. Because: ① 99% of my typing are done in emacs. So, i don't really need them to be OS-wide. ② Each method of remapping keys all have their own limitations (e.g. on Mac and Windows, there's no way to remap some key combinations.), but within emacs it has the most support on remapping keys that has less restrictions than using OS's methods.

Here's interesting thing i discovered recently.

Using “global-set-key” or “key-translation-map” to Insert Unicode Char

If you want to define a key combo for typing a unicode char such as math symbol λ, you can do it using “global-set-key” or “key-translation-map”.

Example of using “global-set-key”:

(global-set-key (kbd "H-3") (lambda () (interactive) (insert "λ"))) ; 【Hyper+3】 insert λ char
(global-set-key (kbd "H-3") "λ") ; 【Hyper+3】 insert λ char. This is a builtin macro for above.

(In this example we use Hyper key, but Ctrl or Meta works too. You can make the Win key or the Menu key act as Hyper. To set up, see: Emacs: How to define Hyper & Super Keys.)

Example of using “key-translation-map”:

(define-key key-translation-map (kbd "H-3") (kbd "λ")) ; 【Hyper+3】 insert λ char

There are some advantage and disadvantages in either way.

Problem with “global-set-key”

If you use “global-set-key”, then when you do interactive search 【Ctrl+s】, then when you type 【Hyper+3】, it'll exit the search. So this means, if you use unicode heavily in your files, then you lose the ability to isearch them. (you can work-around by typing it in the buffer first, put cursor on it, start isearch, 【C-w】 to select the char. Then when done, delete that symbol you inserted for this purpose.)

Using “key-translation-map” doesn't have this problem.

Problem with “key-translation-map”

The problem with “key-translation-map” is this: Suppose you don't type the backtick (`) char often, and you press 【C-x o】 “delete-other-windows” ~50 times more often. So, to increase the efficiency of key use on keyboard, you remap backtick to do “delete-other-windows” and set 【Hyper+`】 for inputting the backtick. The elisp code looks like this:

(global-set-key (kbd "`") 'someCommand) ; set ` to someCommand
(define-key key-translation-map (kbd "H-`") (kbd "`")) ; insert backtick char by 【Hyper+`】

The problem is, when you type 【Hyper+`】, it'll actually call the command bound to backtick.

So, this means, the “key-translation-map” is great for symbol input but is not good if you want to use it as a way to remap buttons.

Note: there's the function “keyboard-translate”. However, it is designed to translate character only. So, key combination isn't a character and you can't use it for Hyper combination. Using (define-key key-translation-map …) is more versatile. (Due to historical reasons, “keyboard-translate” does work for some Ctrl combination key. (thanks to Stefan Monnier and Deniz Dogan for this tip. (Source groups.google.com)))

Who Need to Use Unicode That Often?

Well, i do, a lot, all over, in my writings, as well in coding.

For example, bullet (•), “curly quote”, dash (—), angle bracket for 〈article title〉 and 《book title》 (See: Intro to Chinese Punctuation with Computer Language Syntax Perspectives.), and i use 【lenticular bracket】 to mark key combinations, 「corner bracket」 to mark computer code, and i use FULLWIDTH AMPERSAND (&) for avoid html entity complexity (See: HTML Entities, Ampersand, Unicode, Semantics.) , and lots others.

Using proper symbols decreases ambiguity at syntax level. For example, the asterisk (*) can mean lots of things. But a dedicated bullet “•” carries a precise semantics.

For coding, some languages heavily use math symbols (e.g. APL, Mathematica). For functional languages such as Haskell, Scheme Lisp, you can setup for example “λ” to mean “lambda”, “≠” to mean “!=”, “⊕” for user-defined operators, etc. You can also use symbols for variable names in emacs lisp, Javascript, Java (e.g. “α”). See:

For more articles on keyboarding and unicode, see: Keyboards, Layouts, Hotkeys, Macros, RSI and Unicode Tutorial.

booby-trap

booby-trap

Again, DCU’s research shows there may be close to 1 million computers infected with Rustock malware, all under the control of the person or people operating the network like a remote army, usually without the computer’s owner even aware that his computer has been hijacked. Bot-herders infect computers with malware in a number of ways, such as when a computer owner visits a website booby-trapped with malware and clicks on a malicious advertisement or opens an infected e-mail attachment. Bot-herders do this so discretely that owners often never suspect their PC is living a double life.
Taking Down Botnets: Microsoft and the Rustock Botnet (2011-03-17) By Richard Boscovich. @ Source blogs.technet.com
booby-trapped = An explosive device designed to be triggered when an unsuspecting victim touches or disturbs a seemingly harmless object.

Ooops, keeps posting to the wrong blog. If case you are wondering, this is WordyEnglish, a-word-a-day kinda thing at http://wordy-english.blogspot.com/

2011-03-17

emacs: display-time-world

Perm url with updates: http://xahlee.org/emacs/blog.html

Discovered the command “display-time-world”. These days, when communicating with people around the world (in twitter, Skype, Second Life …), usually i need to know what time it is in their location. This command helps. Faster and more accurate than i can do mental calculation.

W3C HTML Validator Invalid

Perm url with updates: http://xahlee.org/js/w3c_html_validator_problem.html

W3C HTML Validator Invalid

Xah Lee, 2011-03-15

The W3C HTML Validator is getting annoying.

Missing Open Tag as Valid

If you have a page without a opening “body” tag, but does have a closing one, W3 HTML validation report it as valid.

Maybe it's technically valid, but quite annoying.

Test page: W3 HTML Validation Problem: No Open Body.

XHTML Style “<br />” Tag as Valid HTML4

Another problem is that, if you use the XHTML style tag such as <br />, it's also reported as valid. W3C only gives a warning. However, this is technically invalid.

Test page: W3 HTML Validation Problem: Slash End Tag.

With this situation, at this point, you wonder what's validator supposed to be anymore.

UNIX Tar Problem: File Length Truncation, Unicode Name Support

Perm url with updates: http://xahlee.org/comp/unix_tar_problem.html

UNIX Tar Problem: File Length Truncation, Unicode Name Support

Xah Lee, 2011-03-17

Discovered, that GNU tar now has a “--help” option. So, instead of typing “man tar”, you type “tar --help”. Not sure if this has been there for long or what.

Much better. I always hated the “man” fuck. You can never be sure if the man page correspond to the version you are using, and because the doc is separate, it's also pain to maintain for dev, tends to get out of sync.

Another thing about tar is that i never figured out why its syntax doesn't use the dash. You use tar xvf myfile.tar instead of tar -xvf myfile.tar. Many years ago, with dash won't work. Not sure all tar programs support that today.

Also, you can't talk about tar without talking about unix line truncation problem. Tar used to truncate your file names if the path is long (e.g. ~120). See: Unix, RFC, Line Truncation. Am not sure how good it is today.

Something i still wanted to test but never got to it. Does current version of tar preserve file name that has unicode? (e.g. Chinese, math symbols.)

According to tar (file format), there seems to be a new spec in “POSIX.1-2001” that addressed file name length and charset encoding, and is implemented by GNU tar in 2004.

The Wikipedia article turns out quite informative. One thing it mentioned is the “tarbomb”. That is, when untar, the file gets scattered all over your dir, or even to parent dirs, and OVERWRITES your files. This is a extreme pain in the ass.

Another problem interesting is that tar doesn't support table of contents so no random access. If you need to list files or extract one file, you need to read thru it from the beginning.

Here's another good resource discussing tar's problems. New file format? @ Source duplicity.nongnu.org.

In recent month i read that Google still use tape drive as one of their backup. I wonder if they use tar as the file format.

Alright, today, officially i deprecate tar. I'll never use it myself.

2011-03-16

Chrome: Google Map supports Google Earth

Discovered that if you use Google Chrome to access Google Maps, then almost all Google Earth features are there. No need for special plug-ins. Quite amazing.


View Larger Map

Perhaps when you install Google Earth, it automtatically installs plug-in. Or, is Flash doing the 3D work??

Note that this works in E9, too, but not Firefox, Opera, Safari. (all latest public version as of 2011-03-15.) To test, just go to http://maps.google.com/, then hover mouse over the Satellite square. If it supports Google Earth, it'll also pop up a “Earth” square.

See also: Google Earth Geography 101Google Earth Mouse Navigation and Keys.

2011-03-14

IE9 Renderer Crash

Perm url with updates: http://xahlee.org/js/ie9_renderer_crash.html

IE9 Went into Compatibility Mode; Renderer Crash

Xah Lee, 2011-03-14

IE9 is released today. After installing, it asks you to restart Windows. Alright. First thing i did is to check my website. Within 30 seconds, on this page Xah Emacs Tutorial, i got this error: “A problem displaying xahlee.org caused Internet Explorer to refresh the webpage using Compatibility View.” as a pop-up pane at the bottom of the window. Part of the page is not rendered, and part of it disappears when you move your mouse to the navigation menu. Great!

Here's a few screenshots:

Not shown in the screen shot, but half of the page content at the bottom does not show at all, doesn't matter it's in compatibility mode or not. The page isn't using any bleeding edge CSS nor wild javascript, and is valid html4 transitional.

A 5 second web search you found this page: IE has refreshed this page in Compatibility View due to a problem @ Source stackoverflow.com. That user reports that IE9 went into compatibility mode for a HTML5 site.

According to a comment from apparently a IE developer, quote:

this means you've found an IE bug called a "hard assert" which is similar to a crash in the rendering engine. We're interested in finding and fixing these; please file a bug at connect.microsoft.com/ie. Thanks! – EricLaw -MSFT- Oct 1 '10 at 14:31

Rendering engine crash! Great!

When i tried to copy & paste the error text when writing this blog, the text cannot be copied.

And on some pages, it tells me i need Flash plug-in, but Flash was displayed right there in tabs i opened before...

After 3 min reading web about their compatibility mode, it's one complex shit.

So, my first impression of IE9: go home & die.

Other IE9 Problems

Here's random list of IE9 problems. I'm adding them here as i found them.

When dragging a image to desktop, a pop-up dialog comes up with message “Are you sure you want to copy o move files to this folder? You should only copy or move files from locations that you trust. Yes No”. Quite annoying. Idiotic.

• The tabs gets very crowded.

• When there are more tabs than the space allows, it shows a little triangle icon tab on the left and right sides of the tabs. Hard to use.

Inside Jobs; Financial Crisis Documentary

Perm url with updates: http://xahlee.org/Periodic_dosage_dir/inside_jobs_corruption.html

Inside Jobs; Financial Crisis Documentary

Xah Lee, 2011-03-14

Discovered Inside Job (film). It's a documentary film about the financial crisis of 2007-2010. Directed by Charles H Ferguson.

Here's some clips.

“"Wall Street Execs Should be in Jail" Oscar Winner's Acceptance Speech”

“INSIDE JOB Official Trailer”

Here's a interview of the director Charles H Ferguson by Charlie Rose show.

“Charlie Rose Interviews Charles Ferguson on his documentary 'Inside Job'”

inside job movie

“Inside Job”. Documentary film about the financial crisis of 2007-2010. amazon

2011-03-13

Geometry: GeoGebra apps for Plane Curves

Perm url with updates: http://xahlee.org/SpecialPlaneCurves_dir/ggb/index.html

Plane Curves: GeoGebra Files Index

This page lists all GeoGebra files on plane curves. There are a total of 60+ files.

Download the whole thing for $5. Use the paypal button below. In the comment field, put “plane curve geogebra files”. I'll email you the files. Make sure your email address is included and correct.