将我的项目添加到ss3.gemstone.com/ss但是当我在monticello中提交时,我收到以下错误"ZnHttpUnsuccessful:501 Not Implemented"
Smalltalk - 是否可以通过方法将字符串添加到String实例?
基本上我想要的是:
renderThisOn: aString
aString append: 'whatever text I want'
Run Code Online (Sandbox Code Playgroud)
基本上我喜欢String实例(ByteString等),就像Seaside中的"html"对象一样.我把它作为一个参数传递给多个方法,每个方法都向它添加一些信息.
Whatever >> children
^Array with: oneComponent with: anotherComponent.
Run Code Online (Sandbox Code Playgroud)
稍后在代码中可能有类似的东西.
Whatever >> renderContentOn: html
...
html render: oneComponent.
...
html render: anotherComponent.
Run Code Online (Sandbox Code Playgroud)
由于我明确地调用这些组件,所以在#children中使用它们有什么用?#children用于其他任何事情吗?
我有兴趣创建自己的Stream子类,我想知道我应该覆盖哪些方法(在pharo和Gemstone上部署).我有一个包含各种类型的东西的集合,我希望能够流式传输它的一个子集,包含一个类的元素.我不想复制集合或使用collect:block,因为集合可能很大.我的第一个用例是这样的:
stream := self mailBox streamOf: QTurnMessage.
stream size > 1
ifTrue: [ ^ stream at: 2 ]
ifFalse: [ ^ nil ]
Run Code Online (Sandbox Code Playgroud)
关于覆盖哪些方法的任何指针?
我试图覆盖pharo中的'<'运算符,因为我想要一个已实现的类(TimeCal)的SortedCollection.
TimeCal具有以下变量:年月日时分钟.
我的想法是将所有变量转换为分钟,然后将它们与<运算符接收的比较进行比较.但是,我确实收到了错误
"BlockClosure(Object)>> doesNotUnderstand:#>"
这是我的代码:
< comparand
| thisInMins comparandInMins |
thisInMins := [(year * 525600) + (month * 43829) + (day * 1440) + (hour * 60) + minute].
comparandInMins := [(comparand year * 525600) + (comparand month * 43829) + (comparand day * 1440) + (comparand hour * 60) + comparand minute].
(thisInMins > comparandInMins)
ifTrue: [true] ifFalse: [false]
Run Code Online (Sandbox Code Playgroud)
我用来测试它的代码:
time1 := TimeCal new.
time1 hour: 12.
time1 day: 12.
time1 month: 11.
time2 := TimeCal new. …Run Code Online (Sandbox Code Playgroud) 这可能吗?
对于这样的句子hello how are you,我希望我的正则表达式能够返回hello how are you.它只返回hello而不是其他词.
我的正则表达式:
[A-Za-z]*
Run Code Online (Sandbox Code Playgroud)
任何帮助是极大的赞赏.谢谢!如果重要,我正在使用Pharo Smalltalk.我也一直在测试c#.
我开始学习使用Pharo 5的Smalltalk.我现在正在接受来自吱吱声的人的教程,以便对语法等有一定的掌握.
我在开始时,我只有两个类(一个类BlankCell和一个BlanCellTestCase类用于单元测试).Blankcell已经实现了一些消息,我在第1.9节的最后.
行为很好,因为在操场上:
| cell exit |
cell := BlankCell new.
exit := cell exitSideFor: #north.
exit = #south
"the last statement properly returns a true or false"
Run Code Online (Sandbox Code Playgroud)
在测试用例上有三个测试,只有一个失败(与exitSide相关):
testCellExitSides
"Test the exit sides."
| cell exit |
cell := BlankCell new.
exit := cell exitSideFor: #north.
self assert: [ exit = #south ].
exit := cell exitSideFor: #east.
self assert: [ exit = #west ].
exit := cell exitSideFor: #south.
self assert: [ exit …Run Code Online (Sandbox Code Playgroud) 想要将我的小项目从Pharo 5迁移到Pharo 6.1,当我右键单击我的包及其类时,我很高兴地找到了File Out选项.我看到它为我的图像目录中的那些工件生成文本文件(我在Windows上运行).到现在为止还挺好.
但是,我到处寻找一个菜单,将这些文件导入Pharo 6.1(右键单击包列表等)无济于事.如何进行文件输入(与文件输出相反)?
我非常喜欢我在Smalltalk中可以做的增量编程.你有一个正在运行的程序,当你充实你的程序时,你会添加它.您可以更改方法并使用应用的更改重新启动堆栈以查看新版本的功能.在程序运行时,您可以检查本地状态并进行更改.
Python中有类似的东西吗?我已经看到了这些能力的提示,比如reload(),但是我对Python的了解并不完全清楚它是如何使用的.我查看了一些初学Python书籍,但我没有看到任何提及.
因此,基本上我需要做的就是向OrderedCollection中添加一个“用户”对象。
我需要从用户那里获取的只是用户名和密码。
单击提交按钮后,我需要将用户添加到集合中并返回首页(我想可以通过调用#answer来完成)。
在textInput上的阅读速度是海边书籍的99倍,但是提交表单后,我无法理解存储在哪里的数据。
任何英特尔都将受到高度赞赏。
这是我目前的表格:
html form: [
html text: 'Username: '.
html textInput
callback: [ ];
value: 'Enter username here'.
html break.
html text: 'Password: '.
html textInput
callback: [ ];
value: 'Enter password here'.
html break.
html submitButton
callback: [ ];
value: 'Add user']
Run Code Online (Sandbox Code Playgroud)