Archive for the Category » Stupid code tricks «

Monday, April 11th, 2011 | Author:

Even cartographers need PowerPoint now and then. But, as strange as it may seem in a globalized society, its developpers haven’t considered necessary to allow the user to determine a language for a whole presentation. If you happen to have the French or the German version of the software, well, you’re stuck with it and good luck with preparing your slides in English: every new slide will systematically apply French or German to any new box. Either you manually correct each and everyone of them or the auto-corrector will underline your spelling, perhaps even chew it up altogether if you have ‘correct as you type’ active.

The only way to go around this is a macro (!) I’ve got from Chocotooth’s blog:

Sub SetLangUS()
Dim scount, j, k, fcount
scount = ActivePresentation.Slides.Count
For j = 1 To scount
fcount = ActivePresentation.Slides(j).Shapes.Count
For k = 1 To fcount 'change all shapes:
If ActivePresentation.Slides(j).Shapes(k).HasTextFrame Then
ActivePresentation.Slides(j).Shapes(k).TextFrame _
.TextRange.LanguageID = msoLanguageIDEnglishUS
End If
Next k
fcount = ActivePresentation.Slides(j).NotesPage.Shapes.Count
For k = 1 To fcount 'change all shapes:
If ActivePresentation.Slides(j).NotesPage.Shapes(k).HasTextFrame Then
ActivePresentation.Slides(j).NotesPage.Shapes(k).TextFrame _
.TextRange.LanguageID = msoLanguageIDEnglishUS
End If
Next k
Next j
End Sub

What should you do with this? Click the Visual Basic button on the ‘Developer’ tab:

 

Insert a new module by right-clicking on ‘VBAProject’ in the left navigation pane:

New module in Visual Basic

 

This opens a new window. Paste the code into it. And execute it with tha ‘play’ button:

Code Window in Visual Basic

All text boxes have set to English/US. You can save this code for later use in a file with .bas extension. Dear Microsoft, if you could offer a less tedious solution than this by simply integrating the language-switching feature in PowerPoint, many thanks in advance…

 

Thursday, August 12th, 2010 | Author:
echo get_class($my_class_instance) . '<br/>';
foreach (get_class_methods($my_class_instance) as $method) {echo '--------->' . $method . '<br/>';}
Thursday, August 12th, 2010 | Author:

To stock ‘machine readable’ information about a table cell use the abbr tag:

<td abbr="my_data">

Might come in handy 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 with S=Strict, T=Transitional, and F=Frameset.

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:\RECYCLER

If something’s really stuck in the recyler, you will get the following error message (or equivalent in your operationg system installation language):

Problem - Le processus ne peut pas accéder au fichier car ce fichier est utilisé par un autre processus

Ignore that message. The trash on the desktop, too, will still have the “full” icon but this wull be gone once you right-point it and ask the trash to be emptied.

Thursday, August 12th, 2010 | Author:

Trying to call R from, say Java?

C://Program Files/R/R.exe

returns an error as the Windows command line has trouble interpreting spaces.

Use this call instead:

C://program~1/R/R.exe