semantics

Perl does not complain about missing semicolon

早过忘川 提交于 2020-01-13 07:32:32
问题 I just found on my Ubuntu that Perl is not complaining about the semicolon at the end. Check the following code: #!/usr/bin/perl use warnings; use strict; my @array = (1, 2, 3, 4); foreach (@array) { print $_."\n" } print "no, this cant be true" Please notice that semicolon ";" is missing from the print statement. Still the code runs fine. OUTPUT: 1 2 3 4 no, this cant be true If I put semicolon after print, it still works. So this is confusing to me. Could you help me understand what am I

Shorten a text and only keep important sentences

谁说胖子不能爱 提交于 2020-01-12 08:44:57
问题 The German website nandoo.net offers the possibility to shorten a news article. If you change the percentage value with a slider, the text changes and some sentences are left out. You can see that in action here: http://www.nandoo.net/read/article/299925/ The news article is on the left side and tags are marked. The slider is on the top of the second column. The more you move the slider to the left, the shorter the text becomes. How can you offer something like that? Are there any algorithms

When to return IOrderedEnumerable?

落爺英雄遲暮 提交于 2020-01-12 06:28:07
问题 Should IOrderedEnumerable be used as a return type purely for semantic value? For example, when consuming a model in the presentation layer, how can we know whether the collection requires ordering or is already ordered? What about in the case that a repository wraps a stored procedure with an ORDER BY clause. Should the repository return IOrderedEnumerable ? And how would that be achieved? 回答1: I don't think it would be a good idea: Should IOrderedEnumerable be used as a return type purely

When to return IOrderedEnumerable?

久未见 提交于 2020-01-12 06:27:30
问题 Should IOrderedEnumerable be used as a return type purely for semantic value? For example, when consuming a model in the presentation layer, how can we know whether the collection requires ordering or is already ordered? What about in the case that a repository wraps a stored procedure with an ORDER BY clause. Should the repository return IOrderedEnumerable ? And how would that be achieved? 回答1: I don't think it would be a good idea: Should IOrderedEnumerable be used as a return type purely

How to mark-up a button for WCAG 2.0 Compliance?

元气小坏坏 提交于 2020-01-11 09:58:30
问题 In striving for WCAG 2.0 Compliance, I'm finding quite a bit of varied information regarding proper treatment of buttons, specifically what is required to consider the button accessible and compliant. What is the appropriate way to mark-up a <button> ? What attributes or combination do they need to have? My buttons fall into three categories: Buttons that have text that describes their intended action. (e.g. "Learn More" to launch a modal with more product information) Buttons that have text

When is the best time to use <b> and <i> in lieu of <strong> and <em>, if ever?

霸气de小男生 提交于 2020-01-04 05:18:12
问题 Semantically speaking, is there an appropriate place in today's websites (late 2008+) where using the bold <b> and italic <i> tags are more useful than the more widely used <strong> and <em> tags? 回答1: While in general I would stay away from non-semantic tags like b and i , strong and em are not direct replacements for b and i . I would use b or i when it's only presentation you're going for, and what you're marking up has no semantic meaning. For example, a logo like stackoverflow could be

Online Messaging: <ul> vs <ol> vs <div>

孤街浪徒 提交于 2020-01-04 00:10:11
问题 I'm busy writing an online chat, and although it doesn't really matter which I use, since I can style them however I want with CSS, I'd quite like to use the best tag for messages. My first thought was to use an <ol> since the messages are ordered by time . However, Facebook uses <ul> s and Google chat uses <div> s. Twitter does use <ol> . So, which is semantically correct? And, which would be best for user with screen readers? 回答1: div only. <ul><ol> are lists. Chat messages are not ordered

Should you use the underscore _ as an “access modifier indicator” in non-library code in Python? [closed]

假如想象 提交于 2020-01-03 15:55:52
问题 Closed . This question is opinion-based. It is not currently accepting answers. Want to improve this question? Update the question so it can be answered with facts and citations by editing this post. Closed 7 months ago . Introduction So I've been doing a bit of research regarding the underscore character ( _ ). I know most of its use cases and its semantics in them so I'll just drop them below as a recap and I'll conclude with the question, which is more of a conceptual one regarding 2 of

Should you use the underscore _ as an “access modifier indicator” in non-library code in Python? [closed]

試著忘記壹切 提交于 2020-01-03 15:54:11
问题 Closed . This question is opinion-based. It is not currently accepting answers. Want to improve this question? Update the question so it can be answered with facts and citations by editing this post. Closed 7 months ago . Introduction So I've been doing a bit of research regarding the underscore character ( _ ). I know most of its use cases and its semantics in them so I'll just drop them below as a recap and I'll conclude with the question, which is more of a conceptual one regarding 2 of

VBA: Why do people include the variable's name in a “Next” statement?

泪湿孤枕 提交于 2020-01-03 13:35:16
问题 I have always written my For-loops like this: For foo = 1 to 10 ' do something Next However, when I read code snippets online, people always do this: For foo = 1 to 10 ' do something Next foo I have not noticed any difference between the two, and I can't find any documentation on next statement is more desirable. What is the difference between those two (if any)? 回答1: The counter after the Next statement is optional. It used to be required in BASIC-derived languages, but this is no longer the