. .

st4u

ST 4U 334: Using VisualWorks.ini

January 21, 2013 12:27:02.359

Today's Smalltalk 4 You looks at using VisualWorks.ini to make it easier to launch any version of VisualWorks via the same image file association (Windows). 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:

VisualWorks.ini

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:

Tags: ,

Enclosures:
[st4u334-iPhone.m4v ( Size: 4471462 )]

posted by James Robertson

 Share Tweet This

st4u

ST 4U 333: Binary Object Storage in VA Smalltalk

January 18, 2013 11:51:32.923

Today's Smalltalk 4 You looks at the Swapper framework in VA, which can be used to save and restore arbitrary objects to disk in a binary format. 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:

Swapper.

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 take a look at how you can easily store objects in a binary format in external files. VA provides the Swapper framework for this, and it's pretty easy to use. Our example uses a simple point, but you can use theSwapper to store arbitrary objects to a file:


"Binary Storage using the Swapper"
 targetObject:= 2@7. 
(stream := CfsWriteFileStream open: 'testfile.swp') isCfsError
	ifTrue: [self error: stream printString]. 
	
"Set to binary mode"
stream isBytes: true.  
dumper := ObjectDumper new.  
dumper unload: targetObject intoStream: stream. 
stream close. 
dumper hasErrorOccurred
	ifTrue: [self error: dumper currentErrorString].

Note the you don't really check for exceptions; that's all done inside the framework. Rather, you check for errors after your code executes. Once you've got the objects on disk, you'll eventually want them back in Smalltalk:


"load the object from the binary file"
 (stream := CfsReadFileStream open: 'testfile.swp') 
	isCfsError   ifTrue: [self error: stream printString]. 
	
"set binary"
stream isBytes: true.  
loader := ObjectLoader new. 
targetObject := loader loadFromStream: stream. 
stream close. 
loader hasErrorOccurred   
	ifTrue: [self error: loader currentErrorString]. 
targetObject inspect.

Execute that, and you should see your Point object:

Point

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.

Tags: , ,

Enclosures:
[st4u333-iPhone.m4v ( Size: 3535051 )]

posted by James Robertson

 Share Tweet This

st4u

ST 4U 332: Bags and Sets

January 16, 2013 8:20:20.783

Today's Smalltalk 4 You looks at two collection classes, Bag and Set. 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:


Two of the Collection classes that you might need to know more about are Set and bag. The best way to look at that is via a small example:


| collection c1 |
collection := #(1 1 2 3 4 5 6 6 6 7 8 0 9 9).
c1 := collection asBag.
c1 inspect

Inspecting that gives you this:

Bag

What a Bag does is tell you the count for each unique element in the collection. That can be useful if you don't care about the order, but are interested in the occurrences - like this:


c1 occurrencesOf: 9.

That should give you 2.

Now let's try a Set:


| collection c1 |
collection := #(1 1 2 3 4 5 6 6 6 7 8 0 9 9).
c1 := collection asSet.
c1 inspect

Inspect that, and you'll see:

Set

Sets give you just the unique elements - useful if you want to filter out duplicates.

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.

Tags: ,

Enclosures:
[st4u332-iPhone.m4v ( Size: 2738489 )]

posted by James Robertson

 Share Tweet This

st4u

ST 4U 330: Subcanvas Changes in Newer VW

January 11, 2013 12:36:42.526

Today's Smalltalk 4 You looks at change in the way Subcanvases work in newer revs of VisualWorks, and something you may have to do if you rely on some of the older APIs. 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:

Subcanvas

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:

s

Tags: ,

Enclosures:
[st4u330-iPhone.m4v ( Size: 2174414 )]

posted by James Robertson

 Share Tweet This

st4u

ST 4U 329: Binary Message Changes in VisualWorks

January 9, 2013 11:54:11.628

Today's Smalltalk 4 You looks at a recent VisualWorks change in binary messages that might impact your upgrade. 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 Messages

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:

Tags: , ,

Enclosures:
[st4u329-iPhone.m4v ( Size: 3005143 )]

posted by James Robertson

 Share Tweet This

st4u

ST 4U 328: Store Loading in VW

January 7, 2013 12:46:40.276

Today's Smalltalk 4 You looks at an interesting issue with teh Atomic analyzer and loader in VW. 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:

Version Control

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:

Tags: , ,

Enclosures:
[st4u328-iPhone.m4v ( Size: 2842969 )]

posted by James Robertson

 Share Tweet This

st4u

ST 4U 327: Memory Monitoring in VA Smalltalk

January 4, 2013 14:44:09.329

Today's Smalltalk 4 You starts looking at the basic memory monitoring tools available 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:

Memory Tools.

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:


It can be useful to get an idea as to how memory is being used as parts of your Smalltalk application are running - VA Smalltalk provides some tools that allow you to have that look. First off, you'll need to load some applications using the ApplicationManager (EsMemoryTools)

Memory Application

Once that's loaded, go to the launcher's tools menu, and start the monitor:

Memory Monitor

If you start it, not a lot will be happening - after all, we aren't really running anything but the base image. Try something - here, we loaded an image file using streams:

Memory Application

See the changes? You can use this to better effect when running your application (or hotspots in it) to see what's going on.

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.

Enclosures:
[st4u327-iPhone.m4v ( Size: 2375511 )]

posted by James Robertson

 Share Tweet This

st4u

ST 4U 326: Loading Applications in ObjectStudio

January 2, 2013 10:17:45.204

Today's Smalltalk 4 You looks at loading applications into ObjectStudio. The way things end up being displayed for use (and where the Transcript is located) differs somewhat from VisualWorks and 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:

OS Apps

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:

Tags: ,

Enclosures:
[st4u326-iPhone.m4v ( Size: 3392373 )]

posted by James Robertson

 Share Tweet This

st4u

ST 4U 325: Constructed Messages

December 28, 2012 11:40:35.884

Today's Smalltalk 4 You looks at constructed messages - sometimes useful in Smalltalk, but not without their risks. 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:

Config Maps.

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:


One of the things you run across in Smalltalk early on - and typically think is very cool at the time - is the ability to construct and perform a message send. You can ask an object to execute a message via the symbol for the name:


someObject perform: #nameOfMethodHere

That kind of thing is common, and used quite frequently - for instance, eecuting a message after an item has been selected from a list of options. If the actual symbol is used, it's even traceable by the tools in the system. What's also possible - but much harder to trace - is something like this:


execute
	| msg sendMsg |
	
	msg := lastState
		ifTrue: ['add', tail]
		ifFalse: ['remove', tail].
	sendMsg := msg asSymbol.
	lastState := lastState not.
	self perform: sendMsg

Here, a message is constructed by string concatenation, with the string then being made into a symbol and performed. The problem? It's impossible to find these references with the tools - you have to know where they are. Worse yet, we've seen such usage combined with the last screencast - wrap this in an MNU handler, and you'll never know what it isn't working.

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.

Tags: ,

Enclosures:
[st4u235-iPhone.m4v ( Size: 2725923 )]

posted by James Robertson

 Share Tweet This

st4u

ST 4U 234: Message Swallowing MNU

December 21, 2012 12:49:44.511

Today's Smalltalk 4 You looks at the a cool - but dangerous - thing in Smalltalk - the ability to handle messages that are not understood. 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:

MNU.

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:


One of the things you'll run across in Smalltalk is the ability to handle a "Message Not Understood" exception. While there are uses for such handling (proxy development, for example) - it's often quite dangerous. Even more dangerous is implementing a catchall #doesNotUnderstand: message to your class - it can simply swallow all such MNU exceptions, leading to very bizarre behavior. Consider a simple Counter class with a one up counter, and an #addOne (but no #subtractOne) method, and this implementation:


doesNotUnderstand: aMessage
	Transcript show: 'Not Understood: ', aMessage selector printString; cr

It seems simple enough, but consider the case where that counter is meaningful. A user of the class might think #subtractOne works, and then end up with unexpected values. It can be more serious in a real application - recently, I've been upgrading a VisualWorks 7.6 application to VisualWorks 7.9.1. One of the parts swallowed exceptions like what we have above, and finding the missing methods became very difficult.

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.

Tags: ,

Enclosures:
[st4u324-iPhone.m4v ( Size: 3647888 )]

posted by James Robertson

 Share Tweet This

Previous Next (554 total)