The Wiert Corner – irregular stream of stuff

Jeroen W. Pluimers on .NET, C#, Delphi, databases, and personal interests

  • My badges

  • Twitter Updates

  • My Flickr Stream

  • Pages

  • All categories

  • Enter your email address to subscribe to this blog and receive notifications of new posts by email.

    Join 1,862 other subscribers

Archive for 2011

Windows authorization: Adding/Removing users from local groups

Posted by jpluimers on 2011/08/10

Though there are API ways to add users to local groups in Delphi, you need the JwaLmAccess unit from the JEDI API library project to import those.

Sometimes that is not feasible, and sometimes you want to just script things.

For those, you can use the Windows net localgroup command (if you have sufficient privileges, you can even apply it to the local groups on your domain controller by appending it with the /domain parameter, or use the net group /domain command to execute on global domain groups instead of local groups).

Sample of using this in a cmd script:

net localgroup Guests Me Myself I ACME\BugsBunny /delete

It will remove the local users Me, MySelf and I, and remove the domain user ACME\BugsBunny from the local group Guests.

Sample source of using this in Delphi: Read the rest of this entry »

Posted in CommandLine, Delphi, Development, Software Development | 1 Comment »

batch files: getting directory and parent directory

Posted by jpluimers on 2011/08/09

In some situations, batch files are the only thing you have.

In this case, I needed the parent directory of a batchfile.

i.e. not the directory of the batch file itself, but the

  echo batchfile=%0
  echo full=%~f0
setlocal
::http://stackoverflow.com/questions/636381/what-is-the-best-way-to-do-a-substring-in-a-batch-file
  set Directory=%~dp0
echo Directory=%Directory%
:: strip trailing backslash
  set Directory=%Directory:~0,-1%
echo %Directory%
::  ~dp does not work for regular environment variables:
::  set ParentDirectory=%Directory:~dp%  set ParentDirectory=%Directory:~dp%
::  ~dp only works for batch file parameters and loop indexes
  for %%d in (%Directory%) do set ParentDirectory=%%~dpd
  echo ParentDirectory=%ParentDirectory%
endlocal

The point is that the %~dp0 trick as explained in this StackOverflow answer on substrincgs in batch files only works for batch file parameters (starting with a single percentage sign: %0, %1, %4, etc) or for-loop indexes (starting with double percentage signs: %%1, %%d, etc). They don’t work for getting path portions of  regular environment variables.

So I used the substring trick (as explained in the same answer), and then used a for loop (which will have one iteration) to get the path portion.

Note: The substrings trick only works on regular environment variables, not on parameters and loop indexes.

Note 2: I used setlocal/endlocal so the changed environment variables stay local to the batch file and won’t leak out to your command-prompt. If you need the value there, then remove the setlocal/endlocal, or use an “endlocal & set” command on a single line. Read the rest of this entry »

Posted in Batch-Files, Development, Scripting, Software Development | 2 Comments »

Mac OS X Lion reveals passwords in sleep mode? | The Digital Home – CNET News

Posted by jpluimers on 2011/08/08

If you have a Mac, and enabled automatic login, then it is vulnerable to a FireWire password snooping bug.

Looking at that article, you should either:

  • turn it off
  • disable FireWire
  • disable automatic login and reboot

–jeroen

via: Mac OS X Lion reveals passwords in sleep mode? | The Digital Home – CNET News.

Posted in Apple, Power User | Leave a Comment »

Javascript PC Emulator – Technical Notes

Posted by jpluimers on 2011/08/08

Fabrice Bellard wrote a brilliant piece of code: a PC x86 Emulator running in JavaScript.

It can run JSLinux inside your (FireFox 4.x, Chrome 11+, Opera 11.11 and Internet Explorer 9) browser :)

Some links: News, FAQ, Notes and JSLinux.

–jeroen

via: Javascript PC Emulator – Technical Notes.

Posted in *nix, Power User | Leave a Comment »

@NShispeed: OV Chipkaart en #NS-Businesscard perikelen

Posted by jpluimers on 2011/08/05

Zo maar een greep van de afgelopen weken waarin ik met een NS-Businesscard (een soort OV-Chipkaart voor zakelijke reizigers) die wordt geadverteerd als “Met één kaart voordelig reizen van deur-tot-deur”.

NS-Businesscard als OV Chipkaart

De eerste ervaring was goed: door de zomer dienstregeling, reden er minder treinen van Den Haag Laan van NOI naar Rotterdam Centraal. Dus heb ik de Randstadrail lijn E gepakt: die doet er normaal 5 minuten langer over dan de trein, maar met minder treinen per uur tijdens de NS zomerdienstregeling ben je toch eerder op Rotterdam Centraal daan wachten op de volgende NS trein.

Dit werkte in 1 keer: ik kon de NS-Businesscard moeiteloos gebruiken als OV Chipkaart. Handig!

Onhandig: Activeren van NS-Businesskaart voor in-/uitchecken op NS stations

Je zou denken dat je met een NS-Businesscard meteen vanaf de NS Station kunt in-/uitchecken, maar dat is niet zo. Je moet dit op http://ns.nl/bc activeren.

Daarmee dacht ik dat het meteen werkt: de OV-chipkaart palen van de NS staan on-line in verbinding met de NS, en kunnen zowel lezen als schrijven op de kaart, maar zo simpel is het niet. Je moet eerst op een NS kaartjesautomaat de producten op je NS-Businesscard activeren. Daarna werken de OV-chipkaart palen van de NS.

Onhandige plaatsing van de OV-chipkaart palen op station Schiphol

Op Schiphol staan in tegenstelling tot de stemelautomaten (die staan boven) de de OV-chipkaart palen alleen beneden, vaak verborgen achter wachtende reiziers.

Erg onhandig als je haast hebt en niet precies weet waar ze staan.

Daarom dit eens nagevraagd bij de servicebalie op Schiphol: Schiphol verbiedt de NS om de OV-chipkaart palen op een meer logische plek te zetten. De stempelautomaten mogen wel blijven staan omdat ze daar al sinds het begin staan, maar nieuwe zaken mogen niet.

Handig voor een luchthaven die de efficientie voor reizigers hoog in het vaandel heeft staan!

Standaard NS-reizen met in-/uitchecken op NS stations werkt

Daarna een paar dagen heel makkelijk tussen Rotterdam Centraal en Schiphol: wegens werkzaamheden hoefde je geen Fyra toeslag te betalen, dus maakte het niet uit met welke trein ik ging.

Fyra toeslag op NS-Businesscard kan niet

Een conducteur gaf tijdens een van de reizen aan dat je de Fyra toeslag op een OV-chipkaart kunt laden. Dus dat probeerde ik op Schiphol. Ik had er een minuut of 10 voor uitgetrokken, maar het lukte niet, dus de Fyra gemist en een normale Intercity genomen.

In het weekeinde las ik op de site van de Fyra, dat je de Fyra toeslag wel op een normale OV-chipkaart kunt laden, maar niet op een NS-businesscard (die wel gewoon op de metro werkt). Om met George Orwell te spreken: sommige OV-chipkaarten zijn dus meer gelijk als andere.

Links op de NS-site doen niet wat je denkt dat ze doen

In de loop van de middag gecontroleerd weke trein ik we/niet ging halen. Er is zomerdienstregeling, dus niet alle treinen rijden, en het wil met aankomst/vertrektijden nog wel eens hommeles zijn, dus de vertrektijden van Rotterdam Centraal gecontroleerd. Je denkt dat de link die je op de NS-site kopieert ook echt werkt: http://ns.nl/actuele-vertrektijden/main.action?vertrekstationdetails=rtd

Helaas, je moet hier dus alsnog “rtd” of  “Rotterdam Centraal” intikken om de juiste vertrektijden te zien.

Er zijn verder zat andere links die het op de NS-site niet doen, en die ze nooit gaan terugvinden zoals bijvoorbeeld de eerste link op http://www.ns.nl/zakelijk/producten/voor-reizigers/diensten-met-ns-business-card/de-trein-en-fyra.html die wijst naar een niet bestaande pagina http://www.ns.nl/cms/aanvragen-reizen-op-rekening_1.

Niemand bij de NS gaat die links terugvinden omdat in plaats van HTTP foutcode 404 (not found), er een HTTP successcode 200 (OK) wordt teruggeven.

Product op dezelfde dag bestellen en opladen op de NS-businesscard werkt niet

Toen ik zeker wist welke trein ik ging halen heb ik op de http://www.ns.nl/businesscard site een reis geboekt: 20% korting (want na 09:00), met Fyra toeslag.

Bij station Rotterdam Centraal aangekomen geprobeerd (op 3 verschillende automaten!) om dat product op de NS-Businesscard te laden. Dat werkt dus niet! Alle automaten gaven aan dat er geen producten voor deze NS-Businesscard klaar stonden.

Daarom maar een papieren Fyra-toeslagkaartje gekocht, en met de NS-Businesscard ingechecked op Rotterdam Centraal en later uitgechecked op Schiphol.

Een bestelling waar je niets meer aan hebt verwijderen kan niet

In de trein heb ik daarna gebeld met het 0900-betaalnummer achter op de NS-Business card. Daar in eerste instantie geprobeerd om het product dat ik besteld had te annuleren. Dat was nog lastig, want dit nummer heeft aan de ene kant keuzemenus waar je een nummertje moet intikken, maar op andere plekken moet je met natuurlijke taal inspreken wat je wilt. Daar kom je natuurlijk pas sachter als je een paar minuten en een paar keer de melding dat de computer niet begrepen heeft wat je bedoelt.

Een bestelling verwijderen mag niet als je die op dezelfde dag besteld hebt.

Daarom het nummer nog eens geprobeerd te bellen en een minuut of wat de menus doorgegaan om te kijken of ik een mens aan de lijn kon krijgen, maar dat werkt niet: dit nummer is alleen maar computer-operated.

Service loket op Schiphol weet ook niet precies

Het NS Service loket op Schiphol was heel vriendelijk; ik mocht zelfs op hun kosten de 0900 nummers bellen. Hun eerste reactie was “dat moet u via uw werkgever regelen”, handig: als ZZP-er ben ik dat zelf :)

Ze waren heel verbaasd wat er niet mogelijk was (ook de mensen die per portofoon werden geconsulteerd), en na wat heen en weer gebel bleven de opties “internet” en NS Servicedesk over.

Omdat er inmiddels een redelijke rij achter me stond, heb ik het bel-aanbod vriendelijk afgewezen en dat later zelf gedaan.

De NS servicedesk weet nauwelijks iets van de NS-Businesscard

Om te kijken of ik via een mens verder kon komen daarna via via het 0900-betaalnummer van de NS servicedesk opgezocht.

Dat is ook een computer-operated menu, maar onder sommige entries (niet alle entries die beginnen met “een mens spreken” geven ook een mens aan de lijn) krijg je dus een mens aan de lijn.

Het viel me al op dat in de menu’s nergens “NS-Businesscard” voorkomt, maar omdat dit een OV-Chipkaart is dit en één van de “mens spreken” opties onder “OV-chipkaart” inderdaad een mens aan de lijn gaf, daar gevraagd hoe het zat. En inderdaad: ik kreeg iemand aan de lijn die aangaf  – na de opties “internet en 0900-nummer op de NS-Businesscard” aan te bieden – dat NS-Businesscard iets “aparts” is en dat die een eigen (030!) nummer hebben.

Dat 030 nummer is (handig voor B2B) alleen tijdens kantooruren (08:30 tot 17:00) geopend.

Wordt vervolgd…

–jeroen

Posted in LifeHacker, Power User | 3 Comments »

Speaking at DelphiLive! 2011 in San Jose, CA, USA from September 12th to 14th 2011

Posted by jpluimers on 2011/08/04

I’ll be speaking at a few conferences this fall.

The furthest for me will be DelphiLive! 2011 in San Jose, CA, which will be held from September 12th to 14th (slightly more than a month from now).

Note that if you want to come, the early bird discount is until augusts 15!

Part of the sessions and speakers lists are already published, but it will be extended shortly (some nice Delphi XE2 sessions are in the pipeline), followed by a workshop tutorials list, and agenda.

My sessions are going to be these:

Not everything for those sessions is set in stone yet, so if you have ideas for things I should include, exclude, emphasize or understate, please let me know.

I’m looking forward to meet (often again!) a lot of attendees and speakers.

The social part of conferences is very important too.
Last year, after the conference, a few speakers, attendees and other people had a marvelous steak dinner. Great fun!

Hope to see a few of my blog readers at one conference or the other.

–jeroen

PS: Like last year, the conference will be held at Crowne Plaza Hotel San Jose Downtown, 282 Almaden Boulevard, San Jose, CA 95113, USA (it has a special room rate of USD 139 per night for conference attendees).

PS2: Some more events will follow shortly.

Posted in Conferences, Delphi, DelphiLive, Development, Event, Software Development | 1 Comment »

Windows Azure Toolkit for Social Games

Posted by jpluimers on 2011/08/03

On my research list: Windows Azure Toolkit for Social Games.

–jeroen

Posted in .NET, Development, Software Development | Leave a Comment »

Text displayed in some core fonts appears blurred in Internet Explorer 9 on a computer that is running Windows Vista, Windows Server 2008, Windows 7, or Windows Server 2008 R2

Posted by jpluimers on 2011/08/02

Right now there are so many ways to display text, that – depending on your physical display (CRT, LCD, etc) – all behave differently.

Even Microsoft has released a patch (see the below quote from KB 2545698 that got released last month).

This issue occurs because of a design change to how Internet Explorer 9 renders text. By default, Internet Explorer 9 uses sub-pixel positioned ClearType to render text by using DirectWrite, whereas Internet Explorer 8 uses whole-pixel positioned ClearType to render text by using the Microsoft Windows graphics device interface (GDI).

I’m wondering if there is a way to make it work ‘right’ on every type of display combination.

Do you know any?

–jeroen

via Text displayed in some core fonts appears blurred in Internet Explorer 9 on a computer that is running Windows Vista, Windows Server 2008, Windows 7, or Windows Server 2008 R2.

Posted in .NET, Delphi, Development, Font, Power User, Software Development | 5 Comments »

Reading list: Version Control by Example

Posted by jpluimers on 2011/08/01

Great stuff to read: Version Control by Example by Eric Sink of SourceGear and Spyglass fame.

–jeroen

Posted in Development, DVCS - Distributed Version Control, Source Code Management | Leave a Comment »

Portable PowerShell – ShellTools

Posted by jpluimers on 2011/08/01

As a contractor, it is far easier to have your tools with you on a USB stick, than to depend on software distribution mechanisms or installation policies at clients.

Hence I like the Portable PowerShell from ShellTools: a way to run (side-by-side!) various versions of PowerShell from a USB stick.

–jeroen

Posted in CommandLine, Power User, PowerShell | Leave a Comment »