Recent Posts

Pages: 1 ... 8 9 [10]
91
Code Challenges / Re: RSS Challenge
« Last post by AIR on August 15, 2021, 10:41:14 am »
I was able to open the file with the cURL extension module using HTTPS. Your example uses HTTP The URL you used is redirected.

Code: Bash
  1. ubuntu@rpi4b:~/sbrt/examples$ scriba rss.sb
  2. <html><head><title>Object moved</title></head><body>
  3. <h2>Object moved to <a href="https://s.ch9.ms/Events/MIX/MIX11/RSS/mp4high">here</a>.</h2>
  4. </body></html>
  5. ubuntu@rpi4b:~/sbrt/examples$
  6.  

The Windows version is returning an extension module error using HTTPS.  :-\

I will have to do the challenge in SB Linux. (RPi 4B)

The redirect is a wrinkle/easter egg.  ;)

Try the "CURLOPT_FOLLOWLOCATION" option?

AIR.
92
Code Challenges / Re: RSS Challenge
« Last post by John on August 15, 2021, 02:16:09 am »
Code: Script BASIC
  1. ' AIR RSS Challenge
  2.  
  3. IMPORT curl.bas
  4.  
  5. ch = curl::init()
  6. curl::option(ch, "URL", "https://s.ch9.ms/Events/MIX/MIX11/RSS/mp4high")
  7. rss = curl::perform(ch)
  8. curl::finish(ch)
  9.  
  10. SPLITA rss BY "</item>" TO item
  11. FOR x = 0 TO UBOUND(item)
  12.   IF item[x] LIKE "*<title>*</title>*[CDATA[<p>*</p>*<pubDate>*</pub*<dc:creator>*</dc:*<enclosure url=\"*\" length*duration=\"*\"*" THEN
  13.     PRINT STRING(20,"-"), "\n"
  14.     PRINT "Title: ", JOKER(2), "\n"
  15.     PRINT "Presenter: ",JOKER(8), "\n"
  16.     PRINT "Date: ", JOKER(6), "\n"
  17.     PRINT "Description: ", JOKER(4), "\n"
  18.     PRINT "Video Link: ", JOKER(10), "\n"
  19.     PRINT "Duration: ", FORMATDATE("0H:0m:0s", JOKER(12)), "\n"
  20.   END IF
  21. NEXT
  22.  


--------------------
Title: Introducing MMP Audience Insight
Presenter: Eric Schmidt
Date: Tue, 15 Mar 2011 20:26:00 GMT
Description: As live and on-demand online video distribution grows so does the need for meaningful and timely analysis of consumption and quality of service. Microsoft Media Platform Audience Insight is a composeable collection of technologies that enables media publishers, application developers, business decision makers and technical support staff to gain real time insight to media streaming applications. Audience Insight provides real time visibility into digital media related events, for example video starts, DVR actions and advertising delivery. These events are correlated and grouped to produce sets of KPIs to inform real time decision making and contextual business analysis. This session will review the architecture behind Audience Insight and will demonstrate how to gain insight for massive scale video distribution scenarios.
Video Link: http://video.ch9.ms/ch9/7e2b/82589c56-4005-405d-959e-9ea700dd7e2b/MIX11MED04_high_ch9.mp4
Duration: 01:02:48
--------------------
Title: Mono: State of the Union
Presenter: Miguel de Icaza
Date: Tue, 15 Mar 2011 20:26:00 GMT
Description: Come learn how Mono can help every one of your current projects: from our C# compiler as a service to running your .NET code on iPhone, Android and Mac. All demos will feature our amazing MonoDevelop cross platform IDE. Come to be energized and fall in love with .NET all over again. This is your second honeymoon. Do not miss it.
Video Link: http://video.ch9.ms/ch9/7c8b/2d17abeb-01a7-4d61-b366-9ea700dd7c8b/MIX11EXT03_high_ch9.mp4
Duration: 01:05:05
--------------------
Title: Riding the Geolocation Wave
Presenter: Tatham Oddie
Date: Tue, 15 Mar 2011 20:26:00 GMT
Description: It&rsquo;s pretty obvious by now that geolocation is a heavy player in the next wave of applications and APIs. Now is the time to learn how to take advantage of this information and add context to your own applications. In this session we&rsquo;ll look at geolocation at every layer of the stack &ndash; from open protocols to operating system APIs, from the browser to Windows Phone 7. Building a compelling geo-enabled experience takes more than simple coordinates. In this session we will introduce the basics of determining a user&rsquo;s location and then delve into how to make geo data a useful addition to your application instead of a bolt-on &ldquo;me too&rdquo;.
Video Link: http://video.ch9.ms/ch9/7ce8/f849553d-644e-4dad-8deb-9ea700dd7ce8/MIX11EXT04_high_ch9.mp4
Duration: 00:47:52
93
Code Challenges / Re: RSS Challenge
« Last post by John on August 15, 2021, 12:08:53 am »
I was able to open the file with the cURL extension module using HTTPS. Your example uses HTTP The URL you used is redirected.

Code: Bash
  1. ubuntu@rpi4b:~/sbrt/examples$ scriba rss.sb
  2. <html><head><title>Object moved</title></head><body>
  3. <h2>Object moved to <a href="https://s.ch9.ms/Events/MIX/MIX11/RSS/mp4high">here</a>.</h2>
  4. </body></html>
  5. ubuntu@rpi4b:~/sbrt/examples$
  6.  

The Windows version is returning an extension module error using HTTPS.  :-\

I will have to do the challenge in SB Linux. (RPi 4B)


94
Code Challenges / Re: RSS Challenge
« Last post by John on August 14, 2021, 11:14:24 pm »
Strange I can't seem to download / GET the file with the ScriptBasic cURL extension module. When I try the URL in a browser it asks how I want to view the file.

No error  but no data returned either.

Code: Script BASIC
  1. IMPORT curl.sbi
  2.  
  3. ch = curl::init()
  4. curl::option(ch, "URL", "http://channel9.msdn.com/Events/MIX/MIX11/RSS/mp4high")
  5. curl::option(ch, "FILE", "mp4high.xml")
  6. curl::perform(ch)
  7. curl::finish(ch)
  8.  

Code: Script BASIC
  1. IMPORT curl.sbi
  2.  
  3. ch = curl::init()
  4. curl::option(ch, "URL", "http://channel9.msdn.com/Events/MIX/MIX11/RSS/mp4high")
  5. curl::option(ch, "CUSTOMREQUEST", "GET")
  6. rss = curl::perform(ch)
  7. curl::finish(ch)
  8.  
  9. PRINT rss
  10.  

Neither of the above examples return anything.  :-[  SB Linux does the same thing.

I tried using the SB native socket feature but it can't open the file either.

Code: Script BASIC
  1. OPEN "channel9.msdn.com/Events/MIX/MIX11/RSS/mp4high:80" FOR socket AS #1
  2.  
  3. FOR x = 1 to 50
  4.   LINE INPUT #1, rss
  5.   PRINT rss
  6. NEXT
  7.  
  8. CLOSE(1)
  9.  


(0): error &H16:The file can not be opened.

95
Code Challenges / Re: RSS Challenge
« Last post by John on August 14, 2021, 09:15:04 pm »
Great idea AIR. Let's hope this wakes up the member base.

I'll submit a SB version soon.
96
Code Challenges / Re: RSS Challenge
« Last post by AIR on August 14, 2021, 09:08:05 pm »
NIM Code by AIR:
Code: Text
  1. import httpClient
  2. import xmlparser
  3. import xmltree
  4. import strutils
  5. from parseutils import parseInt
  6. from strformat import fmt
  7.  
  8.  
  9. var url = "http://channel9.msdn.com/Events/MIX/MIX11/RSS/mp4high"
  10.  
  11. proc secondsToHMS(seconds: string): string =
  12.     var totalSeconds = seconds.parseInt
  13.     var seconds = totalSeconds.mod(60)
  14.     var minutes = (totalSeconds.mod(3600)).div(60)
  15.     var hours = (totalSeconds.mod(86400)).div(3600)
  16.     result = fmt"{hours:02}:{minutes:02}:{seconds:02}"
  17.  
  18.  
  19. proc fetchRSS(url: string): XmlNode =
  20.     var client = newHttpClient()
  21.     let rss = client.getContent(url)
  22.     return parseXML(rss)
  23.  
  24.  
  25. var xmlRoot = fetchRSS(url)
  26. echo "-".repeat(20)
  27. for item in xmlRoot.findAll("item"):
  28.     echo "Title: " & item.child("title").innerText
  29.     echo "Presenter: " & item.child("dc:creator").innerText
  30.     echo "Date: " & item.child("pubDate").innerText
  31.     echo "Description: " & item.child("itunes:summary").innerText
  32.     echo "Video Link: " & item.child("enclosure").attr("url")
  33.     echo "Duration: " & secondsToHMS(item.child("media:group").child("media:content").attr("duration"))
  34.     echo "-".repeat(20)
  35.  

AIR.
97
Code Challenges / RSS Challenge
« Last post by AIR on August 14, 2021, 08:57:31 pm »
Don't know if we're still doing this since it's been a while.


Using the rss feed "http://channel9.msdn.com/Events/MIX/MIX11/RSS/mp4high", which is a series of MSDN-sponsored video presentations, download and parse the feed (a local copy of the rss is not allowed for your final submission, but can be used only while building out your submission) and produce output that shows:
  • Title
  • Name of Presenter
  • The Release Date
  • Description of the Video Presentation
  • Link to the video itself
  • Duration of the Video in HH:MM:SS format
Speed is not the point, accuracy is, since people have different internet capabilities (and some of you may be international).

External libraries are allowed.  External executables/binaries are not (so no curl, xpath, or any other command line tool), because the spirit of this challenge is to provide a solution in code leveraging what your language of choice provides you with.


Example output, generated by code I created this evening using NIM:

Quote
--------------------
Title: Introducing MMP Audience Insight
Presenter: Eric Schmidt
Date: Tue, 15 Mar 2011 20:26:00 GMT
Description: As live and on-demand online video distribution grows so does the need for meaningful and timely analysis of consumption and quality of service. Microsoft Media Platform Audience Insight is a composeable collection of technologies that enables media publishers, application developers, business decision makers and technical support staff to gain real time insight to media streaming applications. Audience Insight provides real time visibility into digital media related events, for example video starts, DVR actions and advertising delivery. These events are correlated and grouped to produce sets of KPIs to inform real time decision making and contextual business analysis. This session will review the architecture behind Audience Insight and will demonstrate how to gain insight for massive scale video distribution scenarios.
Video Link: http://video.ch9.ms/ch9/7e2b/82589c56-4005-405d-959e-9ea700dd7e2b/MIX11MED04_high_ch9.mp4
Duration: 01:02:48
--------------------
Title: Mono: State of the Union
Presenter: Miguel de Icaza
Date: Tue, 15 Mar 2011 20:26:00 GMT
Description: Come learn how Mono can help every one of your current projects: from our C# compiler as a service to running your .NET code on iPhone, Android and Mac. All demos will feature our amazing MonoDevelop cross platform IDE. Come to be energized and fall in love with .NET all over again. This is your second honeymoon. Do not miss it.
Video Link: http://video.ch9.ms/ch9/7c8b/2d17abeb-01a7-4d61-b366-9ea700dd7c8b/MIX11EXT03_high_ch9.mp4
Duration: 01:05:05
--------------------
Title: Riding the Geolocation Wave
Presenter: Tatham Oddie
Date: Tue, 15 Mar 2011 20:26:00 GMT
Description: It&rsquo;s pretty obvious by now that geolocation is a heavy player in the next wave of applications and APIs. Now is the time to learn how to take advantage of this information and add context to your own applications. In this session we&rsquo;ll look at geolocation at every layer of the stack &ndash; from open protocols to operating system APIs, from the browser to Windows Phone 7. Building a compelling geo-enabled experience takes more than simple coordinates. In this session we will introduce the basics of determining a user&rsquo;s location and then delve into how to make geo data a useful addition to your application instead of a bolt-on &ldquo;me too&rdquo;.
Video Link: http://video.ch9.ms/ch9/7ce8/f849553d-644e-4dad-8deb-9ea700dd7ce8/MIX11EXT04_high_ch9.mp4
Duration: 00:47:52
--------------------

AIR.
98
Code Challenges / Re: XML Challenge
« Last post by AIR on August 14, 2021, 05:28:45 pm »
2 years later....... ;D

NIM
Code: Text
  1. import xmltree, xmlparser, strutils
  2.  
  3. let doc = loadXml("sample.xml")
  4.  
  5. for x in doc.findAll("food"):
  6.     echo "'$#' has a sodium level of $#" % [x.child("name").innerText, x.child("sodium").innerText]
  7.  

Code: [Select]
'Avocado Dip' has a sodium level of 210
'Bagels, New York Style ' has a sodium level of 510
'Beef Frankfurter, Quarter Pound ' has a sodium level of 1100
'Chicken Pot Pie' has a sodium level of 810
'Cole Slaw' has a sodium level of 15
'Eggs' has a sodium level of 65
'Hazelnut Spread' has a sodium level of 20
'Potato Chips' has a sodium level of 180
'Soy Patties, Grilled' has a sodium level of 420
'Truffles, Dark Chocolate' has a sodium level of 10
99
Nim / Re: NimCocoa
« Last post by John on August 04, 2021, 07:25:52 pm »
I wish I could afford to be an Apple developer and make a living at it.  :'(
100
Nim / Re: NimCocoa
« Last post by AIR on August 04, 2021, 06:40:42 pm »
John,

You asked me this a few years ago, the answer is still 'no'.

I know there are many fans of IUP (there's also a module for Nim), but I'm not one of them.  From a programmer's usage perspective, it's good.   From an implementor's perspective, trying to bring a new base toolkit to it is an unending rabbit hole. There are far too many obfuscated layers to IUP that require unraveling.

In my opinion, there are too may GUI tool-kits that try to accommodate multiple platforms, with necessary tradeoffs being the result.  I just want to use something on a Mac that is designed from the ground up to *be* for Mac and nothing else.


AIR.
Pages: 1 ... 8 9 [10]