. .

st4u

ST 4U 283: DoesNotUnderstand Abuse

September 14, 2012 0:20:39.299

Today's Smalltalk 4 You looks at how it's easy to use - and abuse - #doesNotUnderstand: in 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:

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:


Today we'll look at #doesNotUnderstand: - and how you:

  • Can override it to change the way an object behaves
  • Should never do this lightly - it can create situations where your application fails in very hard to understand ways

First, we'll load the SimpleCounter application we used as an example for WebServices, and add this method:


doesNotUnderstand: aMessage
	| arg dict |
	
	dict := Dictionary new.
	dict at: #one put: 1.
	dict at: #two put: 2.
	dict at: #three put: 3.
	arg := dict at: aMessage selector ifAbsent: [nil].
	arg := arg isNil
		ifTrue: [0]
		ifFalse: [arg].
	self perform: #addValue: with: arg

Notice what this does - it treats a few strings as numeric arguments, and then converts anything it doesn't understand into a send of #addValue: with an argument of zero. That seems great - no more MessageNotUnderstood exceptions here. However, consider a more interesting object doing something like this, and passing values down the chain (maybe to a database, eventually). If you're lucky, you only get bad data. If you're unlucky, you get bad data and very, very odd application behavior.

Note the following workspace code:


counter := Counter new.
counter one.
counter two.
counter three.
counter thousand.
counter goAway


All of that now "works" - or at least, none of those message sends break immediately. However, a follow on developer who sees the sending of #goAway, and looks for an implementor will find 26 nothing. That's the danger here. The code is now much more difficult to understand.

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:
[st4u283-iPhone.m4v ( Size: 4741560 )]

posted by James Robertson

 Share Tweet This

st4u

ST 4U 282: Preparing a Pharo Image for Production

September 12, 2012 8:39:45.059

Today's Smalltalk 4 You looks at a few simple things you can do to prepare a Pharo image for deployment. 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:

Deployment

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:
[st4u282-iPhone.m4v ( Size: 2595517 )]

posted by James Robertson

 Share Tweet This

st4u

ST 4U 281: Less Common Config Options in VA Smalltalk (2)

September 10, 2012 9:43:06.120

Today's Smalltalk 4 You looks at a few more of the options in workspace preferences, focusing on the export (file out) functionality. 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:

export.

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 more of the "hidden" settings in VA Smalltalk - specifically, ones that modify the file out format used by VA Smalltalk. This can be important if you are trying to port code from VA Smalltalk to another Smalltalk, such as Pharo or Squeak. Since Instantiations makes it easy for you to use VA if you are working on an open source project, this might be something that comes up.

Scroll down in the preferences workspace until you find this line:


System genericFormat: false.

Change the false to true, and then execute it:

Workspace Preferences

If you filed out some code before making that change, and then again afterwards, you'll see some small changes in the files:

file out

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:
[st4u281-iPhone.m4v ( Size: 3920700 )]

posted by James Robertson

 Share Tweet This

st4u

ST 4U 280: Less Common Config Options in VA Smalltalk

September 7, 2012 10:19:05.753

Today's Smalltalk 4 You looks at some of the less well known configuration options 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:

Preferences Workspace.

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 "hidden" settings in VA Smalltalk - These settings can be found in the Workspace preferences tool:

Workspace Preferences

If you scroll through here, you'll find a set of one line settings options (typically boolean settings). The way they show up in the workspace is how they are set by default; you can change the setting by editing the line and executing the code (or just executing it for things like dumping debug information:

Workspace Preferences

It's probably worth your time to scroll through here and have a look at what can be done.

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:
[st4u280.mp4 ( Size: 3651936 )]

posted by James Robertson

 Share Tweet This

st4u

ST 4U 279: Halos in Pharo

September 5, 2012 10:20:51.885

Today's Smalltalk 4 You looks at Halos in Pharo Smalltalk - yes, they are still there, you just have to go looking for them :). 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:

Halos in Pharo

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:
[st4u279-iPhone.m4v ( Size: 1138347 )]

posted by James Robertson

 Share Tweet This

st4u

ST 4U 278: Comparing Editions in VA Smalltalk

August 31, 2012 9:51:21.195

Today's Smalltalk 4 You looks at compaing editions in ENVY - the nice part of this is, that includes editions that you never formally released. 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:

Comparing Editions.

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 one of the simpler, but nicer features of ENVY in VA Smalltalk - the ability to compare two Applications for differences. While that's easily possible in any version control system, ENVY tracks everything - so we can even compare to versions we never released:

Comparing

Simply pop up the context menu after selecting both apps, and pick the comparison option. Note that you can include (or exclude) sub applications:

Comparing

What pops up is a differences browser, showing the places where the two applications differ. If you think you may have "lost" code in an un-released edition, ENVY makes it easy to recover it.

Differences

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:
[st4u278-iPhone.m4v ( Size: 2327433 )]

posted by James Robertson

 Share Tweet This

st4u

ST 4U 277: DDE in VA Smalltalk

August 29, 2012 14:57:41.545

Today's Smalltalk 4 You looks at using DDE (Windows) 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:

DDE.

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 DDE support in VA Smalltalk. While DDE is an old way of doing inter-process communication, it still works well, and it's easy to use. To start, load the DDE-Examples package from the features tool, and then find the DDE-Examples Application:

Example

Have a look at the DDETimeServer and the DDETimeClient. We'll be using those for the purpose of this example. Just create an instance of the server in a workspace:

Example Code

Then create the client - you should see the time printing to the Transcript. All this example does is set up a topic for the client to find, and, when found, print to the Transcript:

printing

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:
[st4u277-iPhone.m4v ( Size: 2470096 )]

posted by James Robertson

 Share Tweet This

st4u

ST 4U 276: Stdin/Stdout with Pharo

August 27, 2012 10:06:41.725

Today's Smalltalk 4 You looks at using stdin/stdout 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:

stdout

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:
[st4u276-iPhone.m4v ( Size: 1995159 )]

posted by James Robertson

 Share Tweet This

st4u

ST 4U 275: Deploying Web Services in VA Smalltalk

August 24, 2012 10:11:45.751

Today's Smalltalk 4 You puts the pieces together on WS* in VA Smalltalk - we'll deploy our simple example. 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:

Web Services.

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 back to the Web Services example we had been building in VA Smalltalk. To get started, recall the simple example we'll be using - a "counter" class:

Example

The first thing we'll need is a server to listen on a port. Start that this way:


server := SstHttpServerExample
        runAt: 'http://:7777'

        in: ('C:\Program Files\Instantiations\VA Smalltalk\8.5\xml').

The file path should be to wherever you have VA looking for the XML files, as specified in your ini file.

If you do that correctly, you should see a console window like the following appear:

Listener

That window will log what's happening, so if anything goes wrong, you can examine the results. Next, you'll need to deploy the container for your WS* application:


SstWSContainer clearAll.

"create server container" 

[ | aContainer  | 
aContainer := SstWSContainer
        createContainerNamed:  'ServerContainer'
         using: (SstWSContainerConfiguration defaultConfiguration).
        aContainer startUp.
        aContainer deploy:   'http://localhost:7777/CounterServer.xml'] fork.


You should see some reporting in the server log after doing this:

Listener

Now, we are ready to actually set up and invoke the code through a client. Here's the code for that:


"create client container" 

[ "| cContainer counterService |"
    cContainer := SstWSContainer
        containerNamed:  'ClientContainer'
        ifNone: [SstWSContainer createContainerNamed: 'ClientContainer'].
        cContainer deploy:   'http://localhost:7777/CounterClient.xml'.


   "two ways to retrieve the service from the client" 

   "counterService := (SstWSContainer 
		containerNamed: 'ClientContainer') allServices first. "
   counterService := (SstWSContainer containerNamed: 'ClientContainer') 
	serviceNamed: 'Counter' inNamespace: 'http://www.Counter.com/Counter-impl'.

   "result should be the string returned from the Counter class methods" 

   (counterService addValue: '5') inspect.
   (counterService subtractValue: '10' ) inspect  ] fork.

Notice the lines at the end where we invoke the service. If everything went well, you'll see two signs that it all worked - lines in the Transcript from the code, and more entries in the log:

Worked

Worked

Finally, if you want to experiment with the example, you may need the following "clean up" code - to clear out your listeners and start fresh:


(SstWSContainer containerNamed: 'ServerContainer') shutDown.

(SstWSContainer containerNamed: 'ClientContainer') shutDown

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:
[st4u275-iPhone.m4v ( Size: 4509257 )]

posted by James Robertson

 Share Tweet This

st4u

ST 4U 274: Examining the WS* XML Files in VA

August 22, 2012 7:44:41.704

Today's Smalltalk 4 You looks at the the XML files produced by the VA Smalltalk Web Services libraries, and where you'll need to modify them for your own use.. 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:

XML 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 take a look at the XML files generated by the VA Web Services support code, and we'll get to using it all next time. You might want to download the XML files here.

WS* Support

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:
[st4u274-iPhone.m4v ( Size: 4277034 )]

posted by James Robertson

 Share Tweet This

Previous Next (554 total)