Today's Smalltalk 4 You continues looking at the basic Smalltalk class libraries in VA Smalltalk - today it's the Stream libraries, focusing on reading. If you have trouble viewing it here in the browser, you can also navigate directly to YouTube. To watch now, click on the image below:
If you have trouble viewing that directly, you can click here to download the video directly. If you need the video in a Windows Media format, then download that here.
You can also watch it on YouTube:
Today we'll look at the Stream class hierarchy, focusing on read streams. To get started, we want to browse the Stream hierarchy, in order to get a full picture of the local and inherited APIs:/p>
We are going to focus on the API methods (as per the ANSI specification, and experiment with a few simple examples in a workspace. The workspace code we'll use follows:
"read stream on a collection"
array := #(1 2 3 4 5 6 7 8 9 10).
stream := array readStream.
"get next item"
oneItem := stream next. 1
"get next 3"
nextThree := stream next: 3. (2 3 4)
"up to end"
rest := stream upToEnd. (5 6 7 8 9 10)
"set back to start"
stream reset.
"now peek - get next item, don't move position"
pos := stream position. 0
peeked := stream peek. 0
pos2 := stream position. 0
"skip first 3, get 4th"
stream skip: 3.
fourth := stream next. 4
You may be wondering about the text printed after each line; that's the result of doing a Display on each set of code. Try it yourself, and see if it all works the same way
Most of the examples work with streams that are positionable - i.e., there's a cursor into the stream, and we can freely move the cursor back and forth. That's true of internal streams and of file streams - but not of things like streams over a socket. Take a look at class PositionableStream and the APIs defined in it:
Here's a screen capture of the workspace after we've tried each line:
The most important reading methods to understand are:
#next - get the next element from the stream
#next: - get the next N elements from the stream
#upToEnd - get the rest of the elements on the stream
#reset - reset the position back to the start
#peek - peek ahead one element without moving the cursor
It's worth trying a few experiments of your own - and notice that streams are not just about text. You can stream over any collection in Smalltalk, as our example above shows.
Need more help? There's a screencast for other topics like this which you may want to watch. Questions? Try the "Chat with James" Google gadget over in the sidebar.
Welcome to episode 16 of "Thu'umcast" - a podcast where Michael Lucas-Smith, Scott Dirk, Austin Haley, Makahlua and I document our trials and tribulations in Elder Scrolls V: Skyrim
The Bethesda/Interplay lawsuit came to a close recently, so we talked a bit about that (seeing as how we are all Fallout fans as well). We then moved on to the College of Winterhold. While we talked about that quest line a bit in the early podcasts, we never really went into depth - so today we give it the full treatment.
If you liked our work on That Podcast, you'll probably like this. We intend to stay with the same idea - a gameplay podcast. If you don't want spoilers, don't listen - we are going to be talking about how we play the game, and what we ran across as we played.
Welcome to episode 16 of "Thu'umcast" - a podcast where Michael Lucas-Smith, Scott Dirk, Austin Haley, Makahlua and I document our trials and tribulations in Elder Scrolls V: Skyrim
The Bethesda/Interplay lawsuit came to a close recently, so we talked a bit about that (seeing as how we are all Fallout fans as well). We then moved on to the College of Winterhold. While we talked about that quest line a bit in the early podcasts, we never really went into depth - so today we give it the full treatment.
If you liked our work on That Podcast, you'll probably like this. We intend to stay with the same idea - a gameplay podcast. If you don't want spoilers, don't listen - we are going to be talking about how we play the game, and what we ran across as we played.
We did a Facebook episode a bit ago - the group has exploded with great comments, topics, and discussions, so we're going to do it again. We can't possibly go chronologically (there's too much!) - so here's our idea: start a new set of discussions about what we should cover on the show, and we'll do shoutouts to everyone we can. While you're at it, tell us which member of the cast should do the shoutout for you.
Thanks again - we couldn't do this without all of you!
Join the Facebook Group to discuss the tutorials. You can view the archives here.
To watch now, click on the image below:
If you have trouble viewing that directly, you can click here to download the video directly. If you need the video in a Windows Media format, then download that here.
Today's Smalltalk 4 You continues looking at the basic Smalltalk class libraries in VA Smalltalk - with the focus on write streams If you have trouble viewing it here in the browser, you can also navigate directly to YouTube. To watch now, click on the image below:
If you have trouble viewing that directly, you can click here to download the video directly. If you need the video in a Windows Media format, then download that here.
You can also watch it on YouTube:
Today we'll look at the Stream class hierarchy, focusing on write streams. To get started, we want to browse the Stream hierarchy, in order to get a full picture of the local and inherited APIs:/p>
We are going to focus on the API methods (as per the ANSI specification, and experiment with a few simple examples in a workspace. The workspace code we'll use follows:
"writing"
wStream := WriteStream on: String new.
wStream nextPut: $3.
wStream nextPutAll: ' foo bar baz'.
wStream cr.
wStream contents.
Here we are writing text (Strings and Characters) to a stream, but you can put anything on an internal stream (for external ones, make them binary to do the same thing). Here's what running the above will give you if you inspect the results:
The most important writing methods to understand are:
#nextPut: - write one element to the stream
#nextPutAll: - sent with a collection as an argument, write it to the stream
contents - get all elements on the stream
It's worth trying a few experiments of your own - and notice that streams are not just about text. You can stream over any collection in Smalltalk - try creating a write stream and putting numbers on it, and see what you get back with #contents
Need more help? There's a screencast for other topics like this which you may want to watch. Questions? Try the "Chat with James" Google gadget over in the sidebar.
The next STUG meeting in NYC is coming up on March 7th, and will feature Alejandro Reimondo, talking about S8:
The presentation will introduce the debut of S8. S8 is Smalltalk running over javascript execution engines on all major browser flavors. Its a generic framework but with initial implementations and objectives for the development of social networking and mobile applications. The presentation will discuss examples of this including the targetting of Android devices.
I've written a bit about SOPA - the new copyright law that's being debated makes the DMCA look reasonable (yes, it really is that bad). One of my senators is a co-sponsor (of the senate version, under the name Protect IP), which makes me even happier about the whole thing.
The freedom, innovation, and economic opportunity that the Internet enables is in jeopardy. Congress is considering legislation that will dramatically change your Internet experience and put an end to reddit and many other sites you use everyday. Internet experts, organizations, companies, entrepreneurs, legal experts, journalists, and individuals have repeatedly expressed how dangerous this bill is.
This proposal really is that bad, and the first place it would get used would be to silence political opposition (of all stripes, but especially of the opposition candidate versus incumbent sort) under the cover of "copyright infringement".
The DMCA lets copyright holders lodge a takedown notice against alleged infringement - this bill makes that kind of thing a felony. And never mind the restriction to "foreign websites" - you try and imagine Google filtering based on the plethora of stupid that the copyright industry will toss out if this passes. You try to imagine any site running any kind of open comments section, when a stray link could result in DNS banishment. We're headed to a "great firewall of America" with this bill.
Join the Facebook Group to discuss the tutorials. You can view the archives here.
To watch now, click on the image below:
If you have trouble viewing that directly, you can click here to download the video directly. If you need the video in a Windows Media format, then download that here.
Some people just can't handle the idea that non-"professionals" are working successfully in their space. Take Bob Bly - the idea that writing basic copy is becoming a commodity terrifies him (most likely because it damages his billing rate):
Now a relatively new term — content — further degrades writers and the status of writing.
"Writing" sounds like a craft or skill. "Content" sounds like something you buy by the can or by the pound.
Or, maybe - just maybe - his "mad writing skills" aren't so special after all, and lots of people out there can do the same thing - at a fraction of the cost.
Apparently it all comes down to the fact that The Pirate Bay has a .org domain — and according to Masnick, the current version of the SOPA bill working its way through congress excludes American domestic domains from being the target of takedown notices from copyright holders. In this case, a “domestic domain” is any domain that comes from a TLD run by an American registry — and sure enough, .org’s registry is Public Interest Registry, a US non-profit based in Virginia. In other words, thepiratebay.org isn’t eligible for a SOPA-based takedown, even if its servers are based in Sweden or another country outside the US. Believe it or not, by the same logic, .com and .net domains — both of which are managed by American company VeriSign — would also be immune from the SOPA bill as it currently stands.
In a nutshell, this is why I'm skeptical of "expert" opinion. I notice that on subjects I have fairly deep knowledge of, "expert opinion" is nearly always wrong - and not just a little wrong. This leads to a simple question: if they get the stuff I know well wrong, what about everything else?
Today's Smalltalk 4 You looks at class extensions (as opposed to overrides) in VisualWorks Smalltalk. If you have trouble viewing it here in the browser, you can also navigate directly to YouTube. To watch now, click on the image below:
If you have trouble viewing that directly, you can click here to download the video directly. If you need the video in a Windows Media format, then download that here.
Some late breaking news here: following Lamar Smith's announcement that the new manager's amendment for SOPA will remove DNS blocking (to be added back at a later date after it's been "studied"), Rep. Issa has announced that he will now postpone the "nerd" hearing that he was holding in the House Oversight Committee, which was originally scheduled for Wednesday. The key reason? Majority Leader Eric Cantor has promised him that he will not bring the bill to the floor unless there's real consensus on the bill.
At least the bums rush aspect of the bill is over; with luck, slowing it down will take us to the election cycle, and the bill can just languish.
Welcome to episode 61 of Independent Misinterpretations - a Smalltalk and dynamic language oriented podcast with James Robertson and David Buck.
This week Dave Buck and I talk about the Smalltalk process model, and some of the things Smalltalk developers run into with it. Also, Dave mentioned the Space Wars game he was writing with his son - he posted a few details and the source on his blog.
You can subscribe to the podcast in iTunes (or any other podcatching software) using this feed directly or in iTunes with this one.
To listen now, you can either download the mp3 edition, or the AAC edition. The AAC edition comes with chapter markers. You can subscribe to either edition of the podcast directly in iTunes; just search for Smalltalk and look in the Podcast results. You can subscribe to the mp3 edition directly using this feed, or the AAC edition using this feed using any podcatching software. You can also download the podcast in ogg format.
If you like the music we use, please visit Josh Woodward's site. We use the song Troublemaker for our intro/outro music. I'm sure he'd appreciate your support!
If you have feedback, send it to jarober@gmail.com - or visit us on Facebook - you can subscribe in iTunes using this iTunes enabled feed.. If you enjoy the podcast, pass the word - we would love to have more people hear about Smalltalk!
Welcome to episode 61 of Independent Misinterpretations - a Smalltalk and dynamic language oriented podcast with James Robertson and David Buck.
This week Dave Buck and I talk about the Smalltalk process model, and some of the things Smalltalk developers run into with it. Also, Dave mentioned the Space Wars game he was writing with his son - he posted a few details and the source on his blog.
You can subscribe to the podcast in iTunes (or any other podcatching software) using this feed directly or in iTunes with this one.
To listen now, you can either download the mp3 edition, or the AAC edition. The AAC edition comes with chapter markers. You can subscribe to either edition of the podcast directly in iTunes; just search for Smalltalk and look in the Podcast results. You can subscribe to the mp3 edition directly using this feed, or the AAC edition using this feed using any podcatching software. You can also download the podcast in ogg format.
If you like the music we use, please visit Josh Woodward's site. We use the song Troublemaker for our intro/outro music. I'm sure he'd appreciate your support!
If you have feedback, send it to jarober@gmail.com - or visit us on Facebook - you can subscribe in iTunes using this iTunes enabled feed.. If you enjoy the podcast, pass the word - we would love to have more people hear about Smalltalk!
Today's Smalltalk 4 You continues looking at the basic Smalltalk class libraries in VA Smalltalk - today it's the Delay and Duration classes. If you have trouble viewing it here in the browser, you can also navigate directly to YouTube. To watch now, click on the image below:
If you have trouble viewing that directly, you can click here to download the video directly. If you need the video in a Windows Media format, then download that here.
You can also watch it on YouTube:
Today we'll look at class Delay and Duration. You'll need these classes anytime you want to set up a timer of some kind in VA Smalltalk (such as in a process that wakes up periodically to do some task). To get started, we want to look at the two classes:
You can use Delay without using Duration; Duration makes it easy to specify a time interval (by second, millisecond, day, or even longer time periods). That makes it easy to specify an interval, and then set up a Delay to wait for that interval. You do that via the #wait message:
"use a duration"
duration := Duration seconds: 10.
ms := duration asMilliseconds.
Transcript show: 'Now: ', DateAndTime now asMilliseconds printString; cr.
(Delay forMilliseconds: ms) wait.
Transcript show: 'End: ', DateAndTime now asMilliseconds printString; cr.
What we did above is specify a duration, and then use that duration as the interval for the Delay. If you look in your Transcript afterwards, you'll see the following:
You can simply specify a number of seconds or milliseconds in Delay, without using a Duration; Duration just makes it easy to set up a time interval:
Need more help? There's a screencast for other topics like this which you may want to watch. Questions? Try the "Chat with James" Google gadget over in the sidebar.
Welcome to episode 17 of "Thu'umcast" - a podcast where Michael Lucas-Smith, Scott Dirk, Austin Haley, Makahlua and I document our trials and tribulations in Elder Scrolls V: Skyrim
James, Scott and Austin talk about two of the larger side quest lines: No Stone Unturned (the Berenziah stones quest), and the Daedric quests (which lead the Oblivion Walker achievement)
If you liked our work on That Podcast, you'll probably like this. We intend to stay with the same idea - a gameplay podcast. If you don't want spoilers, don't listen - we are going to be talking about how we play the game, and what we ran across as we played.
Welcome to episode 17 of "Thu'umcast" - a podcast where Michael Lucas-Smith, Scott Dirk, Austin Haley, Makahlua and I document our trials and tribulations in Elder Scrolls V: Skyrim
James, Scott and Austin talk about two of the larger side quest lines: No Stone Unturned (the Berenziah stones quest), and the Daedric quests (which lead the Oblivion Walker achievement)
If you liked our work on That Podcast, you'll probably like this. We intend to stay with the same idea - a gameplay podcast. If you don't want spoilers, don't listen - we are going to be talking about how we play the game, and what we ran across as we played.