Page 3 of 3 <123
Topic Options
#178113 - 2007-07-20 01:32 PM Re: How Many Members [Re: Lonkero]
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
749:
 Code:
; ChangeLamp.kix
;	Automated lightbulb changer
;! 
Dim $R, $O, $N, $S, $I, $M,$
"Please enter lightbulb maintenance reference: " Gets $R
 
$=Lamp
$O=GetObject($+"://"+$R)
$S=GetObject("Switch://"+$R)

If $O.Illuminated | $S.Toggle | $O.Illuminated
  If $O.Type="Bayonet"
    $O.Push
    $O.Rotate(-90)
    $O.Pull
    Do
      $N=CreateObject($+".Bayonet")
      $N.Push
      If $N.IsHot
        $S.Toggle
        $=RunFingersUnderColdWater(@WKSTA)
      EndIf
    Until NOT $N.Broken
    $O.Rotate(90)
  Else ;$O.Type="Edison Screw"
    Do
      $O.Rotate(-180)
    until $O.Released
    Do
      $N=CreateObject($+".Screw")
      While $N.Loose
        $N.Rotate(180)
        If $N.IsHot
          $S.Toggle
          $=RunFingersUnderColdWater(@WKSTA)
        EndIf
      Loop
    Until Not $N.Broken
  EndIf
  $S.Toggle
  If $OState | $O.Illuminated
    $+" successfully changed and tested"+@CRLF
  Else
    $+" still not working.  Please try running FixFuse.kix then retry ChangeLamp.kix"+@CRLF
  EndIf
  $S.Toggle
Else
  $+" is OK, no need to change"+@CRLF
EndIf
;!
_________________________
!

download KiXnet

Top
#178114 - 2007-07-20 01:36 PM Re: How Many Members [Re: Lonkero]
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
734:
 Code:
; ChangeLamp.kix
;	Automated lightbulb changer
;! 
Dim $R, $O, $N, $S, $I, $M,$
"Please enter lightbulb maintenance reference: " Gets $R
 
$=Lamp
$O=GetObject($+"://"+$R)
$S=GetObject("Switch://"+$R)

If $O.Illuminated | $S.Toggle | $O.Illuminated
  Do
    $O.Push
    $O.Rotate(-90)
    $O.Pull
  until $O.Released
  If $O.Type="Bayonet"
    Do
      $N=CreateObject($+".Bayonet")
      $N.Push
      If $N.IsHot
        $S.Toggle
        $=RunFingersUnderColdWater(@WKSTA)
      EndIf
    Until NOT $N.Broken
    $O.Rotate(90)
  Else
    Do
      $N=CreateObject($+".Screw")
      While $N.Loose
        $N.Rotate(180)
        If $N.IsHot
          $S.Toggle
          $=RunFingersUnderColdWater(@WKSTA)
        EndIf
      Loop
    Until Not $N.Broken
  EndIf
  $S.Toggle
  If $OState | $O.Illuminated
    $+" successfully changed and tested"+@CRLF
  Else
    $+" still not working.  Please try running FixFuse.kix then retry ChangeLamp.kix"+@CRLF
  EndIf
  $S.Toggle
Else
  $+" is OK, no need to change"+@CRLF
EndIf
;!
_________________________
!

download KiXnet

Top
#178116 - 2007-07-20 01:59 PM Re: How Many Members [Re: Lonkero]
Richard H. Administrator Offline
Administrator
*****

Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
Tch! You've still left the logical error in.
Top
#178117 - 2007-07-20 02:00 PM Re: How Many Members [Re: Lonkero]
Arend_ Moderator Offline
MM club member
*****

Registered: 2005-01-17
Posts: 1895
Loc: Hilversum, The Netherlands
733:
 Code:
; ChangeLamp.kix
;	Automated lightbulb changer
;! 
Dim $R,$O,$N,$S,$I,$M,$,$W
"Please enter lightbulb maintenance reference:" Gets $R
$W=@WKSTA
$=Lamp
$O=GetObject($+"://"+$R)
$S=GetObject("Switch://"+$R)
If $O.Illuminated | $S.Toggle | $O.Illuminated
  Do
    $O.Push
    $O.Rotate(-90)
    $O.Pull
  Until $O.Released
  If $O.Type="Bayonet"
    Do
      $N=CreateObject($+".Bayonet")
      $N.Push
      If $N.IsHot
        $S.Toggle
        $=RunFingersUnderColdWater($W)
      EndIf
    Until NOT $N.Broken
    $O.Rotate(90)
  Else
    Do
      $N=CreateObject($+".Screw")
      While $N.Loose
        $N.Rotate(180)
        If $N.IsHot
          $S.Toggle
          $=RunFingersUnderColdWater($W)
        EndIf
      Loop
    Until Not $N.Broken
  EndIf
  $S.Toggle
  If $OState | $O.Illuminated
    $+"successfully changed and tested"+@CRLF
  Else
    $+"still not working. Please try running FixFuse.kix then retry ChangeLamp.kix"+@CRLF
  EndIf
  $S.Toggle
Else
  $+"is OK, no need to change"+@CRLF
EndIf
;!

Top
#178118 - 2007-07-20 02:37 PM Re: How Many Members [Re: Arend_]
Benny69 Offline
Moderator
*****

Registered: 2003-10-29
Posts: 1036
Loc: Lincoln, Ne
You folks in Europe are always pushing the technological boundaries and coming up with fantastic new ways of doing things, we in the States do things a little different and often takes a different approach.

263
 Code:
; ChangeLamp.kix
;	Automated lightbulb changer
;! 
Dim $, $R, $L, $T, $H, $C
$=Lamp

"Please enter lightbulb maintenance reference: " Gets $R

$L=GetObject($+"://"+$R)

If Not($L.Illuminated)
	$T=$L.HireSomeOneFromIndiaForTechnicalSupport
	$H=$T.HireSomeOneFromChinaToChangeBulb
	$C=$H.EatDoughnutAndDrinkCoffeeWhileBulbIsBeingChanged
;EndIf
;!
_________________________
Wait don't order yet,... get KiXforms Designer .NET 2.0 (Beta)
KiXforms Designer .NET 2.0 (Beta)

Top
#178119 - 2007-07-20 02:53 PM Re: How Many Members [Re: Benny69]
Arend_ Moderator Offline
MM club member
*****

Registered: 2005-01-17
Posts: 1895
Loc: Hilversum, The Netherlands
LOL Benny \:\)
You forgot:
 Code:
$C=$J.CallLocalEmployeeToToggle


;\)

729:
 Code:
; ChangeLamp.kix
;	Automated lightbulb changer
;! 
Dim $R,$O,$N,$S,$I,$M,$
"Please enter lightbulb maintenance reference:" Gets $R
$=Lamp
$O=GetObject($+"://"+$R)
$S=GetObject("Switch://"+$R)
If $O.Illuminated | $S.Toggle | $O.Illuminated
  Do
    $O.Push
    $O.Rotate(-90)
    $O.Pull
  Until $O.Released
  If $O.Type="Bayonet"
    Do
      $N=CreateObject($+".Bayonet")
      $N.Push
      If $N.IsHot
        $S.Toggle
        $=RunFingersUnderColdWater(@WKSTA)
      EndIf
    Until NOT $N.Broken
    $O.Rotate(90)
  Else
    Do
      $N=CreateObject($+".Screw")
      While $N.Loose
        $N.Rotate(180)
        If $N.IsHot
          $S.Toggle
          $=RunFingersUnderColdWater(@WKSTA)
        EndIf
      Loop
    Until Not $N.Broken
  EndIf
  $S.Toggle
  If $OState | $O.Illuminated
    $+"successfully changed and tested"+@CRLF
  Else
    $+"still not working. Please try running FixFuse.kix then retry ChangeLamp.kix"+@CRLF
  EndIf
  $S.Toggle
Else
  $+"is OK, no need to change"+@CRLF
EndIf
;!


Edited by apronk (2007-07-20 03:00 PM)

Top
#178122 - 2007-07-20 07:48 PM Re: How Many Members [Re: Arend_]
Witto Offline
MM club member
*****

Registered: 2004-09-29
Posts: 1828
Loc: Belgium
I am still waiting until I see that last EndIf dissapear
Top
#178129 - 2007-07-20 11:51 PM Re: How Many Members [Re: Witto]
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
richie, is this corrected?
 Code:
; ChangeLamp.kix
;	Automated lightbulb changer
;! 
Dim $R,$O,$N,$S,$I,$M,$
"Please enter lightbulb maintenance reference:" Gets $R
$=Lamp
$O=GetObject($+"://"+$R)
$S=GetObject("Switch://"+$R)
If $O.Illuminated | $S.Toggle | $O.Illuminated
  Do
    $O.Push
    $O.Rotate(-90)
    $O.Pull
  Until $O.Released
  If $O.Type="Bayonet"
    do
      $N=CreateObject($+".Bayonet")
      $N.Push
      $O.Rotate(90)
      If $N.IsHot
        $S.Toggle
        $=RunFingersUnderColdWater(@WKSTA)
      EndIf
    until 0=$N.Broken
  Else
    Do
      $N=CreateObject($+".Screw")
      While $N.Loose
        $N.Rotate(180)
        If $N.IsHot
          $S.Toggle
          $=RunFingersUnderColdWater(@WKSTA)
        EndIf
      Loop
    Until 0=$N.Broken
  EndIf
  $S.Toggle
  If $OState | $O.Illuminated
    $+"successfully changed and tested"+@CRLF
  Else
    $+"still not working. Please try running FixFuse.kix then retry ChangeLamp.kix"+@CRLF
  EndIf
  $S.Toggle
Else
  $+"is OK, no need to change"+@CRLF
;!


for 722.
_________________________
!

download KiXnet

Top
#178161 - 2007-07-23 09:00 AM Re: How Many Members [Re: Lonkero]
Arend_ Moderator Offline
MM club member
*****

Registered: 2005-01-17
Posts: 1895
Loc: Hilversum, The Netherlands
The logical error would be that the script assumes a Bayonet type for unscrewing \:\)

Logical version for a score of 755
 Code:
; ChangeLamp.kix
;	Automated lightbulb changer
;! 
Dim $R,$O,$N,$S,$I,$M,$
"Please enter lightbulb maintenance reference:" Gets $R
$=Lamp
$O=GetObject($+"://"+$R)
$S=GetObject("Switch://"+$R)
If $O.Illuminated | $S.Toggle | $O.Illuminated
  If $O.Type="Bayonet"
    Do
      $O.Push
      $O.Rotate(-90)
      $O.Pull
    Until $O.Released
    Do
      $N=CreateObject($+".Bayonet")
      $N.Push
      $O.Rotate(90)
      If $N.IsHot
        $S.Toggle
        $=RunFingersUnderColdWater(@WKSTA)
      EndIf
    until 0=$N.Broken
  Else
    Do
      $O.Rotate(-180)
    Until $O.Released
    Do
      $N=CreateObject($+".Screw")
      While $N.Loose
        $N.Rotate(180)
        If $N.IsHot
          $S.Toggle
          $=RunFingersUnderColdWater(@WKSTA)
        EndIf
      Loop
    Until 0=$N.Broken
  EndIf
  $S.Toggle
  If $OState | $O.Illuminated
    $+"successfully changed and tested"+@CRLF
  Else
    $+"still not working. Please try running FixFuse.kix then retry ChangeLamp.kix"+@CRLF
  EndIf
  $S.Toggle
Else
  $+"is OK, no need to change"+@CRLF
;!

Top
#178165 - 2007-07-23 09:20 AM Re: How Many Members [Re: Arend_]
Richard H. Administrator Offline
Administrator
*****

Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
It's really not a very subtle error, however I think that you've both got coding target fixation and are missing the obvious.

Consider why you would be changing the lamp in the first place.

Top
#178254 - 2007-07-23 09:44 PM Re: How Many Members [Re: Richard H.]
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
because I already tested it's broken?
but you just said before that human is human, thus, he/she would double check anyways, right?

apronk, did you notice your code is hugely longer than mine?
_________________________
!

download KiXnet

Top
#178286 - 2007-07-24 09:15 AM Re: How Many Members [Re: Lonkero]
Richard H. Administrator Offline
Administrator
*****

Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
 Originally Posted By: Jooel
because I already tested it's broken?
but you just said before that human is human, thus, he/she would double check anyways, right?


The check / toggle / check was in the original, and is fine.
The error doesn't affect the golf score, but the code goes like this:

 Code:
If $O.Illuminated | $S.Toggle | $O.Illuminated
    ; Change light-bulb
Else
    ; Don't change lamp
EndIf


So, you only ever change the lightbulb if it is working.

Top
#178287 - 2007-07-24 09:24 AM Re: How Many Members [Re: Richard H.]
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
right!
lol.
_________________________
!

download KiXnet

Top
#180127 - 2007-09-04 05:23 AM Re: How Many Members [Re: Lonkero]
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11624
Loc: CA
LOL - Just accidentally ran into this page today


How many Microsoft employees does it take to change a lightbulb?
http://blogs.msdn.com/ericlippert/archive/2003/10/28/53298.aspx

Top
#180131 - 2007-09-04 09:43 AM Re: How Many Members [Re: NTDOC]
Arend_ Moderator Offline
MM club member
*****

Registered: 2005-01-17
Posts: 1895
Loc: Hilversum, The Netherlands
 Originally Posted By: Microsoft
At Microsoft we try very, very hard to not release half-baked software


LOL, somehow I don't believe that ;\)

Top
#180132 - 2007-09-04 01:46 PM Re: How Many Members [Re: Arend_]
Björn Offline
Korg Regular
*****

Registered: 2005-12-07
Posts: 953
Loc: Stockholm, Sweden.
soooo... I am the n00b to start it all over again? or perhaps you haven't run out of light/bright bulbs/lam[bs/ps] ?
_________________________
as long as it works - why fix it?
If it doesn't work - kix-it!

Top
Page 3 of 3 <123


Moderator:  Arend_, Allen, Jochen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 369 anonymous users online.
Newest Members
rrosell, PatrickPinto, Raoul, Timothy, Jojo67
17877 Registered Users

Generated in 0.071 seconds in which 0.027 seconds were spent on a total of 14 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org