Shooting yourself in the foot

Ideja no “labās prakses” prezentācijas

  • C: You shoot yourself in the foot
  • PHP: You shoot yourself in the foot with a gun made from pieces taken from 300 other guns
  • Ruby on Rails: You want to shoot yourself in the foot, but the convention is to shoot yourself in the head

(pievienošu no sevis)

  • SharePoint: You want to shoot yourself in the foot, but first you have to “IISRESET /noforce”

“Ja nu” failu nosaukumos

Vienmēr gribas būt drošiem, ka automātiski pieglabāto failu nosaukumi būs failsistēmai saprotami. Neliels “tīrītājs”, kas izvāc visādus #, \, / utt liekos simbolus. Uzticamies latviešu burtiem, atstarpēm neuzticamies vis.

Public Function GetGoodFileName(ByVal spText As String) As String
    Return System.Text.RegularExpressions.Regex.Replace(spText, _
            "[^a-zA-Z0-9āčēģīķļņšūžĀČĒĢĪĶĻŅŠŪŽ_-]", "")
End Function

On Wiki

Vikipedia viena pati vēl nav “spēks”, tā ir vienkārši laba un laikam līdzi ejoša enciklopēdija (protams, taisnība ir arī tiem, kuri norāda uz publiskajā domēnā esošas vārdnīcas vājajām vietām).

Tomēr man šķiet, ka īsto viki garšu var sajust, lasot vikipēdijas diskusiju lapas, kas parāda ne tikai meklēto lietu, bet arī citus zināšanu apgabalus meklētās lietas apkaimē. Nu, piemēram, šāda diskusija par OSI modeli.

Var vien pabrīnīties, ka arī latviešu viki ir diskusijas. Piemēram, par Spānijas karaļu vārdiem.

Lasām!

IsUserInGroup updated

In an earlier article I’ve been talkin about how to check if a user belongs to a specific domain group. However, the code in that article doesn’t work on local groups and WinNT ADSI provider. I’ve made an update to the code posted there, this should work both on domain and local groups.

Usage:

If IsUserInGroup("Contoso\JohnDoe", "Contoso\Managers") Then
   '...do something
End If

Notes:

  • Option Strict Off. Sorry, I’m using the GetObject magic function here, so there’s no way I could leave the option strict on.
  • Seems to be quite slow when local groups are scanned from outside.
  • Could be a problem when you have users from two different domains + local users.

    Continue reading IsUserInGroup updated

Par “conditional comments”

Ir tāda lieta HTMLā kā “conditional comments“, kas ir parasti SGML komentāri, kurus Internet Explorer 5+ tomēr “lasa” un mēģina saprast. Un ja tur atrodas [if kautkas] tad tas tiek ņemts vērā.

Parasti tiek lietots, lai speciāli priekš IE ielādētu papildus CSS failu vai “pielabotu” atsevišķas CSS definīcijas, bet tikpat labi, lūk, arī alternatīvs pielietojums nosacījumam “ja tiek lietots IE”.

<!--[if IE]>
<a href="http://www.getfirefox.com/" title="Browse happy">Go get firefox</a>
<![endif]-->