Planet Smalltalk

May 21, 2013

Noury Bouraqadi - Installation of ROS on OSX Montain Lion

This documentation is based on: http://www.ros.org/wiki/fuerte/Installation/OSX/Homebrew/Source.  Only the three points in red are different from the official documentation. Start by installing Homebrew and configuring the environment to use Homebrew. Requirements Apple doesn’t include an X Windows server anymore, so you need to install Quartz X Windows Server Command Line Tools for Xcode or Xcode 4 XCode 4.3: Command… Continue reading

Tom Koschate - Caught in a (vm)Trap

I was reminded by recent posting by Joachim Tuchel (VMTRAP with VA Smalltalk due to strange bytecode differences (or whatever)), that I needed to document my own recent experience with vmtraps.

I was working with another developer at TAF debugging a VA Smalltalk 8.5.2 image in AIX when his development image died, and couldn’t be re-opened. Moments later, other developers using the same AIX machine reported that they couldn’t open development images either. Packaged images were fine, as were VAST 8.0 images. Lacking a better solution at the time, I had our system administrator bounce the box, and all was well.

I was later reminded by the fine folks at Instantiations support that I should have checked for rogue es processes, and made sure that the /tmp/es directory was clear of all files once every possible Smalltalk process was gone. The same reminder would hold true for Linux and Solaris users as well.

Just something to keep in mind when working with Smalltalk in a UNIX environment…


Pharo News - Pharo by Example Spanish

 A Spanish translation of the Pharo by Example book is available.

- PDF: here
- http://pharobyexample.org

JR's Smalltalk 4 You - ST 4U 389: STON Serializer

Pharo has a simple object serializer, STON - today we'll take a look at it.

Torsten Bergmann - To trap a better mouse

Ian Piumarta (Squeak Unix VM maintainer, long time Squeaker and Smalltalker) who is working for Viewpoints Research Institute will speak Wednesday May 29, 2013, 3:30 pm at Room W1008, West Building 8W, Ookayama campus, Tokyo Institute of Technology about "To trap a better mouse".

Yoshiki Ohshima - [映画] Star Trek Into Darkness

Trekkieではない私も、グループで見に行きました。どういう映画だったかというとまあ下記のリンク先の通りなのですが、BonnieがFacebookで書いている通りにそれでも楽しい映画ではありました。 http://io9.com/star-trek-into-darkness-the-spoiler-faq-508927844

May 20, 2013

Francois Stephany - Scroll UITableView to currently selected UITextField

Situation

I have a UITableView. Each cell of the table view has a UITextField in its contentView. The table view is actually a giant form.

In iOS when a tableView has cells containing textfield, it is supposed to scroll when a textfield becomes the first responder so focused textfield is visible when the user edits its content.

It wasn’t the case for me.

Solution

Do not forget the [textField resignFirstResponder] when passing the isFirstResponder to the next textfield. Otherwise the tableView won’t scroll to the new first responder when editing.

- (BOOL)textFieldShouldReturn:(UITextField *)textField {
  NSInteger nextTag = textField.tag + 1;
  UIView* nextResponder = [self.view viewWithTag:nextTag];
  [textField resignFirstResponder];

  if (nextResponder) {
    [nextResponder becomeFirstResponder];
  }
  return YES;
}

Et voilà, the tableView will scroll as you expect.

JR's Smalltalk 4 You - ST 4U 388: Pharo Screen Capture

Pharo has the ability to do screen captures of its environment built on now; today we'll have a look

May 19, 2013

Independent Misinterpretations - IM 127: Native Boost

Igor Stasenko talks bout Native Boost at Smalltalks 2012

Pharo News - Malinglist Move

The Pharo users and development lists have been moved to a new (and hopefully more stable) server.

pharo-dev: this is the development list discussing the development of Pharo itself.

pharo-users: This is for everyone who uses Pharo to develop Software and for those who want to learn Pharo.

The most comprehensive archive can be found on Nabble (users, dev).

Pharo News - Pharo Mailinglist Move

Pharo Mailinglist Move

Pharo News - Mailinglists Moved

The pharo development and user mailinglists moved to a new server last week.


May 18, 2013

Holger Hans Peter Freyther - Using the new PackageLoader feature when creating unit tests for DBD-PostgreSQL

In the previous post I briefly mentioned the new feature of the PackageLoader that went into the development version of GNU Smalltalk. Today I am going show a usage of it.

GNU Smalltalk has a database abstraction called DBI and multiple backends (MySQL, SQLite and PostgreSQL). In general I am using the SQLite backend to develop my application and depending on the users (e.g. do I need concurrent access) I will move to PostgreSQL. When moving my new application to PostgreSQL the import of data failed and this was due some issues with the conversion of Smalltalk types to PostgreSQL.

After some exploring to understand the issue I started to develop a unit test. The first thing I did was to create a test entry in the package description of DBD-PostgreSQL, fileIn a file and name a SUnit TestCase or TestSuite.


 <test>
   <sunit>DBI.PostgreSQL.PostgresTestCase<sunit>
   <filein>Tests.st</filein>
 </test>

The next thing is to start GNU Smalltalk and load the package and get the test. I cheated a bit and directly constructed a Kernel.DirPackage instance.


$ gst
st> package := Kernel.DirPackage file: 'package.xml'
st> package fileIn.
st> test := package test.
st> test fileIn.

The above code has loaded the main package (and dependencies) and the test package as well. I went ahead and manually invoked the tests I have. This can be done by sending the >>#buildSuite message to my TestCase and then calling run on the result.


st> DBI.PostgreSQL.PostgresTestCase buildSuite run
0 run, 0 passes

Now I can start to write the actual testcases. I decided to write one test per datatype. I created a >>#setUp selector that opens the database connection and creates a table that contains every built-in type of PostgreSQL as column and a >>#tearDown to close the database connection. Then I decided to write one test per datatype and started with the ones I knew that were broken. I could incrementally create tests and type the following commands to execute them.


st> test fileIn. DBI.PostgreSQL.PostgresTestCase buildSuite run

As expected my first tests were failing. I decided to use the open classes feature of Smalltalk and put the fixes to the tests into the Tests.st file and re-executed the above and my test started to pass, then I wrote another test, executed the suite, created a fix, re-loaded and ran the tests. This has worked nicely but then there was a fix that manipulated a lookup table owned by a singleton. This means that my changes to the code were not picked up as the instance was already initialized. There are multiple ways to overcome this. I could have called the initialize function of the singleton again, I could have manipulated the lookup table inside the singleton or I could have re-set the singleton. I decided to do the later using the reflection facilities of Smalltalk. I put a nil into the instanceVariable called uniqueInstance of the PGFieldConverter class.


st> DBI.PostgreSQL.PGFieldConverter instVarNamed: #uniqueInstance put: nil

After re-executing the testsuite the singleton was re-created and the next testcase was fixed. The only thing left to do was to move the fixes from the Tests.st to the right place in the original files and run make check on the entire codebase to check that everything works as expected.

May 17, 2013

Cincom Smalltalk - Smalltalk Digest: STIC’13 PREVIEW EDITION

May's special STIC'13 Preview Edition of the Smalltalk Digest is available now.

JR's Smalltalk 4 You - ST 4U 387: Cascades and yourself

People new to Smalltalk often wonder why cascades usually end in #yourself. Today we'll look at why that is.

Pharo News - Web with Pharo Conference 6 June 2013 @ Lille

Inria is organizing a conference around the web and pharo the 6 June 2013 at Euratechnologies, Lille.

https://www.inria.fr/centre/lille/agenda/web-3.0-avec-pharo

Great speakers (J. Brichau from Yesplan, N. Petton from Amber and objectfusion, N Hartl from 2Denker,...) will present their business and products as well as some of the technology they use.
Do not miss this key event!

https://www.facebook.com/events/534073843317751/

Register at: http://bit.ly/16ahf7f

Joachim Tuchel - Zipping files in VA Smalltalk

Marten shares  a source snippet on how to create a zip archive with VA Smalltalk: Today I was in the need to create a zip archive in VASmalltalk and zip-code had been introduced with the new Monticello Importer in version 8.5.2 (application: MZZipUnzipApp) Read the rest on his blog. Tagged: english, Smalltalk, tutorial, VA Smalltalk

Noury Bouraqadi - CFP SSRR 2013: Symposium on Safety, Security and Rescue Robotics in Linkoeping, Sweden, October 2013

The 11th IEEE International Symposium on Safety, Security, and Rescue Robotics continues its tradition of attracting cutting-edge papers in the theory and practice of robots for all types of safety, security, and rescue applications such as disaster response, mitigation and recovery; rapid and secure inspection of critical infrastructure; detection of chemical, biological and radiological risks,… Continue reading

May 16, 2013

Cincom Smalltalk - The Cincom® ObjectStudio® GUI Files – Part 2: Fundamentals

The current ObjectStudio GUI project is bringing considerable innovations to the environment.

Marten Feldtmann - VASmalltalk – how to create a zip archive …

Today I was in the need to create a zip archive in VASmalltalk and zip-code had been introduced with the new Monticello Importer in version 8.5.2 (application: MZZipUnzipApp)

Documentation is spare and therefore a simple code example how to create a zip archive (and as a reminder for me):

| cfsPath zipArchive |
"where all my files are located"
cfsPath := CfsPath named: 'D:\json-sendelisten'.

"my zip archive to write"
zipArchive := MZZipArchive openWrite: 'd:\test8.zip'.

"i want to add all file from that directory ..."
cfsPath fileEntries do: [ :eachFileEntry |
  | singleFile fileContent |
  singleFile := cfsPath append: eachFileEntry dName.
  
  "method from MSKCfsExtension"
  fileContent := singleFile mskGetBinaryContent.	

  zipArchive 

    "create a current file within the archive"
    createFile: eachFileEntry dName 
    comment: '' 
    method: MZConstants::Z_DEFLATED 
    level: MZConstants::Z_BESTCOMPRESSION;

    "write the binay content of the file to the archive"
    write: fileContent ;

    "close the current file in the archive"
    closeCurrentFile.
].

"close the archive"
zipArchive close.

Filed under: Smalltalk Tagged: Smalltalk, unzip, zip

JR's Smalltalk 4 You - ST 4U 386: Code Critic in Pharo

Pharo 2.0 includes the code critic tool, which lets you take a look at possible defects in your code

Stephan Wessels - Part of my Squeak Tutorial was translated to Serbo-Croatian

Here’s the link to the translated page: Squeak Tutorial page translated to Serbo-Croatian.

I added a note to the page explaining what happened and why. Pretty neat.

DiggFacebookLinkedInMySpaceSlashdotTwitterShare

May 15, 2013

Andres Valloud - HPS source size over time

When I joined Cincom in 2007, source code cleanup for our VM was one of the first priorities for engineers because cruft was getting too much in our way.  This cleanup might sound easy to do, but it takes a large amount of effort precisely because so much cruft had accumulated.  What tends to happen is that one thing leads to another and all of a sudden what was meant as a removal of an obsolete feature involves investigating how every compiler in use reacts to various code constructs.  And then you also find bugs that had been masked by the code you're trying to remove, and these require even more time to sort out.

From a features point of view, it's unrewarding work because at the end of the day you have what you had before.  The key difference, which becomes observable over time, is that when you put in this kind of work then support call volume starts going down, random crashes stop happening, and the code cruft doesn't get in your way so you don't even have to research it.  As a result, the fraction of time you can spend adding new features goes up.

We've been at it for over 6 years now, and we can clearly see the difference in our everyday work.  Take a look:
  • VW 7.4 (2005): 337776 LOC.
  • VW 7.4 (2005): 338139 LOC.
  • VW 7.4a (2006): 358636 LOC.
  • VW 7.4b (2006): 358957 LOC.
  • VW 7.4c (2006): 359419 LOC.
  • VW 7.4d (2006): 358782 LOC.
  • VW 7.5 (2007): 358921 LOC.
  • VW 7.6 (2007): 357264 LOC.
  • VW 7.6a (2008): 350093 LOC.
  • VW 7.7 (2009): 345618 LOC.
  • VW 7.7a (2010): 270093 LOC.
  • VW 7.7.1 (2010): 270124 LOC.
  • VW 7.7.1a (2010): 270119 LOC.
  • VW 7.8 (2011): 261580 LOC.
  • VW 7.8a (2011): 261611 LOC.
  • VW 7.8b (2011): 261739 LOC.
  • VW 7.8.1a (2011): 261748 LOC.
  • VW 7.9 (2012): 252309 LOC.
  • VW 7.10 (2013): 240880 LOC (March).
As you can see, from the high water mark of 359419 LOC to today's 240880 LOC, we have removed 33% of the VM's source code.  Think of it: wouldn't it be nice to drop a third of your source code while killing a ton of bugs and adding new features?  Also, using the standard measuring stick of "400 page book" = "20k LOC", we can see HPS went from requiring 18 to 12 books.

We still have more code deletions queued up for 7.10, which are associated with various optimizations and bug fixes.  With a bit of luck, we'll reach 12k LOC (that is, about 240 printed pages) deleted in this release cycle.

Update: we went into code freeze in preparation for 7.10.  Here's an update on the code deletion.
  • VW 7.10 (2013): 240368 LOC (April code freeze).
Another 500 LOC bit the dust since March, and the VM executable became a couple kilobytes smaller too.  Finally, we're at basically 12k LOC deleted for the whole release.

Update 2: we gained about 500 LOC for 7.10, but only in exchange for IPv6 functionality.  I'll update the LOC count later since we know there are a few more fixes that will go in.

Joachim Tuchel - VMTRAP with VA Smalltalk due to strange bytecode differences (or whatever)

Today I was on the hunt. And I finally shot the beast that killed hundreds of good men over the last decades or so. Well, at least it seems it’s dead, and I don’t really know why. I know it’s dead and I was hunting for it, but I am not sure I pulled the […]

Holger Hans Peter Freyther - PackageLoader>>#loadPackageFromFile:

GNU Smalltalk has the concept of packages for a long time. By default the gst-package application will read an XML file and then create a ZIP archive. This package format is called a Star archive in GNU Smalltalk.

When developing it is easier to just load the package from the filesystem and this is why we now have the above PackageLoader>>#loadPackageFromFile:.

Cincom Smalltalk - Schedule for STIC’13 Unveiled

Conference organizers have unveiled the schedule for STIC’13, which will be held on June 9-12, 2013 at the Wigwam Resort in Litchfield Park (Phoenix), Arizona.

JR's Smalltalk 4 You - ST 4U 385: Pharo Browser Tools

In Pharo 2.0, a few useful browsing tools are easily accessible on the right hand side of the code pane - today we'll explore them

James Robertson - Pharo and the Web: A Conference

From Stephane:

We are organizing a conference around the web and pharo on 6 June 2013 at http://www.euratechnologies.com.

Great speakers (J. Brichau from Yesplan, N. Petton from Amber and objectfusion, N Hartl from 2Denker,...) will present their business and products as well as some of the technology they use. Do not miss this key event.

Tags:

May 14, 2013

JR's Smalltalk 4 You - ST 4U 384: VisualWorks and Multi-Monitor on Mac

Depending on how you have your second monitor set up on OS X, you can get exceptions out if VisualWorks doing common actions. Today we'll look at a simple work-around for the problem

Pharo News - Pharo3: The Power of the AST

Pharo3 development is rapidly progressing. One of the plans for Pharo3 is to use a high level code model based on the the AST (Abstract Syntax Tree) of the Refactoring Engine.

We will use it in many contexts, here are two examples.

Navigation. When selecting code or navigating expressions, the editor can do better then just using word boundaries:

Suggestions. When we want to do an actions on a selection, why not just show those that make sense? Why do I need to carefully highlight a  selector to browser implementors? The AST model can do much better!

This work is done by Gisela Decuzzi and available in the last Pharo3 builds. More to come! e.g. better shortcuts, AST based syntax highlighting, and much more.