Skip to content

Commit 21df4cd

Browse files
committed
comments
1 parent 98128be commit 21df4cd

21 files changed

+559
-22
lines changed

sites/en/pages/enforce-fast-forward-as-merge-strategy.txt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
=status show
55
=author szabgab
66
=archive 1
7-
=comments_disqus_enable 1
7+
=comments_disqus_enable 0
88

99
=abstract start
1010

@@ -81,3 +81,7 @@ As far as I know GitHub does not support requiring fast-forward when you accept
8181
As I can see one can set <a href="https://docs.gitlab.com/ee/user/project/merge_requests/fast_forward_merge.html">fast forward merge</a> as the only acceptable merge strategy.
8282

8383

84+
<h2>Comments</h2>
85+
86+
On Bitbucket Server you can install my "Control Freak" plugin to enforce a fast-forward policy when merging into certain branches (e.g., master).
87+

sites/en/pages/exercise-count-digits.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/flask-routes.txt

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

1010
=abstract start
1111

@@ -77,3 +77,7 @@ pytest -s
7777

7878

7979
<a href="http://exploreflask.com/en/latest/views.html">See also</a>
80+
81+
<h2>Comments</h2>
82+
83+
can I write on the one of html page which is in templates folder from any function in which is written in main flask file?

sites/en/pages/function-vs-generator-in-python.txt

Lines changed: 38 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

@@ -55,3 +55,40 @@ if <hl>True</hl> is still true in the <hl>while(True):</hl> statement.
5555
So from the outside the <hl>fibonacci</hl> function will behave just as the
5656
<a href="/callback-or-iterator-in-python">Fibonacci iterator</a> does which
5757
makes our code simple.
58+
59+
60+
<h2>Comments</h2>
61+
62+
1. You shouldn't have to collect values in fibonacci function if you yield them
63+
2. Instead of checking length of array just add start values into `values` array before `while` cycle
64+
65+
def fib_gen():
66+
a = 1
67+
b = 1
68+
yield b
69+
while True:
70+
yield b
71+
a,b = b,a+b
72+
73+
fibonacci = fib_gen()
74+
for item in xrange(10000):
75+
fib_number = fibonacci.next()
76+
if fib_number % 17 == 0:
77+
print fib_number
78+
break
79+
80+
81+
<hr>
82+
83+
instead of using xrange, or range in Python 3, alongside with __next__(), you could do the following in your for loop:
84+
85+
k,n=0,10000
86+
for i fib_gen():
87+
k+=1
88+
if i % 17 == 0:
89+
print(i)
90+
break
91+
if k==n:
92+
break
93+
94+

sites/en/pages/getting-started-with-pytest.txt

Lines changed: 27 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

@@ -222,4 +222,30 @@ In the second one (test_mymod_2.py) there were two test functions.
222222
The first one passed (<hl>.</hl>) the second failed <hl>F</hl>.
223223

224224

225+
<h2>Comments</h2>
226+
227+
I have a project which has about 2000 lines of code in it. When I started writing it, my ideas of unit testing was putting a bunch of code in a section beginning with:
228+
229+
if __name__ == "__main__":
230+
def test_something ( actual_answer, expected_answer, error_message ):
231+
assert actual_answer == expected_answer, "%s : actual_answer is %s expected_answer is %s" % ( str(actual_answer), str(expected_answer), error_message )
232+
233+
my_object = MyClass( arg )
234+
test_something ( my_object.function( arg_1 ), expected_answer_1, "my_object.function flunked test 1"
235+
test_something ( my_object.function( arg_2), expected_answer_2, "my_object.function flunked test 2"
236+
237+
238+
239+
So I am doing unit testing, but I get the sense that I am not doing unit testing the way it "ought" be done.
240+
241+
I have been looking through the internet, and I find that the literature on testing code in general and testing using pytest in particular is vast. What I have not found, and maybe that's because what I am looking for is buried in something else, is how to take my existing code base and revamp it for use with pytest or some other testing framework.
242+
243+
In particular, I have a function that uses <tt>subprocess.run</tt> to run a command and then parses the command's output. I'd like to test it. I have several ideas on how to go about doing this, such putting the subprocess call in a subroutine or method which detects if it is "production" or "test" and returns a canned output if in test. This idea doesn't scale very well, and IMHO clutters up the production code unnecessarily,
244+
245+
<hr>
246+
247+
nice post, very simple and clear. I have a question though, is there any recommendation on how to organize our .py files that will contain all of these test_ functions? I know this always depends on preferences but I'd like to know if there are any recommended guidelines on how to structure our testing for instance if I have a module called connectors.py does it make sense to say that we will need a test_connectors.py that will unit test every function in it?
248+
249+
--
250+
That's a good strategy.
225251

sites/en/pages/groovy-temporary-file.txt

Lines changed: 36 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
=abstract end
@@ -14,3 +14,38 @@
1414

1515
<include file="examples/groovy/temp_file_oop.gvy">
1616

17+
<h2>Comments</h2>
18+
19+
Thank you very much, your answer resolved my issue:
20+
21+
def map1 = [:]
22+
map1.put('jfr_1', "Hello World!")
23+
def i = 1
24+
def x = map1."jfr_$i"
25+
println "x = " + "${x}" ----> x = Hello World!
26+
27+
28+
<hr>
29+
30+
def jfr_1 = "Hello World!"
31+
def i = 1
32+
def x = "jfr_$i"
33+
println "${x}"
34+
35+
Above code prints: jfr_1 instead of Hello World! What I'm doing wrong?
36+
37+
---
38+
39+
Nothing. That's the expected behaviour.
40+
41+
<hr>
42+
43+
Thank you for the reply, how can I print "Hello World!" instead
44+
Using PERL print ($$x) will print "Hello World!".
45+
46+
---
47+
48+
Even in Perl you should not do that and you should "use strict" to make sure you don't do it by mistake. In Perl you'd use a hash in Groovy a map for that kind of data structure.
49+
50+
<hr>
51+

sites/en/pages/handlebars-conditionals.txt

Lines changed: 18 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

@@ -143,3 +143,20 @@ It can be found among the <a href="http://assemble.io/helpers/helpers-comparison
143143

144144
In any case I think it was interesting to see how to build and use this.
145145

146+
<h2>Comments</h2>
147+
148+
Handlebars is pretty useless, how difficult can it be to include support for expressions? That you have to declare so much code for this kind of basic behaviour...
149+
150+
<hr>
151+
152+
Thank you so much for this! Spent ages looking online for an example of 'if_eq' and yours is the first one that clicked for me.
153+
154+
<hr>
155+
156+
Thank you for the Uncaught Error section, saved me several hours :)
157+
158+
<hr>
159+
160+
Thanks for this great post! But for the first example, where true is expected false is returned. please verify and correct it. I ma facing the same issue in my project.
161+
162+

sites/en/pages/hello-world-with-angular-controller.txt

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

1010
=abstract start
1111

@@ -54,7 +54,7 @@ These two mark the area in which the <hl>$scope</hl> is relevant.
5454

5555
This was a fairly simple example with a hard-coded value assigned to an attribute and used in an expression.
5656

57-
<h2>Hello user Conroller</h2>
57+
<h2>Hello user Controller</h2>
5858

5959
Let's see a slightly more complex example in which we handle input from the user and process that input in
6060
the controller. The processing will be very simple, just concatenating with a fixed string.
@@ -80,3 +80,17 @@ will display the content of <hl>$scope.name</hl> and <hl>$scope.greeting</hl> re
8080

8181
The result is that as we type "Foo" in the input box, our page will display "Hello Foo" in <hl>h1</hl>
8282
tags and <hl>Foo</hl> in <hl>h2</hl> tags.
83+
84+
<h2>Comments</h2>
85+
86+
hey, thanks Gabor
87+
88+
<hr>
89+
90+
it is absolutely Great Tutorial to get started with angular js Thanks :)
91+
92+
<hr>
93+
94+
Great tutorial for beginners, thanks for posting!
95+
96+

sites/en/pages/how-to-contribute-to-an-open-source-project.txt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
=indexes Open Source
44
=status show
55
=author szabgab
6-
=comments_disqus_enable 1
6+
=comments_disqus_enable 0
77

88
=abstract start
99

@@ -109,4 +109,8 @@ Anyway, be patient. Remember, the person on the other side is a developer just l
109109

110110
Most importantly enjoy the process. You are always learning something.
111111

112+
<h2>Comments</h2>
113+
114+
Very nice article. There is a lot of free and open source software projects that needs contributions, and attentions also improvements out there that worth taking notice.
115+
112116

sites/en/pages/how-to-exit-a-nodejs-script.txt

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

1010
=abstract start
1111

@@ -21,3 +21,19 @@ called <a href="http://nodejs.org/api/process.html#process_process_exit_code">ex
2121

2222
<include file="examples/node/process_exit.js">
2323

24+
<h2>Comments</h2>
25+
26+
ctrl+C twice
27+
28+
or type:
29+
30+
.exit
31+
32+
<hr>
33+
34+
nice
35+
36+
<hr>
37+
38+
It was just what I was looking for. Thank you very very much
39+

sites/en/pages/http-client-request-in-nodejs.txt

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

1010
=abstract start
1111

@@ -202,4 +202,11 @@ field=value
202202
So indeed, this managed to collect the data that was sent by the client.
203203

204204

205+
<h2>Comments</h2>
206+
207+
Hi Gabor, It is actually a beautiful tuto, I really appreciate. But i would say, it is seem like to be a node http server tuto rather then a node http client.
208+
209+
<hr>
210+
211+
Its a great example to see how the legacy version of node consumed data. Thanks a lot
205212

sites/en/pages/install-and-configure-nginx-using-ansible.txt

Lines changed: 39 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

@@ -183,3 +183,41 @@ That printed:
183183

184184
When I visited the http://192.168.56.11/ from my desktop machine, it showed me the web page as I expected it, with the logo of Ansible.
185185

186+
<h2>Comments</h2>
187+
188+
I got curl: (7) couldn't connect to host
189+
190+
<hr>
191+
192+
Hi,
193+
194+
I configured two EC2 RHL7 machine in AWS.(region - US East (Ohio))
195+
196+
1. control machine
197+
2. Node machine
198+
199+
When i am trying to run playbook i get the below error.
200+
------------------------------------------------
201+
fatal: [172.31.18.198]: FAILED! => {"changed": false, "msg": "Repo rhui-REGION-client-config-server-7 forced skip_if_unavailable=True due to: /etc/pki/rhui/cdn.redhat.com-chain.crt\nRepo rhui-REGION-client-config-server-7 forced skip_if_unavailable=True due to: /etc/pki/rhui/product/rhui-client-config-server-7.crt\nRepo rhui-REGION-client-config-server-7 forced skip_if_unavailable=True due to: /etc/pki/rhui/rhui-client-config-server-7.key\nRepo rhui-REGION-rhel-server-releases forced skip_if_unavailable=True due to: /etc/pki/rhui/cdn.redhat.com-chain.crt\nRepo rhui-REGION-rhel-server-releases forced skip_if_unavailable=True due to: /etc/pki/rhui/product/content-rhel7.crt\nRepo rhui-REGION-rhel-server-releases forced skip_if_unavailable=True due to: /etc/pki/rhui/content-rhel7.key\nRepo rhui-REGION-rhel-server-rh-common forced skip_if_unavailable=True due to: /etc/pki/rhui/cdn.redhat.com-chain.crt\nRepo rhui-REGION-rhel-server-rh-common forced skip_if_unavailable=True due to: /etc/pki/rhui/product/content-rhel7.crt\nRepo rhui-REGION-rhel-server-rh-common forced skip_if_unavailable=True due to: /etc/pki/rhui/content-rhel7.key\n\n\nCould not contact any CDS load balancers: rhui2-cds01.us-east-2.aws.c..., rhui2-cds02.us-east-2.aws.c....\n", "rc": 1, "results": []}
202+
-----------------------------
203+
204+
Could you please help me to understand the issue.
205+
206+
<hr>
207+
208+
I am trying to install nginx in node machine.
209+
210+
- hosts: webservers
211+
tasks:
212+
- name: ensure nginx is at the latest version
213+
yum: name=nginx state=latest
214+
- name: start nginx
215+
service:
216+
name: nginx
217+
state: started
218+
219+
---
220+
221+
Enable ssh between the machines and mention the users: name your user here
222+
223+

sites/en/pages/introduction-to-python-unittest.txt

Lines changed: 6 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

@@ -269,4 +269,9 @@ BTW as you can see the test-methods are the smallest units the <hl>unittest</hl>
269269
module can operate on, so it is probably a good idea to keep them very short
270270
and focused on specific features.
271271

272+
<h2>Comments</h2>
273+
274+
That was awesome explanation about uninttest.
275+
Would like to know one thing, is there a possibility of collecting all failed test cases & rerunning ?
276+
272277

sites/en/pages/javascript-function-that-accepts-any-number-of-arguments.txt

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

1010
=abstract start
1111

0 commit comments

Comments
 (0)