. .

st4u

ST 4U 263: Undeclared Variables in VA Smalltalk

July 27, 2012 9:26:23.693

Today's Smalltalk 4 You looks at what happens in VA Smalltalk when you leave a variable (in this case, an instance variable) undefined. The scenario being sketched is a bit artificial; you couldn't package an application in the state being shown, and ENVY does warn you about the situation. Having said that, most developers cheerfully ignore warnings, so we'll have a look. 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:

Undefined.

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:


When you work on a number of classes at once, you can sometimes leave a variable undeclared - i.e., you have methods that use the variable, but you've deleted it from the class definition. When you do that, you'll get a warning in the Transcript - but if you miss/ignore that warning, very bad things can happen. Let's take a small example.

We've defined a class with one instance variable, and then created an instance and set that variable in a workspace:

Small class

Having created the instance in the workspace, it'll live until we leave VA or close the workspace. Now, let's delete the variable in the browser. Notice the warnings in the Transcript, but for now, we'll ignore them. Now try sending the accessing method for the variable that's been deleted:

Undeclared

What you see above is an inspector on a class - which one you get will vary, but it indicates that you are poking where you should not be poking. To demonstrate how dangerous that can be, let's use the setter and set the variable's value.

If you inspect the results of sending the getter, you'll get back the value you tried to set. However, things are now in an odd state. Depending on where you poked, VA will likely crash after you try to do something. In development, that's annoying. In production, it could mean some pretty hard to diagnose errors.

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

posted by James Robertson

 Share Tweet This

st4u

ST 4U 262: Moving Classes Between Applications

July 25, 2012 7:24:45.320

Today's Smalltalk 4 You looks at moving classes and methods between ENVY Applications. 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:

Moving Code.

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:


Sometimes you need to move one or more classes from one Application to another (in ENVY). It's fairly easy to do, but there are a few things to keep in mind. To set up, we've created three applications. In the first one, we defined a class. In the second, we extended that class (with a new method). In the third, we defined another new class:

3 Apps

Before we can move a class between applications, we need to open the editions (both source and destination). In the example here, all three applications have been released; we'll create open editions first:

open editions

Next, we'll try to move the class in MyApplication1:

move

destinations

In the second image above, all the applications to which we could move the class are listed. Notice that MyApplication2 is not listed? It's open, but it extends the class in question. Given that setup, we cannot move the class into MyApplication2. We can move it into MyApplication3, because it's open, and has no extensions that get in the way.

Why isn't anything else listed? That's simple - we didn't create an open edition on anything else - thus, they are all ineligible to be recipients of the move. ENVY only shows us the possible destinations.

Now, select the class in MyApplication3, and try to move that. You'll see the following options:

destinations

Finally, try moving the extension in MyAplication2:

destinations

That can be moved to MyApplication1, where it would simply join the rest of the class. If we do that, the browser will look like this:

moved

As with any changes made in an open edition, VA highlights them for us.

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

posted by James Robertson

 Share Tweet This

st4u

ST 4U 261: Setting up a Shared Monticello Cache

July 23, 2012 7:45:58.699

Today's Smalltalk 4 You looks at setting up a common local cache for all of your Pharo images. 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:

Monticello cache

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

posted by James Robertson

 Share Tweet This

st4u

ST 4U 260: Inspectors in VA Smalltalk, part 2

July 20, 2012 9:38:11.173

Today's Smalltalk 4 You goes deeper into the VA Smalltalk inspector. 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:

Inspector.

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 continue with inspectors in VA Smalltalk. One thing to bear in mind is that you are inspecting the live object - try inspecting the code below:


1 to: 100 by: 20.

You should see an inspector on the Interval object. The instance variables are on the left, with the values on the right. For self, we see a printable representation of the entire object:

interval

Now, on the left, select by, and change the value to something else - like 11. Pop up the menu in the right pane, and select save:

inspector

See what happened? By changing the value of one of the attributes, we changed the object:

inspector

You can do that for any object in the system, but be careful - if you were to inspect something like CwConstants, which is used across the system, and make changes, you could damage the way things operate. With Smalltalk, you have a lot of power, but you need to be careful about how you wield it.

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

posted by James Robertson

 Share Tweet This

st4u

ST 4U 259: Inspectors in VA Smalltalk

July 18, 2012 10:33:02.123

Today's Smalltalk 4 You looks at the inspector in VA Smalltalk - a powerful tool for examining objects. 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:

Inspector.

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 inspectors in VA Smalltalk. Specifically, the general inspector, and the inspector used for dictionaries. To start with, we'll inspect a couple of simple objects: an array and a dictionary:

code

Now, select the array, and inspect it. You should see what we have below: the indices of the array on the left (if this were a non-array, those would be instance variables), and the values held in those slots to the right:

inspector

Next, inspect the dictionary - it looks much the same, with the keys on the left, and their values on the right:

inspector

To see something a bit different for the dictionary inspector, let's evaluate something with a lot more keys: CwConstants.

Large Dictionary

Notice how groups of keys are on the top left (Alphabetically organized, in this case), and, if we select a group, we can see each individual key on the lower left. The values still appear on the right

Now, for dictionaries like this one, we can see a specific addition for the inspector on dictionaries. Right click on a key - notice the menu that pops up? It's different than the one we saw for arrays:

inspector menu

Try browsing references. For the one shown above, you'll see where that key is used in the system:

Usage

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

posted by James Robertson

 Share Tweet This

st4u

ST 4U 258: A Pharo HTTP Server in One Minute

July 16, 2012 10:16:38.415

Today's Smalltalk 4 You looks at how easy it is to get a Pharo based HTTP server (Zinc) installed and running. If you have a Linux box handy, you can be browsing your server in less than a minute. If you have trouble viewing it here in the browser, you can also navigate directly to YouTube.

The command line to get this going is:


curl http://zn.stfx.eu/zn/pharo-server.sh | bash

Small caveat - you may have to install curl first, depending on how you set your Linux environment up.

To watch now, click on the image below:

Zinc HTTP

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

posted by James Robertson

 Share Tweet This

st4u

ST 4U 257: Code Recovery in VA Smalltalk

July 13, 2012 11:12:56.707

Today's Smalltalk 4 You looks at code recovery in VA Smalltalk. Short of a drive failure, it's pretty much impossible to lose code when using VA, and we'll see why today. 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:

Code Recovery.

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 easy it is to recover lost code in VA - we'll create a small application and class, and then quit without saving - relying on ENVY to pick up the pieces for us. To start, here's the small class:

Class

We quit without saving, brought a base image (i.e., not one we saved) up, and sure enough, our code is nowhere to be found:

Lost Code

From the Launcher, select browse the applications in ENVY, and scroll down to the one we just lost - it will show up as not having been released, but it's all there. Tight click and select Load.

Load

That loads the application, but we still want the classes. Right click again, and select Manage Application:

Manage

From here, we can select one or more classes in the list, and load them by version - in this case, the most recent:

Load Class

Now we can return to our workspace, and try creating an instance again:

Recovered

That's one of the nicest things about ENVY - even if you don't version your code off, it does it for you. Short of a catastrophic loss of your drive, you can't really lose code.

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

posted by James Robertson

 Share Tweet This

st4u

ST 4U 256: Comparing Versions in Monticello

July 11, 2012 7:33:44.273

Today's Smalltalk 4 You looks at a small thing in Monticello - how to compare versions of a package easily. 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:

Monticello

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

posted by James Robertson

 Share Tweet This

st4u

ST 4U 255: Querying ENVY for Problems

July 9, 2012 7:45:58.996

Today's Smalltalk 4 You looks at some of the stock queries you can make of your VA system from the launcher. 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:

Envy Queries.

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 queries you can use - directly off the VA Smalltalk launcher - to get information about your applications. To get started, pull down the Tools menu, and then pull right at Query:

Queries

What that exposes is a set of stock ENVY queries you can use to diagnose possible issues in your library. For instance, in a large project it may be useful to select the first one - Open Editions - to see what you have going on. One thing you need to be aware of is that these queries all report answers to the Transcript:

Query Results

Just try them out and see what kinds of responses you get. As you develop your codebase, come back to these tools 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.

Technorati Tags: , ,

Enclosures:
[st4u255-iPhone.m4v ( Size: 4246502 )]

posted by James Robertson

 Share Tweet This

st4u

ST 4U 254: A Simple Socket Server in VA Smalltalk

July 6, 2012 9:06:12.363

Today's Smalltalk 4 You looks at setting up a socket based listener 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:

TCP.

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 again look at using sockets for basic communication in VA Smalltalk. This time, we'll set up the socket server in VA Smalltalk, and have VW Smalltalk interact with that. To get started, load the TCP support into VA:

TCP

That loads in the basic support we need. Here's the VA code to run:


"In VA"
sock := AbtSocketStream openAsServerOnHost: 'localhost' port: 8001.
sock2 := sock accept.
buffer :- sock2 next: 23.
Transcript show: buffer; cr.
sock close.

"Once that's running, In VisualWorks"
SocketAccessor exampleIPClient.



Once you have the VA side running, try the VW code. You should see the following in the Transcript in VA:

TCP

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

posted by James Robertson

 Share Tweet This

Previous Next (554 total)