首页 \ 问答 \ Io语言用户输入(Io language user input)

Io语言用户输入(Io language user input)

我最近开始搞乱Io编程语言并认为它非常有趣且易于学习。 但我也很讨厌它的文档和支持很少。 通常我来寻求帮助,但即使在这里,主题也很少。

我在7周的书中学习了7种语言,我喜欢,但在那里他主要讨论了Io的更深层用途。

我的问题可能非常简单,但我无法在任何地方找到答案......你如何实际问用户输入? 我已经找到了传递设置字符串的方法,从文件中读取字符串,但我找不到一种方法来询问用户输入。

我现在正在做的是编写一个接受2个参数的函数:一个字符串和一个要在该字符串中查找的子字符串。 该函数在字符串中查找子字符串并打印索引。 我甚至不知道我是应该要求用户输入还是以另一种方式做这个...

我正试图在Io上获得一些键盘时间,但这令人沮丧:/

另外,有没有人知道任何对初学者友好的IRC频道? 不一定只是Io,但总的来说?

多谢你们。


I recently started messing around with the Io programming language and think it's pretty fun and simple to learn. But I also hate that there is so little documentation and support for it. Normally I come to SO for help, but even on here the topic is sparse.

I am learning from the 7 languages in 7 weeks book, which I like, but there he mainly talks about the deeper uses of Io.

My question is probably extremely simple but I can't find an answer anywhere... How do you actually ask a user for input? I've found ways to pass along set strings, read in strings from files, but I can't find a way to ask a user for input.

What I'm working on now is writing a function that accepts 2 parameters: a string and a substring to find in that string. The function finds the substring in the string and prints the index. I don't even know if I should be asking the user for input or doing this another way...

I'm trying to get some keyboard time in on Io but it's frustrating :/

Also, does anyone know of any IRC channels that are friendly to beginners? Not necessarily just Io, but in general?

Thanks guys.


原文:https://stackoverflow.com/questions/35370002
更新时间:2022-12-11 18:12

最满意答案

如果您希望将数据限制为任何经过身份验证的用户,则需要检查auth !== null

如果希望数据仅限于当前经过身份验证的用户,则需要检查auth.uid == $uid 。 您不需要检查auth == null && auth.uid != $uid因为如果auth变量为null, auth.uid == $uid将评估为false。 但你仍然可以将两者都包括在内。

实质上, auth != null将数据限制为任何经过身份验证的用户,并且auth.uid != null限制为当前经过身份验证的单个用户。

现在提供一些额外的课程信息。

使用Bolt编译器简化通用规则。

安全规则是灵活的,但它们对于复制通用规则没有太多便利。 为此,您可以使用Bolt编译器

Bolt编译器允许您创建类型并将它们分配给Firebase数据库中的路径。 这些类型充当架构。 您还可以创建抽象通用规则的函数。

写了一篇关于用Bolt保护用户数据的博文 。 它通过您需要知道的内容来保证用户数据在Bolt中使用类型和功能进行保护。

isCurrentUser(uid) = auth != null && auth.uid == uid;
isAuthenticated() = auth != null

path /users/$uid {
  read() = isAuthenticated() // any authenticated user can read 
  write() = isCurrentUser($uid); 
}

在上面的示例中,我们重复使用isCurrentUser()函数三次。 这将使更改前进更容易处理。


You need to check auth !== null if you want the data restricted to any authenticated user.

You need to check for auth.uid == $uid when you want the data restricted to the currently authenticated user. You don't need to check for auth == null && auth.uid != $uid because auth.uid == $uid will evaluate to false if the auth variable is null. But you can still include both to be thorough.

So essentially, auth != null is restricts the data to any authenticated user, and auth.uid != null restricts to the single currently authenticated user.

Now for some extra curricular information.

Use the Bolt compiler to simplify common rules.

Security Rules are flexible, but they don't have much convenience for reproducing common rules. For that, you can use the Bolt compiler.

The Bolt compiler allows you to create types and assign them to paths in your Firebase database. These types act as schema. You can also create functions that abstract common rules.

I wrote a blog post on securing user data with Bolt. It goes through what you need to know to keep user data secured with types and functions in Bolt.

isCurrentUser(uid) = auth != null && auth.uid == uid;
isAuthenticated() = auth != null

path /users/$uid {
  read() = isAuthenticated() // any authenticated user can read 
  write() = isCurrentUser($uid); 
}

In the example above we reuse the isCurrentUser() function three separate times. This will make changes moving forward much easier to deal with.

相关问答

更多
  • 检查会话就足够了。 服务器的会话和客户端之间存在映射,这就是它足够安全的原因。 当然,如果您想要“绝对”安全性(但不存在100%安全性),则使用SSL。 以下是Django / RoR如何检查请求是否来自AJAX调用(在node.js代码中转换): function isXHR( req, res ) { return !!req.header( 'HTTP_X_REQUESTED_WITH' ) === 'XMLHttpRequest'; } 但是,这意味着XHR调用必须包含此HTTP标头。 大 ...
  • 我认为您应该将代码修改为以下内容并再试一次: - constructor(private afAuth: AngularFireAuth) { this.login(); } login() { console.log('We are logging in on Firebase :)'); firebase.auth().signInWithCustomToken(localStorage.getItem('firebase_token')) .then(success= ...
  • 你可以在所有日子的时间用foreach来尝试这种方式, $all_hours = [monHours, tueHours , wedHours , thuHours , friHours , satHours ,sunHours]; foreach($all_hours as $k=>$hours){ if ($hours.length>0){ $arr = $hours[k].split("-"); operationTime[$k].isActive= true; op ...
  • 用户可以通过匿名,电子邮件/密码,各种OAuth提供商和电话号码登录进行身份验证。您可以启用/禁用其中任何一个。 上面的根规则允许通过任何规定的机制对任何经过身份验证的用户进行只读访问,并将指定用户的访问权限写入自己的数据。 伪造登录非常困难。数据库将始终检查请求是否具有ID令牌(当auth不为null时)。 ID令牌使用公钥加密,并且在没有私钥的情况下很难伪造。 A user can authenticate via anonymous, email/password, various OAuth pro ...
  • 让我们快速浏览一下 public function check() { return ! is_null($this->user()); } 正如您所看到的,所有检查都是检查null。 当你需要知道他们是否被授权时,使用Auth::check()会容易得多。 如果你不打算使用它,返回一个对象是没有意义的。 Let's take a quick peek under the hood public function check() { return ! is_null($this->user ...
  • 单击左侧的数据库,您将在顶部有选项,单击规则选项卡,您将看到并能够在那里编辑规则。 Click on Database on the left and there you will have options at the top, click on the rules tab and you will see and be able to edit your rules there.
  • 因为您使用用户标识作为密钥,所以可以在规则中使用它,以确保用户只能读取/写入其自己的节点,如下所示: { "rules": { "$user_id": { ".write": "$user_id === auth.uid", ".read": "$user_id === auth.uid" } } } 有关更多信息,请参阅有关基于用户的安全性和保护数据的Firebase文档。 有关将用户链接到他们的数据的更加激进的答案,您可以在这里查看我的答 ...
  • 在Firebase JavaScript SDK的2.x版本上,对React Native进行了身份验证,但在运行之间的任何位置都没有保留会话信息。 这样做的原因是React Native中没有本地存储(Firebase用于在浏览器中保存此信息)。 在Firebase JavaScript SDK 3.0版中,身份验证不再适用于React Native。 从Firebase JavaScript SDK 3.1版开始,身份验证再次在React Native上运行。 会话详细信息保留在React Native ...
  • 当然你可以这样做,所以数据库中的一个路径对于未经身份验证的用户是可读的,但我不推荐它。 允许任何人阅读所有用户的用户名并不理想。 另一个选择是您可以先创建用户,然后让他们在经过身份验证后选择用户名,但是您必须弄清楚如何处理经过身份验证的用户,然后在选择用户名之前退出应用程序。 更好的选择是使用Cloud Functions for Firebase和HTTP触发器,并将所需的用户名作为请求的一部分传递。 该请求将包括对所需用户名的查询,并且响应将返回用户名是否可用。 它可能看起来像这样: const fun ...
  • 如果您希望将数据限制为任何经过身份验证的用户,则需要检查auth !== null 。 如果希望数据仅限于当前经过身份验证的用户,则需要检查auth.uid == $uid 。 您不需要检查auth == null && auth.uid != $uid因为如果auth变量为null, auth.uid == $uid将评估为false。 但你仍然可以将两者都包括在内。 实质上, auth != null将数据限制为任何经过身份验证的用户,并且auth.uid != null限制为当前经过身份验证的单个用户 ...

相关文章

更多

最新问答

更多
  • 获取MVC 4使用的DisplayMode后缀(Get the DisplayMode Suffix being used by MVC 4)
  • 如何通过引用返回对象?(How is returning an object by reference possible?)
  • 矩阵如何存储在内存中?(How are matrices stored in memory?)
  • 每个请求的Java新会话?(Java New Session For Each Request?)
  • css:浮动div中重叠的标题h1(css: overlapping headlines h1 in floated divs)
  • 无论图像如何,Caffe预测同一类(Caffe predicts same class regardless of image)
  • xcode语法颜色编码解释?(xcode syntax color coding explained?)
  • 在Access 2010 Runtime中使用Office 2000校对工具(Use Office 2000 proofing tools in Access 2010 Runtime)
  • 从单独的Web主机将图像传输到服务器上(Getting images onto server from separate web host)
  • 从旧版本复制文件并保留它们(旧/新版本)(Copy a file from old revision and keep both of them (old / new revision))
  • 西安哪有PLC可控制编程的培训
  • 在Entity Framework中选择基类(Select base class in Entity Framework)
  • 在Android中出现错误“数据集和渲染器应该不为null,并且应该具有相同数量的系列”(Error “Dataset and renderer should be not null and should have the same number of series” in Android)
  • 电脑二级VF有什么用
  • Datamapper Ruby如何添加Hook方法(Datamapper Ruby How to add Hook Method)
  • 金华英语角.
  • 手机软件如何制作
  • 用于Android webview中图像保存的上下文菜单(Context Menu for Image Saving in an Android webview)
  • 注意:未定义的偏移量:PHP(Notice: Undefined offset: PHP)
  • 如何读R中的大数据集[复制](How to read large dataset in R [duplicate])
  • Unity 5 Heighmap与地形宽度/地形长度的分辨率关系?(Unity 5 Heighmap Resolution relationship to terrain width / terrain length?)
  • 如何通知PipedOutputStream线程写入最后一个字节的PipedInputStream线程?(How to notify PipedInputStream thread that PipedOutputStream thread has written last byte?)
  • python的访问器方法有哪些
  • DeviceNetworkInformation:哪个是哪个?(DeviceNetworkInformation: Which is which?)
  • 在Ruby中对组合进行排序(Sorting a combination in Ruby)
  • 网站开发的流程?
  • 使用Zend Framework 2中的JOIN sql检索数据(Retrieve data using JOIN sql in Zend Framework 2)
  • 条带格式类型格式模式编号无法正常工作(Stripes format type format pattern number not working properly)
  • 透明度错误IE11(Transparency bug IE11)
  • linux的基本操作命令。。。