Skip to content

Commit 8aedaf1

Browse files
committed
comments
1 parent 7d80059 commit 8aedaf1

18 files changed

+616
-28
lines changed

sites/en/pages/enable-ansible-passwordless-sudo.txt

Lines changed: 40 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
=books ansible
66
=author szabgab
77
=archive 1
8-
=comments_disqus_enable 1
8+
=comments_disqus_enable 0
99

1010
=abstract start
1111

@@ -312,3 +312,42 @@ root:!:17596:0:99999:7:::
312312

313313
Having passwordless access is great for automation, but you need to be aware of the security implications we discussed above.
314314

315+
<h2>Comments</h2>
316+
317+
This enables passwordless sudo for all accounts for all commands.
318+
319+
Surely it would be better to follow the recommendation in the /etc/sudoers file and use the lineinfile module to create a file, say, /etc/sudoers.d/ansible containing a line something like (untested)
320+
321+
foo ALL = (root:root) NOPASSWD: ALL
322+
323+
324+
---
325+
326+
I tried this, using 'ansible' instead of 'foo', but Ansible would still says it required a password. I had also made the 'ansible' user usable by *my* username without password, by using:
327+
328+
- name: Get the username running the deploy
329+
local_action: command whoami
330+
register: username
331+
become: false
332+
333+
- name: Allow using this user without password
334+
lineinfile:
335+
dest: /etc/sudoers.d/ansible
336+
state: present
337+
regexp: "^{{ username.stdout }}"
338+
line: "{{ username.stdout }} ALL=(ansible) NOPASSWD: ALL"
339+
validate: 'visudo -cf %s'
340+
341+
Works on the command line, not in Ansible...
342+
343+
<hr>
344+
345+
%sudo ALL=(ALL:ALL) NOPASSWD: ALL
346+
347+
should be
348+
349+
%sudo ALL=(ALL:ALL) NOPASSWD:ALL
350+
351+
If you're not careful, that extra space just after `NOPASSWD:` will ruin your system like it did mine (even when using visudo which was unexpected)
352+
353+

sites/en/pages/exercise-count-words-in-a-file.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
=status show
55
=books ruby, python, javascript, php
66
=author szabgab
7-
=comments_disqus_enable 1
7+
=comments_disqus_enable 0
88

99
=abstract start
1010

sites/en/pages/generating-code-coverage-report-gnu-gcc-gcov-lcov.txt

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
=status draft
55
=author szabgab
66
=archive 1
7-
=comments_disqus_enable 1
7+
=comments_disqus_enable 0
88

99
=abstract start
1010
=abstract end
@@ -22,6 +22,3 @@ lcov --remove all.info '/usr/*' '3rdparty/*' 'app/tests/*' --rc lcov_branch_cove
2222
genhtml selected.info --rc lcov_branch_coverage=1 --output-directory out
2323
</code>
2424

25-
26-
<code>
27-
</code>

sites/en/pages/groovy-types.txt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
=books groovy
66
=author szabgab
77
=archive 1
8-
=comments_disqus_enable 1
8+
=comments_disqus_enable 0
99

1010
=abstract start
1111

@@ -75,4 +75,8 @@ but we can assign any type of value to it and it will be automatically converted
7575

7676
See the <a href="http://groovy-lang.org/syntax.html">Groovy syntax</a> for more details.
7777

78+
<h2>Comments</h2>
79+
80+
boolean b = ""; returns false; however not b = "" even with prior declaration and assignment of b as boolean b = false per se within groovysh shell command prompt
81+
7882

sites/en/pages/hello-world-with-flask-and-python.txt

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
=books python, flask
66
=author szabgab
77
=archive 1
8-
=comments_disqus_enable 1
8+
=comments_disqus_enable 0
99

1010
=abstract start
1111

@@ -149,12 +149,9 @@ FLASK_APP=hello_world flask run --host 0.0.0.0
149149
FLASK_APP=hello_world FLASK_DEBUG=1 flask run --host 0.0.0.0 --port 3000
150150
</code>
151151

152+
<h2>Comments</h2>
152153

153-
154-
155-
156-
157-
158-
154+
how to resolve this error? GET /favicon.ico 404 NOT
155+
FOUND
159156

160157

sites/en/pages/how-to-insert-a-dictionary-in-another-dictionary-in-python.txt

Lines changed: 53 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
=books python
66
=author szabgab
77
=archive 1
8-
=comments_disqus_enable 1
8+
=comments_disqus_enable 0
99

1010
=abstract start
1111

@@ -71,4 +71,56 @@ The resulting printout shows that both <hl>team_b</hl>, and the internal part of
7171
in this case we assign a reference to the dictionary. So when we assigned <hl>team_b</hl> to <hl>team_a["b"]</hl>
7272
we have not copied the content of <hl>team_b</hl>, we just connected the existing dictionary to another place where it can be accessed from.
7373

74+
<h2>Comments</h2>
75+
76+
I'm trying to add a dictionary to another dictionary primary{{secondary_key : value}, {secondary_key : value}}. When I try to assign a value like this "dict[primary_key][secondary_key] = value" I get error IndexError: list assignment index out of range.
77+
78+
---
79+
80+
That means you declared either the external object or the internal object as list and not as dictionary.
81+
82+
<hr>
83+
84+
i have dictionary
85+
{key:value}
86+
{key:value}
87+
{key:value}
88+
.......
89+
i wanted to make it into a single key dictionary like
90+
[{'key':value} , {'key:value} , {'key':value}......]
91+
what should i do
92+
93+
----
94+
You say "I have a dictionary" and then you show 3 dictionaries. Then in the result you show a list with 3 dictionaries in it. If you have a dictionary, could you print it out and paste the result here?
95+
96+
----
97+
98+
say i have three dictionaries as follows in a text file
99+
{'America': 47.0, India': 1.0, 'England': 1.0}
100+
{'America': 7.0, 'India': 9.0, 'England': 2.0}
101+
{'America': 2.0, 'India': 2.0, 'England': 3.0}
102+
103+
i need an output as
104+
105+
[{'America': 47.0, India': 1.0, 'England': 1.0},
106+
{'America': 7.0, 'India': 9.0, 'England': 2.0},
107+
{'America': 2.0, 'India': 2.0, 'England': 3.0}]
108+
109+
----
110+
111+
Have you written any code already? Show that!
112+
113+
---
114+
115+
with open("abc.txt") as f:
116+
for line in f:
117+
118+
numbers_str = line.split()
119+
120+
numbers_float = [float(x) for x in numbers_str]
121+
keys=['America','India','England']
122+
zip(numbers_float,keys)
123+
results= dict(zip(keys,numbers_float))
124+
print results.items()
125+
74126

sites/en/pages/introduction-to-handlebars-javascript-templating-system.txt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
=books javascript, handlebars
66
=author szabgab
77
=archive 1
8-
=comments_disqus_enable 1
8+
=comments_disqus_enable 0
99

1010
=abstract start
1111

@@ -104,4 +104,8 @@ document.getElementById('result').innerHTML = html;
104104
That's it about the basics of Handlebars. If you'd like to learn more, you can check out the
105105
documentation on the web site of <a href="http://handlebarsjs.com/">Handlebars</a>
106106

107+
<h2>Comments</h2>
108+
109+
Hello!! Your article is excellent it has provided me with good information. I need your help in solving one problem I am using handlebarjs for templating. I have three templates in one single file and a singal json object (ie array of objects within array of objects) depending on the condition in one of my helper function i am trying to nest a template into parent template. I can share the piece of code with you.
110+
107111

sites/en/pages/iterate-over-character-of-a-string-in-ruby.txt

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
=title Iterate over characters of a string in Ruby
22
=timestamp 2015-02-11T15:30:01
3-
=indexes split, each_char
3+
=indexes split, each_char
44
=status show
55
=books ruby
66
=author szabgab
77
=archive 1
8-
=comments_disqus_enable 1
8+
=comments_disqus_enable 0
99

1010
=abstract start
1111

@@ -76,4 +76,30 @@ e
7676
f
7777
</code>
7878

79+
<h2>Comments</h2>
80+
81+
so would it be accurate to write:
82+
83+
%w { 1 2 3 4 }.each do |num|
84+
s3_file "/usr/local/tomcat7-7/part[num].tif"
85+
remote_path "part[num].tif"
86+
bucket "perftest-data"
87+
aws_access_key_id "XXXXXXX"
88+
aws_secret_access_key "ZZZZZZZZ"
89+
owner "root"
90+
group "root"
91+
mode "0644"
92+
action :create
93+
end
94+
95+
<hr>
96+
97+
You can also do it with a simple iteration loop, leveraging the fact that string objects are stored as arrays of characters:
98+
99+
input = 'abcdef'
100+
101+
input.length.times { |i|
102+
puts input[i]
103+
}
104+
79105

sites/en/pages/javascript-hello-world-change-the-dom.txt

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
=books javascript
66
=author szabgab
77
=archive 1
8-
=comments_disqus_enable 1
8+
=comments_disqus_enable 0
99

1010
=abstract start
1111

@@ -49,3 +49,10 @@ and that's why they are used usually) with an id <b>display</b>.
4949

5050
<try file="examples/js/set_innerhtml.html">
5151

52+
<h2>Comments</h2>
53+
54+
Putting the JavaScript code after the HTML is loaded does not always work. I ran into this after making a HTML, CSS, JavaScript app using PHP desktop.
55+
56+
For whatever reason, the HTML was not completely loaded and there was a need for a 400 millisecond delay before executing the JavaScript code to fill the DIV tags.
57+
58+
Just keep this in mind should you run into that scenario and your JavaScript can't find the HTML tags after the page is loaded.

0 commit comments

Comments
 (0)