[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

RubyConf2004 - list of attendees' interests

Rob

9/28/2004 3:48:00 AM

RubyConf2004 attendees, let's give serendipity a hand.

If attendees add themselves and their interests to the following wiki
page, we'll find it easier to meet up during the conference:

http://www.rubygarden.org/ruby?RubyConf...

Cheers,
Rob

__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail...


6 Answers

James Britt

9/28/2004 4:21:00 AM

0

Rob wrote:

> RubyConf2004 attendees, let's give serendipity a hand.
>
> If attendees add themselves and their interests to the following wiki
> page, we'll find it easier to meet up during the conference:
>
> http://www.rubygarden.org/ruby?RubyConf...

Nice idea. Just added me self.

James

But the wiki home page has been spammed again :(



Matt Lawrence

9/28/2004 4:25:00 AM

0

Gavin Sinclair

9/28/2004 4:33:00 AM

0

On Tuesday, September 28, 2004, 2:21:04 PM, James wrote:

> But the wiki home page has been spammed again :(

What a surprise. Jim Weirich has patched his instance of UseModWiki
to only allow links to external websites where the HTTP capitalised.

E.g. (1) is accepted but (2) is rejected.

(1) HTTP://rubyforge.org
(2) http://rub...

Perhaps this patch could be incorporated into the RubyGarden wiki.
It's sure to prevent a lot of spam.

Patch found here:

http://onestepback.org/index.cgi/General/CautiouslyOptim...

Gavin



Anthony Jones

10/2/2007 10:46:00 AM

0

"scott" <sbailey@mileslumber.com> wrote in message
news:eXFedyDBIHA.1356@TK2MSFTNGP03.phx.gbl...
> From looking at the xml structure, it looks like sorting the src attribute
> would be about the only thing that I could sort by. If I could sort that,
> then at least the artists would be in order within the playlist.
>
>


I'm not sure where ASP fits into all this however here is a VBScript that
will do the sort based on the src attribute:-

Dim oDOM
Dim oSeq
Dim arrMedia
Dim i

Set oDOM = CreateObject("MSXML2.DOMDocument.3.0")
oDOM.load "g:\temp\test.smil"

Set oSeq = oDOM.selectSingleNode("/smil/body/seq")

ReDim arrMedia(oSeq.childNodes.length - 1)

For i = 0 To UBound(arrMedia)
Set arrMedia(i) = oSeq.childNodes(i)
Next

ShellSortObj arrMedia, GetRef("Comparator")

For i = 0 To UBound(arrMedia)
oSeq.appendChild arrMedia(i)
Next

oDOM.save "g:\temp\test2.smil"

Function Comparator(roLeft, roRight)
Comparator = roLeft.getAttribute("src") > roRight.getAttribute("src")
End Function

Sub ShellSortObj(rarr, fnCompare)

Dim i, j
Dim distance
Dim tmpValue
Dim lCount

lCount = UBound(rarr) + 1

distance = 0
Do
distance = distance * 3 + 1
Loop Until distance > lCount

Do
distance = distance \ 3
For i = distance To lCount - 1
If fnCompare(rarr(i - distance), rarr(i)) Then
j = i
Set tmpValue = rarr(j)
Do
Set rarr(j) = rarr(j - distance)
j = j - distance
If j + 1 <= distance Then Exit Do
Loop While fnCompare(rarr(j - distance), tmpValue)
' move the data back in the array
Set rarr(j) = tmpValue
End If
Next
Loop Until distance <= 1

End Sub

Note the at its the comparator function that defines the basis for sort. So
with a few utlity functions:-

Function GetFolder(FilePath)

Dim lLastSlash

lLastSlash = InStrRev(FilePath, "\")

If lLastSlash > 0 Then
GetFolder = Left(FilePath, lLastSlash - 1)
End If

End Function

Function GetTrackNo(FileName)

Dim lLastSlash
Dim lLastDot
Dim sFileTitle

lLastSlash = InStrRev(FileName, "\")
lLastDot = InStrRev(FileName, ".")

sFileTitle = Mid(FileName, lLastSlash + 1, lLastDot - lLastSlash - 1)

GetTrackNo = CInt(Right(sFileTitle, 2))

End Function

We can change the comparator to:-

Function Comparator(roLeft, roRight)

Dim sLeftFolder
Dim sRightFolder
Dim sLeftTrackNo
Dim sRightTrackNo

sLeftFolder = GetFolder(roLeft.getAttribute("src"))
sRightFolder = GetFolder(roRight.getAttribute("src"))

If sLeftFolder = sRightFolder Then
sLeftTrackNo = GetTrackNo(roLeft.getAttribute("src"))
sRightTrackNo = GetTrackNo(roRight.getAttribute("src"))
Comparator = sLeftTrackNo > sRightTrackNo
Else
Comparator = sLeftFolder > sRightFolder
End If

End Function

Now it will sort by folder then by track number. Hence a sensible folder
structure which has a folder per artist in which there is a folder per album
will sort quite nicely.

You (or other readers) might be tempted to optimize the code (sort oriented
questions tends to bring that desire out of people) but don't in the real
world the performance of thsi code is perfectly adequate.


--
Anthony Jones - MVP ASP/ASP.NET


scott

10/2/2007 4:21:00 PM

0

I assume that "g:\temp\test.smil" should be my playlist path. What does the
path in the below line represent?

Set oSeq = oDOM.selectSingleNode("/smil/body/seq")


"Anthony Jones" <Ant@yadayadayada.com> wrote in message
news:ebqyjFOBIHA.1212@TK2MSFTNGP05.phx.gbl...
> "scott" <sbailey@mileslumber.com> wrote in message
> news:eXFedyDBIHA.1356@TK2MSFTNGP03.phx.gbl...
>> From looking at the xml structure, it looks like sorting the src
>> attribute
>> would be about the only thing that I could sort by. If I could sort that,
>> then at least the artists would be in order within the playlist.
>>
>>
>
>
> I'm not sure where ASP fits into all this however here is a VBScript that
> will do the sort based on the src attribute:-
>
> Dim oDOM
> Dim oSeq
> Dim arrMedia
> Dim i
>
> Set oDOM = CreateObject("MSXML2.DOMDocument.3.0")
> oDOM.load "g:\temp\test.smil"
>
> Set oSeq = oDOM.selectSingleNode("/smil/body/seq")
>
> ReDim arrMedia(oSeq.childNodes.length - 1)
>
> For i = 0 To UBound(arrMedia)
> Set arrMedia(i) = oSeq.childNodes(i)
> Next
>
> ShellSortObj arrMedia, GetRef("Comparator")
>
> For i = 0 To UBound(arrMedia)
> oSeq.appendChild arrMedia(i)
> Next
>
> oDOM.save "g:\temp\test2.smil"
>
> Function Comparator(roLeft, roRight)
> Comparator = roLeft.getAttribute("src") > roRight.getAttribute("src")
> End Function
>
> Sub ShellSortObj(rarr, fnCompare)
>
> Dim i, j
> Dim distance
> Dim tmpValue
> Dim lCount
>
> lCount = UBound(rarr) + 1
>
> distance = 0
> Do
> distance = distance * 3 + 1
> Loop Until distance > lCount
>
> Do
> distance = distance \ 3
> For i = distance To lCount - 1
> If fnCompare(rarr(i - distance), rarr(i)) Then
> j = i
> Set tmpValue = rarr(j)
> Do
> Set rarr(j) = rarr(j - distance)
> j = j - distance
> If j + 1 <= distance Then Exit Do
> Loop While fnCompare(rarr(j - distance), tmpValue)
> ' move the data back in the array
> Set rarr(j) = tmpValue
> End If
> Next
> Loop Until distance <= 1
>
> End Sub
>
> Note the at its the comparator function that defines the basis for sort.
> So
> with a few utlity functions:-
>
> Function GetFolder(FilePath)
>
> Dim lLastSlash
>
> lLastSlash = InStrRev(FilePath, "\")
>
> If lLastSlash > 0 Then
> GetFolder = Left(FilePath, lLastSlash - 1)
> End If
>
> End Function
>
> Function GetTrackNo(FileName)
>
> Dim lLastSlash
> Dim lLastDot
> Dim sFileTitle
>
> lLastSlash = InStrRev(FileName, "\")
> lLastDot = InStrRev(FileName, ".")
>
> sFileTitle = Mid(FileName, lLastSlash + 1, lLastDot - lLastSlash - 1)
>
> GetTrackNo = CInt(Right(sFileTitle, 2))
>
> End Function
>
> We can change the comparator to:-
>
> Function Comparator(roLeft, roRight)
>
> Dim sLeftFolder
> Dim sRightFolder
> Dim sLeftTrackNo
> Dim sRightTrackNo
>
> sLeftFolder = GetFolder(roLeft.getAttribute("src"))
> sRightFolder = GetFolder(roRight.getAttribute("src"))
>
> If sLeftFolder = sRightFolder Then
> sLeftTrackNo = GetTrackNo(roLeft.getAttribute("src"))
> sRightTrackNo = GetTrackNo(roRight.getAttribute("src"))
> Comparator = sLeftTrackNo > sRightTrackNo
> Else
> Comparator = sLeftFolder > sRightFolder
> End If
>
> End Function
>
> Now it will sort by folder then by track number. Hence a sensible folder
> structure which has a folder per artist in which there is a folder per
> album
> will sort quite nicely.
>
> You (or other readers) might be tempted to optimize the code (sort
> oriented
> questions tends to bring that desire out of people) but don't in the real
> world the performance of thsi code is perfectly adequate.
>
>
> --
> Anthony Jones - MVP ASP/ASP.NET
>
>


Daniel Crichton

10/3/2007 12:14:00 PM

0

scott wrote on Tue, 2 Oct 2007 11:20:56 -0500:

> I assume that "g:\temp\test.smil" should be my playlist path. What does
> the path in the below line represent?

> Set oSeq = oDOM.selectSingleNode("/smil/body/seq")


The above line will set the object variable oSeq to point to the first node
that matches in the structure

<smil>
<body>
<seq>

the following line then loops through the childNodes (which will be all the
<media> nodes)

Dan



> "Anthony Jones" <Ant@yadayadayada.com> wrote in message news:ebqyjFOBIHA.1212@TK2MSFTNGP05.phx.gbl...
>> "scott" <sbailey@mileslumber.com> wrote in message
>> news:eXFedyDBIHA.1356@TK2MSFTNGP03.phx.gbl...
>>> From looking at the xml structure, it looks like sorting the src
>>> attribute would be about the only thing that I could sort by. If I
>>> could sort that, then at least the artists would be in order within
>>> the playlist.




>> I'm not sure where ASP fits into all this however here is a VBScript
>> that will do the sort based on the src attribute:-

>> Dim oDOM
>> Dim oSeq
>> Dim arrMedia
>> Dim i

>> Set oDOM = CreateObject("MSXML2.DOMDocument.3.0")
>> oDOM.load "g:\temp\test.smil"

>> Set oSeq = oDOM.selectSingleNode("/smil/body/seq")

>> ReDim arrMedia(oSeq.childNodes.length - 1)

>> For i = 0 To UBound(arrMedia)
>> Set arrMedia(i) = oSeq.childNodes(i)
>> Next

>> ShellSortObj arrMedia, GetRef("Comparator")

>> For i = 0 To UBound(arrMedia)
>> oSeq.appendChild arrMedia(i)
>> Next

>> oDOM.save "g:\temp\test2.smil"

>> Function Comparator(roLeft, roRight)
>> Comparator = roLeft.getAttribute("src") > roRight.getAttribute("src")
>> End Function

>> Sub ShellSortObj(rarr, fnCompare)

>> Dim i, j
>> Dim distance
>> Dim tmpValue
>> Dim lCount

>> lCount = UBound(rarr) + 1

>> distance = 0
>> Do distance = distance * 3 + 1
>> Loop Until distance > lCount

>> Do distance = distance \ 3
>> For i = distance To lCount - 1
>> If fnCompare(rarr(i - distance), rarr(i)) Then j = i
>> Set tmpValue = rarr(j)
>> Do
>> Set rarr(j) = rarr(j - distance)
>> j = j - distance
>> If j + 1 <= distance Then Exit Do
>> Loop While fnCompare(rarr(j - distance), tmpValue)
>> ' move the data back in the array
>> Set rarr(j) = tmpValue
>> End If
>> Next
>> Loop Until distance <= 1

>> End Sub

>> Note the at its the comparator function that defines the basis for
>> sort.
>> So with a few utlity functions:-

>> Function GetFolder(FilePath)

>> Dim lLastSlash

>> lLastSlash = InStrRev(FilePath, "\")

>> If lLastSlash > 0 Then
>> GetFolder = Left(FilePath, lLastSlash - 1)
>> End If

>> End Function

>> Function GetTrackNo(FileName)

>> Dim lLastSlash
>> Dim lLastDot
>> Dim sFileTitle

>> lLastSlash = InStrRev(FileName, "\")
>> lLastDot = InStrRev(FileName, ".")

>> sFileTitle = Mid(FileName, lLastSlash + 1, lLastDot - lLastSlash - 1)

>> GetTrackNo = CInt(Right(sFileTitle, 2))

>> End Function

>> We can change the comparator to:-

>> Function Comparator(roLeft, roRight)

>> Dim sLeftFolder
>> Dim sRightFolder
>> Dim sLeftTrackNo
>> Dim sRightTrackNo

>> sLeftFolder = GetFolder(roLeft.getAttribute("src"))
>> sRightFolder = GetFolder(roRight.getAttribute("src"))

>> If sLeftFolder = sRightFolder Then sLeftTrackNo =
>> GetTrackNo(roLeft.getAttribute("src"))
>> sRightTrackNo = GetTrackNo(roRight.getAttribute("src"))
>> Comparator = sLeftTrackNo > sRightTrackNo
>> Else
>> Comparator = sLeftFolder > sRightFolder
>> End If

>> End Function

>> Now it will sort by folder then by track number. Hence a sensible
>> folder structure which has a folder per artist in which there is a
>> folder per album will sort quite nicely.

>> You (or other readers) might be tempted to optimize the code (sort
>> oriented questions tends to bring that desire out of people) but
>> don't in the real world the performance of thsi code is perfectly
>> adequate.


>> --
>> Anthony Jones - MVP ASP/ASP.NET