Calculate Week number correctly in Foxpro (Visual Foxpro)

Silly Week() function in Foxpro doesn't work like it should! This year (2009) is very long... So it has a week 53. I think here in Holland we use the method that the larger part of the week should be in the new year to call it week number one.

So according to the help on the Week() function we select nFirstWeek 2 (The larger half (four days) of the first week is in the current year.).

Foxpro Week(Date(2009,12,31),2) returns week 52! That is absolutely wrong.
A search on the Internet brought me a solution that works for me. It was found on Fox Wiki. This is the very impressive code:

FUNCTION GetWeekNo
 LPARAMETERS ldDate
 lnJulian = VAL(SYS(11,ldDate))+1
 lnDay4 = MOD(MOD(MOD((lnJulian+31741 - MOD(lnJulian,7)),146097),36524),1461)
 lnLeap = INT(lnDay4/1460)
 lnDay1 = MOD(lnDay4-lnLeap,365) + lnLeap
 RETURN INT(lnDay1/7)+1
ENDFUNC

Thanks go to theRambler who proposed this on TekTips.

UPDATE: I stand corrected...
Nard van Gentevoort emailed me to explain the VFP Week() function wil give me the right week number. But first I have tot tell it what day the week starts on. Silly americans start the week on Sunday "at the seventh day he relaxed and saw all was good".. doesn't ring a bell? So because we do things right and start off our week at Monday, the full function call in the Netherlands should be: Week(date,2,2). Tested WEEK(DATE(2009,12,31),2,2) and it gives 53 like I expect it to. Thanks Nard !

Play radiostreams in Windows Media player

Link: http://weblogs.asp.net/jgalloway/archive/2004/12/21/328265.aspx

Winamp is getting more bloated and slow all the time. Just starting takes half a minute 88|, too long!

But I like music streams... Search through Google took me to this article which then lead me to this page by John Galloway. Respect !

The utility installs as an extra program to open the PLS stream and tricks Windows Mediaplayer into streaming it. Tested it and it works! Just a silly AAC warning that can be ignored.

Use ShoutCast to locate a stream you like (What about 50+ stations streaming Christmas songs 24/7?). Or take a look at my Old Skool favorites.

Hoe het niet moet en hoe het wel moet

Link: http://thereifixedit.com/

Website met foto's van creatieve en vaak knullige reparaties.

Verzameling van websites met oplossingen en instructies hoe het wel moet vind je bij PCmag.

Solve long wait between print Jobs

The Windows spooler took about 5 to 10 minutes to start the next print job in queue.
There was no spooler problem because other printers had no similar long waits. This also meant there was no problem with spooler file access.
Compared our 2 Linkpro PS 350-A print servers for settings. They had the latest firmware and setting were similar, so no problems there.

The problem looked something like an old Parallel matrix printer not acknowledging that it had finished printing. The job was allready printed but the print spooler still said it was printing. That took forever until some other Windows server process recognized the process is 'hanging' and killed it alltogether. Just then the next print job in the queue would start to print.

The solution was just a checkbox away:
In the printer properties, open the Ports tab.
Then click on Configure Port.. to open the port config.
On that page, the LPR byte counting enabled checkbox should be ticked.


This solves the endless wait problem. I think instead of waiting for an end job acknowledge by the printer (that never comes), the spooler now just counts the number of bytes sent. If it has sent all bytes the job is finished and the next job can be started.

Getting Tabbed browsing to work in IE on Terminal Server

My users lost their tabbed browsing and missed it a lot.
Could not find which policy prohibited the tabbed working. As an administrator -again- I had no problem whatsoever. So this should be a rights or policy issue.

Found the solution in this thread:

In the policy User\Policies\Administrative\Windows Components\Windows Explorer
the Classic Shell should be Disabled! (not Enabled in any case).

After next logon (as a user) the Tabs were back in Internet Explorer.
For me this was an unexpected place; couldn't have thought of this myself.
Hope this wil help you all.

Getting Flash Player to work in IE on a Terminal Server

A lot of webpages became unuseable to my users because Flash player would not work in Internet Explorer 7 running in a Terminal Server 2003 session.
Strange thing I noticed was that as a supervisor I had no problem whatsoever.
Tried (un) installing several times, which solved nothing.
Then I stumbled upon the solution on this Adobe forum.

Solution was easy and worked for me:
Open Regedt32 and change access rights to include all users (domain users in our case).
Give at least read rights to these registry keys:
[HKEY_CLASSES_ROOT\TypeLib\{D27CDB6B-AE6D-11CF-96B8-444553540000}]
[HKEY_CLASSES_ROOT\CLSID\{D27CDB6B-AE6D-11CF-96B8-444553540000}]

Blinden het bos in gestuurd

Gisteren kwam ik deze vreemde situatie tegen. Nota bene vlak bij het ziekenhuis worden de blinden letterlijk de struiken in gestuurd. Een collega zegt mij dat dit standaard is en dat de blinde aan de onderbroken stroken herkent dat hij al af moet slaan.... Maar ik vind het een vreemd gezicht.
Het schijnt dat de blindenstrook bij het stadhuis rechtstreeks de vijver in leidt....
Wat nou als een baldadig iemand de gaten in de stroken opvult? Of breng ik nu mensen op slechte ideeën?

Update oktober 2009:
Mijn collega heeft een blinde geraadpleegd. Wat blijkt? Er is echt over nagedacht, jawel!
Zodra de blindenstrook (de ribbels) schuin afbuigt moet de natuurlijke lijn gevolgd gaan worden. Dat betekent dat de blinde met de stok dan de rand van stoep, struik of grasveld kan gaan volgen. Kijk, dat scheelt een hoop ribbeltegels :)
Oh ja, er zijn ook zogenaamde "holle" tegels. Als hier met een blindenstok op getikt wordt klinkt het ineens heel anders en weet de blinde wat er staat te gebeuren. Deze klanktegel geeft het begin (of einde) van een route aan.

Ach, de gemeente Purmerend legt het zelf nog eenvoudiger uit.