smalltalk

How to change the font in the SpTextPresenter?

岁酱吖の 提交于 2021-01-27 17:02:19
问题 Pharo 9, Spec 2 -- I have a Spec 2 presenter with a text widget: initializePresenters text := self newText. super initializePresenters As I understand its type is SpTextPresenter . How to change the font of this text ? Font face, size of the all shown text in this widget... For example, to "Courier New", 9. EDIT 1 : Also I tried: text addStyle: { SpStyleSTONReader fromString: ' Font { #name: "Source Sans Pro", #size: 12, #bold: false, #italic: true }' }. but it does not work, the error is:

Which Smalltalk object should be passed to a C function expecting const char*

倖福魔咒の 提交于 2021-01-27 14:36:02
问题 I want to call the following C function: int ssh_userauth_password (ssh_session session, const char * username, const char * password) But regular Smalltalk strings are not working: library ssh_login: session userAuth: nil password: 'myPwd'. session is a pointer that i already have and works ok. But const char * are not mapped to normal string. Is there any class to map this ? Also i tried with CPointer and asByteArray but both fail. 回答1: You need to pass a CPointer object. Easiest way to do

Smalltalk variables: why should I declare them?

生来就可爱ヽ(ⅴ<●) 提交于 2021-01-27 06:11:50
问题 Basically I can use variables just by assigning something to them, for example: x := something It works fine. But in classes, if I define a new method, but I don't declare the variable, I get an "assignment to undeclared variable x", so I have to use: |x| x := something Why is this? 回答1: As Uko mentions, there are different kinds of variables in Smalltalk and that's why we need to declare them differently. Let's review all of Smalltalk variables here for the sake of completeness. Instance

Smalltalk variables: why should I declare them?

我们两清 提交于 2021-01-27 06:10:28
问题 Basically I can use variables just by assigning something to them, for example: x := something It works fine. But in classes, if I define a new method, but I don't declare the variable, I get an "assignment to undeclared variable x", so I have to use: |x| x := something Why is this? 回答1: As Uko mentions, there are different kinds of variables in Smalltalk and that's why we need to declare them differently. Let's review all of Smalltalk variables here for the sake of completeness. Instance

Smalltalk (Pharo) How to interface with the user simply

南笙酒味 提交于 2021-01-21 08:29:35
问题 I stumbled upon Smalltalk and further downloaded Pharo, because it was recommended. My first impression is very positive. I wanted to port some simple programs I have written in C++ (my main language), so I can get a feel for Smalltalk. However, I realized I can't find a simple way to just get some input from the user, e.g. I want to create a console calculator with a REPL loop, but I can't find a way to do this in Pharo. I don't want a gui with buttons, because that is just slow and

Smalltalk: Can a single object block the entire system by entering an infinite loop?

随声附和 提交于 2021-01-04 07:23:49
问题 Since Smalltalk scheduling is non-preemptive, processes must explicitly yield or wait on a semaphore Does this mean that one object entering an infinite loop could stall the entire system? the loop can be interrupted at any time. Even an atomic loop like [true] whileTrue can be interrupted before "executing" the true object By what can it be interrupted? 回答1: It is the Virtual Machine who may interrupt the image. Under a normal execution flow, the VM is basically sending messages, one after

Smalltalk: Can a single object block the entire system by entering an infinite loop?

眉间皱痕 提交于 2021-01-04 07:23:06
问题 Since Smalltalk scheduling is non-preemptive, processes must explicitly yield or wait on a semaphore Does this mean that one object entering an infinite loop could stall the entire system? the loop can be interrupted at any time. Even an atomic loop like [true] whileTrue can be interrupted before "executing" the true object By what can it be interrupted? 回答1: It is the Virtual Machine who may interrupt the image. Under a normal execution flow, the VM is basically sending messages, one after

历年NOIP提高组初赛选择解析

眉间皱痕 提交于 2021-01-03 14:21:09
碎片知识点 编译型语言是编译一次就可以转成计算机可以直接运行的机器语言程序(如.exe文件)但是由于他们是直接编译的,依赖于计算机的不同,所以跨平台能力比较差,但是运行速度高。 解释性语言则是每次运行前编译,先解释再运行,导致运行效率降低,但是因为其依托于虚拟机/解释器所以跨平台性能好。 高级语言还可分为面向过程语言和面向对象语言。(区别自然是有没有对象) 于 1967 年出现的 Simula67 是历史上第一个面向对象语言 Smalltalk 被公认为第二个面向对象的程序设计语言,和第一个IDE C 和 Pascal 是纯面向过程语言 就算没有对象也可以学面向对象的程序设计语言 C++ 第一个高级语言是fortran,Ada是美国军方发明的语言,取名Ada是为了纪念第一个女程序员 第一个支持面向对象的语言是simula67 1、 (NOIP-2004–T19-多选)下列哪个(些)程序设计语言支持面向对象程序设计方法( ABDE )。 A. C++ B. Object Pascal C. C D. Smalltalk E. Java C++,object Pascal,VB,smalltalk(第一个支持动态类型的语言),simula67(第一个面向对象的语言),Java是面向对象的 free Pascal,C是面向过程的 题型一:数学 1.1 组合数学 模型: Catalan数

领域驱动设计,让程序员心中有码(四)

梦想与她 提交于 2020-12-29 03:40:45
题图 from unsplash 我一直认为,程序员也是艺术家,他们撰写的每一行代码,是献给这大好世界的优美诗篇。不同的人,写的代码也许风格迥异。有的,如春风化雨润物无声,有的,如高山流水,曲高和寡,还有的如旱日春雷,先声夺人。而如果说,代码是诗篇,那么代码的分层艺术绝对是最先映入读者眼帘的序幕了。 分层,一直以来是一个非常经典的软件工程学问题,提到分层,无论是资深或者新入门的开发者,或多或少都有自己的理解。 在8年前,我刚参加工作时,有幸参与了比较多项目的研发和维护过程,这些项目的开发者,大多是比我年长几岁的软件开发者。在他们的开发习惯中,往往会倾向于直接在代码中写入用户界面、数据库访问等支持代码,甚至有相当一部分情况下,会把代码写入到用户界面中,这意味着在用户界面层,往往会写入大量的代码,说不定会超过上万行代码。我觉得可以将这种设计,理解为“单层架构“。 再后来的项目开始有了一点点改变,这个时候的架构,被成为“三层架构“。在.NET开发史上,三层架构成为一种历史悠久的框架,从十年前开始,一直到今天,依然是.NET开发者最为熟练的技术框架。如图所示,三层架构在客户端和数据库之间增加了一个中间层,将有效的业务规则、数据访问等放在业务层中进行处理。界面层主要使用对数据的绑定渲染,再通过数据层实现数据的提交处理。有的开发者说,三层架构通吃一切项目,似乎所有的项目都可以用三层架构来套用

领域驱动设计,让程序员心中有码(四)

无人久伴 提交于 2020-12-29 03:15:12
#领域驱动设计,让程序员心中有码(四) ----------------------追忆有关分层的古老往事 我一直认为,程序员也是艺术家,他们撰写的每一行代码,是献给这大好世界的优美诗篇。不同的人,写的代码也许风格迥异。有的,如春风化雨润物无声,有的,如高山流水,曲高和寡,还有的如旱日春雷,先声夺人。而如果说,代码是诗篇,那么代码的分层艺术绝对是最先映入读者眼帘的序幕了。 分层,一直以来是一个非常经典的软件工程学问题,提到分层,无论是资深或者新入门的开发者,或多或少都有自己的理解。 在8年前,我刚参加工作时,有幸参与了比较多项目的研发和维护过程,这些项目的开发者,大多是比我年长几岁的软件开发者。在他们的开发习惯中,往往会倾向于直接在代码中写入用户界面、数据库访问等支持代码,甚至有相当一部分情况下,会把代码写入到用户界面中,这意味着在用户界面层,往往会写入大量的代码,说不定会超过上万行代码。我觉得可以将这种设计,理解为“单层架构“。 再后来的项目开始有了一点点改变,这个时候的架构,被成为“三层架构“。在.NET开发史上,三层架构成为一种历史悠久的框架,从十年前开始,一直到今天,依然是.NET开发者最为熟练的技术框架。如图所示,三层架构在客户端和数据库之间增加了一个中间层,将有效的业务规则、数据访问等放在业务层中进行处理。界面层主要使用对数据的绑定渲染,再通过数据层实现数据的提交处理