Today's Smalltalk 4 You continues with "ProfStef", which is part of the "one click" Pharo download. Today we we take a look at how blocks work - this is part 1 of 2 on that. 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.
I'm back in Dallas, and I'm still waiting for network access and the work laptop to arrive. That's the bad news; the good news is, I do have an image with the entire system on it, and I'm having a look at the overrides and extensions (we are currently on VW 7.6), looking for potential issues in an upgrade to VW 7.7.1.
I was a bit worried about the Dataset mods they've made, but having looked at them a bit more, I'm less worried. What I really need to do is get network access so that I can build a 7.7.1 image and start really looking at things with the Comparison tool - but that's on hold. With luck, things will fall into place before the end of the week :)
The absurdity of copyright law knows no bounds. After the Supreme Court hung 4-4, with one justice recused, the lower court ruling held:
Omega, of Switzerland, sued Costco for copyright infringement, because Costco was obtaining the watches from unauthorized European dealers that sold them far cheaper than U.S.-based Omega distributors. Omega copyrighted the watch design in the United States by imprinting the company’s emblem on the underside of the timepiece.
So with that, the clear incentive is to produce your goods outside the US, apply copyright via the method used in this case, and then sue all used goods stores out of existence.
You know how software is licensed? If this idea lasts, hardware will go the same way.
Today's Javascript 4 You. Today we look at one of the more useful looping consyructs in Javascript - it's a lot like the iterators in Smalltalk. If you have trouble viewing it here in the browser, you can also navigate directly to YouTube.
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.
I've upgraded BottomFeeder from one rev of VW to another multiple times now, so I have a pretty good feel for looking at overrides - but on this new job, I wanted something bit more formal than "eyeball the bundle and look for red, bolded classes". So, I wrote a small reporter that starts out with this, in the older version of VW:
That collects all of the classes in the current image where the class definition is an override. Usually, that means that a developer has added one or more instance variables to the class for an application (or tool) specific reason - although in this app, there are two such overrides where the class definition hasn't changed. That likely means someone bailed on a modification at some point, but neglected to remove the override.
Anyway - with that information in hand, I just bossed out some basic data - the full name of the class (i.e., full namespace qualification) and the array of instance variable names. Then I loaded that information into a 7.7.1 image, got the class from the string name, and grabbed the array of instance variables for each of those. With the two sets of data sitting in an object, it's easy to do some basic comparisons. Useful, and not at all difficult.
One of the small annoyances in VisualWorks is the way selection works with listboxes when you set them for:
Select on (mouse button) down (the normal way to do it)
Set up the listbox for multiple selections
Want the user to be able to select mutiple items, come back, and then drag the previously selected group
That last thing is what doesn't work out of the box - instead, when you first click the left button, the selected group is de-selected, and the one thing you were pointing at when you wanted to do a drag operation becomes the new selection.
As you might guess, given the way most end user tools now work, end users are not entirely pleased with this turn of events. So... It was off to controller land. A few minutes of investigation told me that multi-selection listboxes use the class EmulatedSequenceController, and I started trawling through the code.
Now, other than patching some of the more egregious flaws in the way Datasets work, I haven't done a lot of hacking on controllers. So it took me a bit of rathole diving before I realized that the problem was in EmulatedSequenceTracker, which works in conjunction with the controller. If you look at the #redButtonPressedEvent: method there (with a flashback to Xerox mice tossed in), you find that you end up calling down to #setUpDragDropFor:
setUpDragDropFor: aMouseButtonEvent
"If we are doing drag and drop, we don't have to do the preparation
work"
self outside: false.
(controller selectOnDownWithDrag and: [self view selectionIndex ~= self view targetIndex])
ifTrue:
[self controller toggleTargetWithEvent: aMouseButtonEvent.
selectionDone := true]
The problem resides in the first statement in the block - the controller is told to toggle the selection, and it dutifully does so. It's only later in the call chain that drag/drop is checked for, by which time the selection has been reset. So... I hacked up three methods in EmulatedSequenceController to make that happen on red button up instead of on red button down - note the extra checks for whether we want to drag or not; without that, you get some truly weird behavior:
setUpDragDropFor: aMouseButtonEvent
"If we are doing drag and drop, we don't have to do the preparation
work"
"JR 12/13/10: For multi-select, don't toggle target on red down. Instead, that should happen on red up"
self outside: false.
(controller selectOnDownWithDrag and: [self view selectionIndex ~= self view targetIndex])
ifTrue:
["self controller toggleTargetWithEvent: aMouseButtonEvent."
selectionDone := true]
redButtonReleasedEvent: aMouseButtonEvent
self sensor ungrabMouseEventFor: self.
self finishSelectionForEvent: aMouseButtonEvent.
"JR 12/13/10 - moved out of the #redButtonPressedEvent: method.
For multi-select lists, if drag/drop is on, we want selections toggled on mouse up"
self wantsToDrag
ifTrue: [self controller toggleTargetWithEvent: aMouseButtonEvent.
selectionDone := true]
This method below is mostly the same as the inherited version, with the extra ifFalse: clause at the end:
setUpFor: aMouseButtonEvent
"If we are doing drag and drop, we don't have to do the preparation
work"
"JR 12/13/10 - When not dragging, actually make the selection"
| index |
selectionDone := false.
startPoint := self cursorPointFor: aMouseButtonEvent.
self outside: false.
(index := self view numberOfElements) = 0 ifTrue: [^self].
index := self controller findElementFor: (self cursorPointFor: aMouseButtonEvent).
self view targetIndex: index.
self wantsToDrag
ifTrue: [self setUpDragDropFor: aMouseButtonEvent]"This API is obsolete. Use cursorPointFor: instead."
ifFalse: [self controller toggleTargetWithEvent: aMouseButtonEvent.
selectionDone := true]
In the button release method, I copied over both lines from the block in #setUpDragDropFor:. After that, things worked the way I wanted them to - with multiple selections only deselecting on mouse button up. Kind of amusing that such a small fix took me most of the day to track down, but there you go :)
Today's Smalltalk 4 You continues with "ProfStef", which is part of the "one click" Pharo download. Today we we continue with Blocks - this is part 2 of 2 on that. 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.
Travis has been thinking about sort functions in Smalltalk, and how to follow the same patterns shown in SymbolValue and Block culling:
Since the introduction of SymbolValue and Block culling, one of the things I've chased is how to do this same style of programming with sorting. For most sorting cases, you have a series of objects that you want to sort on some particular attribute. Maybe a sequence of customers you'd like to sort by name.
Travis goes into the approach he picked - go read the whole thing for the details. I do like this summation:
I sat down last night, and with tests, put together a TAG-SortFunctions package, published in the Cincom Public Repository. The basic idea was to use an object. Time and time and time again over the years, I rediscover the principle "there's an object waiting to be birthed here!"
A lot of sins in Smalltalk code can be solved by remembering to create a new object when it's useful to do so. It's not like they cost money :)
Yesterday, I pushed up a post detailing a hack I did to make drag/drop in VisualWorks listboxes work more like they are expected to work. One problem though; my "fix" pretty much breaks select on down, which isn't really what you want.
As is usually the case with such things, if the fix seems overly complex, you're probably doing something wrong - and I certainly was here. The problem comes up in EmulatedSequenceTracker>>setUpDragDropFor:
setUpDragDropFor: aMouseButtonEvent
"If we are doing drag and drop, we don't have to do the preparation
work"
self outside: false.
(controller selectOnDownWithDrag and: [self view selectionIndex ~= self view targetIndex])
ifTrue:
[(self isTryingToGrabPreviouslySelectedAreaWith: aMouseButtonEvent)
ifFalse: [self controller toggleTargetWithEvent: aMouseButtonEvent].
selectionDone := true]
Notice the change from what I posted yesterday. Instead of outright ignoring the selection, I added a test - and the test method looks like this:
isTryingToGrabPreviouslySelectedAreaWith: anEvent
"if the user is trying to grab a previously selected area, and drag/drop is on, answer true. Otherwise answer false"
| index indices |
controller wantsToDrag
ifFalse: [^false].
index := self view targetIndex.
indices := self view selectionChannel value.
(self eventHasKeyboardOptionsDown: anEvent)
ifTrue: [^false].
^(indices includes: index)
Basically, you ask three questions:
Is drag/drop on? If not, just proceed normally
Is the user trying to select a previously selected thing (individually or a group)? If so, ignore that selection so that drag/drop can proceed.
With respect to the previous test, let the event proceed if a keyboard modifier is down
That test on keyboard modifier looks like this:
eventHasKeyboardOptionsDown: anEvent
"we want keyboard modifiers to still affect the selection - the #respondsTo: test makes this
work in both VW 7.6 (and older) and VW 7.7.1"
^(anEvent respondsTo: #ctrlOrCommandDown)
ifTrue: [anEvent ctrlOrCommandDown | anEvent shiftDown]
ifFalse: [anEvent ctrlDown | anEvent altDown | anEvent shiftDown]
With that, it looks like things respond the way you would expect, and select on down works (unlike the hack I posted yesterday). I also think this is closer to a supportable fix - although I suspect a full rewrite of the controller and tracker are still a decent idea. You can find the code in the public repository as MultiSelectPatch. Kind of outside my scope though :)
Welcome to episode 15 of "That Podcast: An FNV Diary" - a podcast where Michael Lucas-Smith and I document our trials and tribulations in Fallout: New Vegas.
On today's podcast, Michael and James talk about mods for the PC edition of the game. There's a lot of stuff there, even though it's still eary days in terms of mods.
Got feedback? Send it to James. We'd really appreciate it if you head on over to iTunes and leave a comment - enjoy the podcast, and we'll see you in the wastelands!
Welcome to episode 15 of "That Podcast: An FNV Diary" - a podcast where Michael Lucas-Smith and I document our trials and tribulations in Fallout: New Vegas.
On today's podcast, Michael and James talk about mods for the PC edition of the game. There's a lot of stuff there, even though it's still eary days in terms of mods.
Got feedback? Send it to James. We'd really appreciate it if you head on over to iTunes and leave a comment - enjoy the podcast, and we'll see you in the wastelands!
Today's Javascript 4 You. Today we start looking at exception handling in Javascript. If you have trouble viewing it here in the browser, you can also navigate directly to YouTube.
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.
One of the things I've been asked to look at here is build automation. Right now, all builds are done manually, using RTP - and sometimes, based on various things going on, they need multiple builds done per day. As you can imagine, that takes up a lot of staff time, and adds in an error prone personal component to the process.
Now, I'm hardly an expert in such things, and for that matter, there are entire toolsets devoted to this field. Having said that, I do have a set of build scripts for BottomFeeder, so I have done some work here. When I sat down to look at what I do for Bf, I realized that while I've automated pieces, I haven't automated everything. So, I created a small (very small) tool to tie my process together. We'll see whether or not it scales up well enough to use for the problem at work, but that's in the future.
Right now, here's how I do BottomFeeder builds:
Execute a Smalltalk script that creates a runtime image
Execute a second Smalltalk script that uses image compression tools to shrink down the image file for deployment
Run a shell script that creates the various zip files I throw up to the server
Manually use sftp to ttransfer the files
Not as automated as I'd like :) I wrapped the first three things up with the tool I created - the last bit will require some research on my part - I haven't done unattended sftp in a shell script before, and unlike stock FTP, it's not something I can do in Smalltalk out of the box. So how does it work? Simple, really - I have a key=value ini file that describes each script that will run. The one for BottomFeeder looks like this:
Basically, each section describes how to run the script, whether it's a VW script or not, and an assertion script to go with the build piece. That assertion piece is just a small bit a of Smalltalk that should return a boolean, explaining whether the associated build script worked or not. Then I put together a (very simple) UI that lets me pick a script to use, and see the results. Heck, I even have tests :) That window looks like this, after I ran my test script:
That's pretty much it, really - there's plenty that could be done, and it's hardly the best build system in the world - but it suits my purposes well enough, and automates what was a tedious build process. Whether it scales up for a real project - I'll find out soon enough :) If you're interested in taking a look, load the "BuilderBundle" bundle from the public store repository. I'm happy to hear any comments, good, bad, or indifferent.
Today's Smalltalk 4 You continues with "ProfStef", which is part of the "one click" Pharo download. Today we we take a look at how conditionals work - like most other things in Smalltalk, it's noy built in syntax, it's part of the library. 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.
For years, I've been saying that to create great Web content, you need to always be thinking: Nobody cares about my products and services except me and the others in my organization. What your buyers do care about are themselves and they care a great deal about solving their problems (and are always on the lookout for a company that can help them do so).
The thing is, it's true - but only to an extent. In the process of telling people how you can solve their problems, you have to get into the how - and presumably, that involves.... your product(s). So yes, no one cares about your products - in the abstract. What they might care about is how your products can be used in their domain.
In order to get there, you do actually have to - *gasp* talk about your products. Because cutesy videos might attract a lot of views, but if they don't relate you and your products to a live problem, that's all they do.
Are you tired of marshaling state, mapping URLs, and making sure your form fields all have unique element IDs? Do you long for a better way to develop for the web, without editing XML files? Do you ever wish complex online applications actually let you use the Back button? Seaside frees you from these burdens, leaving you to focus on creating the applications that can make or break your business.
Here's another video from ESUG 2010, which was held in Barcelona, Spain, the week of September 13, 2010. In this presentation, Thomas Stalze talks about System Integration. You can watch using the embedded player below, or follow this link to Vimeo.
Syfy announced today it will end its original action-adventure series Stargate Universe once the show returns to finish its second season in the spring of 2011. The upcoming 10 episodes will be the series' last.
I find it depressing that well written shows like this just don't find a place.
Mariano Rivera admitted the unthinkable had been a possibility. — The Boston Red Sox offered him a chance to turn in his pinstripes and switch sides in baseball's fiercest rivalry. — “It was real.
I follow baseball pretty closely, and I'm a big Yankees fan - but this is one of those periodic reminders that it's primarily a business, not something put out there for the sole enjoyment of the fans. When that fourth wall breaks (think Babe Ruth going to the Yankees, or his late career away from the Yankees), it makes that all the more obvious.
I've always been a big reader - I just finished two sci fi books on my last trip to Dallas (I still need to post the reviews for those). What I'm finding lately is this: I'd much prefer to read on my iPad than read on paper.
Why? A few reasons:
The iPad is light. I can carry as many books as I like on it, and it doesn't get heavier
I can buy a new book anytime I have access to the net
I don't ever have to worry about losing my place - the Kindle app manages that for me
I think the weight thing is the big one. I'd really rather not cart a bunch of books in my travel bag - especially since they are just so much dead weight after I've finished. Even with books I've been waiting for, like Towers of Midnight - I'll wait for the digital edition. The hardcover is too big, and even the paperback (when it comes out) will take up a lot of space.
Welcome to episode 10 of Independent Misinterpretations - a Smalltalk and dynamic language oriented podcast with James Robertson, Michael Lucas-Smith, and David Buck. This week David and I spoke about the supposed interchangeability of developers - something management longs for. While we don't think this is advisable or desirable, there are some ways in which some level of interchnageablility is useful: no one wants a dead project because a key developer leaves.
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 10 of Independent Misinterpretations - a Smalltalk and dynamic language oriented podcast with James Robertson, Michael Lucas-Smith, and David Buck. This week David and I spoke about the supposed interchangeability of developers - something management longs for. While we don't think this is advisable or desirable, there are some ways in which some level of interchnageablility is useful: no one wants a dead project because a key developer leaves.
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!
I just finished reading a very interesting book - "Spin" by Robert Charles Wilson. I also finished the second (of three?) books in the series, "Axis". The books are connected, but can be read separately - it does help to read Spin first so that you know how things got to be the way they are.
To summarize the plot of the first book, one night the stars go out. Panic ensues, and then things get progressively more odd as the reason for the blackout is found: the Earth has been wrapped in some kind of barrier that keeps time passing normally as billions of years pass beyond the barrier. That gives rise to a bunch of "end of the world" cults, as it seems obvious what will happen if the barrier is removed after enough time has passed that the Sun itself starts to expire.
Suffice to say that doesn't play out exactly as the doomsayers expect - but neither do things "go back to normal", either.
The second book is concerned with what happens after the spin barrier is removed. I don't really want to get too far into that, as doing so would spoil the first book. It leaves a lot for a follow on book though, so I'm certainly looking forward to that.
While the setting is near future, and it's clearly a sci-fi setting, it's mostly about the people. I became very attached to a number of the people - one thing I will say is that Wilson is not afraid to kill off characters, even ones that have become quite central to the story thus far. That keeps you reading - no one is safe. I'm looking foward to book three, and if you like pondering how people would collectively and individually handle a presumed apocalypse - that then doesn't play out as the worst fears had it - these are great books.
It's the end of the year, so it's time to look at the schedule for the videos and podcasts. JS4U and ST4U will be on hold after Wednesday until the new year; there will be at lest one more "Independent Misinterpretations" before the end of the year, but then that will go on hiatus until January as well.
Have a Merry Christmas, Happy New Year, and enjoy the archives until January rolls in!
Today's Javascript 4 You. Today we start looking at exception handling in Javascript. If you have trouble viewing it here in the browser, you can also navigate directly to YouTube.
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.
The two things that you spend most of your time doing as a programmer — coding and debugging — are made noticeably easier and more fun by that combination of Smalltalk language and IDE. The language syntax is small, powerful, expressive, introspective. The entire stack (and libraries, and IDE) is written in Smalltalk (turtles all the way down), and you have access to the source code, allowing you to study and extend all operations, basic and complex. The code organization — explicit, first-class visual IDE support for packages, classes, protocols (groupings of methods by intended use) and methods — is extremely helpful.
Follow the link and see what he says about the debugger - non-Smalltalkers often miss the power of the debugger in Smalltalk.
I have two - count 'em, two - strings of lights across my doorway and the step railings outside:
As I was plugging them in, they went out. I thought one string had dropped a fuse, so I went looking for replacements - and found my battery backup in the basement (the one I use for the router) beeping. The ground fault on that plug had popped. How the heck are two lousy strings of lights an overload state?
The Aida 6 web framework is rather different in objectives than Seaside 3 as a Smalltalk application server. My specific interest was to determine to what extent the services for web applications were orthogonal to any given web markup. Both default to HTML but I am looking at frameworks suitable for emitting declarative Curl markup using the Curl web content language (originally MIT and now Sumisho.)
I found this interesting, because it's ground I've mostly covered with my Silt server - things like iTunes enabled feeds, XML-RPC interfaces for posting tools, and so on:
In which I hope to adequately explain how I used PierCMS to launch my new podcast, Those Optimize Guys.
Sergio advocates using Feedburner, which does most of the work for you. Probably a decent idea now, but I like the fact that all generation is under my control :)