Éibhear/Gibiris

I posted a word-cloud to Google+ today: https://plus.google.com/115884503870283339998/posts/Ee8vQ2gQVfy, and I'm going to attempt to show how I did that.

  1. I created an org-mode table with the following columns:
    • Technology – The technology of interest.
    • Weighting – a font-size weighting derived from the No. Months value for each technology.
    • No. Years – the number of years I have worked with each technology.
    • No. Months – the number of months I have worked with each technology.
    • Red – the red component of the text entry's colour in the word cloud
    • Gree – the green component of the text entry's colour in the word cloud
    • Blue – the blue component of the text entry's colour in the word cloud
    • Span – the HTML <span ...>...</span> text that will define how the text will look.
  2. I created another org-mode table, which I named Parameters with just one row and two columns:
    • Minimum font % – the minimum percentage of normal size any of the text entries is to have.
    • Maximum font % – the maximum percentage of normal size any of the text entries is to have.
  3. I then applied the following formulae to the table:
    • $2='(format "%.2f" (+ remote(Parameters,@2$1) (/ (* (- $4 (apply 'min '(@2$4..@43$4))) (- remote(Parameters,@2$2) remote(Parameters,@2$1)) ) (float (- (apply 'max '(@2$4..@43$4)) (apply 'min '(@2$4..@43$4)))) )));L

      This sets the weighting value for each technology based on the number of months I have worked with it. The code is derived from the same code that generates the tag cloud on this web site, as developed for o-blog.

    • $4=$3*12

      This calculates the number of months I have worked with a technology based on the number of years in the third column.

    • $5='(random 255);L

      This generates a random value for the red component of the font's colour.

    • $6=127

      This sets the green component of the font's colour. I set it specifically to 127 for all entries to ensure that they can all be read on a white background.

    • $7='(random 255);L

      This generates a random value for the blue component of the font's colour.

    • $8='(format "<span style=\"color: rgb(%d,%d,%d)\"><span style=\"font-size: %s%%\">%s</span></span>" $5 $6 $7 $2 "$1");L

      This generates a HTML <span ...>...</span> element for each technology.

  4. Using C-u C-u C-c C-c, I forced the recalculation of all the formulae, which resulted in a new HTML <span ...>...</span> element for each technology in the 8th column.
  5. I then created a new org-mode table with two columns:
    • Order – the order sequence for putting the elements into.
    • Span – the HTML <span ...>...</span> elements for each technology.
  6. I applied the formula $1='(random 1000);L to the table to set the first column to a random number between 0 and 1000.
  7. Using org-table-copy-region, I copied the Span column from the technologies table into the Span column of this new table.
  8. Using C-u C-u C-c C-c, I then forced the calculation of values into the Order column.
  9. I then used org-sort on the Order column to sort the HTML <span ...>...</span> elements in a "random" fashion.
  10. I then copied this set of elements into a HTML file and opened it with a web browser.
  11. Then it was a screen-grab into The Gimp to capture the image, which I then cropped to show only the words.

I'm sure there're people who would regard the above as not the best way to generate a word-cloud, but I did approach this with the view of having a bit of fun.

I would say, however, that the use of C-u C-u C-c C-c on a table where fields are calculated using a random-number generator is probably unwise, as convergence would never be achieved – org-mode will never see the table as being "stable".

Here's the org-mode bit:

#+NAME: Parameters
| Minimum font % | Maximum font % |
|----------------+----------------|
|             50 |            400 |
|----------------+----------------|

#+NAME: TechnologiesData
| Technology            | Weighting | No. Years | No. Months | Red | Green | Blue | Span                                                                                                   |
|-----------------------+-----------+-----------+------------+-----+-------+------+--------------------------------------------------------------------------------------------------------|
| Python                |     50.00 |         1 |         12 | 226 |   127 |   88 | <span style="color: rgb(226,127,88)"><span style="font-size: 50.0%">Python</span></span>               |
| PHP                   |     50.00 |         1 |         12 | 186 |   127 |   77 | <span style="color: rgb(186,127,77)"><span style="font-size: 50.0%">PHP</span></span>                  |
| Eclipse               |     50.00 |         1 |         12 |  54 |   127 |  237 | <span style="color: rgb(54,127,237)"><span style="font-size: 50.0%">Eclipse</span></span>              |
| LDAP/Active Directory |     50.00 |         1 |         12 |   9 |   127 |  105 | <span style="color: rgb(9,127,105)"><span style="font-size: 50.0%">LDAP/Active Directory</span></span> |
| Dollar Universe       |     50.00 |         1 |         12 | 190 |   127 |  146 | <span style="color: rgb(190,127,146)"><span style="font-size: 50.0%">Dollar Universe</span></span>     |
| MySQL                 |     67.95 |         2 |         24 | 240 |   127 |    2 | <span style="color: rgb(240,127,2)"><span style="font-size: 67.95%">MySQL</span></span>                |
| TOAD                  |     67.95 |         2 |         24 |  81 |   127 |  240 | <span style="color: rgb(81,127,240)"><span style="font-size: 67.95%">TOAD</span></span>                |
| Oracle WebLogic       |     85.90 |         3 |         36 |  78 |   127 |  107 | <span style="color: rgb(78,127,107)"><span style="font-size: 85.9%">Oracle WebLogic</span></span>      |
| UML                   |    103.85 |         4 |         48 |  62 |   127 |   50 | <span style="color: rgb(62,127,50)"><span style="font-size: 103.85%">UML</span></span>                 |
| MS SQL Server         |    103.85 |         4 |         48 | 115 |   127 |  186 | <span style="color: rgb(115,127,186)"><span style="font-size: 103.85%">MS SQL Server</span></span>     |
| ArgoUML               |    103.85 |         4 |         48 | 116 |   127 |  158 | <span style="color: rgb(116,127,158)"><span style="font-size: 103.85%">ArgoUML</span></span>           |
| MS Windows Server     |    103.85 |         4 |         48 |  29 |   127 |  200 | <span style="color: rgb(29,127,200)"><span style="font-size: 103.85%">MS Windows Server</span></span>  |
| C                     |    139.74 |         6 |         72 |  47 |   127 |  217 | <span style="color: rgb(47,127,217)"><span style="font-size: 139.74%">C</span></span>                  |
| Oracle JDeveloper     |    139.74 |         6 |         72 |  70 |   127 |  233 | <span style="color: rgb(70,127,233)"><span style="font-size: 139.74%">Oracle JDeveloper</span></span>  |
| SQL Developer         |    157.69 |         7 |         84 |  85 |   127 |  222 | <span style="color: rgb(85,127,222)"><span style="font-size: 157.69%">SQL Developer</span></span>      |
| MQ                    |    157.69 |         7 |         84 |  77 |   127 |   28 | <span style="color: rgb(77,127,28)"><span style="font-size: 157.69%">MQ</span></span>                  |
| Subversion            |    193.59 |         9 |        108 |  66 |   127 |   18 | <span style="color: rgb(66,127,18)"><span style="font-size: 193.59%">Subversion</span></span>          |
| autosys               |    193.59 |         9 |        108 | 247 |   127 |  106 | <span style="color: rgb(247,127,106)"><span style="font-size: 193.59%">autosys</span></span>           |
| PuTTY                 |    229.49 |        11 |        132 | 110 |   127 |  134 | <span style="color: rgb(110,127,134)"><span style="font-size: 229.49%">PuTTY</span></span>             |
| Fixed-field files     |    229.49 |        11 |        132 |  69 |   127 |  214 | <span style="color: rgb(69,127,214)"><span style="font-size: 229.49%">Fixed-field files</span></span>  |
| EFT                   |    229.49 |        11 |        132 | 135 |   127 |  142 | <span style="color: rgb(135,127,142)"><span style="font-size: 229.49%">EFT</span></span>               |
| cygwin                |    265.38 |        13 |        156 | 200 |   127 |  191 | <span style="color: rgb(200,127,191)"><span style="font-size: 265.38%">cygwin</span></span>            |
| GNU/Linux             |    283.33 |        14 |        168 |  24 |   127 |  145 | <span style="color: rgb(24,127,145)"><span style="font-size: 283.33%">GNU/Linux</span></span>          |
| PGP/GnuPG             |    283.33 |        14 |        168 |  30 |   127 |  192 | <span style="color: rgb(30,127,192)"><span style="font-size: 283.33%">PGP/GnuPG</span></span>          |
| ssh                   |    283.33 |        14 |        168 | 118 |   127 |   59 | <span style="color: rgb(118,127,59)"><span style="font-size: 283.33%">ssh</span></span>                |
| Oracle AS             |    301.28 |        15 |        180 | 139 |   127 |  135 | <span style="color: rgb(139,127,135)"><span style="font-size: 301.28%">Oracle AS</span></span>         |
| XML                   |    301.28 |        15 |        180 | 157 |   127 |   99 | <span style="color: rgb(157,127,99)"><span style="font-size: 301.28%">XML</span></span>                |
| CSV                   |    301.28 |        15 |        180 | 200 |   127 |  208 | <span style="color: rgb(200,127,208)"><span style="font-size: 301.28%">CSV</span></span>               |
| java                  |    319.23 |        16 |        192 | 138 |   127 |  248 | <span style="color: rgb(138,127,248)"><span style="font-size: 319.23%">java</span></span>              |
| lisp                  |    355.13 |        18 |        216 | 131 |   127 |  118 | <span style="color: rgb(131,127,118)"><span style="font-size: 355.13%">lisp</span></span>              |
| httpd/apache          |    355.13 |        18 |        216 | 128 |   127 |  191 | <span style="color: rgb(128,127,191)"><span style="font-size: 355.13%">httpd/apache</span></span>      |
| GNU/Emacs             |    355.13 |        18 |        216 | 177 |   127 |  197 | <span style="color: rgb(177,127,197)"><span style="font-size: 355.13%">GNU/Emacs</span></span>         |
| Oracle Forms          |    391.03 |        20 |        240 | 116 |   127 |  218 | <span style="color: rgb(116,127,218)"><span style="font-size: 391.03%">Oracle Forms</span></span>      |
| SQL, PL/SQL           |    400.00 |      20.5 |       246. | 118 |   127 |   94 | <span style="color: rgb(118,127,94)"><span style="font-size: 400.0%">SQL, PL/SQL</span></span>         |
| UNIX Shell            |    400.00 |      20.5 |       246. |  89 |   127 |  254 | <span style="color: rgb(89,127,254)"><span style="font-size: 400.0%">UNIX Shell</span></span>          |
| HTML/CSS              |    400.00 |      20.5 |       246. | 153 |   127 |   49 | <span style="color: rgb(153,127,49)"><span style="font-size: 400.0%">HTML/CSS</span></span>            |
| Oracle DB             |    400.00 |      20.5 |       246. |  27 |   127 |  200 | <span style="color: rgb(27,127,200)"><span style="font-size: 400.0%">Oracle DB</span></span>           |
| Oracle Developer      |    400.00 |      20.5 |       246. | 246 |   127 |   92 | <span style="color: rgb(246,127,92)"><span style="font-size: 400.0%">Oracle Developer</span></span>    |
| vi                    |    400.00 |      20.5 |       246. | 138 |   127 |   51 | <span style="color: rgb(138,127,51)"><span style="font-size: 400.0%">vi</span></span>                  |
| UNIX                  |    400.00 |      20.5 |       246. | 207 |   127 |  226 | <span style="color: rgb(207,127,226)"><span style="font-size: 400.0%">UNIX</span></span>               |
| SQL*Loader            |    400.00 |      20.5 |       246. |  25 |   127 |   63 | <span style="color: rgb(25,127,63)"><span style="font-size: 400.0%">SQL*Loader</span></span>           |
| Revision control      |    400.00 |      20.5 |       246. | 179 |   127 |   16 | <span style="color: rgb(179,127,16)"><span style="font-size: 400.0%">Revision control</span></span>    |
|-----------------------+-----------+-----------+------------+-----+-------+------+--------------------------------------------------------------------------------------------------------|
#+TBLFM: $2='(format "%.2f" (+ remote(Parameters,@2$1) (/ (* (- $4 (apply 'min '(@2$4..@43$4))) (- remote(Parameters,@2$2) remote(Parameters,@2$1)) ) (float (- (apply 'max '(@2$4..@43$4)) (apply 'min '(@2$4..@43$4)))) )));L::$4=$3*12::$5='(random 255);L::$6=127::$7='(random 255);L::$8='(format "<span style=\"color: rgb(%d,%d,%d)\"><span style=\"font-size: %s%%\">%s</span></span>" $5 $6 $7 $2 "$1");L

#+NAME: RandomOrder
| Order | Span |
|-------+------|
|       |      |
#+TBLFM: $1='(random 1000);L

And here's the HTML file I used:

<html>
  <head></head>
  <body>
    <span style="color: rgb(131,127,118)"><span style="font-size: 355.13%">lisp</span></span>
    <span style="color: rgb(25,127,63)"><span style="font-size: 400.0%">SQL*Loader</span></span>
    <span style="color: rgb(116,127,218)"><span style="font-size: 391.03%">Oracle Forms</span></span>
    <span style="color: rgb(153,127,49)"><span style="font-size: 400.0%">HTML/CSS</span></span>
    <span style="color: rgb(116,127,158)"><span style="font-size: 103.85%">ArgoUML</span></span>
    <span style="color: rgb(200,127,191)"><span style="font-size: 265.38%">cygwin</span></span>
    <span style="color: rgb(207,127,226)"><span style="font-size: 400.0%">UNIX</span></span>
    <span style="color: rgb(179,127,16)"><span style="font-size: 400.0%">Revision control</span></span>
    <span style="color: rgb(47,127,217)"><span style="font-size: 139.74%">C</span></span>
    <span style="color: rgb(54,127,237)"><span style="font-size: 50.0%">Eclipse</span></span>
    <span style="color: rgb(138,127,51)"><span style="font-size: 400.0%">vi</span></span>
    <span style="color: rgb(139,127,135)"><span style="font-size: 301.28%">Oracle AS</span></span>
    <span style="color: rgb(118,127,59)"><span style="font-size: 283.33%">ssh</span></span>
    <span style="color: rgb(200,127,208)"><span style="font-size: 301.28%">CSV</span></span>
    <span style="color: rgb(177,127,197)"><span style="font-size: 355.13%">GNU/Emacs</span></span>
    <span style="color: rgb(9,127,105)"><span style="font-size: 50.0%">LDAP/Active Directory</span></span>
    <span style="color: rgb(77,127,28)"><span style="font-size: 157.69%">MQ</span></span>
    <span style="color: rgb(30,127,192)"><span style="font-size: 283.33%">PGP/GnuPG</span></span>
    <span style="color: rgb(85,127,222)"><span style="font-size: 157.69%">SQL Developer</span></span>
    <span style="color: rgb(115,127,186)"><span style="font-size: 103.85%">MS SQL Server</span></span>
    <span style="color: rgb(62,127,50)"><span style="font-size: 103.85%">UML</span></span>
    <span style="color: rgb(89,127,254)"><span style="font-size: 400.0%">UNIX Shell</span></span>
    <span style="color: rgb(240,127,2)"><span style="font-size: 67.95%">MySQL</span></span>
    <span style="color: rgb(29,127,200)"><span style="font-size: 103.85%">MS Windows Server</span></span>
    <span style="color: rgb(81,127,240)"><span style="font-size: 67.95%">TOAD</span></span>
    <span style="color: rgb(128,127,191)"><span style="font-size: 355.13%">httpd/apache</span></span>
    <span style="color: rgb(70,127,233)"><span style="font-size: 139.74%">Oracle JDeveloper</span></span>
    <span style="color: rgb(27,127,200)"><span style="font-size: 400.0%">Oracle DB</span></span>
    <span style="color: rgb(138,127,248)"><span style="font-size: 319.23%">java</span></span>
    <span style="color: rgb(78,127,107)"><span style="font-size: 85.9%">Oracle WebLogic</span></span>
    <span style="color: rgb(118,127,94)"><span style="font-size: 400.0%">SQL, PL/SQL</span></span>
    <span style="color: rgb(226,127,88)"><span style="font-size: 50.0%">Python</span></span>
    <span style="color: rgb(246,127,92)"><span style="font-size: 400.0%">Oracle Developer</span></span>
    <span style="color: rgb(186,127,77)"><span style="font-size: 50.0%">PHP</span></span>
    <span style="color: rgb(66,127,18)"><span style="font-size: 193.59%">Subversion</span></span>
    <span style="color: rgb(157,127,99)"><span style="font-size: 301.28%">XML</span></span>
    <span style="color: rgb(135,127,142)"><span style="font-size: 229.49%">EFT</span></span>
    <span style="color: rgb(247,127,106)"><span style="font-size: 193.59%">autosys</span></span>
    <span style="color: rgb(190,127,146)"><span style="font-size: 50.0%">Dollar Universe</span></span>
    <span style="color: rgb(110,127,134)"><span style="font-size: 229.49%">PuTTY</span></span>
    <span style="color: rgb(69,127,214)"><span style="font-size: 229.49%">Fixed-field files</span></span>
    <span style="color: rgb(24,127,145)"><span style="font-size: 283.33%">GNU/Linux</span></span>
  </body>
</html>

And, finally, here's the result:

techCloud.png


You can comment on this post below, or on the matrix room here. If you want, you can "Log in" using your [matrix] ID.

All comments are subject to this site's comment policy.