. .

smalltalk

More Smalltalk

April 27, 2010 15:48:49.000

I just spotted another Smalltalk implementation:

ChocoSmallTalk is a hybrid SmallTalk/Lisp implementation in Common Lisp. The purpose of this project is an embedded SmallTalk in Lisp, known as a meta-circular implementation of lisp as an add-on. As time permits this project should be usable on ARM based processors on handhelds to make a real lisp-smalltalk machine.

Technorati Tags: ,

posted by James Robertson

 Share Tweet This

smalltalk

Using LOBs with Oracle and VisualWorks

April 27, 2010 6:29:36.418

Today's Smalltalk Daily looks at using LOBs with Oracle (version 9 and up) with VisualWorks. If you're looking for a particular topic, you can find it with the Media Search application on our site.

The code used is below; To watch, click on the viewer:


"The following are examples to demonstrate performance improvement when 
setting the right size of LOB buffers."

"Connect to an Oracle database."
conn := OracleConnection new.
conn username: 'username';
password: 'password';
environment: 'ORACLEDB'.
conn connect.
sess := conn getSession.

"Drop the test table if existed."
sess prepare: 'DROP TABLE TestLob';
	execute;
	answer;
	answer.

"Create a test table."
sess prepare: 'CREATE TABLE TestLob (A CLOB, B BLOB, C INTEGER)';
	execute;
	answer;
	answer.

conn begin.
insertSQL := 'INSERT INTO TestLob (a, b, c) VALUES (?, ?, ?)'.
sess prepare: insertSQL.
clobLength := 2097152. "2MB"
blobLength := 2097152. "2MB"
clob := String new: clobLength withAll: $a.
blob := ByteArray new: blobLength withAll: 1.

sess lobBufferSize: 32768.  "32KB is the default buffer size for read/write Large Objects."

insertTime1 := Time millisecondsToRun: [
		sess bindInput: (Array with: clob with: blob with: 1);
		execute;
		answer;
		answer.
].

"Print out the miliseconds spent."
Transcript 
	cr; 
	show: 'Time spent for insert when lobBufferSize is 32KB ', insertTime1 asFloat printString.

"Set lobBufferSize to 1MB"
sess lobBufferSize: 1048576.  "1MB"

insertTime2 := Time millisecondsToRun: [
		sess bindInput: (Array with: clob with: blob with: 2);
		execute;
		answer;
		answer.
].

"Print out the miliseconds spent."
Transcript 
	cr; 
	show: 'Time spent  for insert when lobBufferSize is 1MB: ', insertTime2 asFloat printString.

conn commit.

conn begin.
sess := conn getSession.
selectSQL := 'SELECT * FROM TestLob'.
sess answerLobAsValue. "Get LOBs back as values."
sess defaultDisplayLobSize: 2097152. "We want every byte of the LOBs returned."

sess lobBufferSize: 32768.  "32KB is the default buffer size for read/write Large Objects."
selectTime1 := Time millisecondsToRun: [ | ans1 |
		sess prepare: selectSQL;
		execute.
		ans1 := sess answer.
		ans1 upToEnd.
].

"Print out the miliseconds spent."
Transcript 
	cr; 
	show: 'Time spent for select when lobBufferSize is 32KB ', selectTime1 asFloat printString.

"Set lobBufferSize to 1MB"
sess lobBufferSize: 1048576.  "1MB"

selectTime2 := Time millisecondsToRun: [ | ans2 | 
		sess prepare: selectSQL;
		execute.
		ans2 := sess answer.
		ans2 upToEnd.
].

"Print out the miliseconds spent."
Transcript 
	cr; 
	show: 'Time spent  for select when lobBufferSize is 1MB: ', selectTime2 asFloat printString.

conn rollback.


You can download the video directly here. If you like this kind of video, why not subscribe to "Smalltalk Daily"?

Technorati Tags: , , ,

posted by James Robertson

 Share Tweet This

smalltalk

Argentina Leads the Way

April 26, 2010 15:30:29.000

For the upcoming Google "Summer of Code" projects, four of the five projects are being led by people from the Argentinian Smalltalk community. Looks like the Smalltalks conference series has been doing good things down there :)

Technorati Tags: , ,

posted by James Robertson

 Share Tweet This

smalltalk

Scratch on the Podcast

April 26, 2010 8:35:10.000

This Tuesday at 9 PM EDT we'll be doing the podcast - Listen live as we talk to John McIntosh and John Maloney about Scratch.

I'm sure the topic of the new Apple language regime for the iPod and iPhone will come up, but we'll primarily be focused on what Scratch is, and what kind of reception it's had in the educational community

Technorati Tags: , , , ,

posted by James Robertson

 Share Tweet This

smalltalk

Array Binding with VisualWorks and Oracle: Video

April 26, 2010 6:48:32.939

Today's Smalltalk Daily looks at using Array Binding against Oracle (version 9 and up) with VisualWorks. If you're looking for a particular topic, you can find it with the Media Search application on our site.

The code used is below; To watch, click on the viewer:


"The following Workspace examples will show the performance improvements when using array 
binding and array fetching in VisualWorks."

"Connect to an Oracle database."
conn := OracleConnection new.
conn username: 'username';
password: 'password';
environment: 'ORACLEDB'.
conn connect.

sess := conn getSession.

"Drop the test table if existed."
sess prepare: 'DROP TABLE TESTTABLE';
	execute;
	answer;
	answer.

"Create a test table."
sess prepare:  'CREATE TABLE TESTTABLE(
	NUMMER int ,
	BEMERKUNG varchar2 (30)
)';
	execute;
	answer;
	answer.

"Set the number of records being inserted."
loopCount := 1000.

"The SQL used to do inerst."
sql := 'INSERT INTO TESTTABLE VALUES (?, ?)'.

"Insert: not using array binding."
sess prepare: sql.
insertTime1 := Time millisecondsToRun: [
	1 to: loopCount do: [ :i|
         sess bindInput: (Array with: i with: 'test');
		execute;
		answer;
		answer.
	].			
].

"Print out the miliseconds spent."
Transcript 
	cr; 
	show: 'Time spent without using array binding: ', insertTime1 asFloat printString.

"Insert: Using array binding."
insertTime2 := Time millisecondsToRun: [
|bindArray numArray stringArray |
    numArray := Array new: loopCount.
    stringArray := Array new: loopCount.
	1 to: loopCount do: [ :i|
		numArray at: i put: i.
		stringArray at: i put: 'test'.
	].			
	bindArray := Array with: numArray with: stringArray.
	sess prepare: sql.
         sess bindInput: bindArray;
		execute;
		answer;
		answer.
].

"Print out the miliseconds spent."
Transcript 
	cr; 
	show: 'Time spent using array binding: ', insertTime2 asFloat printString.

"Set times to repeat."
loopCount := 1.

"Set the SQL to do the fetch."
sql := 'SELECT * from TESTTABLE'.

"Default value of blockFactor is 1."
sess blockFactor: 1.

selectTime1 := Time millisecondsToRun: [
	1 to: loopCount do: [ :i|
		sess prepare: sql;
		execute.
		ans := sess answer.
		res := ans upToEnd.
    	].
].

"Print out the miliseconds spent."
Transcript 
	cr; 
	show: 'Time spent when blcokFactor is 1: ', selectTime1 asFloat printString.

"Set blockFactor to 100."
sess blockFactor: 100.

selectTime2 := Time millisecondsToRun: [
	1 to: loopCount do: [ :i|
		sess prepare: sql;
		execute.
		ans := sess answer.
		res := ans upToEnd.
    	].
].

"Print out the miliseconds spent."
Transcript 
	cr; 
	show: 'Time spent when blcokFactor is 100: ', selectTime2 asFloat printString.

"Set blockFactor to 500."
sess blockFactor: 500.

selectTime3 := Time millisecondsToRun: [
	1 to: loopCount do: [ :i|
		sess prepare: sql;
		execute.
		ans := sess answer.
		res := ans upToEnd.
    	].
].

"Print out the miliseconds spent."
Transcript 
	cr; 
	show: 'Time spent when blcokFactor is 500: ', selectTime3 asFloat printString.


You can download the video directly here. If you like this kind of video, why not subscribe to "Smalltalk Daily"?

Technorati Tags: , , , ,

posted by James Robertson

 Share Tweet This

smalltalk

Across Smalltalks Part 2 (Podcast)

April 25, 2010 10:47:55.420

This week's podcast is part 2 of our conversation with Julian Fitzell, about cross dialect Smalltalk code - the approach taken with Grease and Slime for Seaside, and how that might help in other projects.

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. Starting with Episode 185, you can also download the podcast in ogg format.

To listen immediately, use the player below:

If you like the music we use, please visit Josh Woodward's site. We use the song Effortless for our intro/outro music. I'm sure he'd appreciate your support!

If you have feedback, send it to smalltalkpodcasts@cincom.com - or visit us on Facebook or Ning - you can vote for the Podcast Alley, and subscribe on iTunes. If you enjoy the podcast, pass the word - we would love to have more people hear about Smalltalk!

Technorati Tags: , , ,

posted by James Robertson

 Share Tweet This

smalltalk

Using Prefetch with Oracle and ObjectStudio: Video

April 23, 2010 8:19:07.058

Today's screencast looks at using Oracle's pre-fetch capabilities with ObjectStudio - note that this is an upcoming feature of ObjectStudio 8.2.1. If you're looking for a particular topic, you can find it with the Media Search application on our site.

The code used is below; To watch, click on the viewer:


"PrefetchRows example. Feature is available in OS8.2.1"

"Prefetch rows is similar to array fatching, but it happens in Oracle client. If 
OCI_ATTR_PREFETCH_ROWS is set then this value multiplied by the row size of 
memory is allocated.  When a call to fetch is made all the memory allocated 
is used to store records from the server. The first call gets back n rows and 
subsequent calls to fetch do not make a network call until all n records have 
been returned from the client."

"The following Workspace examples will show the performance 
improvements when using prefetchRows in OS8."

"Logon to the Oracle Server."
ObjectStudio.OracleDatabase 
	logOnServer: #'OracleDB' 
	user: #'username' 
	password: #'pwd' 
	alias: #'OracleDB'.


"Get the Oracle database instance."
db := ObjectStudio.Database accessName: #'OracleDB'.

"Drop the test table if existed."
db execSql: 'DROP TABLE TESTTABLE'.

"Create a test table."
db execSql: 'CREATE TABLE TESTTABLE(
	NUMMER int ,
	BEMERKUNG varchar2 (30)
)'.

"Set the number of recrods being inserted."
loopCount := 2000.

"The SQL used to do inerst."
sql := 'INSERT INTO TESTTABLE VALUES (?, ?)'.

insertTime := [
|bindArray numArray stringArray |
    numArray := OrderedCollection new.
    stringArray := OrderedCollection new.
	1 to: loopCount do: [ :i|
		numArray add: i.
		stringArray add: 'bla'.
	].			
	bindArray := Array with: numArray with: stringArray.
    sql := 'INSERT INTO TESTTABLE VALUES (?, ?)'.
    db execSql: sql vars: bindArray.
] millisecondsToRun.

"Print out the miliseconds spent."
('Insert using array binding: ' + insertTime) out.

"Set times to repeat."
loopCount := 1.

"Set the SQL to do the fetch."
sql := 'SELECT * from TESTTABLE'.

"Default value of prefetchRows is 1."
db prefetchRows: 1.

selectTime1 := [
1 to: loopCount do: [ :i|
        db execSql: sql.
    ].
] millisecondsToRun.

"Print out the miliseconds spent."
('Select with prefetchRows= 1: ' + selectTime1) out.	

"Set prefetchRows to be 100."	
db prefetchRows: 100.
selectTime2 := [
1 to: loopCount do: [ :i|
    db execSql: sql.
	]
] millisecondsToRun.

"Print out the miliseconds spent."
('Select with prefetchRows=100: ' + selectTime2) out.

"Set prefetchRows to be 1000."	
db prefetchRows: 1000.
selectTime3 := [
1 to: loopCount do: [ :i|
    db execSql: sql.
	]
] millisecondsToRun.

"Print out the miliseconds spent."
('Select with and prefetchRows=1000: ' + selectTime3) out.



You can download the video directly here. If you like this kind of video, why not subscribe to "Smalltalk Daily"?

Technorati Tags: , , ,

posted by James Robertson

 Share Tweet This

smalltalk

Smalltalk Events

April 22, 2010 23:01:45.819

Julian Fitzell has a rundown of a number of upcoming Smalltalk events.

Technorati Tags:

posted by James Robertson

 Share Tweet This

smalltalk

Debugging a Frozen Smalltalk App

April 22, 2010 12:47:05.998

I have some advice (via Andreas) over on my Cincom Blog

Technorati Tags: ,

posted by James Robertson

 Share Tweet This

smalltalk

Using Statement Caching with Oracle and ObjectStudio: Video

April 22, 2010 9:08:45.940

Today's screencast looks at using statement caching against Oracle (version 9 and up) with ObjectStudio. If you're looking for a particular topic, you can find it with the Media Search application on our site.

The code used is below; To watch, click on the viewer:


"Statement Caching examples. Oracle does not support this feature until 9.0.0, so make 
sure you are using Oracle 9.0.0 and later."

"Information from Oracle: Statement caching refers to the feature that provides and 
manages a cache of statements for each session. In the server, it means that cursors 
are ready to be used without the need to parse the statement again.  It can be 
used with connection pooling, and will improve performance and scalability." 

"The following are two examples, one uses statement caching, the other does not."

"Statement Caching is off be default."
ObjectStudio.OracleDatabase useStatementCaching: false.

"Logon to the Oracle Server."
ObjectStudio.OracleDatabase 
	logOnServer: #'OracleDB' 
	user: #'username' 
	password: #'pwd' 
	alias: #'OracleDB'.


"Get the Oracle database instance."
db := ObjectStudio.Database accessName: #'OracleDB'.

"Set times to repeat."
loopCount := 100.

"Set the SQL to do the fetch."
sql :='select * from sys.all_tables where TABLE_NAME=''DUAL'''.

selectTime1 := [
1 to: loopCount do: [ :i|
        db execSql: sql.
    ].
] millisecondsToRun.

"Print out the miliseconds spent."
('Select without using statement caching: ' + selectTime1) out.	

db logOff.


"Turn on Statement Caching."
ObjectStudio.OracleDatabase useStatementCaching: true.

"Logon to the Oracle Server."
ObjectStudio.OracleDatabase 
	logOnServer: #'OracleDB' 
	user: #'username' 
	password: #'pwd' 
	alias: #'OracleDB'.

"Get the Oracle database instance."
db := ObjectStudio.Database accessName: #'OracleDB'.

selectTime2 := [
1 to: loopCount do: [ :i|
    db execSql: sql.
	]
] millisecondsToRun.

"Print out the miliseconds spent."
('Select using statement caching: ' + selectTime2) out.	

db logOff.



You can download the video directly here. If you like this kind of video, why not subscribe to "Smalltalk Daily"?

posted by James Robertson

 Share Tweet This

Previous Next (1107 total)