. .

st4u

ST 4U 293: Getting Started with ObjectStudio

October 8, 2012 12:14:25.428

Today's Smalltalk 4 You takes a high level, starting out view of ObjectStudio 8. 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:

Logging

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:

Technorati Tags: , ,

Enclosures:
[st4u293-iPhone.m4v ( Size: 2819968 )]

posted by James Robertson

 Share Tweet This

st4u

ST 4U 292: Random Numbers in VA Smalltalk

October 5, 2012 11:35:41.033

Today's Smalltalk 4 You looks at random number generation in VA 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:

Random Numbers.

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 random number generation in VA Smalltalk. The class you'll want to look at is EsRandom. The common way to get a random number in Smalltalk is like this:


| rand randVal |
rand := EsRandom new.
randVal := rand next.

That yields a floating point value with a lot of digits to the right of the decimal place. In many Smalltalks, you end up multiplying that by a number (to put it in the range you want), rounding, and adding one. In VA, there's a nice convenience method, #nextInt: - you give it a value, and you get back a random number between 1 and that value:


| rand randVal |
rand := EsRandom new.
randVal := rand nextInt: 100.

Display the results to make sure you get back what you expect - in this case, it should be a value between one and one hundred.

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.

Technorati Tags: , ,

Enclosures:
[st4u292-iPhone.m4v ( Size: 2244155 )]

posted by James Robertson

 Share Tweet This

st4u

ST 4U 291: Reading and Writing Binary Files in VA Smalltalk

October 3, 2012 8:25:44.990

Today's Smalltalk 4 You goes through a simple example - reading and writing a file in binary mode in VA 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:

Binary Data.

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 go through a small example - how to write, and read, a simple binary file. To start, let's write a couple of numbers to a file:


stream := FileStream write: 'testBin.bin'.
stream isBytes: true.
stream nextPut: 2.
stream nextPut: 3.
stream close.

Even though we are using the abstract class FileStream, VA picks up the correct concrete subclass when we use the #write: method. Next, we'll want to read the file in binary mode (again, using #isBytes:)


stream := FileStream read: 'testBin.bin'.
stream isBytes: true.
first := stream next.
second := stream next.
stream close.
^Array with: first with: second.

Inspect the results to ensure that you got back what you expect - you should see something like this:

Binary Data

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.

Technorati Tags: , ,

Enclosures:
[st4u291-iPhone.m4v ( Size: 2138732 )]

posted by James Robertson

 Share Tweet This

st4u

ST 4U 290: Finding all Instances

October 1, 2012 8:07:02.015

Today's Smalltalk 4 You looks at a common problem in Smalltalk development - finding all instances of an object. You can send #allInstances in a workspace and inspect the results, but there's a simpler way in VisualWorks - a menu pick in the browser. 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:

all instances

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:

Technorati Tags: ,

Enclosures:
[st4u290-iPhone.m4v ( Size: 966599 )]

posted by James Robertson

 Share Tweet This

st4u

ST 4U 289: Reading Binary FIles in VA Smalltalk

September 28, 2012 10:23:47.057

Today's Smalltalk 4 You looks at reading binary formatted files in VA 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:

binary files.

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 how you open files in binary mode in VA Smalltalk. To get started, look at the code below:


"specify that we are reading characters"
stream := CfsReadFileStream open: 'abt.ini'.
stream isCharacters: true.
text := stream contents.
stream close.
^text.



"specify binary"
stream := CfsReadFileStream open: 'snow1.jpg'.
stream isBytes: true.
bytes := stream contents.
stream close.
^bytes.

You would not typically use #isCharacters: - that's the default. Use #isBytes: to read the raw bytes into a byte array.

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.

Technorati Tags: , , ,

Enclosures:
[st4u289-iPhone.m4v ( Size: 2143061 )]

posted by James Robertson

 Share Tweet This

st4u

ST 4U 288: Using Files in VA Smalltalk

September 26, 2012 14:07:15.354

Today's Smalltalk 4 You looks at file i/o in VA Smalltalk - starting with the basics. 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:

file io.

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 file handling in VA Smalltalk. The simplest way to get started is with FileStream - which doesn't look like it exists. That's because it's an alias for CfsFileStream:

Files

Working with files in VA Smalltalk is fairly straightforward. You send messages to the abstract superclass (CfsFileStream), and, depending on the API, you get back the concrete subclass. You then work with that using standard stream protocol:


"Open a file read only"
stream := FileStream open: 'abt.ini' oflag: ORDONLY.
text := stream upToEnd.
stream close.
^text


"open a file, simpler API
stream := FileStream read: 'abt.ini'.
text := stream upToEnd.
stream close.
^text

"open for writing"
stream := FileStream write: 'test.txt'.
stream nextPutAll: 'This is a test'; cr.
stream close.

Go ahead and try those out (possibly changing the names depending on what files exist in for working directory).

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.

Technorati Tags: , ,

Enclosures:
[st4u288-iPhone.m4v ( Size: 3178135 )]

posted by James Robertson

 Share Tweet This

st4u

ST 4U 287: Large Change Files in VisualWorks

September 24, 2012 14:56:21.000

Today's Smalltalk 4 You looks at what you can do when your changes file gets to be absurdly large in VisualWorks (or ObjectStudio). 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:

Changes File

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:

Technorati Tags: , ,

Enclosures:
[st4u287-iPhone.m4v ( Size: 685083 )]

posted by James Robertson

 Share Tweet This

st4u

ST 4U 286: Interesting Collection Methods

September 21, 2012 10:20:01.137

Today's Smalltalk 4 You looks at some of the more interesting methods in the collection hierarchy. 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:

Collections.

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 some of the more useful methods in the Collection class hierarchy, and use some examples to illustrate. We're using VA Smalltal, so fire that up and look at class collection:

Collection

Select the ANSI-API category, and have a look at the methods - you can count on the ones here being implemented (and implemented this way) across all the major Smalltalks. Some of the methods here are "new" - in the sense that the various vendors have only added them to their distributions in the last few years. Today we'll take a look at some of these methods:


coll1 := #(1 2 3 4 5).
coll2 := #(4 5 6 7 8).
coll3 := #(1 1 2 3 3 4 4 5).

coll1 anySatisfy: [:each | each < 10]. true
coll1 allSatisfy: [:each | each < 3]. false
coll1 noneSatisfy: [:each | each > 10]. true

coll1 intersection: coll2. Set(4 5 )

coll2 occurrencesOf: 2 0 

coll3 sorted: [:a : b | b <= a] (5 4 4 3 3 2 1 1)

The results of executing each line of code is after each line (using Display from the workspace menu). If you don't follow why, go ahead and experiment with the examples, and debug through them.

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.

Technorati Tags: ,

Enclosures:
[st4u286-iPhone.m4v ( Size: 5781385 )]

posted by James Robertson

 Share Tweet This

st4u

ST 4U 285: Getting Started with VAST Goodies

September 19, 2012 10:19:41.299

Today's Smalltalk 4 You looks at getting started with the VAST Goodies site (and tools). 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:

Goodies.

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 VAST Goodies site - it's both an example of a VA Smalltalk application (using Seaside), and a useful site for getting (and contributing) community provided Smalltalk code. In order to make use of it, you first need to load the support code into VA. Fortunately, that's easy - it's right in the features tool:

VAST Goodies

Simply move it over to the right and load - note that all of the pre-reqs get picked up for you:

Load

That gets the tools in - we covered how to make use of them here

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.

Technorati Tags: , ,

Enclosures:
[st4u285-iPhone.m4v ( Size: 2507204 )]

posted by James Robertson

 Share Tweet This

st4u

ST 4U 284: Nautilus Browser Shortcuts

September 17, 2012 15:45:14.919

Today's Smalltalk 4 You looks at the keyboard shortcuts available in the Nautilus browsre in Pharo. 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:

nautilus

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:

Technorati Tags: , ,

Enclosures:
[st4u284-iPhone.m4v ( Size: 1136726 )]

posted by James Robertson

 Share Tweet This

Previous Next (554 total)