Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


Weekly/Monthly Challenge?

 
Logged in as: Guest
arrSession:exec spGetSession 2,9,47585
 Active Users: There are 0 members and 0 guests.
 Users viewing this topic: none
 

 

 
  
  Printable Version
All Forums >> [General Forum] >> Off-Topic Lounge >> Weekly/Monthly Challenge?
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: [1] 2 3   next >   >>
Login
Message << Older Topic   Newer Topic >>
 Weekly/Monthly Challenge? - 5/25/2007 1:08:00 AM   
  mcds99


Posts: 395
Score: 4
Joined: 2/28/2006
Status: offline
With the mass of talent (not me) in this forum I was thinking it might be fun to have a contest of sorts.
I come up with these ideas (stupid at times) and have no idea how to go about doing anything about them.

There would have to be 3 or 4 skill levels because for me to compete against ehvbs, dm_4ever, or DiGITAL.SkReAM would be funny at best ;-)
Obviously I'm not skilled enough to put something like this on.

I just thougt it might be a way to promote the forum and educate people on VBS. People come here for answers, this would help people
provide answers, learn to solve script problems and become better scripters.

_____________________________

Sam

Keep it Simple Make it Fun KiSMiF
 
 
Post #: 1
 
 RE: Weekly/Monthly Challenge? - 5/25/2007 1:21:30 AM   
  ebgreen


Posts: 4411
Score: 29
Joined: 7/12/2005
Status: offline
I think it would be fun. Have you looked at the Scripting Games that the Scripting Guys do at MS's Script Center?

_____________________________

"... when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick
Goog places to start:http://www.visualbasicscript.com/m_24727/tm.htm
http://www.visualbasicscript.com/m_47117/tm.htm

(in reply to mcds99)
 
 
Post #: 2
 
 RE: Weekly/Monthly Challenge? - 6/11/2007 2:06:31 AM   
  ehvbs

 

Posts: 1843
Score: 46
Joined: 6/22/2005
From: Germany
Status: offline
I do like mcds99's proposal. If you like my sample for a challenge:

   According to the VBScript Docs ("VarType Constants") there are
   these subtypes of variants in VBScript:
   
   vbEmpty         0 Uninitialized (default)
   vbNull          1 Contains no valid data
   vbInteger       2 Integer subtype
   vbLong          3 Long subtype
   vbSingle        4 Single subtype
   vbDouble        5 Double subtype
   vbCurrency      6 Currency subtype
   vbDate          7 Date subtype
   vbString        8 String subtype
   vbObject        9 Object
   vbError        10 Error subtype
   vbBoolean      11 Boolean subtype
   vbVariant      12 Variant (used only for arrays of variants)
   vbDataObject   13 Data access object
   vbDecimal      14 Decimal subtype
   vbByte         17 Byte subtype
   vbArray      8192 Array
  
   Given the array:
  
       Dim aTests : aTests = Array( 1, "test" )
  
   The line:
  
       WScript.Echo Join( aTests, vbTab )
  
   will output:
  
       1   test
  
   but if you add an object to aTests:
  
       Dim aTests : aTests = Array( 1, "test", New RegExp )
  
   you'll get an error like:
  
       Das Objekt unterstützt diese Eigenschaft oder Methode nicht.
       (The object doesn't support this method or property)
  
   The challenge: Create an Array aTest with at least one sample for
   each possible subtype and write a
  
       Function JoinX( aArr, sSep )
  
   that does what Join() should have done in the first place.
  
and we could reach an agreement regarding the way to post such
challenges (and the - hopefully - many answers), I'd gladly do
my best to keep you challenged.

ehvbs

(in reply to mcds99)
 
 
Post #: 3
 
 RE: Weekly/Monthly Challenge? - 6/12/2007 7:58:25 PM   
  ginolard


Posts: 965
Score: 21
Joined: 8/10/2005
Status: offline
I think the first challenge should be to get ehvbs to reply to someone in less than 3 lines



_____________________________

Author of ManagePC - http://managepc.net
AD Query Template - http://www.visualbasicscript.com/m_40609/tm.htm
Consolidated Scripting Framework - http://www.visualbasicscript.com/m_59109/tm.htm

(in reply to ehvbs)
 
 
Post #: 4
 
 RE: Weekly/Monthly Challenge? - 6/13/2007 1:41:12 AM   
  ebgreen


Posts: 4411
Score: 29
Joined: 7/12/2005
Status: offline
I was looking at this but I can't determine how to get a couple of the data types. Is anyone else looking at it?

_____________________________

"... when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick
Goog places to start:http://www.visualbasicscript.com/m_24727/tm.htm
http://www.visualbasicscript.com/m_47117/tm.htm

(in reply to ginolard)
 
 
Post #: 5
 
 RE: Weekly/Monthly Challenge? - 6/13/2007 2:41:57 AM   
  ehvbs

 

Posts: 1843
Score: 46
Joined: 6/22/2005
From: Germany
Status: offline
Hi ebgreen,

of course I'm looking at it! I appreciate your interest. This is the code I use
to get sample data in a systematic/flexible way:


      

I hope, this time I am lucky and get some further feedback!

ehvbs

(in reply to ebgreen)
 
 
Post #: 6
 
 RE: Weekly/Monthly Challenge? - 6/13/2007 4:43:30 AM   
  ebgreen


Posts: 4411
Score: 29
Joined: 7/12/2005
Status: offline
Here is what I was working with:


      

I think I will move onto the JoinX question now.

_____________________________

"... when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick
Goog places to start:http://www.visualbasicscript.com/m_24727/tm.htm
http://www.visualbasicscript.com/m_47117/tm.htm

(in reply to ehvbs)
 
 
Post #: 7
 
 RE: Weekly/Monthly Challenge? - 6/13/2007 7:48:36 AM   
  ehvbs

 

Posts: 1843
Score: 46
Joined: 6/22/2005
From: Germany
Status: offline
Hi ebgreen,

some short remarks (trying to do it in 3 lines netto)

(1) oErr = Err  => Set oErr = Err (?)

(2) On Error GoTo 0 missing (?)

(3) Is "ADOConnectObject.ADOConnectObject" valid (?)

Looking forward to your XJoin()!

ehvbs

(in reply to ebgreen)
 
 
Post #: 8
 
 RE: Weekly/Monthly Challenge? - 6/13/2007 3:07:06 PM   
  dm_4ever


Posts: 1944
Score: 30
Joined: 6/29/2006
From: Orange County, California
Status: offline
ginolard - , ehvbs overwhelms me sometimes with his long posts...I'd be afraid to see extremely concise explanations or code from him...so it's good where he's at...at least this way after reading and looking for a few minutes it makes sense to me.

I wanted to take a crack at this but wasn't sure how to handle those types that can't be echoed out...looking at the examples by ebgreen and ehvbs (who I think gave a lot away)...this is what I have so far.


      

_____________________________

dm_4ever

My philosophy: K.I.S.S - Keep It Simple Stupid
Read Me: http://www.visualbasicscript.com/m_24727/tm.htm
Frequently Asked Stuff: http://www.visualbasicscript.com/m_47117/tm.htm

(in reply to ehvbs)
 
 
Post #: 9
 
 RE: Weekly/Monthly Challenge? - 6/20/2007 8:54:41 AM   
  ehvbs

 

Posts: 1843
Score: 46
Joined: 6/22/2005
From: Germany
Status: offline
[shameless attempt to get some attention for this topic]

This looks like becoming a yearly challenge!

[no offense meant]

(in reply to dm_4ever)
 
 
Post #: 10
 
 RE: Weekly/Monthly Challenge? - 6/20/2007 6:00:54 PM   
  ginolard


Posts: 965
Score: 21
Joined: 8/10/2005
Status: offline
Well, I'm a bit closer than you guys.  Using the Arraylist .NET object you can return objects

However, for some reason, it doesn't like the Currency vartype.

UPDATE: Fixed that little problem by simply copying the DataList to an array and adding the Currency vartype at the end of the array.

What do I win? ;)


      

< Message edited by ginolard -- 6/20/2007 6:58:58 PM >


_____________________________

Author of ManagePC - http://managepc.net
AD Query Template - http://www.visualbasicscript.com/m_40609/tm.htm
Consolidated Scripting Framework - http://www.visualbasicscript.com/m_59109/tm.htm

(in reply to ehvbs)
 
 
Post #: 11
 
 RE: Weekly/Monthly Challenge? - 6/21/2007 4:22:15 AM   
  ehvbs

 

Posts: 1843
Score: 46
Joined: 6/22/2005
From: Germany
Status: offline
Hi all ye worthy contenders!

The most important question first:

(1) The price: If we get some more interesting/inspiring contributions I would send
     to the winner (determined by a poll (?) or mutual consense): A German book
     about VBScript for Beginners with a dedication/devotement signed by me stating
     that the winner doesn't need the book

(2) Looks like sample data for all types can be fabricated now: the literals Empty,
     Null und Nothing come handy; the global Err object can be use directly (but see
     (3)); "CDate(Now())" seems a bit tautologous to me

(3) Did you spot that for the Err object the TypeName is object but the VarType
     is 3 (Long)? That came as a nasty surprise for me!

(4) Decimal isn't supported by VBScript, so I wouldn't reject a JoinX() that skips
     this data type; I believe that ginolard's roundabout way via .NET changed
     his VBScript Currency variable into a Decimal - but I'm not sure

(5) dm_4ever started with the concatenation functionality. Good start, but it
     looks very complicated to me - isn't there a more simple way? - remember
     you'll have to cope with an Array containing an Array containing ...
    
(6) As to the escape (?) to .NET: We (ok - I) want a function JoinX() that can
     be used as easily as Join(). We (ok - I) wouldn't like the necessity to convert
     my VBScript arrays to .NET Arraylists. I would renege on this statement if
     somebody can show/prove that the Arraylist can be joined without further
     programming, like sJoined = DataList.Join( ", " ).

Looking forwards to more interesting ideas and code!

ehvbs

(in reply to ginolard)
 
 
Post #: 12
 
 RE: Weekly/Monthly Challenge? - 6/21/2007 7:17:13 AM   
  ginolard


Posts: 965
Score: 21
Joined: 8/10/2005
Status: offline
Bah - now he's moving the goalposts!

;)

_____________________________

Author of ManagePC - http://managepc.net
AD Query Template - http://www.visualbasicscript.com/m_40609/tm.htm
Consolidated Scripting Framework - http://www.visualbasicscript.com/m_59109/tm.htm

(in reply to ehvbs)
 
 
Post #: 13
 
 RE: Weekly/Monthly Challenge? - 6/21/2007 7:26:06 AM   
  ehvbs

 

Posts: 1843
Score: 46
Joined: 6/22/2005
From: Germany
Status: offline
Hi ginolard,

that wasn't my intention. Could you give me a hint about the movement -
I will try to make myself clear(er).

ehvbs

(in reply to ginolard)
 
 
Post #: 14
 
 RE: Weekly/Monthly Challenge? - 6/21/2007 7:02:13 PM   
  ginolard


Posts: 965
Score: 21
Joined: 8/10/2005
Status: offline
Well, not allowing DataLists....I thought I was on to a winner there ;)

_____________________________

Author of ManagePC - http://managepc.net
AD Query Template - http://www.visualbasicscript.com/m_40609/tm.htm
Consolidated Scripting Framework - http://www.visualbasicscript.com/m_59109/tm.htm

(in reply to ehvbs)
 
 
Post #: 15
 
 RE: Weekly/Monthly Challenge? - 6/22/2007 2:02:24 AM   
  ebgreen


Posts: 4411
Score: 29
Joined: 7/12/2005
Status: offline
I have not had much time to look at this, but it did remind me of something that I wrote a very long time ago. I wrote this code when I was learning VBScript so that I could understand dictionaries. It doesn't directly have to do with joining arrays, but the recursive approach that it takes could be a useful point in a possible direction for someone with more time than I have right now.


      

_____________________________

"... when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick
Goog places to start:http://www.visualbasicscript.com/m_24727/tm.htm
http://www.visualbasicscript.com/m_47117/tm.htm

(in reply to mcds99)
 
 
Post #: 16
 
 RE: Weekly/Monthly Challenge? - 6/23/2007 12:54:36 PM   
  DiGiTAL.SkReAM


Posts: 1056
Score: 6
Joined: 9/6/2005
From: Florida, USA
Status: offline
I've gotta admit, I'm completely lost as to what you are looking for, ehvbs.
First off, all variables are type variant in vbs.  Never heard of 'subtypes'.

It sounds like you are looking for some kind of recursive element-testing function, that tests each element in an array to see if that element is an array itself.  If it is, it tests each of those elements, etc.  And then it joins each array/element together.


      

Is that what you are looking for?  I am unsure as all this talk of subtypes has made me somewhat dizzy.

_____________________________

"There's the one man who learns by reading, the two men that learn by watching, and the rest of us have to pee on the electric fence for ourselves." - Roy Rogers

"Would you like to touch my monkey?" - Dieter (Mike Meyers)

(in reply to ebgreen)
 
 
Post #: 17
 
 RE: Weekly/Monthly Challenge? - 6/24/2007 4:43:48 AM   
  dm_4ever


Posts: 1944
Score: 30
Joined: 6/29/2006
From: Orange County, California
Status: offline
I have to admit I am a bit confused as to what the expected output should be as well.

DiGiTAL.SkReAM, I like the way you used the dictionary to build the new array and join it...decided to change mine to use the same technique

So after changing a few things....


      

_____________________________

dm_4ever

My philosophy: K.I.S.S - Keep It Simple Stupid
Read Me: http://www.visualbasicscript.com/m_24727/tm.htm
Frequently Asked Stuff: http://www.visualbasicscript.com/m_47117/tm.htm