readability

Recommended HTML readability transcoding libraries in .Net [closed]

浪子不回头ぞ 提交于 2019-12-07 13:51:09
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 6 years ago . Background I'm trying to read and analyze content from web pages, with focus on the main content of the page - without menus, sidebars, scripts, and other HTML clutter. What have I tried? I've tried NReadability, but it throws exceptions and fails on too many cases. Other than that it is a good solution. HTML

JavaScript - Are loops faster than discretely writing line-by-line?

邮差的信 提交于 2019-12-07 05:48:33
问题 Ignoring all code cleanliness and readability, which script will finish quicker? This: for(var i = 0; i < 10; i++){ --do that thing-- } Or this: --do that thing-- --do that thing-- --do that thing-- --do that thing-- --do that thing-- --do that thing-- --do that thing-- --do that thing-- --do that thing-- --do that thing-- Or are they the same, performance-wise? 回答1: "Unrolling" a loop by repeatedly "copy & pasting" the loop body can improve or reduce performance. The outcome depends on... ..

Formatting an if statement for readability

孤街浪徒 提交于 2019-12-07 04:15:57
问题 What's the best way to format this for readability? if (strpos($file, '.jpg',1) && file_exists("$thumbsdir/$file") == false || strpos($file, '.gif',1) && file_exists("$thumbsdir/$file") == false || strpos($file, '.png',1) && file_exists("$thumbsdir/$file") == false) { createThumb("$gallerydir/$file", "$thumbsdir/$file",$thumbsize); fwrite($log,date("Y-m-d")." @ ".date("H:i:s")." CREATED: $thumbsdir/$file\n"); } 回答1: I'd extract the "is an image" logic into its own function, which makes the if

How to write readable SQL in VB.NET

主宰稳场 提交于 2019-12-06 09:17:18
When writing Sql in VB.NET one often ends up with something quite unreadable due to VB's lack of multi-line strings. For Example: Dim sql As String = "SELECT t1.Name, t1.Description, t1.Address, t1.PhoneNumber, t2.RegistrationID, t2.Date, t2.Description, t2.RegistrationStatus FROM Users t1 JOIN Registrations t2 ON t1.UserID = t2.UserID WHERE t2.RegistrationID = @RegistrationID" You could break the string up using line-continuation characters, but the extra quote marks and line-continuation characters make this harder to read. Also it makes transferring the query between code and SSMS difficult

Can qgraph render edge labels outside the actual edge?

半腔热情 提交于 2019-12-06 06:42:19
I'm trying to insert edge labels outside the actual edge in my qgraph for readability purposes. I particularly don't like the option of include a white bg below the label, it screws up the edge. According to the manual, it is possible to adjust edge label position only along the line, but not on the side. Did anyone struggle with this before? Is it possible to circumvent this issue? Cheers There does not seem to be a parameter for adjusting the across axis location of the edge label. One solution is to add the edge labels to the plot separately. An example is given below, which yielded the

Introducing variables only for readability?

那年仲夏 提交于 2019-12-06 04:55:31
Is it a good idea to introduce variables only for the sake of readability ? Example 1: while(nameNode1.charAt(0) == nameNode2.charAt(0) && nameNode1.length() > 1 && nameNode2.length() > 1) { nameNode1 = nameNode1.substring(1, nameNode1.length()); nameNode2 = nameNode2.substring(1, nameNode2.length()); } Example 2: boolean letterFromBothNodesAreEqual_andNameHasMoreThanOneLetter = nameNode1.charAt(0) == nameNode2.charAt(0) && nameNode1.length() > 1 && nameNode2.length() > 1; while(letterFromBothNodesAreEqual_andNameHasMoreThanOneLetter) { nameNode1 = nameNode1.substring(1, nameNode1.length());

Compare rotated lists in python

人走茶凉 提交于 2019-12-06 04:17:34
I'm trying to compare two lists to determine if one is a rotation (cyclic permutation) of the other, e.g.: a = [1, 2, 3] b = [1, 2, 3] or [2, 3, 1] or [3, 1, 2] are all matches, whereas: b = [3, 2, 1] is not To do this I've got the following code: def _matching_lists(a, b): return not [i for i, j in zip(a,b) if i != j] def _compare_rotated_lists(a, b): rotations = [b[i:] + b[:i] for i in range(len(b))] matches = [i for i in range(len(rotations)) if _matching_lists(a, rotations[i])] return matches This builds a list of all possible rotations of b and then compares each one. Is it possible to do

Recommended HTML readability transcoding libraries in .Net [closed]

ぐ巨炮叔叔 提交于 2019-12-05 19:28:59
Closed. This question is off-topic . It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 6 years ago . Background I'm trying to read and analyze content from web pages, with focus on the main content of the page - without menus, sidebars, scripts, and other HTML clutter. What have I tried? I've tried NReadability , but it throws exceptions and fails on too many cases. Other than that it is a good solution. HTML Agility Pack is not what I need here, because I do want too get rid of non-content code. EDIT: I'm

JavaScript - Are loops faster than discretely writing line-by-line?

点点圈 提交于 2019-12-05 13:45:51
Ignoring all code cleanliness and readability, which script will finish quicker? This: for(var i = 0; i < 10; i++){ --do that thing-- } Or this: --do that thing-- --do that thing-- --do that thing-- --do that thing-- --do that thing-- --do that thing-- --do that thing-- --do that thing-- --do that thing-- --do that thing-- Or are they the same, performance-wise? "Unrolling" a loop by repeatedly "copy & pasting" the loop body can improve or reduce performance. The outcome depends on... ...your JavaScript engine ...the code in the loop body ...how well documented your code is (no kidding!) Let's

Is it bad style to reassign long variables as a local abbreviation?

折月煮酒 提交于 2019-12-05 13:18:57
I prefer to use long identifiers to keep my code semantically clear, but in the case of repeated references to the same identifier, I'd like for it to "get out of the way" in the current scope. Take this example in Python: def define_many_mappings_1(self): self.define_bidirectional_parameter_mapping("status", "current_status") self.define_bidirectional_parameter_mapping("id", "unique_id") self.define_bidirectional_parameter_mapping("location", "coordinates") #etc... Let's assume that I really want to stick with this long method name, and that these arguments are always going to be hard-coded.