Stupid code tricks

Wednesday, March 22nd, 2017 | Author:

A histogram gives you counts of elements within spefic ranges of a variable, represented as bars. Sometimes, you want to see more then bars. The following code allows you to represent a second variable with a color shade: library(ggplot2) library(data.table)   # create an example of a table d <- data.table( slope = round(rnorm(50),50), p […]

Friday, January 29th, 2016 | Author:

Currently working with XML structured legal texts, I often need to transform them  into a JSON format compatible with D3 tree visualisation. BaseX is a great app, but its code documentation isn’t exactly user-friendly. Here I want to transform a document srutured as <text> <meta></meta> <doc> <p> <s> <t></t> </s> </p> </doc> </text><text> <meta></meta> <doc> […]

Sunday, November 29th, 2015 | Author:

The digital height model DHM25 is a set of data representing the 3D form of the earth’s surface without vegetation and buildings. It is essentially based on the Swiss National Map 1:25 000. Years ago, when Swisstopo was called Bundesamt für Landestopographie, they published this data in their home-made format called MMBLT, stored in files […]

Category: Stupid code tricks, Tools  | Tags: , , ,  | Leave a Comment
Wednesday, December 05th, 2012 | Author:

ArcMap has the bad habit of forgetting to unlock files that you remove from a project. I have lost hours, as the only solution to remove unwanted locks seemed to be shutting down ArcMap, modifying the file, then restarting ArcMap (that takes at least a minute to load each time). Nothing seemed to help until […]

Wednesday, August 08th, 2012 | Author:

If you’ve changed your standard .tex file editor to Notepad2 or Notepad++, chances are that the contextual menu entry “Create New > Document file” has disappeared. To restore it, just save the following code as a .reg file and run it (thanks to Archos alias Limneos for posting the code on a SevenForums): Windows Registry […]

Wednesday, August 08th, 2012 | Author:

I want Windows 7 to sort my files alphabetically, and I mean alphanumerically, from 0 to z, in ASCII order. Windows 7 acts way too smart sorting files by names to my taste. On more ancient versions of Windows (e.g. Windows 2000) the sorting order would be something like this: Ie4_01 Ie4_128 Ie401sp2 Ie5 Ie501sp2 […]

Monday, April 11th, 2011 | Author:

Changing the language of a whole presentation in MS PowerPoint can be troublesome. Especially when you translate your slides. You easily end up with a mix of languages on a number of slides. You notice, then, that it is not possible to select the main one: the language button (on the bar below) is simply […]

Thursday, August 12th, 2010 | Author:

echo get_class($my_class_instance) . ‘&lt;br/&gt;’; foreach (get_class_methods($my_class_instance) as $method) {echo ‘———&gt;’ . $method . ‘&lt;br/&gt;’;}echo get_class($my_class_instance) . ‘&lt;br/&gt;’; foreach (get_class_methods($my_class_instance) as $method) {echo ‘———&gt;’ . $method . ‘&lt;br/&gt;’;}

Thursday, August 12th, 2010 | Author:

To stock ‘machine readable’ information about a table cell use the abbr tag: Useful for example when you try to give jQuery a handle on specific table cells when id and class tags are already in use. The ‘abbr’ attribute is an official attribute of the td tag in HTML 4.01/XHTML 1.0 DTD in compliance […]

Thursday, August 12th, 2010 | Author:

Sometimes, stuff gets stuck in Windows trash. Mouse-click trash emptying doesn’t work any more. If that happens, use the following DOS code in the command line: rd /s /q C:\RECYCLERrd /s /q C:\RECYCLER If something’s really stuck in the recyler, you will get the following error message (or equivalent in your operationg system installation language): […]