|
|
|||||||
Okay, everybody: I think I have a new challenging KiXtart Golf tournament for you. First of all, I'd like to credit BrianTX (I believe) for the idea to this challenge. Secondly, the timeframe is a total of 10 days. A private coding phase with no code postings allowed will run from now to Wednesday afternoon. Because of the complexity of the problem and time constraints of participants, the deadline for the first part has been extended to Saturday, July 20, 6pm EST. Part 2 (public improvements of code) will begin automatically after this date/time. A second public coding phase, including postings of code, will run from Wednesday afternoon to Sunday evening. Follwing are the official rules for the contest: ================================================================ KiXtart GOLF - How To Play ================================================================ Most importantly, anybody can play, no age restrictions, no penalties, no handicap! The object in "real" golf is to hit the ball in the hole in the fewest strokes. The object in KiXtart Golf is to get from input (tee) to target (hole) in the fewest keystrokes. Example: How many positive elements are in array $a? Array $a could be of structure $a=[1, 2 ,-3, 4, -5, -7, 8, 9] One approach: code:for a score of 45.for $b=0 to ubound($a) Another solution is: code]DO $b=$b+1 if $a[$b]>0 $c=$c+1 endif UNTIL $b>(UBOUND($a)+1)[/code] for a score of 53. Better approach: Code sample 1 ================================================================ KiXtart GOLF - The Rules ================================================================ 1) The goal of KiXtart Golf is to score the lowest strokes. 2) Strokes are all characters in a piece of code except whitespace characters, unless the whitespace character is necessary for the line of code to work. Therefore, carriage returns and line feeds do not count or spaces in between the '=' sign when assigning variables, e.g. '$a = $b' scores 5. 3) Code can be constructed any way you like, as long as it is syntactically correct with KiXtart. 4) The final solution MUST pass all test scripts that accompagny the KiXtart golf challenge. 5) The use of '$' as a variable is allowed. 6) In case of questions about a particular way to count the KiXtart Golf Challenge organizer has the last call. 7) During the private coding phase, no code is allowed to be posted. Violations result in disqualification of said player. 8) During the public coding phase, code should be posted, reused, and borrowed from other players. 9) The following script can be used to count the KiXtart Golf score: http://81.17.37.55/board/ultimatebb.php?ubb=get_topic;f=2;t=003418 ================================================================ KiXtart GOLF - The Duration of the Competition ================================================================ 1) Private coding phase: From date/time of posting the tournament challenge to the following Wednesday, 3pm EST (BBS+6 time) 2) Public coding phase: From Wednesday 3pm EST (BBS+6 time) to the following Sunday, 7pm EST (BBS+6 time) 3) Final results: The following Monday, 11am EST (BBS+6 time) ****************************** * The KiXtart Golf Challenge * ****************************** Write a UDf that can replace the 'REGEDIT /S' registry import. Three test registry files have been provided and should go into the same directory as the test script. The test script checks whether the written UDF imports the registry files correctly by checking for registry keys, registry types, and registry values. The registry files can be imported into Windows 9x, NT, 2000, XP but have only been tested with Windows 2000. Please insert your UDf inside the marked space at the end of the test script. The test script will the run your UDF and check whether all registry keys are correctly placed. All necessary files are posted below: All files can also be downloaded at http://people.bu.edu/jenmeyer/kixtart/golf.zip GOLF.KIX code:Registry file IMPORT1.REG; KiXtart Golf Test script quote:Registry file IMPORT2.REG quote:Registry file IMPORT3.REG quote: [ 16 July 2002, 15:37: Message edited by: sealeopard ] |
||||||||
|
|
|||||||
again a slow weekend? wouldn't it be very nice when Ruud is releasing a new version each week? greetings. |
||||||||
|
|
|||||||
this is not good... too drunk to participate today... |
||||||||
|
|
|||||||
ok, I made fully working script for just strings and it says: undefined variable even though the first line defines the variable as 0 have you tested your script? |
||||||||
|
|
|||||||
also... your reg-files are not working. reading first line gives: ÿþR when it is if I make it myself: REGEDIT4 |
||||||||
|
|
|||||||
had to "type" in dos your reg-files to get them working???? [ 14 July 2002, 03:15: Message edited by: Lonkero ] |
||||||||
|
|
|||||||
Lonkero: did you use the .REG files from the downloadable ZIP-file that I provided or did you copy and paste the .REG files? I did check my ZIP file and it seemed to be okay. The best way to test those .REG fiels is to just import tme with REGEDIT and see what they are doing. Let me know if there are any problems. |
||||||||
|
|
|||||||
for what happened with them read my last post. I did download your zip. |
||||||||
|
|
|||||||
Lonkero: I did test the golf.kix script. I first imported the three .REG files with REGEDIT. I then ran the GOLF.KIX script under KiXtart 4.10a and it gave mo no errors. I did use a dummy function for ImportRegFile() though just so I can verify the registry entry testing part. So, are you okay now? Or are there still any problems? |
||||||||
|
|
|||||||
I'll download your zip again. I'll run the reg files with my working code to see if them really work. as I see it, reg-files are just text-files with reg-extension so they should open correctly with kixtart... I'll return my feedback on this soon (if I don't passout!) cheers, |
||||||||
|
|
|||||||
Yes, they are plain text files. The identifyer is 'REGEDIT4' in the first line denoting a registry file. Under Windows 2000 this first ID line is different if you export a regfile out of the registry. |
||||||||
|
|
|||||||
downloaded and tested again. don't know. this is probably a windows unicode bug... I have w2k sp2 here. finnish installation and the lines in your reg-files are showing up as symbols. don't know about others non-us ppl, but for me those files are corrupted and I can't use them. cheers, |
||||||||
|
|
|||||||
The REG files supplied are in Unicode format. These don't work in Windows 98, have to be ascii or REGEDIT won't recognise them. Had to load into Wordpad and 'Save As' Text format [ 14 July 2002, 01:22: Message edited by: AJH ] |
||||||||
|
|
|||||||
ajh, you seem to be second one to try them and second one saying they do not work. jens? |
||||||||
|
|
|||||||
The Error Checking code seems to check for the default subkey entry existing (and = REG_SZ) when it should not be set. (eg on 'ImportX\subdirectory2' etc) On Windows 98 this key always exists (and is by default REG_SZ) - showing 8 errors after merging the supplied files. eg: if readtype(HKCU\...\Import1\Subdirectory2','')='REG_SZ' $errorcount=$errorcount+1 endif [ 14 July 2002, 01:55: Message edited by: AJH ] |
||||||||
|
|
|||||||
I got this error when trying to reduce my code: "out of beer" |
||||||||
|
|
|||||||
I don't have a problem with the files. Ironing out the last couple bugs |
||||||||
|
|
|||||||
I got a bug not getting over with. string and null can't be easily diffed with if... going back. |
||||||||
|
|
|||||||
started to work with profilestring-functions and found out that the script is growing over 0.5k! after spending some 200 minutes on that have to fall back to sleep or to previous state. |
||||||||
|
|
|||||||
This code seems to be incorrect. code:Import1\Subdirectory1','' should be 'String1'; check for registry values in import1 {edit} A real sucky score but it works! KixGolf score = 1657 After some sleep, the score should drop some. [ 14 July 2002, 09:23: Message edited by: Howard Bullock ] |
||||||||
|
|
|||||||
I'm stuck with something I cant understand. if I make kix to read lines from those files they come out as: 7 9 , 2 0 , 6 5 , 6 e .... what heck is going on? all I do is: while @error=0 readline(1) ? loop does not matter which version I use. [ 14 July 2002, 13:00: Message edited by: Lonkero ] |
||||||||
|
|
|||||||
Lonkero Your problem is because the supplied .REG files are Unicode, and the Kix ReadLine() function is for reading ascii files. This topic Unicode Converter UDF discusses some unicode problems. My input to the debate includes a UDF called ReadFile which (like PIPE) returns an array containing the ascii text lines. Both ascii and unicode input files can be used. |
||||||||
|
|
|||||||
ajh, so, is this kinda unicode right? when I export from regedit as "regedit4 regfile" it works just fine. jens, does my script have to work with your files too? |
||||||||
|
|
|||||||
I think Jens need to clarify the matter. Are the input files assumed to be: a) Always ascii b) always unicode c) any combination If Unicode is required then the Kix ReadLine function is useless for this operation |
||||||||
|
|
|||||||
was going to ask 10 minutes ago about fso but then kpnqwest's net went down. back again. so what external (not included strickly in kix. meaning com, dos utils etc...) things maybe used? |
||||||||
|
|
|||||||
I elected COM (a native ability of KiX) to save some strokes. I think I may need to save a lot more by the time every else chimes in. {edit} Also, in W2K SP2 Regedit.exe always shows a (default) value even when one doesn't exist. Regedt32.exe shows exactly want is there. I lost a couple hours last night trying to delete a key that wasn't there. trying to save the stroke for if KeyExist(). [ 14 July 2002, 16:10: Message edited by: Howard Bullock ] |
||||||||
|
|
|||||||
hoby, yes com is native ability but what you objects you call? are they supported by default in all required os'es? |
||||||||
|
|
|||||||
Guys, I only tested the scripts under Windows 2000 SP2. I will go back and test the scripts under Windows 98 and reexport the .REG files again. The .REG files are supposed to be text files, not unicode-files. I'm sorry for the lack of testing done. |
||||||||
|
|
|||||||
I can't answer that. I only have W2K and the docs for WSH 5.5, 5.6. You have a choice of to two text based methods for FSO. |
||||||||
|
|
|||||||
that jens' post helped a lot. makes the code almost halfsized... |
||||||||
|
|
|||||||
The UNICODE was a nice twist. It took a couple minutes to make that determination since W2K handles it transparently on most tools. I guess I can re-code if you change them. That probably would more fair for those OS challenged individuals. [ 14 July 2002, 16:21: Message edited by: Howard Bullock ] |
||||||||
|
|
|||||||
Hmm, it seems ther are two different coding tracks right now, on using Windows scripting Host, and one without. It'll be interesting to see which one will be the more efficient one |
||||||||
|
|
|||||||
In my approach WSH added strokes because of FSO object creation line and the long object and methods names used in WSH. It only added one line and some chars for me. {edit} Now if I use more WSH functionality for things other than just reading a file, I might be able to improve the product in areas where KiX is a little shy on functionality, I might be able to make a better product. [ 14 July 2002, 16:39: Message edited by: Howard Bullock ] |
||||||||
|
|
|||||||
also, do we have to catch the return codes or can we let the 0's take over the window? |
||||||||
|
|
|||||||
huh. longest part comes from multilined hex-values... |
||||||||
|
|
|||||||
done. without fso. it does not handle (as without any comstuff) the unicode files. only pure text reg-files KixGolf score = 611!!!!!!!!!!!!!!! hoby? [ 14 July 2002, 18:53: Message edited by: Lonkero ] |
||||||||
|
|
|||||||
Wow. (Scratching my head...) |
||||||||
|
|
|||||||
Okay guys, I investigated the UNICODE thing. If the export is done from e.g. Windows 9x (and I believe Windows NT, though I don't have one ready right now), then the exported .REG file is a normal text file with the first line being 'REGEDIT4'. If the export is done from Windows 2000 (and Windows xP?), then the exported file is in UNICODE. This file cannot be reimported with REGEDIT /S under Windows 9x/NT. This type of file is identified by 'Windows Registry Editor Version 5.00' and is an UNICODE file. Allowed is only pure KiXtart, no external programs, WMI/ADSI/WSH is allowed since most have it installed anyway. I will post an updated .ZIP file soon not containing any UNICODE files, only REGEDIT4 .REG files. But it might take me an hour or so. |
||||||||
|
|
|||||||
yes! I like what I'm reading! if someone else get's under 1000 score too, I'll start minimizing my code. as didn't do it yet, just made it working... [ 14 July 2002, 19:36: Message edited by: Lonkero ] |
||||||||
|
|
|||||||
Jens, This unicode thing is a known issue. See my second post on the FAQ Topic: Registry |
||||||||
|
|
|||||||
Jens There is a typo in both the original Import2 posting and in the Zip file The Import2\Subdirectory1 "Binary1" entry contains this string ...,726f,... (missing ',') Not sure what WSH functions people are using... [ 14 July 2002, 21:48: Message edited by: AJH ] |
||||||||
|
|
|||||||
I thought the missing comma was a test to find BAD data and ignore it like Regedit does. The tests do not expect to find that Value. |
||||||||
|
|
|||||||
it works just fine for me! kixtart fixes that automatically. btw, the actual score was: KixGolf score = 602 forgot to remove some debug code [ 14 July 2002, 22:13: Message edited by: Lonkero ] |
||||||||
|
|
|||||||
Yeah, I "fixed" it too at first, but that particular value reported an error and in my zombie state late last night it seemed as though it was not suppose to exist according to the test code. So I recoded my script to check for missing commas and discard the line. Somebody let me know if it was a typo. Now that I am again awake, I might be able to collate the tasks at hand. [ 14 July 2002, 23:09: Message edited by: Howard Bullock ] |
||||||||
|
|
|||||||
also, didn't get a reply to my question: do we need to supress return codes? I mean, function return 0 on success. can we let them be output to console as long as the function works? when we must replace the regedit /s, do we also need to have setconsole("hide") in our function? |
||||||||
|
|
|||||||
ok, didn't read the test script well enough. as didn't even used it. as it does not have all reg types... uttleast seems so. anyway, forgot one feature. that means my score will increase. I'll be back. |
||||||||
|
|
|||||||
ok dudes. I'm getting also over 1000 here. didn't use the explicit and now it does not allow any of my lines. if not getting it working, will leave this battle. too much frustration. |
||||||||
|
|
|||||||
Folks: I just uploaded a new .ZIP file with the test script and the .REG files. Get it here: http://people.bu.edu/jenmeyer/kixtart/golf.zip And yes, there is a faulty dataset in one of the .REG files, and I put this in deliberately There doesn't need to be UNICODE support in this routine, just support for REGEDIT4 .REG files. With regards to return codes, the only return code is the one for ImportRegFile(), there shouldn't be any screen output inside the UDF. I alos have put a Windows 2000 UNICODE file into the ZIP package, which is NOT part of the test script. The test script basically checks whether the keys/values/types are correct, and whether the appropriate keys/values have been deleted. BTW, my count is currently 1813 without shortened variables and using pure KiXtart (not even a call to an outside object) but including some error checking for correct file type and syntax. |
||||||||
|
|
|||||||
quote:No, you don't need that. I was imagining a simple UDF that runs the .REG files fed to it and returns an error code inducation whether the file was imported correctlt or not (e.g. file not found). Since REGEDIT /S doesn't tell you if some imports haven't been doen because of syntax error, it is not necessary for the UDF to do this either. Finally, I didn't put all types of registry entries into the test .REG files, just the most important ones. So, a UDF posted into the UDF section might need to contain those cases, too, but for this exercise, it is not necessary. |
||||||||
|
|
|||||||
no. I can admit this is getting weird. if I loose explicit and novarsinstring and array support my script works fine. if I try to make it work with any of those, only errors occurs... I won't sleep tonight, that's for sure. |
||||||||
|
|
|||||||
btw, does regedit support array input? I have used it only with multiple strings... just to make a point... |
||||||||
|
|
|||||||
head is blowing away... please give me something else to think about! {edit} record of the day: 5 boxes cigarettes and 3 litres of coffee... unofficial though [ 15 July 2002, 01:36: Message edited by: Lonkero ] |
||||||||
|
|
|||||||
jens, this is really nice. when vars in strings is off the values get there nicely. when it's on, all valuenames get written as strings. also it messes up my data fields. |
||||||||
|
|
|||||||
I didn't sleep last night. Been at this forever. I am now exploring some alternatives. I haven't checked everything and I don't if everything works correctly yet, but I can correctly enum everything. It's interesting at (KixGolf score = 909). |
||||||||
|
|
|||||||
hoby, did you have any intresting time with those new restricking rules? I'm almost there... don't know how will come around this last thing... script size has about doubled because of those strict-rules. |
||||||||
|
|
|||||||
Jens, was I correct in NOT correcting your faulting data set and not loading the value? Or should we repair it and load it? |
||||||||
|
|
|||||||
I understood that it does not matter do we load or not. as data correctness checking does not need to be. |
||||||||
|
|
|||||||
mmm... golf.kix checks for defaultvalues. that's ok. but, my script does not create them and still they come up in regedit. and your script says 7 errors found. if I've understood correctly, default value is allways there when key is made and it can't be removed. and when not set, it also is reg_sz. anyway, my script is fine now with your strict rules and it also works with the reg-types not needed by this golf course. KixGolf score = 775 btw, hoby, your v3 gave just score 0 cheers, |
||||||||
|
|
|||||||
Did turn on counting by putting a ";!" at the beginning of your function? |
||||||||
|
|
|||||||
ah! did not. well, didn't cut of any chars... result is the same: KixGolf score = 775 |
||||||||
|
|
|||||||
Oh, and the "Default" values are not really there even though Regedit says they are. Use regedt32 to verify. |
||||||||
|
|
|||||||
another bloody bug. |
||||||||
|
|
|||||||
Lonkero, I have KiXGolfed your example script to this: code:and it scores 35 nowfor each $x in $a cj |
||||||||
|
|
|||||||
now the validator said that my script passed it. I can't check it more right now. score 803 not feeling happy. I'm so tired... it was feeling too good to be really ahead of others so much. now back on earth. hoby, are you allready under 800? [ 15 July 2002, 08:25: Message edited by: Lonkero ] |
||||||||
|
|
|||||||
I'm too tired to tell...>1000 with problems. I keep digging myself deeper because I'm too tired. Goodnight 3:15AM here. |
||||||||
|
|
|||||||
Dear Howard, A good night's rest. Are you still using kixtart. Hard to understand who so much failures. General it is something for the MS club. greetings. |
||||||||
|
|
|||||||
I'm trying something different still using the Unicode import files. I will give this a little more effort before changing to the ASCII file and doing something a little simpler. |
||||||||
|
|
|||||||
Wow! It looks like I've missed a lot of the fun! I've been busy entertaining my girlfriend all weekend. Hmm... so should I hazard participation in this project? I may give it a go... at least for awhile. Brian |
||||||||
|
|
|||||||
brian, just don't loose your head like some of us have done. ok, fixed a bug with more than 2 lined multistrings. KixGolf score = 792 cheers, |
||||||||
|
|
|||||||
Brian: Entertaining one's girlfirend is important (I just had friends split up because they didn't take enough time for each other, pretty messy for their kids). It's not too late to join. The first round will run until Wednesday afternoon (or longer if people would like to have more time on it before seeing what others have coded). Right now, you only need to import non-UNICODE files. Also, if a line is not properly formatted (there's one in one of the .REG files) then this line will NOT be processed. you also need to only cover those registry types that are part of the sample .REG files, which are the most common ones. |
||||||||
|
|
|||||||
That's cool. I have a pretty good idea on how to do this.. but under 1000 seems pretty durn good. Brian |
||||||||
|
|
|||||||
Hmm. are you guys using readprofilestring? Just curious.. I'm fiddling around with it because it seems like the easiest way to enumerate items. The only problem is the line breaks with a \. Brian [ 15 July 2002, 16:32: Message edited by: BrianTX ] |
||||||||
|
|
|||||||
brian, you can make it enumerate really shortly (did that) but then comes that... could also open the file... this way, when \ occurs you could read to that line. could get you under 1000... I'm not using it anymore as the handling could get too tricky for my simple mind well, I'm just waiting now if someone has a glance to make shorter code cause I'm pretty much done with mine. if you get the shorter one I can always take one stroke out of it as usual... |
||||||||
|
|
|||||||
I'm not using it either, just straight-forward OPEN-READLINE-CLOSE and some parsing in between |
||||||||
|
|
|||||||
mmm... jens, you better be carefull how many keywords you use or you'll get disqualified by yourself! I might say too that after 48 hours of coding and dissappoinment, you will be glad, if you get it even workin... correctly. |
||||||||
|
|
|||||||
While doing more research, I discovered that: code:MUST have double slashes in order to work... Just a comment.REGEDIT4 Brian |
||||||||
|
|
|||||||
For your information: Keys can have square brackets and quotes inside them (but not '\') In the .REG file they are stored as-is eg [hkcu\...\test[key"for'your]perusal] The value-name / value-content pairs use escape sequences with '\' as the escape character (eg " is \", \ is \\) You should try parsing things like this "string\"quote:1"="first:string\"quote\\d" Spaces are legal between constructs, eg: [hkcu\...] "test1" = dword: 11223344 |
||||||||
|
|
|||||||
are legal... jens, wasn't it enough to work with your example ok, have to test my script again tomorrow against spaces too... must... sleep... |
||||||||
|
|
|||||||
I am really . When view my key "07-13-2002", in Regedit and Regedt32 the Type shows REG_SZ. The input data to the WriteValue command was a variable of type string $D="" (which the VarTypeName was checked on the line preceding the WriteValue command), and "REG_SZ" as the 4th parm. Yet I get an error in Golf.kix because ReadType() returns "REG_NONE". REG_NONE No defined value type. Can anyone shed some light on this? {edit} Just tested the ["b" ] inside the keyname and passed [ 16 July 2002, 04:35: Message edited by: Howard Bullock ] |
||||||||
|
|
|||||||
I use REGDMP and REGINI from the reskit for registry work. They use the same format between NT4 and win2k and don't have all those brackets to worry about. You can also set registry permissions with them. I am not aware of any shortcomings with them, but if anyone knows... cj |
||||||||
|
|
|||||||
I'm at KiXGolf score 1873 and haven't even written to the registry. But I'm using normal variable names, haven't yet shortend them to one-letter ones. I'm successfuly parsing registry keys and registry entries, currently working on the values and regtypes. I'm thinking of extending the deadline to Saturday evening (about 6pm EST). I'm not sure whether I can be online at that time since my in-laws will be in town for the weekend. |
||||||||
|
|
|||||||
KixGolf score = 1184: with the fore-mentioned issue. (using something different) KixGolf score = 1123... KixGolf score = 1151... [ 16 July 2002, 06:13: Message edited by: Howard Bullock ] |
||||||||
|
|
|||||||
hoby, doesn't it feel good, when your score is taking it back up? [ 16 July 2002, 07:22: Message edited by: Lonkero ] |
||||||||
|
|
|||||||
I still have the problem mentioned a few post above. I swapped out the WSH read file for KiX OPEN,READLINE loop for a reduction, but found that I was getting garbage for the last line when I read it all into a variable. A line: quote:seemed to show up. Brain hurt too much to figure it out. So I switched back for the time being. |
||||||||
|
|
|||||||
mmm... so jens, are we ending tomorrow or should I keep minimizing my code the whole week? hoby, you'll get there. just keep on coding cheers, |
||||||||
|
|
|||||||
Guys, I haven't even had time to make some reasonable code... I know a good way to parse the file (at least it seems to be a good way), but I haven't had the time to implement it because I've been EXTREMELY busy at work and at home! (geez.. people sure are demanding these days) So, I would LOVE an extension on this stuff. Here is a hint on the method being formulated in my noggin: (READLINE/FOR/SELECT/ENDSELECT/NEXT for parsing)... Is anyone/everyone else doing it like this? Brian |
||||||||
|
|
|||||||
Brian: I am using all of your functions, too, and additionally RIGHT/LEFT/SUBSTR/ADDKEY/DELKEY/WRITEVALUE So I guess you're on the right way. BTW, I've been very busy, too, unfortunately, and I don't believe I can finish my code til tomorrow either. I know that Lonkero must have pushed his code below the magic 1000-barrier by now (and his # of caffeine-containing-drinks above that same level ) but for the sake of giving everybody a fighting chance, I will now officially extend the deadline for the first part to Saturday, July 20, 6pm EST (midnight BBS time). After this time, everybody can feel free (and is encouraged) to post their code solution even if it is only rudimentary or just a framework. I might not be able to officially announce the beginning of the second round at that time because of a potential family commitment (entertaining the in-laws), but you can just go ahaead and post anyway (preferable as a new thread). [ 16 July 2002, 15:37: Message edited by: sealeopard ] |
||||||||
|
|
|||||||
I used them too. at the time played with some other functions too... but then discovered nice kixtart functions which save a lot of strokes compared to that... no more will I say, just smile: |
||||||||
|
|
|||||||
Brian and AHJ, You are right. When Regedit exports strings containing backslashes they are doubled. An example is this: code:In KiX, the code should be written as:REGEDIT4 code:So to make a fully functional Registry-UDF, we have to remove every second backslash in strings$RC=AddKey('HKEY_CURRENT_USER\Network\E') read from reg-files and substitute every \" with " Another problem is, that equal signs are allowed in both valuenames and stringvalues. Try to make the logic for transforming this regfile to a KiX-script: code:The KiX script should look someting like this:REGEDIT4 code:The problem is the equal sign in the valuename. You can's split the valuename from the value using$RC = AddKey('HKEY_CURRENT_USER\Software\KiXtart\Test') InStr() to find the first equal sign !! There might be other exceptions, but i don't believe we shall count them in during this 'golfmatch'. But the next challenge will be to make a fully functional UDF to take all these 'strange' behaviours into account. -Erik Ps. My KiX-score at this moment is about 2000. Even without the issue of \\ \" and Equal-signs in valuenames, i have never been under 1300 in KiX-score, so i belive i will just step back and wait for the final result Pps. The second 'regfile' is fully legal, working on both Win9x and XP. I can't imagine who should want to make values and valuenames with contents like this. But you never know [ 16 July 2002, 23:56: Message edited by: kholm ] |
||||||||
|
|
|||||||
mmm... so, is it enough that we have code that works with these test scripts or do we have to take to account also these exceptions? \\ i understand but "a=a"="a" gets my head hurt. I just parsed my code to 785 and making addings to it is not easy anymore. |
||||||||
|
|
|||||||
Lonk, I believe that the rules for the tournament is, that new hazards can't be build after playoff. So your script has to handle the regfiles delivered from Jens and nothing more. Maybe Jens can confirm this ? -Erik |
||||||||
|
|
|||||||
wonderful! so I might keep on parsing it... no. I want some competition. just want to see is it hoby or brian the next one entering under M club |
||||||||
|
|
|||||||
I'll be lucky to even get working code at this point. Life is staying pretty busy, so I don't know how much time I'm going to have to work on this. I suppose I'll have to give it a go at some point, just to see if I can come close. Brian |
||||||||
|
|
|||||||
I just noticed that in the latest downloaded zip file I have (Monday, July 15, 2002, 3:23:00 PM) the is a fourth reg file (unicode) and the Golf script includes it in the array of files to process. Is this a change or should I comment this line out? code:$regfilearray[2]=@SCRIPTDIR+'\import3_w2k.reg' |
||||||||
|
|
|||||||
I removed the whole line... {edit} damn! I was supposed to leave this to the afternoon! [ 17 July 2002, 15:19: Message edited by: Lonkero ] |
||||||||
|
|
|||||||
This fourth .REG file (import3.w2k.reg) is NOT part of the challange, I just put it in there to illustrate the UNICODE issue with Windows 2000 exported .REG files. Anyway, the challange only requires you to import the provided .REG files. It doesn't expect you to import any and all types of .REG files. Nevertheless, if anybody would be willing to write a complete UDf for this, then all registry types and escape sequences must be taken into acount. |
||||||||
|
|
|||||||
I wonder... I'm still messing with parsing the file... only about half way through with that (I think) and already at 270ish... I'm wondering if Lonkero conquered a method to use the READPROFILESTRING instead.. hmmm. Brian |
||||||||
|
|
|||||||
brian, readprofilestring has one take down: it's call is long. and if you use it with execute, execute is long. brian, let's say that I started other way than many others of you. that's why my starting code was just 611. then added some functioning to small script was not so big case. well, it was. head hurted and so on... but, I quess I'm the one who still has spent the longest time with this golf. even now when I haven't been looking to my code for a while. |
||||||||
|
|
|||||||
Well, my first stab at it is 1057. I haven't fully tested it nor simplified the code much. Brian |
||||||||
|
|
|||||||
I was correct. there is two dudes that can come close and brian can maybe even overcome me... brian, once you get under 1000, I'm forced to cut me code. until that, keep on working! |
||||||||
|
|
|||||||
I doubt it.. It mostly works, but I haven't built in support for arrays nor figured out the "bug" you guys were talking about (which causes validation errors). Although i see several ways to reduce the code once I finish all that. Brian {edit} I'm tempted to try the READPROFILESTRING method... I'm thinking I could get tighter code with it. {edit} Ok.. should pass validation...except no support for arrays, yet. {edit} Ok.. supports arrays. I probably wont' have time to work on this until tomorrow.. so.. I'll take some more stabs at it then... 1160 is the score... I'm sure I can shave quite a bit.. but for now it's working with the validation script even. [ 18 July 2002, 00:05: Message edited by: BrianTX ] |
||||||||
|
|
|||||||
mmm... btw, it takes 3o strokes to add support for all registry types. I quess the final udf can be under 1000... |
||||||||
|
|
|||||||
Down to 1079.... It was probably more robust before, but to handle the .reg files from Jens, I could cut out some stuff. Brian {edit} make that 1066 -- no issues with the .reg files Jens presented. {edit} make that 1050... [ 18 July 2002, 16:51: Message edited by: BrianTX ] |
||||||||
|
|
|||||||
KixGolf score = 1036 Still trying to resolve the issue where REG_NONE is returned from Kix ReadType() when Regedit and Regedt32 say it is REG_SZ. |
||||||||
|
|
|||||||
KixGolf score = 969 Report from UDF-checker: The UDF ImportRegFile passed the validation test. Please do not forget to post your KiXtart Golf score. BUT: The script dosn’t handle exeptions like : \” \\ end eqal signs in valuenames, and there is no errorchecking at all. (I have a second script with exeptionhandling, the score for that is: 1538) Scores counted with Howard’s KixGolf scoring script. -Erik |
||||||||
|
|
|||||||
kholm, you don't seem a starter at all. good to have company... quess I have to start working on the parsing... I understood that those special cases are not needed... I understood, it's enough functionality if it works with the test scripts. like it does not need deletion of value |
||||||||
|
|
|||||||
Erik: Nice job. BTW, it's okay if there's no error checking and if it doesn't handle all registry types and escape sequences. As long as it fulfills the challange requirements (importing the provided .REG files), ity is a valid script. However, a UDF to replace REGEDIT would of course need error checking and be able to parse all registry tyes and escape sequesnces and handle odd formatting. |
||||||||
|
|
|||||||
Lonkero, You are right, there is no code to check if the value String2 is deleted (I belive Jens has forgotten that ) If I omit the code for deleting values, my score is: 926, but i’m not shure if that would be considered as job done. -Erik |
||||||||
|
|
|||||||
I'm down to 1025 so far... still working on it, though. Brian |
||||||||
|
|
|||||||
jens, do we need to delete values? I will get 10-15 hits more if we do... |
||||||||
|
|
|||||||
Erik: At least you found out that the vaule needs to be deleted. The checking routine was just put into the code to make it easier to verify all the registry edits. It's not totally comprehensive. |
||||||||
|
|
|||||||
I beat you all. Mine deleted the value properly on Sunday. I still can't understand why Regedit and Regedt32 tell I all correct and ReadType cause the error checking code to report errors because ReadType returns REG_NONE |
||||||||
|
|
|||||||
Not sure either. I basically copied the reg types from REGEDIT into the test script. After applying the .REG files with REGEDIT and running the test script it did tell me everything is okay. Maybe REGEDIT is doing something after the delete operation? |
||||||||
|
|
|||||||
well... how it can work for others? |
||||||||
|
|
|||||||
Howard, I believe that your script is not stripping of the double hyphens. You are using: '"Created 07-13-2002"' as entryname in WriteValue() You Should use: 'Created 07-13-2002' The ReadType() statement looks for an entry with this name: Created 07-13-2002 That dosn't exist beacuse you have created an entry named: "Created 07-13-2002" I have just checked, if you use ReadType() on a nonexisting entry then it reports: REG_NONE (And @Error = 2) -Erik |
||||||||
|
|
|||||||
OK... i'm at 939... Might still be able to shave some.. {edit} includes deleting keys/values... Brian Lonkero, what is your score? [ 18 July 2002, 23:45: Message edited by: BrianTX ] |
||||||||
|
|
|||||||
I haven't added deletion of value as thought it was not needed. the current score without it is in some post before... something like 900 cheers, |
||||||||
|
|
|||||||
Let me know.. I'm approaching 900... {edit} I'm at 927 and done for the day... I think.. Brian [ 19 July 2002, 00:03: Message edited by: BrianTX ] |
||||||||
|
|
|||||||
I know, but I don't have any wintosh system at home so can't compete. my code has been done for a while so don't know I can make my head to it anymore. anyway, I have to add that delvalue code tomorrow and that obviously adds the code size. heh, we probably end up with same code with only diff being the var names. |
||||||||
|
|
|||||||
My score now is 933 And unless i get really inspired i belive that only a few bytes can be cut of. I'm not sure what to do with the eronious value that has been mentioned on several ocasions (Missing comma) My regfile from the downloaded zip-file dosn't contanin any errors, if any of you check for that i'm truly out. {edit} Now 921 [ 19 July 2002, 00:17: Message edited by: kholm ] |
||||||||
|
|
|||||||
now I'm feeling sad I didn't take my laptop at home. dudes, go to sleep! this is not fare!!!! |
||||||||
|
|
|||||||
What erroneous value? I don't have a problem with any of mine. The golf.kix script says I got it right... I can probably shave a few more strokes, though, although I don't really have time right now. Enjoy! Brian |
||||||||
|
|
|||||||
brian, does your script remove values correctly? the golf kix says to my script it's ok but jens says something that also values marked for deletion needs to be deleted. |
||||||||
|
|
|||||||
Brian, AHJ posted this quote:And i have seen mentioned by Jens (The tournament master ) that this is by intend, AND it shouldn’t be imported. If this has to be checked i wil have to add 20 points to my last scorechart. Still no errorchecking, score is now: 908 I get a lot of 000000000000 on my screen AND the please post message -Erik ps. Special for you Lonkero: My script removes values as intended. |
||||||||
|
|
|||||||
Yes.. the ones marked for deletion are: "name"=- and [-HKLM\etc\etc\etc] Mine deletes them fine. I also get the 0000000, etc. message. The golf.zip file I downloaded had no such error( nor the binary1 value even).. So, I didn't realize it was an issue. P.S. It's a little hard to do this if there are different versions of the files... Brian [ 19 July 2002, 01:34: Message edited by: BrianTX ] |
||||||||
|
|
|||||||
I reckon we should change the scoring system to give each command and variable a point each, rather than per length. The per length scoring system gives EXPANDENVIRONMENTVARS more points than GO for no reason. To improve your score, you can make a UDF called A that contains your WRITEPROFILESTRING function and get a lower score. I think this goes against the whole concept/principle of golf by allowing a more complicated script to score better than a simpler one. I propose that we change the scoring system to count keywords and variables instead, allowing a better indication of cleaner coding to show. This would also allow more meaningful variable names, increasing code readability. my 2c cj [ 19 July 2002, 07:08: Message edited by: cj ] |
||||||||
|
|
|||||||
erik, I think jens said that misspelled data does not have to be cared of. this means two things: the value may not get in. the value may go in. my script writes that value in just fine and I'm not going to drop it out and get 50 more hits by it. as we don't need to make errorchecking or datavalidation of any type. |
||||||||
|
|
|||||||
cj, in your example "if you write a UDF 'A' and call it your get a lower score" is not correct. If you write a UDF, you have to include the code of that UDF as well. [ 19 July 2002, 08:27: Message edited by: Howard Bullock ] |
||||||||
|
|
|||||||
KixGolf score = 828 sh*t! adding the delvalue code added 43 strokes!!! (reference 785 from post "posted 17 July 2002 00:13" at page 4) not funny anymore let's get some coffee and smoke a cigarette and find out what the heck is wrong... |
||||||||
|
|
|||||||
CJ, I agree. Counting varnames as one point would also make the use of $ alone as varname obsolete. It would also be nice if decaring vaiables using Dim and Global were free. Right now i’m making a script that breakes all my own principles. I use nondescriptive varnames and reuse varibles for different purposes, which i would never do ’in the real world’ The backside of imlying new rules is that it wil be very difficult to count the points. As for the function idea for long command names, i belive that if you have to use writeprofilestring more than 3 times in your script you would start to improve your score by creating a function for it. -Erik ps. My score is now: 878 (And the script is nearly impossible to understand) |
||||||||
|
|
|||||||
cutting characters is not easy anymore. KixGolf score = 823 {edit} make that: KixGolf score = 813 now: KixGolf score = 811 now I can go again for cigarette: KixGolf score = 805 came back took some coffee and: KixGolf score = 801 [ 19 July 2002, 13:59: Message edited by: Lonkero ] |
||||||||
|
|
|||||||
I think I should start working now. anyway, got some magic here: KixGolf score = 799 {edit} oh... I forgot to parse one line... KixGolf score = 786 [ 19 July 2002, 14:57: Message edited by: Lonkero ] |
||||||||
|
|
|||||||
I like the scoring system as is because it challanges you to think differently ('Think outside the bun', Taco Bell commercial), now it's not about beautiful code, or self-explanatory code. It's about optimizing as much functionality into a single line as possible. Of course, this also makes it harder to read/understand the script, but that's part of the challange. |
||||||||
|
|
|||||||
Somehow I seem to stay 100 behind you Lonkero.. I'm only at 893 so far.. (Of course, I've only been working on this for a couple days!) Brian [ 19 July 2002, 18:24: Message edited by: BrianTX ] |
||||||||
|
|
|||||||
brian, now you know how it felt with golf III! man, I've been so happy at work after I got it under 800... I'm like flying. |
||||||||
|
|
|||||||
I'm only down to 888.. so far... {edit} 869 {edit} 861 {edit} 853.. It's getting harder to make smaller... {edit} 840 {edit} 829 {edit} 814 -- 30 more to go. lol.. for now. {edit} 808 {edit} 798 Brian [ 19 July 2002, 21:40: Message edited by: BrianTX ] |
||||||||
|
|
|||||||
Ok... I have successfully shaved it down to: 773 I don't know if I can save any more strokes, but this is where it stands so far! Brian {edit} 766 [ 19 July 2002, 22:37: Message edited by: BrianTX ] |
||||||||
|
|
|||||||
bastard. I tell my mom! I have to change my logic if I want to cut more than 2 strokes!!!! ok, let's put up a fight. laptop, on... |
||||||||
|
|
|||||||
I'm looking forward to see the winning script. I gave up at about 1200 i thougt, anyway i have tweaked it to 848 now, so i'm still in the medals -Erik |
||||||||
|
|
|||||||
I bet Howard will surprise us and post a nice score just before time's up... Brian P.S. Now at 761. {edit} 756 {edit} 753 {edit} I can get it to 749, but I'm not going to unless challenged... (It appears I'm being challenged! lol) [ 19 July 2002, 23:13: Message edited by: BrianTX ] |
||||||||
|
|
|||||||
has anyone heard about hoby? haven't got his current score... |
||||||||
|
|
|||||||
ok, got it to 773 but you have made it already lower... continuing... {edit} 760 [ 19 July 2002, 23:12: Message edited by: Lonkero ] |
||||||||
|
|
|||||||
I wish I didn't have to handle array input.. it would shave about 50 strokes.. maybe get me under 700. Brian {edit} now at 748.. should I quit, yet, Jooel? {edit} 744 {edit} 740 Question to Jens: I have assumed there will be no \'s in values. I have also assumed there will be no errors in values. I have also assumed there will be nothing like "="="hi" for registry entries. For the purposes of this competition, are these assumptions okay? Brian {edit} Assuming there are no "=" in the registry keys, I have shaved my score to 736. Brian [ 19 July 2002, 23:46: Message edited by: BrianTX ] |
||||||||
|
|
|||||||
I need a manual... |
||||||||
|
|
|||||||
Last improvement 61 Now at 787 Can i do that again ??? -Erik |
||||||||
|
|
|||||||
Ok. I'm stopping at 736.. I don't see anything to do.. tired of scratching my head. Maybe I'll check back later to see if anyone has cracked that. Otherwise, I'm done! Brian |
||||||||
|
|
|||||||
I did reorganize the whole thing... I mean structurally it was whole new case. quess what score I got? 760, the one I had before and it was even harder to understand it! |
||||||||
|
|
|||||||
heh. I did change one keyword and got it to 759. then parsed my code other way around and parsed and parsed and final was 759! |
||||||||
|
|
|||||||
I hope I won't get laughed at for saying 842 (removed error checking after downloading new test files) |
||||||||
|
|
|||||||
I won't laugh at ya. I used a few tricks to get it down to 736... Pity me if I didn't figure out those few tricks! Brian |
||||||||
|
|
|||||||
I was just going to reply something similar but then some bloody woman took my attension... brian is a leader now... really clearly and he was today at same score as you. if I remember correctly, I was never over 828 so I should be able also to parse my code... to something like 600 but I'm not. you having under 900 is already a great victory as jens has not got under 1000 even though he is the host! |
||||||||
|
|
|||||||
No laughing, I'm down/up to 779 now and at the end of the rope. Keep up trying, i'm getting curious to see the result. -Erik [ 20 July 2002, 03:08: Message edited by: kholm ] |
||||||||
|
|
|||||||
I tried with some case stuff and it got me up to 8?? so, if you're using it, with other means you might come closer... or even ahead of me. |
||||||||
|
|
|||||||
I've tried after trying... I can't cut even 1 out of 759 |
||||||||
|
|
|||||||
Sorry guys. I am dissappointment this go around. I thought I was going to to have a respectable score with my approach but hit some M$ limitations or just lack of knowledge of the M$ implimentation of my selected approach. and damn those long WSH object names. C:\Data\Scripts\Golf>C:\Data\Kix2001\KiX2001.410\kix32 golf5a.kix check for all registry keys Errors:0 check for registry value types in import1:0 check for registry value types in import2:0 check for registry value types in import3:0 check for registry values in import1:0 check for registry values in import2:0 check for registry values in import3:0 The UDF ImportRegFile passed the validation test. Please do not forget to post your KiXtart Golf score. KixGolf score = 918 I am still looking for that magic edit.... |
||||||||
|
|
|||||||
heh... been fighting with this stuff all day. got of 3 score is 756 {edit} 2 hours got 753 just can't cut it more... I quess brians winned this time too. [ 20 July 2002, 21:05: Message edited by: Lonkero ] |
||||||||
|
|
|||||||
ok... at 750 I start to think about what jens said that he can't end this part one. I think this goes on until someone opens the part 2 and I'll keep parsing my code... {edit} 737 {edit2} KixGolf score = 735 [ 20 July 2002, 22:33: Message edited by: Lonkero ] |
||||||||
|
|
|||||||
You actually got it to 735? Brian |
||||||||
|
|
|||||||
yep... have been with my laptop from morning... 10 hours... but, score is now 734 |
||||||||
|
|
|||||||
Hmm.. well, umm.err. i'm down to .. umm. err. 730! Brian |
||||||||
|
|
|||||||
Ok... scratch that... I'm actually down to..... 716 Can you squeak any more, Lonkero? Brian |
||||||||
|
|
|||||||
It looks like time is up as of right now. My score is 716. I'm going to create a new topic and post my UDF.. Brian |
||||||||
|
|
|||||||
Howard, What Erik says is true. Making a UDF of a long named command only gives you a benefit when you use the command more than 3 or so times. eg: code:scores 236$=writeprofilestring("c:\filename", "section", "key", "value") versus code:scores 202function a($section, $key, $value) each line in the first program scores 59, so after 3 of them, the UDF becomes more economical. Erik, it would be harder, but not impossible, to make a script to count. I wrote a script that converts KiX code to coloured HTML by doing a lookup of the valid KiX commands. It is too old to use now, but the principle is sound. KiX uses space and CRLF as command separators, so using SPLIT with these 2 as delimiters makes parsing a KiX script relatively easy... cj |