Re: JUST GOT HACKED

2013-10-02 Thread Ravi Sahni
On Wed, Oct 2, 2013 at 12:19 PM, Ben Finney  wrote:
> Antoon Pardon  writes:
>
>> Op 02-10-13 00:06, Ben Finney schreef:
>> > This is an unmoderated forum, so we have occasional spates of
>> > persistent nuisances, and those who respond with the maturity level
>> > and impulse control of an average six-year-old.
> […]
>>
>> And what about the impuls control and the maturity of people who can't
>> stop answering [a nuisance], knowing they contribute to the nuisance
>> to the group?
>
> Yes, we are in firm agreement here.

So Ben,Antoon you are saying that Nikos is a minor problem -- spam-like --
Whereas people answering him are a bigger problem??!

I find this real confused!! Why they are answering then?!?!
As far as I can make out everyone who is answering (helping!) doing it
frustratation and disgust.  But still they keep answering and
answering!!

Makes no sense


[Sorry -- old programmer (C,C++ etc) -- new to python. If there is
some secret to this list's culture that I missed will be pleased to be
educated!
]


-- 
- Ravi
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: JUST GOT HACKED

2013-10-02 Thread Ben Finney
Ravi Sahni  writes:

> So Ben,Antoon you are saying that [demands for off-topic help with
> demonstrated history of unwillingness to learn] is a minor problem […]
> Whereas [baiting and enabling that behaviour is] a bigger problem??!

(I edited the above to focus on behaviour, not people. Let's not vilify
a person when what is objectionable is the behaviour.)

No, I'm not saying that. I'm saying that both those behaviours are
significant nuisances, both are against our community guidelines of
mutual respect, and both should stop.

Comparing the magnitude of those problems to see which is worse isn't of
interest to me, they're both objectionable to the point of noise and
disruption.

I'd like them both to stop, in the interest of keeping this forum
functional for its intended purposes.

-- 
 \   “If you make people think they're thinking, they'll love you; |
  `\ but if you really make them think, they'll hate you.” —Donald |
_o__) Robert Perry Marquis |
Ben Finney

-- 
https://mail.python.org/mailman/listinfo/python-list


How to manage Git or Mercurial repositories

2013-10-02 Thread Andriy Kornatskyy
Managing version control repositories can be a challenge in multi-user 
environment especially when simplification of user collaboration is your goal. 
There are usually two primary concerns while considering enterprise deployment 
for version control repositories: access control and safety of your data. Both 
are not directly addressed by version control itself, thus a sort of security 
facade is necessary. Read more here:

http://mindref.blogspot.com/2013/10/how-to-manage-git-or-mercurial.html

Thanks.

Andriy Kornatskyy 
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: JUST GOT HACKED

2013-10-02 Thread Steven D'Aprano
On Wed, 02 Oct 2013 16:49:22 +1000, Ben Finney wrote:

> Antoon Pardon  writes:
> 
>> Op 02-10-13 00:06, Ben Finney schreef:
>> > This is an unmoderated forum, so we have occasional spates of
>> > persistent nuisances, and those who respond with the maturity level
>> > and impulse control of an average six-year-old.
> […]
>>
>> And what about the impuls control and the maturity of people who can't
>> stop answering [a nuisance], knowing they contribute to the nuisance to
>> the group?
> 
> Yes, we are in firm agreement here.


Well that's a shame, and I think that your comment here is incompatible 
with your previous approval of the PSF Diversity Statement.

The Python Software Foundation and the global Python community
welcome and encourage participation by everyone. Our community is
based on mutual respect, tolerance, and encouragement, and we are
working to help each other live up to these principles. We want our
community to be more diverse: whoever you are, and whatever your
background, we welcome you.


This doesn't say anything about bullying, mocking and belittling those we 
don't like. It says, *encourage* participation by *everyone*, and that 
includes annoyances like Nikos. Like it or not, he is part of the 
community of Python users too.

I admit to serious reservations about the Diversity Statement and the 
Code of Conduct, but I think I am living up to their ideals. In my 
imperfect way, I am trying to encourage Nikos towards better behaviour by 
rewarding him for good behaviour (answer his sensible questions, 
encourage him to learn on his own) and discourage his bad behaviour. I 
don't mock him or belittle him, and I don't celebrate when he screws up.

And if I slip up and do any of these things, then I would deserve to be 
called out on it.

Ben, are you doing all you can to live up to the PSF ideals? Are you 
encouraging Nikos to be a good member of this community, or just standing 
idly by while others bully him?

I can tell you this: if the PSF Code of Conduct applied here, Nikos would 
be a *distant* third on my list of people to be banned. He might be needy 
and annoying, but he is not abusive and hostile except when defending 
himself from the abuse and hostility of others.

And I've called Nikos out on his retaliation too. He doesn't get a free 
pass from me.



-- 
Steven
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: JUST GOT HACKED

2013-10-02 Thread Mark Lawrence

On 02/10/2013 07:51, Antoon Pardon wrote:

Op 02-10-13 04:30, Steven D'Aprano schreef:

On Wed, 02 Oct 2013 00:24:35 +1000, Daniel Stojanov wrote:


2) I just signed up the this mailing list. To the regulars, is this what
normally happens on this list?


No.


3) I'm a bit late to the party. Is Nikos a real sysadmin or is this some
horrible inside joke I don't get?


Nikos is not a real sysadmin. He is a wanna-be web developer who barely
knows Python. He is arrogant and annoying. Unfortunately he is not the
real problem here. The real problem is a bunch of vigilantes have
appointed themselves the anti-Nikos lynch mob and take every opportunity
they can to mock him, insult him, bait him into responding to their
taunts, and even make public death threats against him. And now it
appears that one of them may have hacked into his web site in an attempt
to put him out of business.


That is your slant of things. My take is that the real problem is those
that keep spoon feeding the help vampire, collaborating to the nuissance
and encouraging Nikos to come back.


These vigilantes have decided to save this mailing list from Nikos, even
if it means destroying it. Nikos at least does ask Python questions. The
vigilantes hardly talk about Python at all, they're too busy laughing at
Nikos and insulting him. Nikos doesn't learn from his errors; neither do
the vigilantes, no matter how many times they have failed they are sure
that if they mock him just a little bit harder he will go away. He won't,
they keep baiting him even more, and this place is going to shit thanks
to them.


Maybe the people venting their frustration think the mailing list is
already partly gone to shit. So why should they care it is going to shit
too for those who collaborate to the nuisance. The latter didn't care
much the mailing list was going to shit for the first. The latter only
started to care about the shit level when they themselves though it
became too high for them. And then they complain about those venting
their frustration but they won't look at how their own behaviour
contributes to the frustration of those venting.



No guessing which camp I'm in.

--
Cheers.

Mark Lawrence

--
https://mail.python.org/mailman/listinfo/python-list


Mutual respect, bullying, tolerance (was: JUST GOT HACKED)

2013-10-02 Thread Ben Finney
Steven D'Aprano  writes:

> Well that's a shame, and I think that your comment here is
> incompatible with your previous approval of the PSF Diversity
> Statement.

We should tolerate people, but we should not tolerate their bad
behaviour.

The Diversity Statement includes the principle of mutual respect, which
I heartily endorse.

I think the behaviour exhibited for months by the originator of this
thread is very unrespectful of this whole community, and that those who
bait and belittle this person are also disrespectful.

Neither bad behaviour excuses the other, and I find both those
behaviours to be against the principles in the PSF Diversity Statement.

> Ben, are you doing all you can to live up to the PSF ideals? Are you
> encouraging Nikos to be a good member of this community, or just
> standing idly by while others bully him?

I have several times responded with unequivocal public condemnation to
those who called for violence to be done against him.

No mere utterance of words can justify a call for violence in response,
and I want no-one to suffer that in this forum regardless how much of a
nuisance they have become.

> And I've called Nikos out on his retaliation too. He doesn't get a
> free pass from me.

I have long since consigned him to a kill-file: his unrepentantly
off-topic demands are far too voluminous for me to keep up with.

-- 
 \ “Holy tintinnabulation, Batman!” —Robin |
  `\   |
_o__)  |
Ben Finney

-- 
https://mail.python.org/mailman/listinfo/python-list


Re: JUST GOT HACKED

2013-10-02 Thread Ravi Sahni
On Wed, Oct 2, 2013 at 12:54 PM, Ben Finney  wrote:
>
> Ravi Sahni  writes:
>
> > So Ben,Antoon you are saying that [demands for off-topic help with
> > demonstrated history of unwillingness to learn] is a minor problem […]
> > Whereas [baiting and enabling that behaviour is] a bigger problem??!
>
> (I edited the above to focus on behaviour, not people. Let's not vilify
> a person when what is objectionable is the behaviour.)

Good... Sorry

>
> No, I'm not saying that. I'm saying that both those behaviours are
> significant nuisances, both are against our community guidelines of
> mutual respect, and both should stop.
>
> Comparing the magnitude of those problems to see which is worse isn't of
> interest to me, they're both objectionable to the point of noise and
> disruption.
>
> I'd like them both to stop, in the interest of keeping this forum
> functional for its intended purposes.
>

Thanks Ben   for clarification and understanding

-- 
- Ravi
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: JUST GOT HACKED

2013-10-02 Thread Antoon Pardon
Op 02-10-13 09:02, Ravi Sahni schreef:
> On Wed, Oct 2, 2013 at 12:19 PM, Ben Finney  
> wrote:
>> Antoon Pardon  writes:
>>
>>> Op 02-10-13 00:06, Ben Finney schreef:
 This is an unmoderated forum, so we have occasional spates of
 persistent nuisances, and those who respond with the maturity level
 and impulse control of an average six-year-old.
>> […]
>>>
>>> And what about the impuls control and the maturity of people who can't
>>> stop answering [a nuisance], knowing they contribute to the nuisance
>>> to the group?
>>
>> Yes, we are in firm agreement here.
> 
> So Ben,Antoon you are saying that Nikos is a minor problem -- spam-like --
> Whereas people answering him are a bigger problem??!
> 
> I find this real confused!! Why they are answering then?!?!
> As far as I can make out everyone who is answering (helping!) doing it
> frustratation and disgust.  But still they keep answering and
> answering!!

You should understand that what is a bigger problem and what is a minor
problem is a personal, subjective judgement and people come to different
conclusions.

So group1 finds Nikos a minor nuisance and is willing to answer him.
Probably because it gives them warm fuzzy feelings knowing they tried
to help someone or because they found the problem interresting to solve.

Now group2 may find Nikos himself not that big a nuisance but they
certainly find Nikos in combination with group1 a major nuisance.
Because it keeps the cycle going and even if they kill file Nikos,
they keep being confronted with his contributions through the responses
of group1.

So frustration builds for those in group2, until it reaches a level
that some of them feel the need to vent that frustration. That can
sometimes be rather ugly to observe and I am sure that some venters
weren't that happy with their own reaction afterwards, but I think
it is an understandable, human reaction.

Now for a number of people in group1, the venting of group2 is a
major nuisance and they start venting their own frustration with that.
Unfortunately, their own need for venting doesn't create any empathy
for the need of group2 for venting. They only see groups2 as the
cause for their own frustration with very little willingness to see
their own contribution to the original built up.

-- 
Antoon Pardon
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: UnicodeDecodeError: 'utf-8' codec can't decode byte 0xb6 in position 0: invalid start byte

2013-10-02 Thread Antoon Pardon
Op 02-10-13 03:36, Steven D'Aprano schreef:
> On Tue, 01 Oct 2013 09:27:22 +0200, Antoon Pardon wrote:
> 
>> People pay for some kind of guaranteed uptime.
> 
> You have *no idea* what sort of contract Nikos has with his customers. 
> Nor do you know have any idea what fees he charges. For all we know, he 
> is promising, and charging for, 99% uptime while delivering 99.9% uptime.

Which is beside the point. It is very well possible to rip someone of
and in the mean time have a contract that makes ripping that person of,
legal.

It is also possible one behaves in a way similar as if ripping
others off, but that your "victims" are lucky and don't experience
a bad outcome (yet).

> I know you are getting off on hating Nikos, but take it elsewhere.

I know you are getting off insinuating hate of those who dare to
critisize Nikos harshly, but take it elsewhere.

-- 
Antoon Pardon

-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Tail recursion to while iteration in 2 easy steps

2013-10-02 Thread Alain Ketterlin
Terry Reedy  writes:

> Part of the reason that Python does not do tail call optimization is
> that turning tail recursion into while iteration is almost trivial,
> once you know the secret of the two easy steps. Here it is.
>
> Assume that you have already done the work of turning a body recursive
> ('not tail recursive') form like
>
> def fact(n): return 1 if n <= 1 else n * fact(n-1)
>
> into a tail recursion like
[...]

How do know that either "<=" or "*" didn't rebind the name "fact" to
something else? I think that's the main reason why python cannot apply
any procedural optimization (even things like inlining are impossible,
or possible only under very conservative assumption, that make it
worthless).

-- Alain.

P/S: don't take me wrong; your explanation is excellent (and very useful
to python programmers). What I say is that it relies on assumptions that
do not apply to python.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Tail recursion to while iteration in 2 easy steps

2013-10-02 Thread Alain Ketterlin
rusi  writes:

> On Wednesday, October 2, 2013 3:00:41 AM UTC+5:30, Terry Reedy wrote:
>> Part of the reason that Python does not do tail call optimization is 
>> that turning tail recursion into while iteration is almost trivial, once 
>> you know the secret of the two easy steps. Here it is.
>
> What happens for mutual tail recursive code like this
>
> def isodd(x) : return False if x==0 else iseven(x-1)
> def iseven(x): return True if x==0 else isodd(x-1)

It takes one step of inlining to make Terry's technique applicable.

(Actually, out of curiosity, I tried this with gcc 4.6.3: the compiler
does 16 levels of inlining, plus tail call optimization. The final code
has no call.)

-- Alain.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: UnicodeDecodeError: 'utf-8' codec can't decode byte 0xb6 in position 0: invalid start byte

2013-10-02 Thread Νίκος

Στις 2/10/2013 4:36 πμ, ο/η Steven D'Aprano έγραψε:

On Tue, 01 Oct 2013 09:27:22 +0200, Antoon Pardon wrote:


People pay for some kind of guaranteed uptime.


You have *no idea* what sort of contract Nikos has with his customers.
Nor do you know have any idea what fees he charges. For all we know, he
is promising, and charging for, 99% uptime while delivering 99.9% uptime.

I know you are getting off on hating Nikos, but take it elsewhere.


It is good to know that some people understand me better then others.

Thank you steven.

--
https://mail.python.org/mailman/listinfo/python-list


Re: UnicodeDecodeError: 'utf-8' codec can't decode byte 0xb6 in position 0: invalid start byte

2013-10-02 Thread Νίκος

Στις 2/10/2013 10:23 πμ, ο/η Antoon Pardon έγραψε:

Op 02-10-13 03:36, Steven D'Aprano schreef:

On Tue, 01 Oct 2013 09:27:22 +0200, Antoon Pardon wrote:


People pay for some kind of guaranteed uptime.


You have *no idea* what sort of contract Nikos has with his customers.
Nor do you know have any idea what fees he charges. For all we know, he
is promising, and charging for, 99% uptime while delivering 99.9% uptime.


Which is beside the point. It is very well possible to rip someone of
and in the mean time have a contract that makes ripping that person of,
legal.

It is also possible one behaves in a way similar as if ripping
others off, but that your "victims" are lucky and don't experience
a bad outcome (yet).


I know you are getting off on hating Nikos, but take it elsewhere.


I know you are getting off insinuating hate of those who dare to
critisize Nikos harshly, but take it elsewhere.


I'am not ripping anyone off.
I designed all their websites and i host all their websiutes.
All their websites do work properly as expected.

I only trial and error with my perosnal domain, personal account only.
The only thing i did change system wide was installing Python 3.3.2 for 
perosnal reasons and rewrite the code for that.


But, wy iam a sitting here and explainign myself to you.
--
https://mail.python.org/mailman/listinfo/python-list


Re: PyDoc_STRVAR error in msvc compile

2013-10-02 Thread Robin Becker

On 01/10/2013 18:26, MRAB wrote:

On 01/10/2013 17:41, Robin Becker wrote:

..



I've tried it in a minimal console program, and it seems to work for me.

thanks for the test. I thought this might be an issue with the macro call 
argument being spread out over several lines, but since your try works I'll dig 
deeper.

--
Robin Becker
--
https://mail.python.org/mailman/listinfo/python-list


Re: JUST GOT HACKED

2013-10-02 Thread Steven D'Aprano
On Wed, 02 Oct 2013 12:32:57 +0530, Ravi Sahni wrote:

> I find this real confused!! Why they are answering then?!?! As far as I
> can make out everyone who is answering (helping!) doing it frustratation
> and disgust.  But still they keep answering and answering!!
> 
> Makes no sense


If you want to ask why people are answering Nikos' questions, you should 
ask them directly. I won't speak for others, but I'll answer for myself: 
I answer Nikos' questions because:

#1 He is a member of our community who needs help with Python, and this 
is a welcoming community, not an elitist one.

#2 Some of his questions are interesting technical questions, like his 
Unicode problems. I have learnt things from answering his questions. I'm 
sure other people have learnt things from reading those answers.

#3 Even his uninteresting questions deserve answers. Everybody here, I am 
sure, has asked boring or stupid or trivial questions at some stage, 
especially the newbies. Even when the answer is just "This answer is the 
same as last time you asked", the question deserves an answer. This is a 
matter of simple respect. We should treat others in the way we would hope 
to be treated if we were in their shoes.

#4 Explicit is better than implicit. Even if nobody has an answer, or if 
it is off-topic, it is better to explicitly say that we have no answer 
and remove all doubt than to respond with nothing but silence and leave 
open the hope that if you just ask again more loudly someone will answer.

#5 In the long run, encouraging good behaviour is more effective at 
changing people's behaviour than merely punishing bad behaviour.

#6 Consider the first impression of a newbie, joining this community with 
questions about Python. The first thing they see is Nikos asking 
questions, and being ignored, or worse, being abused. Does that send the 
message that we want, that their questions are welcome?


-- 
Steven
-- 
https://mail.python.org/mailman/listinfo/python-list


hg.python.org: Server unresponsive and timeout

2013-10-02 Thread Tae Wong
This post is irrelevant from using Python; so it's an Internet server problem.

When you try to connect to hg.python.org, the connection takes forever.

How to fix this server issue?
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: PyDoc_STRVAR error in msvc compile

2013-10-02 Thread Robin Becker

On 02/10/2013 10:00, Robin Becker wrote:

On 01/10/2013 18:26, MRAB wrote:

On 01/10/2013 17:41, Robin Becker wrote:

..



I've tried it in a minimal console program, and it seems to work for me.


thanks for the test. I thought this might be an issue with the macro call
argument being spread out over several lines, but since your try works I'll dig
deeper.
I used -E to get the pre-processor output and it shows my string constant ends 
up with the #ifdef inside it eg



  ..\n" #ifdef " stuff\n" #endif "\n\

I looked for any obvious reason why that should happen, but cannot find 
anything.

if I remove the internal #ifdef and replace with a macro containing the 
conditional string or "" then MSVC 9 seems to be ok with it.


--
Robin Becker
--
https://mail.python.org/mailman/listinfo/python-list


Lowest Value in List

2013-10-02 Thread subhabangalore
Dear Group,

I am trying to work out a solution to the following problem in Python. 

The Problem:
Suppose I have three lists.
Each list is having 10 elements in ascending order.
I have to construct one list having 10 elements which are of the lowest value 
among these 30 elements present in the three given lists.

The Solution:

I tried to address the issue in the following ways:

a) I took three lists, like,
list1=[1,2,3,4,5,6,7,8,9,10]
list2=[0,1,2,3,4,5,6,7,8,9]
list3=[-5,-4,-3,-2,-1,0,1,2,3,4]

I tried to make sum and convert them as set to drop the repeating elements:
set_sum=set(list1+list2+list3)
set([0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, -1, -5, -4, -3, -2])

In the next step I tried to convert it back to list as,
list_set=list(set_sum)
gave the value as,
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, -1, -5, -4, -3, -2]

Now, I imported heapq as, 
import heapq

and took the result as,
result=heapq.nsmallest(10,list_set)
it gave as,
[-5, -4, -3, -2, -1, 0, 1, 2, 3, 4]

b) I am thinking to work out another approach.
I am taking the lists again as,

list1=[1,2,3,4,5,6,7,8,9,10]
list2=[0,1,2,3,4,5,6,7,8,9]
list3=[-5,-4,-3,-2,-1,0,1,2,3,4]

as they are in ascending order, I am trying to take first four/five elements of 
each list,like,

list1_4=list1[:4]
>>> list2_4=list2[:4]
>>> list3_4=list3[:4]

Now, I am trying to add them as,

list11=list1_4+list2_4+list3_4

thus, giving us the result

[1, 2, 3, 4, 0, 1, 2, 3, -5, -4, -3, -2]

Now, we are trying to sort the list of the set of the sum as,

sort_sum=sorted(list(set(list11)))

giving us the required result as,

[-5, -4, -3, -2, 0, 1, 2, 3, 4]

If by taking the value of each list portion as 4 gives as less number of 
elements in final value, as we are making set to avoid repeating numbers, we 
increase element count by one or two and if final result becomes more than 10 
we take first ten.

Are these approaches fine. Or should we think some other way.

If any learned member of the group can kindly let me know how to solve I would 
be helpful enough.

Thanking in Advance,
Subhabrata. 


-- 
https://mail.python.org/mailman/listinfo/python-list


Re: python function parameters, debugging, comments, etc.

2013-10-02 Thread Oscar Benjamin
On 2 October 2013 00:45, Rotwang  wrote:
>
> So the upside of duck-typing is clear. But as you've already discovered, so
> is the downside: Python's dynamic nature means that there's no way for the
> interpreter to know what kind of arguments a function will accept, and so a
> user of any function relies on the function having clear documentation.

It is still necessary to document the arguments of functions in
explicitly typed languages. Knowing that you need a list of strings
does not mean that you know what the function expects of the values of
the strings and what it will try to do with them.

When you see something like
int atoi (const char * str);
you know that it takes a string and returns an integer. However the
function name does not clearly indicate any purpose. What kind of
string should I pass in? Is the returned value an error code or a
value generated from the string (it's actually both). Even if you know
that the function parses strings representing integers there are still
many different formats for representing numbers as strings. Should the
string be in a locale-dependent format? What kind of text encoding is
it using (utf-8 maybe)? Should the characters represent an integer in
decimal format or hex, octal, binary or something else?

Inspecting types can be a quick way to gain information about the
meaning of arguments and return values but it is not something that
you should be relying on to replace documentation.


Oscar
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Lowest Value in List

2013-10-02 Thread Steven D'Aprano
On Wed, 02 Oct 2013 03:04:16 -0700, subhabangalore wrote:

> Dear Group,
> 
> I am trying to work out a solution to the following problem in Python.
> 
> The Problem:
> Suppose I have three lists.
> Each list is having 10 elements in ascending order. I have to construct
> one list having 10 elements which are of the lowest value among these 30
> elements present in the three given lists.

If they have to be the lowest *unique* values, the easiest way is to 
build a set from all three lists, then sort, and take a slice of only the 
first 10:

sorted(set(alist + blist + clist))[:10] 

If you don't want unique values, but want to keep duplicates, then drop 
the call to set:

sorted(alist + blist + clist)[:10] 



> The Solution:
> 
> I tried to address the issue in the following ways:

Thank you for posting your attempts to solve this problem! You had the 
right idea, you just did a little bit too much work.



-- 
Steven
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: I haev fixed it

2013-10-02 Thread Νίκος

Στις 2/10/2013 5:35 πμ, ο/η Steven D'Aprano έγραψε:

On Tue, 01 Oct 2013 13:54:32 +0300, Νίκος wrote:


How did this happened i asked.
I must know how did this happen so i take action to prevent it from
happening again.


If I recall, some of your haters (Mark Lawrence, Antoon Pardon and Chris
Warrick, if I remember correctly) were making lots of noise about
reporting you to the Greek police and having you shut down for
incompetence, as if incompetence was a criminal matter. And now it
appears that somebody now *actually has* broken the law to try to shut
you down. This follows death threats made against you. Under post 9/11
laws, death threats almost certainly would be classified as "terrorism".

I recommend that you report this to your hosting provider, your local
police, and Interpol. If your Gmail account was hacked, you should also
report it to Google. Your local police are probably too busy to care, but
stick to it. At the very least make sure they take your complaint. Get it
on file.

Be careful not to destroy evidence. Don't go deleting log files, htaccess
files or anything else that can be used to identifier the criminal.

Interpol have a division specialising in international computer crime and
if you stick to it with your usual bull-headedness I'm sure you can
convince them to investigate. Your ISP can probably tell you the IP
address of who logged into your account. If your Gmail account was
accessed, Google can do the same.

Nikos, I would treat this seriously. Who knows what this criminal will do
next? Those hating you have talked about getting you arrested, or having
you killed. Now somebody has escalated into breaking into your email
account. They've already proven that they want to destroy your business
and your livelihood. What will they do next? Try to frame you for child
molestation by planting illegal material?

Nikos, if I were you I would not stop until you have tracked down this
criminal hacker and had him arrested, if it takes you a year. Put all
your energy and famous bull-headedness into this, and I'm sure you will
be successful.

I am totally serious here. You have a strong case -- a group of people
who have publicly harassed you, publicly tried to shut down your
business, made death threats against you, and now somebody has hacked
into your account and tried to scare off your customers.

And then, in the name of all that's holy, get yourself some professional
help to secure your website.


You tell me Steven,

If someone was to make a lawsuit that would be me against them, not the 
other way around.


--
https://mail.python.org/mailman/listinfo/python-list


Re: hg.python.org: Server unresponsive and timeout

2013-10-02 Thread Ben Finney
Tae Wong  writes:

> When you try to connect to hg.python.org, the connection takes
> forever.

(Note that this is the community discussion forum for the Python
langauge; it is perhaps not the best forum to report problems with
python.org infrastructure.)

What client are you using to connect? Is there an exact command that we
can try, to see whether the problem is reproducible?

> How to fix this server issue?

The monitor site http://status.python.org/> says that
‘hg.python.org’ is operational when I check, so whoever investigates the
problem will need more detail on what you're trying to do and what
exactly isn't working.

-- 
 \  “The fact that I have no remedy for all the sorrows of the |
  `\ world is no reason for my accepting yours. It simply supports |
_o__)  the strong probability that yours is a fake.” —Henry L. Mencken |
Ben Finney

-- 
https://mail.python.org/mailman/listinfo/python-list


Re: JUST GOT HACKED

2013-10-02 Thread Νίκος

Στις 2/10/2013 10:29 πμ, ο/η Steven D'Aprano έγραψε:

On Wed, 02 Oct 2013 16:49:22 +1000, Ben Finney wrote:


Antoon Pardon  writes:


Op 02-10-13 00:06, Ben Finney schreef:

This is an unmoderated forum, so we have occasional spates of
persistent nuisances, and those who respond with the maturity level
and impulse control of an average six-year-old.

[…]


And what about the impuls control and the maturity of people who can't
stop answering [a nuisance], knowing they contribute to the nuisance to
the group?


Yes, we are in firm agreement here.



Well that's a shame, and I think that your comment here is incompatible
with your previous approval of the PSF Diversity Statement.

 The Python Software Foundation and the global Python community
 welcome and encourage participation by everyone. Our community is
 based on mutual respect, tolerance, and encouragement, and we are
 working to help each other live up to these principles. We want our
 community to be more diverse: whoever you are, and whatever your
 background, we welcome you.


This doesn't say anything about bullying, mocking and belittling those we
don't like. It says, *encourage* participation by *everyone*, and that
includes annoyances like Nikos. Like it or not, he is part of the
community of Python users too.

I admit to serious reservations about the Diversity Statement and the
Code of Conduct, but I think I am living up to their ideals. In my
imperfect way, I am trying to encourage Nikos towards better behaviour by
rewarding him for good behaviour (answer his sensible questions,
encourage him to learn on his own) and discourage his bad behaviour. I
don't mock him or belittle him, and I don't celebrate when he screws up.

And if I slip up and do any of these things, then I would deserve to be
called out on it.

Ben, are you doing all you can to live up to the PSF ideals? Are you
encouraging Nikos to be a good member of this community, or just standing
idly by while others bully him?

I can tell you this: if the PSF Code of Conduct applied here, Nikos would
be a *distant* third on my list of people to be banned. He might be needy
and annoying, but he is not abusive and hostile except when defending
himself from the abuse and hostility of others.

And I've called Nikos out on his retaliation too. He doesn't get a free
pass from me.


My lawyer couldn't have said it better steven :)

Thanks for the vote of support.
The truth is _exactly_ as yoiu have stated it to be.

I apologize though oif some times i loose my temper and use impoprer 
vocabulary on some people. The pressure is just too high at some point 
when i see so many people critisize and make ironic comments agianst me 
all the time in every single thread i start.


I was even mocked because all i wanted to do was to optimize code and 
use the best solution there is to it.


--
https://mail.python.org/mailman/listinfo/python-list


Re: JUST GOT HACKED

2013-10-02 Thread Chris Angelico
On Wed, Oct 2, 2013 at 8:22 PM, Νίκος  wrote:
> I apologize though oif some times i loose my temper and use impoprer
> vocabulary on some people. The pressure is just too high at some point when
> i see so many people critisize and make ironic comments agianst me all the
> time in every single thread i start.
>
> I was even mocked because all i wanted to do was to optimize code and use
> the best solution there is to it.

Well, you weren't trying to use the best solution, for any meaning of
"best" other than "the one that feels most like Perl or APL".

Your primary problem, as I see it, is pressure. You cope VERY badly
under pressure. That's not a big deal in itself - I know plenty of
people like that - but if you're that sort of person, you need to
organize your life such that situations don't become pressured. That's
why I think it would be best for you, in the long run, to give up your
web hosting business and code for pure pleasure - that way, if you run
into a problem, you're not losing customers, and a delay of a day or
two won't hurt anything. You'll be able to work through your coding
issues at leisure, figure out what suits you, and actually spend the
time to _read_ what people are saying to you. Life would be
significantly better for you - and hugely better for this list,
because there'd be no more of these sorts of threads.

Slow down, you're movin' too fast.

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Lowest Value in List

2013-10-02 Thread Antoon Pardon
Op 02-10-13 12:04, subhabangal...@gmail.com schreef:
> Dear Group,
> 
> I am trying to work out a solution to the following problem in Python. 
> 
> The Problem:
> Suppose I have three lists.
> Each list is having 10 elements in ascending order.
> I have to construct one list having 10 elements which are of the lowest value 
> among these 30 elements present in the three given lists.
> 
> The Solution:
> 
> I tried to address the issue in the following ways:
> 
> a) I took three lists, like,
> list1=[1,2,3,4,5,6,7,8,9,10]
> list2=[0,1,2,3,4,5,6,7,8,9]
> list3=[-5,-4,-3,-2,-1,0,1,2,3,4]
> 
> I tried to make sum and convert them as set to drop the repeating elements:
> set_sum=set(list1+list2+list3)
> set([0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, -1, -5, -4, -3, -2])
> 
> In the next step I tried to convert it back to list as,
> list_set=list(set_sum)
> gave the value as,
> [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, -1, -5, -4, -3, -2]
> 
> Now, I imported heapq as, 
> import heapq
> 
> and took the result as,
> result=heapq.nsmallest(10,list_set)
> it gave as,
> [-5, -4, -3, -2, -1, 0, 1, 2, 3, 4]
> 
> b) I am thinking to work out another approach.
> I am taking the lists again as,
> 
> list1=[1,2,3,4,5,6,7,8,9,10]
> list2=[0,1,2,3,4,5,6,7,8,9]
> list3=[-5,-4,-3,-2,-1,0,1,2,3,4]
> 
> as they are in ascending order, I am trying to take first four/five elements 
> of each list,like,
> 
> list1_4=list1[:4]
 list2_4=list2[:4]
 list3_4=list3[:4]
> 
> Now, I am trying to add them as,
> 
> list11=list1_4+list2_4+list3_4
> 
> thus, giving us the result
> 
> [1, 2, 3, 4, 0, 1, 2, 3, -5, -4, -3, -2]
> 
> Now, we are trying to sort the list of the set of the sum as,
> 
> sort_sum=sorted(list(set(list11)))
> 
> giving us the required result as,
> 
> [-5, -4, -3, -2, 0, 1, 2, 3, 4]
> 
> If by taking the value of each list portion as 4 gives as less number of
> elements in final value, as we are making set to avoid repeating numbers,
> we increase element count by one or two and if final result becomes more
> than 10 we take first ten.
> 
> Are these approaches fine. Or should we think some other way.
> 
> If any learned member of the group can kindly let me know how to solve I 
> would be helpful enough.

You may consider a merge phase from the merge sort. Something like the
following: (Pseudo code; not tested)

iters = [iter(list1), iter(list2), iter(list3)]
heads = [(itr.next() for itr in Iters]

index, value = find_smallest_from(heads) # This function finds the
smalles value and returns it with its index

last = value
result = [value]
heads[index] = iters[index].next()
while len(results) < 10:
index, value = find_smallest_from(heads)
if value == last:
continue
last = value
result.append(value)
heads[index] = iters[index].next()
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: JUST GOT HACKED

2013-10-02 Thread Νίκος

Στις 2/10/2013 1:32 μμ, ο/η Chris Angelico έγραψε:

On Wed, Oct 2, 2013 at 8:22 PM, Νίκος  wrote:

I apologize though oif some times i loose my temper and use impoprer
vocabulary on some people. The pressure is just too high at some point when
i see so many people critisize and make ironic comments agianst me all the
time in every single thread i start.

I was even mocked because all i wanted to do was to optimize code and use
the best solution there is to it.


Well, you weren't trying to use the best solution, for any meaning of
"best" other than "the one that feels most like Perl or APL".

Your primary problem, as I see it, is pressure. You cope VERY badly
under pressure. That's not a big deal in itself - I know plenty of
people like that - but if you're that sort of person, you need to
organize your life such that situations don't become pressured. That's
why I think it would be best for you, in the long run, to give up your
web hosting business and code for pure pleasure - that way, if you run
into a problem, you're not losing customers, and a delay of a day or
two won't hurt anything. You'll be able to work through your coding
issues at leisure, figure out what suits you, and actually spend the
time to _read_ what people are saying to you. Life would be
significantly better for you - and hugely better for this list,
because there'd be no more of these sorts of threads.

Slow down, you're movin' too fast.


Please bare with me. I will improve more and more over time.
I have stopped using Google groups because of the he new lines addition 
issues that you said it was annoying ans tarted using Thunderbird, and i 
have also corrected typo errors and try to type more slowly and take the 
time to correct typos.


As you see i'm improving over time.
I can assure you that i read all your answer carefully.

I only re-ask the same thing if:

1. Di not understood what was provided or proposed to me as being a solution
2. Still feel that that the solution provided to me doesn't meet my 
needs and should have been re-written in a different way. Nevertheless 
we are all improving, especially the newbies, by seeing alternative way, 
best methods and wise practices of writing code for the specific problem 
and pick the one that does the job best.


Just bare with me and you will see improving over time.
--
https://mail.python.org/mailman/listinfo/python-list


Efficency help for a Calculator Program

2013-10-02 Thread JonDoe297
You may remember me from this : 

https://groups.google.com/forum/#!topic/comp.lang.python/PIkUno3avkw



I need help to increase the efficiency of this code : 


global repeat
repeat=1
def main():
c=int(raw_input("How many numbers do you want to work? (Min. 2 Max. 3) "))
if c==2:
x=int(raw_input("Enter the first number to be worked "))
y=int(raw_input("Enter the second number to be worked "))
elif c==3:
x=int(raw_input("Enter the first number to be worked "))
y=int(raw_input("Enter the second number to be worked "))
z=int(raw_input("Enter the third number to be worked "))
else:
print "Invalid input.";raw_input("Press  to close this 
window");exit()
p=int(raw_input("Do you want to divide, subtract, add or multiply these 
numbers? (1=divide, 2=subtract, 3=add, 4=multiply) "))
if p==1 and c==2:
print "The result is : ",x/y
repeat=int(raw_input("Do you want to calculate for more numbers? Yes=1 
No=2 "))
if repeat==1:
main()
elif p==1 and c==3:
print "The result is : ",x/y/z
repeat=int(raw_input("Do you want to calculate for more numbers? Yes=1 
No=2 "))
if repeat==1:
main()
elif p==2 and c==2:
print "The result is : ",x-y
repeat=int(raw_input("Do you want to calculate for more numbers? Yes=1 
No=2 "))
if repeat==1:
main()
elif p==2 and c==3:
print "The result is : ",x-y-z
repeat=int(raw_input("Do you want to calculate for more numbers? Yes=1 
No=2 "))
if repeat==1:
main()
elif p==3 and c==2:
print "The result is : ",x+y
repeat=int(raw_input("Do you want to calculate for more numbers? Yes=1 
No=2 "))
if repeat==1:
main()
elif p==3 and c==3:
print "The result is : ",x+y+z
repeat=int(raw_input("Do you want to calculate for more numbers? Yes=1 
No=2 "))
if repeat==1:
main()
elif p==4 and c==2:
print "The result is : ",x*y
repeat=int(raw_input("Do you want to calculate for more numbers? Yes=1 
No=2 "))
if repeat==1:
main()
elif p==4 and c==3:
print "The result is : "+str(x*y*z) 
repeat=int(raw_input("Do you want to calculate for more numbers? Yes=1 
No=2 "))
if repeat==1:
main()
else:
repeat=int(raw_input("Invalid Input. Please read instructions properly. 
Would you like to try again? Yes=1 No=2 "))
if repeat==1:
main()
else:
exit()
main()



Is there any way to make it smaller? It does it's job, but I want it to look 
smaller, more efficient.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: PyDoc_STRVAR error in msvc compile

2013-10-02 Thread Dave Angel
On 2/10/2013 06:01, Robin Becker wrote:

> On 02/10/2013 10:00, Robin Becker wrote:
>> On 01/10/2013 18:26, MRAB wrote:
>>> On 01/10/2013 17:41, Robin Becker wrote:
>> ..

>>> I've tried it in a minimal console program, and it seems to work for me.
>>>
>> thanks for the test. I thought this might be an issue with the macro call
>> argument being spread out over several lines, but since your try works I'll 
>> dig
>> deeper.
> I used -E to get the pre-processor output and it shows my string constant 
> ends 
> up with the #ifdef inside it eg
>
>
>..\n" #ifdef " stuff\n" #endif "\n\
>
> I looked for any obvious reason why that should happen, but cannot find 
> anything.
>
> if I remove the internal #ifdef and replace with a macro containing the 
> conditional string or "" then MSVC 9 seems to be ok with it.
>

MSVC and other compilers do not not see eye to eye on the preprocessor
semantics.  I no longer use MSVC so I can't experiment.  I can only try
to recall extensive manipulation two decades ago.

I believe it does the logic of "backslash at the end of line" first.  So
if there are any spaces or tabs after those backslashes (which might
have been lost when you pasted it here), fix them first.

Then I think it looks for macro definitions, where the # must be the
first non-whitespace of the line.  Then it expands such macros, and I
think MSVC is unusual in that it expands them multiple times, so a macro
expansion can result in another macro invocation.

I'm not sure where quotes fit in here.

Your original message code doesn't match the expansion you show with -E,
so i suspect your "..." eliding hid something significant.

-- 
DaveA

-- 
https://mail.python.org/mailman/listinfo/python-list


Re: JUST GOT HACKED

2013-10-02 Thread Chris Angelico
On Wed, Oct 2, 2013 at 8:43 PM, Νίκος  wrote:
> Just bare with me and you will see improving over time.

Tip: Start with this one... the word you want is 'bear'. In English,
those two words have very different meanings, even though they're
pronounced the same way; "bare with me" actually talks about getting
naked, whereas "bear with me" means what you think it does. :)

I'm quite okay with you improving over time, I'm even okay with it
happening slowly. And I think everyone here would agree with me on
that. But that's why I think you should code only as a hobby, because
that means you're not disrupting anything while you learn. It's the
safe option. It's like learning to drive a car out in the back paddock
(field, for you non-Australians) - there's nobody else to get hurt,
worst you can do is bang the car up a bit... and chances are it's an
old beat-up car anyway, so that's not a big deal. You don't learn to
drive by hopping into a taxi and collecting fares.

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: JUST GOT HACKED

2013-10-02 Thread Νίκος

zero piraeus have said:


In other words: you weren't "hacked". You'd been repeatedly told that
you had publicly visible source code on the net containing passwords in
plain text; all anyone had to do was login to your server with the
credentials you negligently exposed, and open a text editor. If that's
hacking, I'm Neo.


I'am aware of that fact, but the line you are refering too was just 
initiating a mysql connection:


con = pymysql.connect( db = 'mypass', user = 'myuser', passwd = 
'mysqlpass', charset = 'utf8', host = 'localhost' )


That was viewable by the link Mark have posted.

But this wasnt my personal's account's login password, that was just the 
mysql password.


Mysql pass != account's password


That's not to say someone else *hasn't* pissed in your bucket, but if
they have, they won't have publicised the fact.


Ah, now i shoudl worry for more people breaking in?


By the way: if you haven't already, you'll want to remove the extra line
from your .htaccess file.


Tell me the line you are referring to.
Yes i added some line but i want you to tell me which line is that.


case it isn't obvious: no, it wasn't
Mark Lawrence.


Who was it then, you?


I wont get mad but i want you too answer all of my questions and:

1. state by which method you managed to break in since at noplace at my 
awareness did i psot my account's login pass, only the source code of my 
main script which is now fixed by me altering the httpd.conf file and 
placing extra lines into my main .htaccess file


2. Be sincere and tell me if you have created a backdoor on my server 
that allows you to remotely login and do stuff.


I will even thank you for not destroying my system, but i want these 
questions i just types to be answered so i take action to fix things ven 
better.


Please, this is a business server.
--
https://mail.python.org/mailman/listinfo/python-list


Re: Efficency help for a Calculator Program

2013-10-02 Thread Chris Angelico
On Wed, Oct 2, 2013 at 8:44 PM, JonDoe297  wrote:
> Is there any way to make it smaller? It does it's job, but I want it to look 
> smaller, more efficient.

Yes, it is, but let me first clarify something: "Smaller" and "more
efficient" are two quite different concepts. Efficiency doesn't matter
to your code here, so what you're looking for is smaller, clearer
code. Which is a good thing to be doing :)

At top level, the 'global' declaration doesn't do anything. You may as
well not bother with it.

If you change your recursive main() function into a while loop, you'll
be able to combine all your common code very easily. I won't do the
whole job for you, but consider this structure:

repeat=1
while repeat==1:
# get inputs
# calculate and produce output
repeat=int(raw_input("Do you want to do more? "))

And if you need your error state to have a different prompt, you can
use 'continue' to skip the bottom of the loop.

Hope that helps!

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: JUST GOT HACKED

2013-10-02 Thread Νίκος

Στις 2/10/2013 1:54 μμ, ο/η Chris Angelico έγραψε:

On Wed, Oct 2, 2013 at 8:43 PM, Νίκος  wrote:

Just bare with me and you will see improving over time.


Tip: Start with this one... the word you want is 'bear'. In English,
those two words have very different meanings, even though they're
pronounced the same way; "bare with me" actually talks about getting
naked, whereas "bear with me" means what you think it does. :)

I'm quite okay with you improving over time, I'm even okay with it
happening slowly. And I think everyone here would agree with me on
that. But that's why I think you should code only as a hobby, because
that means you're not disrupting anything while you learn. It's the
safe option. It's like learning to drive a car out in the back paddock
(field, for you non-Australians) - there's nobody else to get hurt,
worst you can do is bang the car up a bit... and chances are it's an
old beat-up car anyway, so that's not a big deal. You don't learn to
drive by hopping into a taxi and collecting fares.


I know, but i have too.

All i can say its that my visitor's websites are working smoothly and 
the DNS, Mail issues and Python experiments are happening to my personal 
account, i don't mess at all with my client's data and their settings.


I have to make some money and that needs for some reason to happen now 
as we speak, so i have no alternative than to hop into a car and learn 
to drive during the process, hoping i will not bang-smash the car.


--
https://mail.python.org/mailman/listinfo/python-list


Re: JUST GOT HACKED

2013-10-02 Thread Νίκος

Στις 2/10/2013 1:54 μμ, ο/η Chris Angelico έγραψε:

On Wed, Oct 2, 2013 at 8:43 PM, Νίκος  wrote:

Just bare with me and you will see improving over time.


Tip: Start with this one... the word you want is 'bear'. In English,
those two words have very different meanings, even though they're
pronounced the same way; "bare with me" actually talks about getting
naked, whereas "bear with me" means what you think it does. :)

I'm quite okay with you improving over time, I'm even okay with it
happening slowly. And I think everyone here would agree with me on
that. But that's why I think you should code only as a hobby, because
that means you're not disrupting anything while you learn. It's the
safe option. It's like learning to drive a car out in the back paddock
(field, for you non-Australians) - there's nobody else to get hurt,
worst you can do is bang the car up a bit... and chances are it's an
old beat-up car anyway, so that's not a big deal. You don't learn to
drive by hopping into a taxi and collecting fares.


I know, but i have too.

All i can say its that my visitor's websites are working smoothly and 
the DNS, Mail issues and Python experiments are happening to my personal 
account, i don't mess at all with my client's data and their settings.


I have to make some money and that needs for some reason to happen now 
as we speak, so i have no alternative than to hop into a car and learn 
to drive during the process, hoping i will not bang the the


--
https://mail.python.org/mailman/listinfo/python-list


Re: JUST GOT HACKED

2013-10-02 Thread Chris Angelico
On Wed, Oct 2, 2013 at 9:03 PM, Νίκος  wrote:
> All i can say its that my visitor's websites are working smoothly and the
> DNS, Mail issues and Python experiments are happening to my personal
> account, i don't mess at all with my client's data and their settings.

But when you expose your account to vulnerabilities, you expose your
customers' web sites too. If you insist on doing this both ways, get
yourself a separate computer - maybe just run your own server at home,
it won't be the best but it'll be easy to do. That way, if you let
every man and his dog into your test box, your customers aren't
affected.

However, this is a non-Python subject, and one you'll do well to
research on Google rather than ask about.

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: JUST GOT HACKED

2013-10-02 Thread Antoon Pardon
Op 02-10-13 11:08, Steven D'Aprano schreef:
> On Wed, 02 Oct 2013 12:32:57 +0530, Ravi Sahni wrote:
> 
>> I find this real confused!! Why they are answering then?!?! As far as I
>> can make out everyone who is answering (helping!) doing it frustratation
>> and disgust.  But still they keep answering and answering!!
>>
>> Makes no sense
> 
> 
> If you want to ask why people are answering Nikos' questions, you should 
> ask them directly. I won't speak for others, but I'll answer for myself: 
> I answer Nikos' questions because:
> 
> #1 He is a member of our community who needs help with Python, and this 
> is a welcoming community, not an elitist one.

Come on Steve. You have kill filed people. So you don't think that
merely being a member is enough. Or are you being elistist when you
kill file someone?

> #2 Some of his questions are interesting technical questions, like his 
> Unicode problems. I have learnt things from answering his questions. I'm 
> sure other people have learnt things from reading those answers.

Sure, but not the fourth or fith time the same question comes up in the
same thread.

> #3 Even his uninteresting questions deserve answers. Everybody here, I am 
> sure, has asked boring or stupid or trivial questions at some stage, 
> especially the newbies. Even when the answer is just "This answer is the 
> same as last time you asked", the question deserves an answer. This is a 
> matter of simple respect. We should treat others in the way we would hope 
> to be treated if we were in their shoes.

Steve with Nikos's MO this means you risk a thread with nothing but a
cycle of Nikos repeating his question and others repeating the question
was already answered in the thread.

And you don't treat all others in the way you hope to be treated if you
would be in their shoes. I suspect that should you one day feel so
frustrated you need to vent, you will hope to get treated differently
than how you treat those that need to vent now. You are very selective
about the people in whose shoes you can imagine yourself.

> #4 Explicit is better than implicit. Even if nobody has an answer, or if 
> it is off-topic, it is better to explicitly say that we have no answer 
> and remove all doubt than to respond with nothing but silence and leave 
> open the hope that if you just ask again more loudly someone will answer.
>
> #5 In the long run, encouraging good behaviour is more effective at 
> changing people's behaviour than merely punishing bad behaviour.

But you don't encourage good behaviour by rewarding bad behaviour.
Even when Nikos has ignored previous answers and has ignored advise
to read up on a particular subject, you are still inclined to answer
him. That is not encouraging good bahaviour, that is rewarding bad
behaviour.

All these reasons you have given above, don't differentiate between
Nikos behaving good or badly while asking his questions. You giving a
reason that depends on making such a differentiation doesn't make any
sense after that.

> #6 Consider the first impression of a newbie, joining this community with 
> questions about Python. The first thing they see is Nikos asking 
> questions, and being ignored, or worse, being abused. Does that send the 
> message that we want, that their questions are welcome?

Newbie may be new to python, that doesn't mean they are new to social
interaction. I think people can understand someone has been behaving
badly enough so people won't engage with him anymore.

This reason here implies, that no matter what a nuissance Nikos is,
we should still answer his questions, which blantantly contradicts
your "encourage good behaviour" reason above. There is no encouragement
for good behaviour is you provide an answer anyway, whether the
asker is showing good behaviour or not.

-- 
Antoon Pardon
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: PyDoc_STRVAR error in msvc compile

2013-10-02 Thread Robin Becker

On 02/10/2013 11:49, Dave Angel wrote:

conditional string or "" then MSVC 9 seems to be ok with it.
>

MSVC and other compilers do not not see eye to eye on the preprocessor
semantics.  I no longer use MSVC so I can't experiment.  I can only try
to recall extensive manipulation two decades ago.

I believe it does the logic of "backslash at the end of line" first.  So
if there are any spaces or tabs after those backslashes (which might
have been lost when you pasted it here), fix them first.

Then I think it looks for macro definitions, where the # must be the
first non-whitespace of the line.  Then it expands such macros, and I
think MSVC is unusual in that it expands them multiple times, so a macro
expansion can result in another macro invocation.

I'm not sure where quotes fit in here.

Your original message code doesn't match the expansion you show with -E,
so i suspect your "..." eliding hid something significant.


The actual is this code from _renderPM.c

https://bitbucket.org/rptlab/reportlab/src/fa65fe72b6c2aaecb7747bf14884adb996d8e87f/src/rl_addons/renderPM/_renderPM.c?at=default

PyDoc_STRVAR(__DOC__,
"Helper extension module for renderPM.\n\
\n\
Interface summary:\n\
\n\
import _renderPM\n\
gstate(width,height[,depth=3,bg=0xff]) #create an initialised 
graphics state\n\

makeT1Font(fontName,pfbPath,names[,reader]) #make a T1 font\n\
delCache() #delete all T1 font info\n\
pil2pict(cols,rows,datastr,palette) hreturn PICT version of im as 
bytes\n"
#ifdef  RENDERPM_FT
"ft_get_face(fontName) --> ft_face instance\n"
#endif
"\n\
_libart_version # base library version string\n\
_version# module version string\n\
");

when I run that through the pre-processor I get (all on a single line)


static char __DOC__[] = "Helper extension module for renderPM.\n\nInterface 
summary:\n\n	import _renderPM\n	gstate(width,height[,depth=3,bg=0xff]) 
#create an initialised graphics state\n 
makeT1Font(fontName,pfbPath,names[,reader])	#make a T1 font\n	delCache() #delete 
all T1 font info\n	pil2pict(cols,rows,datastr,palette) hreturn PICT version of 
im as bytes\n" #ifdef 1 "ft_get_face(fontName) --> ft_face instance\n" 
#endif "\n	_libart_version	# base library version string\n	_version		# module 
version string\n";




I tried a couple of variations of \ at the end of the line preceding #ifdef etc 
etc, but nothing seemed to work. The source is properly DOS formatted (according 
to vim) so it's not a simple line ending issue and I don't have any extra spaces 
at the end of the lines etc etc.

--
Robin Becker

--
https://mail.python.org/mailman/listinfo/python-list


Re: JUST GOT HACKED

2013-10-02 Thread Heiko Wundram
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Am 02.10.2013 13:03, schrieb Νίκος:
> I have to make some money and that needs for some reason to happen
> now as we speak, so i have no alternative than to hop into a car
> and learn to drive during the process, hoping i will not bang-smash
> the car.

I'm really sorry for the fact that it seems as though your livelyhood
really does depend on your current mess, but: this is not the way to
learn to administer servers or how to program. Do that first in one
way or another - and then start making money off it.

And, from my personal experience, you are exacerbating your problems
by behaving and/or acting as you currently are, as generally at some
point in time the mess you currently leave behind - which you
permanently choose to ignore - will start to become a liability for
the rest of your livelyhood, which _will_ then get you in real trouble.

- -- 
- --- Heiko.
-BEGIN PGP SIGNATURE-
Version: GnuPG v2.0.20 (MingW32)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQEcBAEBAgAGBQJSTATwAAoJEDMqpHf921/SK54IAJvUF+3nTJq5nKPN2s1WdQbz
hOvqMThrhBE7BG6ybF8TfbKpLmZ+20cZExVzn4Xy9PPGe+WTrt6UR8+UizSst1Vs
EgZ0DrmWb+WRN+nUZPyL45psDMaHdi1bQy0ReVGbav1faG9Y9tAMZ2KEQwfrnmZz
CJ9mTJ95IbuB3iizCdlUOT2qCzhGPyCsx1ejR6IkKofKaO0QU712V7rHN9u/xdlJ
v687pSzeNuRxWP9Rdlp25FIVDgj3oNGrK9HXrYUyra9TXSyZW3XTWbUjwriNMxer
8B00cngvLTEf14AmMeIkno7GvTP5QWq7yNul7n85Pq6ZXJKWLjVLodKwYndSf9I=
=AOdw
-END PGP SIGNATURE-
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: JUST GOT HACKED

2013-10-02 Thread feedthetroll
Am Mittwoch, 2. Oktober 2013 12:52:39 UTC+2 schrieb Ferrous Cranus:
> ...
>> By the way: if you haven't already, you'll want to remove the extra line
>> from your .htaccess file.
> Tell me the line you are referring to.
I think it will be the line YOU did NOT enter. Just take a look yourself. The 
best way will be to compare it to a backup you made before the change.
(Nikos and backups. Good joke, ins't it?)

> ...
> I wont get mad but i want you too answer all of my questions and:
> 1. state by which method you managed to break in since at noplace at my 
> awareness did i psot my account's login pass, only the source code of my 
> main script which is now fixed by me altering the httpd.conf file and 
> placing extra lines into my main .htaccess file
> 2. Be sincere and tell me if you have created a backdoor on my server 
> that allows you to remotely login and do stuff.
> I will even thank you for not destroying my system, but i want these 
> questions i just types to be answered so i take action to fix things ven 
> better.
ROTFL. You made my day. Again!

> Please, this is a business server.
No it ist not:
Am Montag, 30. September 2013 20:03:32 UTC+2 schrieb Ferrous Cranus:
> ...
> I learn Python for personal pleasure because i like programming.
"Learning for personal pleasure" and "business server" can't be true both.
So one of the statements is wrong. Therefore you are a liar Nikos, I'm sorry. 

-- 
https://mail.python.org/mailman/listinfo/python-list


Re: JUST GOT HACKED

2013-10-02 Thread Νίκος

Στις 2/10/2013 2:42 μμ, ο/η feedthetr...@gmx.de έγραψε:

Am Mittwoch, 2. Oktober 2013 12:52:39 UTC+2 schrieb Ferrous Cranus:

...

By the way: if you haven't already, you'll want to remove the extra line
from your .htaccess file.

Tell me the line you are referring to.

I think it will be the line YOU did NOT enter. Just take a look yourself. The 
best way will be to compare it to a backup you made before the change.


Except from the additional line i have added to the .htaccess myself 
there is nothing added extra.


Also i'm under the impression Zeus Piraeus was referring at that 
line(the one i added myself) so to fix my scripts source code which 
could be seen as plain test.



I learn Python for personal pleasure because i like programming.

"Learning for personal pleasure" and "business server" can't be true both.
So one of the statements is wrong. Therefore you are a liar Nikos, I'm sorry.


Yes they work together.
Take my website for example, i have started to leanr Python be reading a 
few things about it as pleasure and now i have a working website which 
has secret bultin abilities as well.



--
https://mail.python.org/mailman/listinfo/python-list


Re: PyDoc_STRVAR error in msvc compile

2013-10-02 Thread Dave Angel
On 2/10/2013 07:28, Robin Becker wrote:


> The actual is this code from _renderPM.c
>
> https://bitbucket.org/rptlab/reportlab/src/fa65fe72b6c2aaecb7747bf14884adb996d8e87f/src/rl_addons/renderPM/_renderPM.c?at=default
>
> PyDoc_STRVAR(__DOC__,
> "Helper extension module for renderPM.\n\
> \n\
> Interface summary:\n\
> \n\
>  import _renderPM\n\
>  gstate(width,height[,depth=3,bg=0xff]) #create an initialised 
> graphics state\n\
>  makeT1Font(fontName,pfbPath,names[,reader]) #make a T1 font\n\
>  delCache() #delete all T1 font info\n\
>  pil2pict(cols,rows,datastr,palette) hreturn PICT version of im as 
> bytes\n"
> #ifdef  RENDERPM_FT
> "ft_get_face(fontName) --> ft_face instance\n"
> #endif
> "\n\
>  _libart_version # base library version string\n\
>  _version# module version string\n\
> ");
>
> when I run that through the pre-processor I get (all on a single line)
>
>
> static char __DOC__[] = "Helper extension module for renderPM.\n\nInterface 
> summary:\n\n  import _renderPM\n  
> gstate(width,height[,depth=3,bg=0xff]) 
> #create an initialised graphics state\n 
> makeT1Font(fontName,pfbPath,names[,reader])   #make a T1 font\n   
> delCache() #delete 
> all T1 font info\npil2pict(cols,rows,datastr,palette) hreturn PICT 
> version of 
> im as bytes\n" #ifdef 1 "ft_get_face(fontName) --> ft_face instance\n" 
> #endif "\n_libart_version # base library version string\n _version
> # module 
> version string\n";
>
>
>
> I tried a couple of variations of \ at the end of the line preceding #ifdef 
> etc 
> etc, but nothing seemed to work. The source is properly DOS formatted 
> (according 
> to vim) so it's not a simple line ending issue and I don't have any extra 
> spaces 
> at the end of the lines etc etc.

Unfortunately, bitbucket doesn't properly support highlighting either,
so I had to copy/paste it into an editor to check for extra spaces. 
That's apparently not your problem.

What I didn't understand before is that PyDoc_STRVAR is a macro, not a
function.  And inside the macro's parameters, you're trying to define an
#ifdef.  i don't think Microsoft supports that.

If I'm right, you need to separate out the conditional string
concatenation from the macro expansion.  it's been too long for me even
to remember the correct way to do that.  There are some legal tricks you
can use.  Maybe search the internet for "preprocessor stringizing".



-- 
DaveA


-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Stop posting HTML [was Re: I haev fixed it]

2013-10-02 Thread Dave Angel
On 1/10/2013 23:33, Michael Torrie wrote:

> On 10/01/2013 08:40 PM, Steven D'Aprano wrote:
>> On Tue, 01 Oct 2013 22:02:36 -0400, Joel Goldstick wrote:
>> 
>>> On Tue, Oct 1, 2013 at 9:52 PM, Steven D'Aprano <
>>> steve+comp.lang.pyt...@pearwood.info> wrote:
>>>
 Joel, you've been asked repeatedly to please stop posting HTML.
>> [...]
>> 
>>> >> class="gmail_extra">I'm very sorry.  I didn't realize I was.  I
>>> use gmail for this list, and I believe it replies with html if the
>>> previous message was written with html.  I'll be more vigilant.
>> 
>> Not vigilant enough, it seems.
>
> Near as I can tell Gmail is posting the message in both html and plain
> text parts in a multi-part message.
>
> Thunderbird has no problem with the plain text part. That's all I see
> right now, unless I force html view, or look at the message source.

You say that as though you think that makes html posting okay.

The html to text conversion done at posting time frequently loses
something in the message, so that people viewing the text in a
newsreader don't see the same thing the author typed. Simplest example
is color or bold. But the author can avoid using these. More
importantly, indentation and paragraph boundaries are sometimes
completely lost, and worse, sometimes just lost in some places.

Sometimes the html and text are both stuffed into the same part of the
mail message.  This is annoying and misleading.  I don't know if gmail
is guilty of this.

Sometimes a message has html only, and the receiving program
sometimes attempts to convert it to plain text.  That's even more likely
to have problems with formatting.

Whenever html is included, it's a redundant waste of space, and many of
us pay for our internet usage by the kilobyte.  Worse, I assume that all
the archives are also bigger by a big percentage.

-- 
DaveA


-- 
https://mail.python.org/mailman/listinfo/python-list


Can arbitrary code run in a server if someone's know just the MySQL password?

2013-10-02 Thread Νίκος

Tim delaney said:

"Because there's no chance with the brilliance you display that there 
could be any possibility of login details being kept in plaintext in 
your database.


And of course your database is so well locked down that no attacker with 
a login to it could then execute arbitrary code on your system.


And there's also zero chance that your personal account login details 
are also available in plaintext somewhere that you're unaware of."

==

Is it possible for someone that knows the MYSQL password of a server to 
run arbitrary code on a linux server?


Okey he uses the password and he gain access to the databases, then 
what? MySQL is a database server how can he run run arbitrary shell 
commands by using MySQL?


If yes, can you give an example please?

Also, is there a chance for my account's password to be retrieved on 
some why due to MySQL access or perhaps by utilizing my own python code?


I'm just trying to figure out how the upload of that .html file happened 
to '/home/nikos/public_html'. I need a theory and Zero Piraeus to answer 
too.


Please, serious replies only, i won't answer to ironic comments or jokes.
--
https://mail.python.org/mailman/listinfo/python-list


Re: Tail recursion to while iteration in 2 easy steps

2013-10-02 Thread random832
On Tue, Oct 1, 2013, at 17:30, Terry Reedy wrote:
> Part of the reason that Python does not do tail call optimization is 
> that turning tail recursion into while iteration is almost trivial, once 
> you know the secret of the two easy steps. Here it is.

That should be a reason it _does_ do it - saying people should rewrite
their functions with loops means declaring that Python is not really a
multi-paradigm programming language but rather rejects functional
programming styles in favor of imperative ones.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Can arbitrary code run in a server if someone's know just the MySQL password?

2013-10-02 Thread Antoon Pardon
Op 02-10-13 14:20, Νίκος schreef:
> Tim delaney said:
> 
> "Because there's no chance with the brilliance you display that there
> could be any possibility of login details being kept in plaintext in
> your database.
> 
> And of course your database is so well locked down that no attacker with
> a login to it could then execute arbitrary code on your system.
> 
> And there's also zero chance that your personal account login details
> are also available in plaintext somewhere that you're unaware of."
> ==
> 
> Is it possible for someone that knows the MYSQL password of a server to
> run arbitrary code on a linux server?
> 
> Okey he uses the password and he gain access to the databases, then
> what? MySQL is a database server how can he run run arbitrary shell
> commands by using MySQL?
> 
> If yes, can you give an example please?
> 
> Also, is there a chance for my account's password to be retrieved on
> some why due to MySQL access or perhaps by utilizing my own python code?
> 
> I'm just trying to figure out how the upload of that .html file happened
> to '/home/nikos/public_html'. I need a theory and Zero Piraeus to answer
> too.
> 
> Please, serious replies only, i won't answer to ironic comments or jokes.

You are not asking a python question. This is a python list. Not a
Nikos advise board. Find a list where your question is more appropiate.

-- 
Antoon Pardon
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Can arbitrary code run in a server if someone's know just the MySQL password?

2013-10-02 Thread feedthetroll
Am Mittwoch, 2. Oktober 2013 14:20:00 UTC+2 schrieb Ferrous Cranus:
> ...
> Is it possible for someone that knows the MYSQL password of a server to 
> run arbitrary code on a linux server?
> ...
> If yes, can you give an example please?
http://lmgtfy.com/?q=mysql+shell+escape

> Please, serious replies only, i won't answer to ironic comments or jokes.
Please only questions about python. This not a mysql or security list.

PLONK!

(Hey Thunderbird has a very useful new feature. Ignore thread.)
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: JUST GOT HACKED

2013-10-02 Thread Chris “Kwpolska” Warrick
On Wed, Oct 2, 2013 at 1:48 AM, Tim Delaney  wrote:
> On 2 October 2013 09:28, Νίκος  wrote:
>>
>>
>> con = pymysql.connect( db = 'mypass', user = 'myuser', passwd =
>> 'mysqlpass', charset = 'utf8', host = 'localhost' )
>>
>> That was viewable by the link Mark have posted.
>>
>> But this wasnt my personal's account's login password, that was just the
>> mysql password.
>>
>> Mysql pass != account's password
>
>
> Because there's no chance with the brilliance you display that there could
> be any possibility of login details being kept in plaintext in your
> database.

Or the statement is a blatant lie and was meant to be

mysql_password is not account_password

as they have the same value, but are set independently.  (too much Python Ale…)

-- 
Chris “Kwpolska” Warrick 
PGP: 5EAAEA16
stop html mail | always bottom-post | only UTF-8 makes sense
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: JUST GOT HACKED

2013-10-02 Thread Steven D'Aprano
On Wed, 02 Oct 2013 04:42:32 -0700, feedthetroll wrote:

> "Learning for personal pleasure" and "business server" can't be true
> both.

Utter nonsense. Some people are fortunate enough to be paid to do 
something that gives them pleasure. Many programmers and system 
administrators are in that lucky position. I am sorry that you 
(apparently) get no pleasure from learning new programming and sys admin 
skills, but don't imagine that everyone is like that.


> So one of the statements is wrong. Therefore you are a liar Nikos,
> I'm sorry.

You should be sorry, because that was uncalled for as well as wrong.



-- 
Steven
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: JUST GOT HACKED

2013-10-02 Thread ishish

Am 02.10.2013 13:47, schrieb Chris “Kwpolska” Warrick:

On Wed, Oct 2, 2013 at 1:48 AM, Tim Delaney
 wrote:

On 2 October 2013 09:28, Νίκος  wrote:



con = pymysql.connect( db = 'mypass', user = 'myuser', passwd =
'mysqlpass', charset = 'utf8', host = 'localhost' )

That was viewable by the link Mark have posted.

But this wasnt my personal's account's login password, that was 
just the

mysql password.

Mysql pass != account's password



Because there's no chance with the brilliance you display that there 
could

be any possibility of login details being kept in plaintext in your
database.


Or the statement is a blatant lie and was meant to be

mysql_password is not account_password

as they have the same value, but are set independently.  (too much
Python Ale…)


Who cares... mysql> \! bash... job done.

--
https://mail.python.org/mailman/listinfo/python-list


Re: Lowest Value in List

2013-10-02 Thread dvghana
On Wednesday, October 2, 2013 10:04:16 AM UTC, subhaba...@gmail.com wrote:
> Dear Group,
> 
> 
> 
> I am trying to work out a solution to the following problem in Python. 
> 
> 
> 
> The Problem:
> 
> Suppose I have three lists.
> 
> Each list is having 10 elements in ascending order.
> 
> I have to construct one list having 10 elements which are of the lowest value 
> among these 30 elements present in the three given lists.
> 
> 
> 
> The Solution:
> 
> 
> 
> I tried to address the issue in the following ways:
> 
> 
> 
> a) I took three lists, like,
> 
> list1=[1,2,3,4,5,6,7,8,9,10]
> 
> list2=[0,1,2,3,4,5,6,7,8,9]
> 
> list3=[-5,-4,-3,-2,-1,0,1,2,3,4]
> 
> 
> 
> I tried to make sum and convert them as set to drop the repeating elements:
> 
> set_sum=set(list1+list2+list3)
> 
> set([0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, -1, -5, -4, -3, -2])
> 
> 
> 
> In the next step I tried to convert it back to list as,
> 
> list_set=list(set_sum)
> 
> gave the value as,
> 
> [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, -1, -5, -4, -3, -2]
> 
> 
> 
> Now, I imported heapq as, 
> 
> import heapq
> 
> 
> 
> and took the result as,
> 
> result=heapq.nsmallest(10,list_set)
> 
> it gave as,
> 
> [-5, -4, -3, -2, -1, 0, 1, 2, 3, 4]
> 
> 
> 
> b) I am thinking to work out another approach.
> 
> I am taking the lists again as,
> 
> 
> 
> list1=[1,2,3,4,5,6,7,8,9,10]
> 
> list2=[0,1,2,3,4,5,6,7,8,9]
> 
> list3=[-5,-4,-3,-2,-1,0,1,2,3,4]
> 
> 
> 
> as they are in ascending order, I am trying to take first four/five elements 
> of each list,like,
> 
> 
> 
> list1_4=list1[:4]
> 
> >>> list2_4=list2[:4]
> 
> >>> list3_4=list3[:4]
> 
> 
> 
> Now, I am trying to add them as,
> 
> 
> 
> list11=list1_4+list2_4+list3_4
> 
> 
> 
> thus, giving us the result
> 
> 
> 
> [1, 2, 3, 4, 0, 1, 2, 3, -5, -4, -3, -2]
> 
> 
> 
> Now, we are trying to sort the list of the set of the sum as,
> 
> 
> 
> sort_sum=sorted(list(set(list11)))
> 
> 
> 
> giving us the required result as,
> 
> 
> 
> [-5, -4, -3, -2, 0, 1, 2, 3, 4]
> 
> 
> 
> If by taking the value of each list portion as 4 gives as less number of 
> elements in final value, as we are making set to avoid repeating numbers, we 
> increase element count by one or two and if final result becomes more than 10 
> we take first ten.
> 
> 
> 
> Are these approaches fine. Or should we think some other way.
> 
> 
> 
> If any learned member of the group can kindly let me know how to solve I 
> would be helpful enough.
> 
> 
> 
> Thanking in Advance,
> 
> Subhabrata.

PS: I'm learning python (or any programming language) for the first time so I'm 
pretty sure you don't have to take my word for it but this is what I've got:

list1 = [1,2,3,4,5,6,7,8,9,10]
list2 = [1,2,5,8,9,10,12,15,16,17]
list3 = [-1,-2,-3,8,20,30,40,50,60,17]


def smallestTen(a,b,c):
ultimatelist = a + b + c
for i in ultimatelist:
return sorted(set(ultimatelist))[:10]

print (smallestTen(list1, list2, list3))

-- 
https://mail.python.org/mailman/listinfo/python-list


Re: JUST GOT HACKED

2013-10-02 Thread Steven D'Aprano
On Wed, 02 Oct 2013 14:03:25 +0300, Νίκος wrote:

> I have to make some money and that needs for some reason to happen now
> as we speak, so i have no alternative than to hop into a car and learn
> to drive during the process, hoping i will not bang-smash the car.

Yes you have alternatives. You have many alternatives, even if you are 
determined to stay in this IT business. We have told you some of these 
alternatives before.

Some alternatives:

- Can you access Google? You can search for guides to do with securing 
web sites. You don't have to ask here. We are not experts on that. This 
is a Python list, not a website administration list.

- Books. Buy some books on system administration. Borrow them from the 
library. Even ten year old books going cheap are better than nothing, 
they will teach you the basic concepts.

- Go do a course.

- Set up a crappy old PC running Linux and put apache on it. Don't put 
anything important on it. You will probably find a million people on the 
internet who will break into it, if you give them permission, and tell 
you what they did. But we are not those people. Look elsewhere.

But don't trust them with anything important. After they are done, erase 
the entire disk and reinstall from scratch. Not everyone is as kind and 
trustworthy as us.

- If you can't find people to break into it for free, you can pay them. 
Surely there are Linux consultants in Greece that will secure your system 
for you for a fee? That's a legitimate business expense and will reduce 
your tax.

- Find a business partner. You can't be the only person in Greece 
interested in building up a web hosting business.


None of these things have anything to do with Python. This entire 
discussion is off-topic, I am only mentioning this to you as a courtesy, 
one human being to another. Please don't insult me by continuing this off-
topic discussion here on this Python list. This is comp.lang.python, not 
comp.lang.teach.nikos.everything.he.needs.to.learn.


Come back when you have Python questions. Everything else, take it away.



-- 
Steven
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: JUST GOT HACKED

2013-10-02 Thread Antoon Pardon
Op 02-10-13 14:51, Steven D'Aprano schreef:
> On Wed, 02 Oct 2013 04:42:32 -0700, feedthetroll wrote:
> 
>> "Learning for personal pleasure" and "business server" can't be true
>> both.
> 
> Utter nonsense. Some people are fortunate enough to be paid to do 
> something that gives them pleasure. Many programmers and system 
> administrators are in that lucky position. I am sorry that you 
> (apparently) get no pleasure from learning new programming and sys admin 
> skills, but don't imagine that everyone is like that.

And how do you come to that conclusion? As far as I understand
feedthetroll only implied you shouldn't do your *learning* for
personal pleasure on the business server.

-- 
Antoon Pardon
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Killing threads with TB (was: Can arbitrary code run in a server if someone's know just the MySQL password?)

2013-10-02 Thread Tim Chase
On 2013-10-02 05:38, feedthetr...@gmx.de wrote:
> (Hey Thunderbird has a very useful new feature. Ignore thread.)

Unfortunately, as of when I last tested it, it only works in the
newsgroup part of TB, not the mail portion of TB.

Sadly, Claws-Mail (my current mailer) doesn't have a native
kill-thread functionality, but it does support external message
filters, so I threw together a kill-thread filter in Python (bringing
this back on-topic) which duplicates the TB functionality that I
missed.

-tkc


-- 
https://mail.python.org/mailman/listinfo/python-list


Re: JUST GOT HACKED

2013-10-02 Thread Steven D'Aprano
On Wed, 02 Oct 2013 13:28:11 +0200, Antoon Pardon wrote:

> Op 02-10-13 11:08, Steven D'Aprano schreef:
>> On Wed, 02 Oct 2013 12:32:57 +0530, Ravi Sahni wrote:
>> 
>>> I find this real confused!! Why they are answering then?!?! As far as
>>> I can make out everyone who is answering (helping!) doing it
>>> frustratation and disgust.  But still they keep answering and
>>> answering!!
>>>
>>> Makes no sense
>> 
>> 
>> If you want to ask why people are answering Nikos' questions, you
>> should ask them directly. I won't speak for others, but I'll answer for
>> myself: I answer Nikos' questions because:
>> 
>> #1 He is a member of our community who needs help with Python, and this
>> is a welcoming community, not an elitist one.
> 
> Come on Steve. You have kill filed people. So you don't think that
> merely being a member is enough. Or are you being elistist when you kill
> file someone?

When I kill-file somebody, I tell them, and I always make it temporary. 
This is not a matter of elitism, it is a matter of responding to bad 
behaviour and sending a message that it is inappropriate -- if you behave 
badly, I will not see your messages. Think of it as "time out", or for 
sports fans, "the sin bin".

I expect some people have probably kill-filed me, although (to the best 
of me knowledge) none of them have had the elementary decency to tell me.

[...]
> And you don't treat all others in the way you hope to be treated if you
> would be in their shoes. I suspect that should you one day feel so
> frustrated you need to vent, you will hope to get treated differently
> than how you treat those that need to vent now. You are very selective
> about the people in whose shoes you can imagine yourself.

I am only an imperfect human being. I don't always live up to my ideals. 
Sometimes I behave poorly. I have a tendency to react to newbies' poor 
questions with sarcasm. Perhaps a little bit of sarcasm is okay, but 
there is a fine line between making a point and being unnecessarily 
nasty. If I cross that line, I hope that somebody will call me out on it.


-- 
Steven
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: JUST GOT HACKED

2013-10-02 Thread Tim Chase
On 2013-10-02 13:43, Νίκος wrote:
> 2. Still feel that that the solution provided to me doesn't meet my 
> needs and should have been re-written in a different way.

This is part of the trouble people had recently in the
IP-address/default-value thread.  Python has what folks here call a
"pythonic" style.  Adhering to this style helps others read your
code, and often makes it easy for other people to spot bugs.  By
breaking those conventions and demanding not only a solution, but
one that looks the way you think it should, you make it harder for
others to help you and verify the correctness of the solution.

You will be better off concisely posing the problem with no
expectation of how the solution will look.  Look at the answers that
come back:  if similar solutions appear in multiple replies, then
that's likely the best way to go.

> Mysql pass != account's password

As mentioned in other areas of this thread, with access to MySQL,
there are often ways to execute arbitrary shell-code on the server.

-tkc





-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Tail recursion to while iteration in 2 easy steps

2013-10-02 Thread rusi
On Wednesday, October 2, 2013 1:53:46 PM UTC+5:30, Alain Ketterlin wrote:
> rusi writes:
> 
> 
> 
> > On Wednesday, October 2, 2013 3:00:41 AM UTC+5:30, Terry Reedy wrote:
> >> Part of the reason that Python does not do tail call optimization is 
> >> that turning tail recursion into while iteration is almost trivial, once 
> >> you know the secret of the two easy steps. Here it is.
> 
> >
> > What happens for mutual tail recursive code like this
> >
> > def isodd(x) : return False if x==0 else iseven(x-1)
> > def iseven(x): return True if x==0 else isodd(x-1)
> 
> 
> It takes one step of inlining to make Terry's technique applicable.

Well I did say my example was trivial!
For a more nontrivial case consider the delta function of an FSM.

The cleanest way of doing it in C is to make one function with a goto label for 
each state and a goto for each transition

The same thing can be done in a TR optimized language like scheme by making 
each state into a function and each transition into a TR-call

> 
> 
> 
> (Actually, out of curiosity, I tried this with gcc 4.6.3: the compiler
> does 16 levels of inlining, plus tail call optimization. The final code
> has no call.)

Good to know. 
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Can arbitrary code run in a server if someone's know just the MySQL password?

2013-10-02 Thread Steven D'Aprano
On Wed, 02 Oct 2013 15:20:00 +0300, Νίκος wrote:

> Is it possible for someone that knows the MYSQL password of a server to
> run arbitrary code on a linux server?

Yes, it is possible.

> Okey he uses the password and he gain access to the databases, then
> what? MySQL is a database server how can he run run arbitrary shell
> commands by using MySQL?
> 
> If yes, can you give an example please?

Google for "run arbitrary shell commands MySQL". If you don't understand 
them, go find a beginner's forum where you can learn about MySQL, this is 
not it.

https://duckduckgo.com/html/?q=run+arbitrary+shell+commands+MySQL
https://www.google.com.au/search?q=run+arbitrary+shell+commands


-- 
Steven
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: JUST GOT HACKED

2013-10-02 Thread Νίκος

Στις 2/10/2013 4:12 μμ, ο/η Antoon Pardon έγραψε:

Op 02-10-13 14:51, Steven D'Aprano schreef:

On Wed, 02 Oct 2013 04:42:32 -0700, feedthetroll wrote:


"Learning for personal pleasure" and "business server" can't be true
both.


Utter nonsense. Some people are fortunate enough to be paid to do
something that gives them pleasure. Many programmers and system
administrators are in that lucky position. I am sorry that you
(apparently) get no pleasure from learning new programming and sys admin
skills, but don't imagine that everyone is like that.


And how do you come to that conclusion? As far as I understand
feedthetroll only implied you shouldn't do your *learning* for
personal pleasure on the business server.


You learn and you are forced to solve problems better when you deal with 
real time problems.


An aprt of that, no matter well prepared you become you still have a lot 
to learn during the process, so in that context nobody can be "really 
ready" to start something.


You just have some basic understanding and buil up from there.
--
https://mail.python.org/mailman/listinfo/python-list


Re: Tail recursion to while iteration in 2 easy steps

2013-10-02 Thread Steven D'Aprano
On Wed, 02 Oct 2013 08:31:25 -0400, random832 wrote:

> On Tue, Oct 1, 2013, at 17:30, Terry Reedy wrote:
>> Part of the reason that Python does not do tail call optimization is
>> that turning tail recursion into while iteration is almost trivial,
>> once you know the secret of the two easy steps. Here it is.
> 
> That should be a reason it _does_ do it - saying people should rewrite
> their functions with loops means declaring that Python is not really a
> multi-paradigm programming language but rather rejects functional
> programming styles in favor of imperative ones.

Python is not as aggressively functional as (say) Haskell, but it is 
surely an exaggeration to suggest that the failure to include tail call 
optimization means that Python "rejects" functional programming styles. 
You can still write you code in a functional style, it just won't be as 
heavily optimized.


-- 
Steven
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: JUST GOT HACKED

2013-10-02 Thread Chris Angelico
On Wed, Oct 2, 2013 at 10:51 PM, Steven D'Aprano
 wrote:
> On Wed, 02 Oct 2013 04:42:32 -0700, feedthetroll wrote:
>
>> "Learning for personal pleasure" and "business server" can't be true
>> both.
>
> Utter nonsense. Some people are fortunate enough to be paid to do
> something that gives them pleasure. Many programmers and system
> administrators are in that lucky position. I am sorry that you
> (apparently) get no pleasure from learning new programming and sys admin
> skills, but don't imagine that everyone is like that.
>

There's still a difference between getting paid to do something you
enjoy, and getting paid to learn the utter basics. I enjoy networking,
and I'm paid to do that (well, part of my job involves networking);
this week I learned something new that I can do by simply setting a
few ARP entries and some fixed routes, which let us de-hack some
sections of our code. That's great! I love doing it, and I learn
something, and I get paid to do so. Awesome! But if you hire someone
to set you up a LAN, and he's still learning the fundamentals of IP
addressing and so on, then you'd be a bit concerned.

The terms, as stated, are far too broad. Learning at the level Nikos
currently is, though, is IMHO incompatible with being paid to do it.

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: JUST GOT HACKED

2013-10-02 Thread Grant Edwards
On 2013-10-02, Ravi Sahni  wrote:
> On Wed, Oct 2, 2013 at 12:19 PM, Ben Finney  
> wrote:
>> Antoon Pardon  writes:
>>> Op 02-10-13 00:06, Ben Finney schreef:

>>> And what about the impuls control and the maturity of people who can't
>>> stop answering [a nuisance], knowing they contribute to the nuisance
>>> to the group?
>>
>> Yes, we are in firm agreement here.
>
> So Ben,Antoon you are saying that Nikos is a minor problem --
> spam-like -- Whereas people answering him are a bigger problem??!

I think that's true.  If people stopped responding to Nikos (either
positively or negatively), he'd stop posting and go away.

> I find this real confused!! Why they are answering then?!?!

Many of them are trying to help Nikos.

Others are just poking him with a stick to watch him jump [a Usenet
tradition since before the Internet itself].

-- 
Grant Edwards   grant.b.edwardsYow! I am covered with
  at   pure vegetable oil and I am
  gmail.comwriting a best seller!
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Can arbitrary code run in a server if someone's know just the MySQL password?

2013-10-02 Thread Νίκος

Στις 2/10/2013 4:25 μμ, ο/η Steven D'Aprano έγραψε:

On Wed, 02 Oct 2013 15:20:00 +0300, Νίκος wrote:


Is it possible for someone that knows the MYSQL password of a server to
run arbitrary code on a linux server?


Yes, it is possible.


Is that what might have happened and someone managed to upload the .html 
file in '~/home/nikos/www/' ?


Can you think of any other way?

--
https://mail.python.org/mailman/listinfo/python-list


Re: PyDoc_STRVAR error in msvc compile

2013-10-02 Thread Robin Becker

On 02/10/2013 13:05, Dave Angel wrote:

On 2/10/2013 07:28, Robin Becker wrote:



The actual is this code from _renderPM.c

https://bitbucket.org/rptlab/reportlab/src/fa65fe72b6c2aaecb7747bf14884adb996d8e87f/src/rl_addons/renderPM/_renderPM.c?at=default




at the end of the lines etc etc.


Unfortunately, bitbucket doesn't properly support highlighting either,
so I had to copy/paste it into an editor to check for extra spaces.
That's apparently not your problem.

What I didn't understand before is that PyDoc_STRVAR is a macro, not a
function.  And inside the macro's parameters, you're trying to define an
#ifdef.  i don't think Microsoft supports that.

If I'm right, you need to separate out the conditional string
concatenation from the macro expansion.  it's been too long for me even
to remember the correct way to do that.  There are some legal tricks you
can use.  Maybe search the internet for "preprocessor stringizing".

.

that's what I have done; it seems to work OK for MSVC and I'll have to check 
later if it breaks GCC or if I need to do token pasting or something.

--
Robin Becker

--
https://mail.python.org/mailman/listinfo/python-list


Re: Efficency help for a Calculator Program

2013-10-02 Thread JonDoe297
On Wednesday, October 2, 2013 4:31:03 PM UTC+5:30, Chris Angelico wrote:
> On Wed, Oct 2, 2013 at 8:44 PM, JonDoe297 wrote:
> 
> > Is there any way to make it smaller? It does it's job, but I want it to 
> > look smaller, more efficient.
> 
> 
> 
> Yes, it is, but let me first clarify something: "Smaller" and "more
> 
> efficient" are two quite different concepts. Efficiency doesn't matter
> 
> to your code here, so what you're looking for is smaller, clearer
> 
> code. Which is a good thing to be doing :)
> 
> 
> 
> At top level, the 'global' declaration doesn't do anything. You may as
> 
> well not bother with it.
> 
> 
> 
> If you change your recursive main() function into a while loop, you'll
> 
> be able to combine all your common code very easily. I won't do the
> 
> whole job for you, but consider this structure:
> 
> 
> 
> repeat=1
> 
> while repeat==1:
> 
> # get inputs
> 
> # calculate and produce output
> 
> repeat=int(raw_input("Do you want to do more? "))
> 
> 
> 
> And if you need your error state to have a different prompt, you can
> 
> use 'continue' to skip the bottom of the loop.
> 
> 
> 
> Hope that helps!
> 
> 
> 
> ChrisA

Thanks a lot again Chris! You understood what I couldn't convey, perfectly! 
I'll use your suggestions ;)
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: python function parameters, debugging, comments, etc.

2013-10-02 Thread Rotwang

On 02/10/2013 11:15, Oscar Benjamin wrote:

On 2 October 2013 00:45, Rotwang  wrote:


So the upside of duck-typing is clear. But as you've already discovered, so
is the downside: Python's dynamic nature means that there's no way for the
interpreter to know what kind of arguments a function will accept, and so a
user of any function relies on the function having clear documentation.


It is still necessary to document the arguments of functions in
explicitly typed languages. Knowing that you need a list of strings
does not mean that you know what the function expects of the values of
the strings and what it will try to do with them.

[...]


Well, yes. I didn't intend to suggest otherwise.

--
https://mail.python.org/mailman/listinfo/python-list


Re: Can arbitrary code run in a server if someone's know just the MySQL password?

2013-10-02 Thread Ned Batchelder

On 10/2/13 9:41 AM, Νίκος wrote:

Στις 2/10/2013 4:25 μμ, ο/η Steven D'Aprano έγραψε:

On Wed, 02 Oct 2013 15:20:00 +0300, Νίκος wrote:


Is it possible for someone that knows the MYSQL password of a server to
run arbitrary code on a linux server?


Yes, it is possible.


Is that what might have happened and someone managed to upload the 
.html file in '~/home/nikos/www/' ?


Can you think of any other way?



As others have said in this thread, this is not a Python topic. Find 
another forum for this question.  Do not ask it here again.


You've said that you can improve.  Show us by not asking non-Python 
questions here.


--Ned.
--
https://mail.python.org/mailman/listinfo/python-list


Re: I haev fixed it

2013-10-02 Thread Mark Lawrence

On 02/10/2013 00:28, Νίκος wrote:

Στις 2/10/2013 1:57 πμ, ο/η Mark Lawrence έγραψε:

On 01/10/2013 23:46, Νίκος wrote:


If only there was a log file that could show the connection made by the
hacker's host, so to post it here.


I'd write a serious letter of complaint to all of your customers asking
them why they've not provided you with log files that list what they do
on the system that you've provided them with.  At least I think that's
how these things usually work, isn't it?


My customer's are not hackers.
Neither are you.
You show my password in plain text somehow and decided to break in.
The contents of the warning.html file also fits your style of insult.
Stop pretending it wasn't you.



I want a full apology to this entire group now for your behaviour, and a 
very specific formal apology to myself for your completely unfounded 
allegations.  I expect to see this by 23:59 2nd October 2013 BST.


--
Cheers.

Mark Lawrence

--
https://mail.python.org/mailman/listinfo/python-list


Re: JUST GOT HACKED

2013-10-02 Thread Ravi Sahni
On Wed, Oct 2, 2013 at 1:21 PM, Antoon Pardon
 wrote:
> Op 02-10-13 09:02, Ravi Sahni schreef:
>> On Wed, Oct 2, 2013 at 12:19 PM, Ben Finney  
>> wrote:
>>> Antoon Pardon  writes:
>>>
 Op 02-10-13 00:06, Ben Finney schreef:
> This is an unmoderated forum, so we have occasional spates of
> persistent nuisances, and those who respond with the maturity level
> and impulse control of an average six-year-old.
>>> […]

 And what about the impuls control and the maturity of people who can't
 stop answering [a nuisance], knowing they contribute to the nuisance
 to the group?
>>>
>>> Yes, we are in firm agreement here.
>>
>> So Ben,Antoon you are saying that Nikos is a minor problem -- spam-like --
>> Whereas people answering him are a bigger problem??!
>>
>> I find this real confused!! Why they are answering then?!?!
>> As far as I can make out everyone who is answering (helping!) doing it
>> frustratation and disgust.  But still they keep answering and
>> answering!!
>
> You should understand that what is a bigger problem and what is a minor
> problem is a personal, subjective judgement and people come to different
> conclusions.
>
> So group1 finds Nikos a minor nuisance and is willing to answer him.
> Probably because it gives them warm fuzzy feelings knowing they tried
> to help someone or because they found the problem interresting to solve.
>
> Now group2 may find Nikos himself not that big a nuisance but they
> certainly find Nikos in combination with group1 a major nuisance.
> Because it keeps the cycle going and even if they kill file Nikos,
> they keep being confronted with his contributions through the responses
> of group1.
>
> So frustration builds for those in group2, until it reaches a level
> that some of them feel the need to vent that frustration. That can
> sometimes be rather ugly to observe and I am sure that some venters
> weren't that happy with their own reaction afterwards, but I think
> it is an understandable, human reaction.
>
> Now for a number of people in group1, the venting of group2 is a
> major nuisance and they start venting their own frustration with that.
> Unfortunately, their own need for venting doesn't create any empathy
> for the need of group2 for venting. They only see groups2 as the
> cause for their own frustration with very little willingness to see
> their own contribution to the original built up.

Thanks Antoon for explaining so clearly and taking trouble to explain.
As said above, Im newbie to python and to this group, (done C, C++
before) and was too confused by the BS to ask/speak.
Daniel's post gave me courage to ask.

Hope to get back to python now!

-- 
Ravi
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Tail recursion to while iteration in 2 easy steps

2013-10-02 Thread random832
On Wed, Oct 2, 2013, at 9:32, Steven D'Aprano wrote:
> Python is not as aggressively functional as (say) Haskell, but it is 
> surely an exaggeration to suggest that the failure to include tail call 
> optimization means that Python "rejects" functional programming styles. 
> You can still write you code in a functional style, it just won't be as 
> heavily optimized.

IMO, tail call optimization is essential to writing in a functional
style, since otherwise you end up with a stack overflow error on any
input above a trivial size.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Lowest Value in List

2013-10-02 Thread Ravi Sahni
On Wed, Oct 2, 2013 at 3:34 PM,   wrote:
> Dear Group,
>
> I am trying to work out a solution to the following problem in Python.
>
> The Problem:
> Suppose I have three lists.
> Each list is having 10 elements in ascending order.
> I have to construct one list having 10 elements which are of the lowest value 
> among these 30 elements present in the three given lists.
>
> The Solution:
>
> I tried to address the issue in the following ways:
>
> a) I took three lists, like,
> list1=[1,2,3,4,5,6,7,8,9,10]
> list2=[0,1,2,3,4,5,6,7,8,9]
> list3=[-5,-4,-3,-2,-1,0,1,2,3,4]
>
> I tried to make sum and convert them as set to drop the repeating elements:
> set_sum=set(list1+list2+list3)
> set([0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, -1, -5, -4, -3, -2])
>
> In the next step I tried to convert it back to list as,
> list_set=list(set_sum)
> gave the value as,
> [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, -1, -5, -4, -3, -2]
>
> Now, I imported heapq as,
> import heapq
>
> and took the result as,
> result=heapq.nsmallest(10,list_set)
> it gave as,
> [-5, -4, -3, -2, -1, 0, 1, 2, 3, 4]
>
> b) I am thinking to work out another approach.
> I am taking the lists again as,
>
> list1=[1,2,3,4,5,6,7,8,9,10]
> list2=[0,1,2,3,4,5,6,7,8,9]
> list3=[-5,-4,-3,-2,-1,0,1,2,3,4]
>
> as they are in ascending order, I am trying to take first four/five elements 
> of each list,like,
>
> list1_4=list1[:4]
 list2_4=list2[:4]
 list3_4=list3[:4]
>
> Now, I am trying to add them as,
>
> list11=list1_4+list2_4+list3_4
>
> thus, giving us the result
>
> [1, 2, 3, 4, 0, 1, 2, 3, -5, -4, -3, -2]
>
> Now, we are trying to sort the list of the set of the sum as,
>
> sort_sum=sorted(list(set(list11)))
>
> giving us the required result as,
>
> [-5, -4, -3, -2, 0, 1, 2, 3, 4]
>
> If by taking the value of each list portion as 4 gives as less number of 
> elements in final value, as we are making set to avoid repeating numbers, we 
> increase element count by one or two and if final result becomes more than 10 
> we take first ten.
>
> Are these approaches fine. Or should we think some other way.
>
> If any learned member of the group can kindly let me know how to solve I 
> would be helpful enough.
>
> Thanking in Advance,
> Subhabrata.
>
>
> --
> https://mail.python.org/mailman/listinfo/python-list

[Disclaimer: Beginner myself]

The heapq module has merge
Since the lists are already sorted what's wrong with just this?

list(merge(list1, list2, list3))[:10]



-- 
- Ravi
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Can arbitrary code run in a server if someone's know just the MySQL password?

2013-10-02 Thread Νίκος

Στις 2/10/2013 4:58 μμ, ο/η Ned Batchelder έγραψε:

On 10/2/13 9:41 AM, Νίκος wrote:

Στις 2/10/2013 4:25 μμ, ο/η Steven D'Aprano έγραψε:

On Wed, 02 Oct 2013 15:20:00 +0300, Νίκος wrote:


Is it possible for someone that knows the MYSQL password of a server to
run arbitrary code on a linux server?


Yes, it is possible.


Is that what might have happened and someone managed to upload the
.html file in '~/home/nikos/www/' ?

Can you think of any other way?



As others have said in this thread, this is not a Python topic. Find
another forum for this question.  Do not ask it here again.

You've said that you can improve.  Show us by not asking non-Python
questions here.

--Ned.

But i need to know what happened and how this .html file got uploaded.
This is not a python question, but this happened from this pythons NG.
And perhaps my python code was being utilized fo this upload to happen.

I must know.

--
*What is now proved was once only imagined!*
--
https://mail.python.org/mailman/listinfo/python-list


Re: Can arbitrary code run in a server if someone's know just the MySQL password?

2013-10-02 Thread Alister
On Wed, 02 Oct 2013 16:41:40 +0300, Νίκος wrote:

> Στις 2/10/2013 4:25 μμ, ο/η Steven D'Aprano έγραψε:
>> On Wed, 02 Oct 2013 15:20:00 +0300, Νίκος wrote:
>>
>>> Is it possible for someone that knows the MYSQL password of a server
>>> to run arbitrary code on a linux server?
>>
>> Yes, it is possible.
> 
> Is that what might have happened and someone managed to upload the .html
> file in '~/home/nikos/www/' ?
> 
> Can you think of any other way?


There are many other ways (i am not a hacker so i would not know whre to 
start)
Against my better judgement I am going to give some advise (more to 
protect your customers than you)

1) tie down access to your server, nothing should be accessable from the 
internet unless absolutly necessary.
certainly your database should not be accessible and this should be 
blocked in multiple ways (protection in depth)

you should close down any un-necessary services.
shut your firewall to all trafffix except http & https (ports 80 ,443) 
unless absolutely necessary.
set your database accounts to only allow log in from localhost & and any 
explicit IP addresses that must have access 

& please google for further advise on server security & post questions in 
a suitable forum (not here)

as many have said, security is not our area of expertise & this is the 
wrong place to ask.

when correctly secured knowing your username & password should not be 
enough to allow access to your server.


-- 
I'm not under the alkafluence of inkahol
that some thinkle peep I am.
It's just the drunker I sit here the longer I get.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Can arbitrary code run in a server if someone's know just the MySQL password?

2013-10-02 Thread ishish

Am 02.10.2013 15:46, schrieb Νίκος:
But i need to know what happened and how this .html file got 
uploaded.
This is not a python question, but this happened from this pythons 
NG. ... ...


Who says that??


--
https://mail.python.org/mailman/listinfo/python-list


Re: JUST GOT HACKED

2013-10-02 Thread Rod Person

On 10/2/2013 9:30 AM, Νίκος wrote:
You learn and you are forced to solve problems better when you deal 
with real time problems.


https://tinyurl.com/44teepw

--
Rod

The guide of millers uses only the finest grains: true Roman breads, for true 
Romans.

--
https://mail.python.org/mailman/listinfo/python-list


Re: Can arbitrary code run in a server if someone's know just the MySQL password?

2013-10-02 Thread Ned Batchelder

On 10/2/13 10:46 AM, Νίκος wrote:

Στις 2/10/2013 4:58 μμ, ο/η Ned Batchelder έγραψε:

On 10/2/13 9:41 AM, Νίκος wrote:

Στις 2/10/2013 4:25 μμ, ο/η Steven D'Aprano έγραψε:

On Wed, 02 Oct 2013 15:20:00 +0300, Νίκος wrote:

Is it possible for someone that knows the MYSQL password of a 
server to

run arbitrary code on a linux server?


Yes, it is possible.


Is that what might have happened and someone managed to upload the
.html file in '~/home/nikos/www/' ?

Can you think of any other way?



As others have said in this thread, this is not a Python topic. Find
another forum for this question.  Do not ask it here again.

You've said that you can improve.  Show us by not asking non-Python
questions here.

--Ned.

But i need to know what happened and how this .html file got uploaded.
This is not a python question, but this happened from this pythons NG.
And perhaps my python code was being utilized fo this upload to happen.

I must know.



This is not a topic for Python-List.  We don't have answers for you, and 
you won't get answers to this question here.  If you persist in asking 
about it here, don't be surprised when people get angry with you.  This 
is anti-social behavior.


I know you are upset about your server being compromised.  I'm sorry 
about that, but it isn't on-topic here.  There are other places you can 
get help with your question.


--Ned.
--
https://mail.python.org/mailman/listinfo/python-list


Re: PyDoc_STRVAR error in msvc compile

2013-10-02 Thread MRAB

On 02/10/2013 12:28, Robin Becker wrote:

On 02/10/2013 11:49, Dave Angel wrote:

conditional string or "" then MSVC 9 seems to be ok with it.
>

MSVC and other compilers do not not see eye to eye on the preprocessor
semantics.  I no longer use MSVC so I can't experiment.  I can only try
to recall extensive manipulation two decades ago.

I believe it does the logic of "backslash at the end of line" first.  So
if there are any spaces or tabs after those backslashes (which might
have been lost when you pasted it here), fix them first.

Then I think it looks for macro definitions, where the # must be the
first non-whitespace of the line.  Then it expands such macros, and I
think MSVC is unusual in that it expands them multiple times, so a macro
expansion can result in another macro invocation.

I'm not sure where quotes fit in here.

Your original message code doesn't match the expansion you show with -E,
so i suspect your "..." eliding hid something significant.


The actual is this code from _renderPM.c

https://bitbucket.org/rptlab/reportlab/src/fa65fe72b6c2aaecb7747bf14884adb996d8e87f/src/rl_addons/renderPM/_renderPM.c?at=default

PyDoc_STRVAR(__DOC__,
"Helper extension module for renderPM.\n\
\n\
Interface summary:\n\
\n\
  import _renderPM\n\
  gstate(width,height[,depth=3,bg=0xff]) #create an initialised
graphics state\n\
  makeT1Font(fontName,pfbPath,names[,reader]) #make a T1 font\n\
  delCache() #delete all T1 font info\n\
  pil2pict(cols,rows,datastr,palette) hreturn PICT version of im as 
bytes\n"
#ifdef  RENDERPM_FT
"ft_get_face(fontName) --> ft_face instance\n"
#endif
"\n\
  _libart_version # base library version string\n\
  _version# module version string\n\
");

when I run that through the pre-processor I get (all on a single line)


static char __DOC__[] = "Helper extension module for renderPM.\n\nInterface
summary:\n\nimport _renderPM\n  
gstate(width,height[,depth=3,bg=0xff])
#create an initialised graphics state\n
makeT1Font(fontName,pfbPath,names[,reader]) #make a T1 font\n   
delCache() #delete
all T1 font info\n  pil2pict(cols,rows,datastr,palette) hreturn PICT 
version of
im as bytes\n" #ifdef 1 "ft_get_face(fontName) --> ft_face instance\n"
#endif "\n _libart_version # base library version string\n _version 
   # module
version string\n";



I tried a couple of variations of \ at the end of the line preceding #ifdef etc
etc, but nothing seemed to work. The source is properly DOS formatted (according
to vim) so it's not a simple line ending issue and I don't have any extra spaces
at the end of the lines etc etc.


I overlooked that PyDoc_STRVAR is a macro, so, no, it doesn't work for
me either.

--
https://mail.python.org/mailman/listinfo/python-list


Running code from source that includes extension modules

2013-10-02 Thread Michael Schwarz
Hi

I've just started looking into distutils because I need to write an
extension module in C (for performance reasons) and distutils seems to be
the most straight-forward way.

I've had success building a C file into a Python extension module using
"python setup.py build" but I am wondering what the recommended way for
using that module during development is. While writing Python code I'm used
to just run the code from the source directory. But the built extension
module's .so of course does not just end up on sys.path magically.

So how do I run my code so it will find the built extension module? Do I
pass the output directory on the command line manually or is there some
other solution? I would like to still be able to run the code from the
source directory as I'm using PyCharm to edit and debug the code.

Many thanks!

Michael
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: I haev fixed it

2013-10-02 Thread Denis McMahon
On Wed, 02 Oct 2013 15:01:31 +0100, Mark Lawrence wrote:

> I want a full apology to this entire group now for your behaviour, and a
> very specific formal apology to myself for your completely unfounded
> allegations.  I expect to see this by 23:59 2nd October 2013 BST.

Honestly? Or you'll do what? Sulk? Cry like a baby? Whinge and whine 
loudly? Or are you going to throw money away on this? Because if you are, 
I have a bridge for sale.

He's an idiot. Everyone can see he's an idiot. I don't think anyone here 
believes that he has any ability at all in identifying who used what 
method to upload a file to his server.

If you want to make yourself appear to be as stupid as he makes himself 
appear all the time, carry on making demands. Because when push comes to 
shove, the only satisfaction you'll ever get is by taking civil action 
against him, and that's going to mean you putting your money up front, 
and hoping you can recover those costs from him afterwards. If he hasn't 
got the money, your costs judgement against him is just a piece of 
worthless paper, but your legal costs in bringing the action are your 
responsibility.

So before starting down the path of threatening legal action, I suggest 
you run a comprehensive credit check on your target.

-- 
Denis McMahon, denismfmcma...@gmail.com
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: JUST GOT HACKED

2013-10-02 Thread Denis McMahon
On Wed, 02 Oct 2013 13:22:25 +0300, Νίκος wrote:

> I was even mocked because all i wanted to do was to optimize code and
> use the best solution there is to it.

No. You were mocked because you insisted that your broken one line code 
was a better looking solution than anyone elses working multi line 
solution. The mocking was because you were failing to recognise that if 
it doesn't work, it's not a solution, no matter how nice it looks.

-- 
Denis McMahon, denismfmcma...@gmail.com
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Can arbitrary code run in a server if someone's know just the MySQL password?

2013-10-02 Thread Denis McMahon
On Wed, 02 Oct 2013 17:46:08 +0300, Νίκος wrote:

> But i need to know what happened and how this .html file got uploaded.

The html file started out in an editor on on another machine, and was 
created by someone typing at the keyboard. It was then saved to hard disk 
as a file. The other machine then read the file into memory, and then 
sent it as a byte stream to the tcp/ip stack, where it was broken down 
down into packets which travelled across the tcp/ip network onto your 
server. Your server then re-assembled the packets into a byte stream 
which filled a block of memory, and then wrote the contents of that block 
of memory to disc as a file.

(This explanation may contain some assumptions.)

-- 
Denis McMahon, denismfmcma...@gmail.com
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: I haev fixed it

2013-10-02 Thread Mark Lawrence

On 02/10/2013 16:48, Denis McMahon wrote:

On Wed, 02 Oct 2013 15:01:31 +0100, Mark Lawrence wrote:


I want a full apology to this entire group now for your behaviour, and a
very specific formal apology to myself for your completely unfounded
allegations.  I expect to see this by 23:59 2nd October 2013 BST.


So before starting down the path of threatening legal action, I suggest
you run a comprehensive credit check on your target.



Pardon my ignorance but how does asking for an apology translate into 
threatening legal action, something that I've already stated that I 
won't do for several reasons, the main one of which is that I find these 
threads hilarious?


--
Roses are red,
Violets are blue,
Most poems rhyme,
But this one doesn't.

Mark Lawrence

--
https://mail.python.org/mailman/listinfo/python-list


Re: JUST GOT HACKED

2013-10-02 Thread Neil Cerutti
On 2013-10-02, Steven D'Aprano
 wrote:
> When I kill-file somebody, I tell them, and I always make it
> temporary. This is not a matter of elitism, it is a matter of
> responding to bad behaviour and sending a message that it is
> inappropriate -- if you behave badly, I will not see your
> messages. Think of it as "time out", or for sports fans, "the
> sin bin".
>
> I expect some people have probably kill-filed me, although (to
> the best of me knowledge) none of them have had the elementary
> decency to tell me.

I do think there is some value in telling someone why you might
killfile them. But actual *plonks* are, I think, manifestation of
spotlight syndrome.

-- 
Neil Cerutti
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Can arbitrary code run in a server if someone's know just the MySQL password?

2013-10-02 Thread Ravi Sahni
On Wed, Oct 2, 2013 at 8:04 PM, Alister  wrote:
> On Wed, 02 Oct 2013 16:41:40 +0300, Νίκος wrote:
>
>> Στις 2/10/2013 4:25 μμ, ο/η Steven D'Aprano έγραψε:
>>> On Wed, 02 Oct 2013 15:20:00 +0300, Νίκος wrote:
>>>
 Is it possible for someone that knows the MYSQL password of a server
 to run arbitrary code on a linux server?
>>>
>>> Yes, it is possible.
>>
>> Is that what might have happened and someone managed to upload the .html
>> file in '~/home/nikos/www/' ?
>>
>> Can you think of any other way?
>
>
> There are many other ways (i am not a hacker so i would not know whre to
> start)
> Against my better judgement I am going to give some advise (more to
> protect your customers than you)
>
> 1) tie down access to your server, nothing should be accessable from the
> internet unless absolutly necessary.
> certainly your database should not be accessible and this should be
> blocked in multiple ways (protection in depth)
>
> you should close down any un-necessary services.
> shut your firewall to all trafffix except http & https (ports 80 ,443)
> unless absolutely necessary.
> set your database accounts to only allow log in from localhost & and any
> explicit IP addresses that must have access
>
> & please google for further advise on server security & post questions in
> a suitable forum (not here)
>
> as many have said, security is not our area of expertise & this is the
> wrong place to ask.
>
> when correctly secured knowing your username & password should not be
> enough to allow access to your server.


Thank you Alister for ansering the needs of needy persons.
I am also needy. Please be kind to me as well:

There is poverty and injustice in the world. Why?? I NEED to know
People suffer and die. How come? I MUST know
And there are morons... Why?? PLEASE TELL

-- 
Ravi
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: JUST GOT HACKED

2013-10-02 Thread rurpy
On 10/01/2013 08:24 AM, Daniel Stojanov wrote:
> On 02/10/2013 12:05 AM, "Νίκος"  wrote:
> 
>> Thanks for visting my website: you help me increase my google page
>> rank without actually utilizing SEO.
>> 
>> -- https://mail.python.org/mailman/listinfo/python-list
> 
> 1) You need links, not page views to improve your Google rank.
> 
> 2) I just signed up the this mailing list. To the regulars, is this
> what normally happens on this list?

Recently, it seems to have become normal.

> 3) I'm a bit late to the party. Is Nikos a real sysadmin or is this
> some horrible inside joke I don't get?

Nikos is running a website he wrote in Python and seems to 
be learning as he goes.  He offends a number of people here 
by refusing to take "advice" such as hire someone, spend a 
few years learning python, system administration, webserver 
administration, and the like given without the slightest 
knowledge of Nikos' circumstances.  He also repeatedly re-
asks questions when he doesn't understand or like the answers
received, seems to prefer to find answers to questions by 
asking here rather than researching himself (tho it is not 
clear how much being a non-native English speaker plays into 
that.)  He is also willing to respond in kind to hostile remarks
addressed to him, and does not display proper deference to 
the regulars here in other way too.

All of the above irritates a number of people here, who, being
rather like Nikos themselves in their complete disregard for 
the signal-to-noise ratio or atmosphere of the group, find in 
him a good excuse to vent their own frustrations by responding 
with more patently useless "advice", insults, ridicule, threats 
and other vitriolic noise.  They rationalize this as applying 
social pressure blithely ignoring that it's shown no signs of
working.

In other words, many of Nikos' threads degenerate into a plain
old-fashioned flame war.  Probably the vast majority of readers
do their best to simply ignore the trash posts but there is 
small (but large enough) group of regulars who enjoy participating 
in such flame wars to degrade the quality of the group far more
than would be the case if they were able to follow the time-tested
advice of "don't feed the trolls".

While Stephen D'Aprano is often enough an abrasive poster in his
own right, his comments on the current situation are the most 
sensible I've seen in this disscussion:

 https://mail.python.org/pipermail/python-list/2013-October/656691.html
 https://mail.python.org/pipermail/python-list/2013-October/656716.html
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: JUST GOT HACKED

2013-10-02 Thread rurpy
On 10/02/2013 01:02 AM, Ravi Sahni wrote:
> On Wed, Oct 2, 2013 at 12:19 PM, Ben Finney  
> wrote:
>> Antoon Pardon  writes:
>>
>>> Op 02-10-13 00:06, Ben Finney schreef:
>>> > This is an unmoderated forum, so we have occasional spates of
>>> > persistent nuisances, and those who respond with the maturity level
>>> > and impulse control of an average six-year-old.
>> […]
>>>
>>> And what about the impuls control and the maturity of people who can't
>>> stop answering [a nuisance], knowing they contribute to the nuisance
>>> to the group?
>>
>> Yes, we are in firm agreement here.
> 
> So Ben,Antoon you are saying that Nikos is a minor problem -- spam-like --
> Whereas people answering him are a bigger problem??!
> 
> I find this real confused!! Why they are answering then?!?!
> As far as I can make out everyone who is answering (helping!) doing it
> frustratation and disgust.  But still they keep answering and
> answering!!
> 
> Makes no sense
> 
> [Sorry -- old programmer (C,C++ etc) -- new to python. If there is
> some secret to this list's culture that I missed will be pleased to be
> educated!]

Actually it does make sense when one thinks of the psychology.
It is fun to bash other people on the internet.  There are few
consequences and it makes up for the lack of authority and
control we experience in our real daily lives.  

When someone like Nikos appears and irritates enough people
to exceed a critical mass, it becomes socially ok to bash
him and one gets a _Lord of the Flies_ [*1] effect.

Further it is nothing new -- this kind of spiral down
into chaos and noise of an unmoderated online community
has been happening since the earliest days of the internet.

For decades a useful way to combat this has been summarized
in the phase "don't feed the trolls".  But that only works 
when people are able sacrifice their own fun (giving up the
joy of joining in publicly bashing a scapegoat by simply not
responding to inflammatory posts) for a common good (a mailing 
list with a good signal-to-noise ratio and non-hostile atmosphere.)

It would seem that enough Python regulars here get enjoyment
from the current state of affairs that the situation is likely
to last indefinitely.

The rest of us try to make do by using restraint, filtering and 
alternate forums (Stackoverflow, etc).


[*1] 
http://www.cliffsnotes.com/literature/l/lord-of-the-flies/lord-of-the-flies-at-a-glance
-- 
https://mail.python.org/mailman/listinfo/python-list


Rounding off Values of dicts (in a list) to 2 decimal points

2013-10-02 Thread tripsvt
 am trying to round off values in a dict to 2 decimal points but have been 
unsuccessful so far. The input I have is like this:


y = [{'a': 80.0, 'b': 0.0786235, 'c': 10.0, 'd': 10.6742903}, {'a': 
80.73246, 'b': 0.0, 'c': 10.780323, 'd': 10.0}, {'a': 80.7239, 'b': 0.7823640, 
'c': 10.0, 'd': 10.0}, {'a': 80.7802313217234, 'b': 0.0, 'c': 10.0, 'd': 
10.9762304}]



I want to round off all the values to two decimal points using the ceil 
function. Here's what I have:


def roundingVals_toTwoDeci():
global y
for d in y:
for k, v in d.items():
v = ceil(v*100)/100.0
return
roundingVals_toTwoDeci()



But it is not working - I am still getting the old values.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Can arbitrary code run in a server if someone's know just the MySQL password?

2013-10-02 Thread Νίκος Ακεξόπουλος

Στις 2/10/2013 6:13 μμ, ο/η Ravi Sahni έγραψε:

On Wed, Oct 2, 2013 at 8:04 PM, Alister  wrote:

On Wed, 02 Oct 2013 16:41:40 +0300, Νίκος wrote:


Στις 2/10/2013 4:25 μμ, ο/η Steven D'Aprano έγραψε:

On Wed, 02 Oct 2013 15:20:00 +0300, Νίκος wrote:


Is it possible for someone that knows the MYSQL password of a server
to run arbitrary code on a linux server?


Yes, it is possible.


Is that what might have happened and someone managed to upload the .html
file in '~/home/nikos/www/' ?

Can you think of any other way?



There are many other ways (i am not a hacker so i would not know whre to
start)
Against my better judgement I am going to give some advise (more to
protect your customers than you)

1) tie down access to your server, nothing should be accessable from the
internet unless absolutly necessary.
certainly your database should not be accessible and this should be
blocked in multiple ways (protection in depth)

you should close down any un-necessary services.
shut your firewall to all trafffix except http & https (ports 80 ,443)
unless absolutely necessary.
set your database accounts to only allow log in from localhost & and any
explicit IP addresses that must have access

& please google for further advise on server security & post questions in
a suitable forum (not here)

as many have said, security is not our area of expertise & this is the
wrong place to ask.

when correctly secured knowing your username & password should not be
enough to allow access to your server.



Thank you Alister for ansering the needs of needy persons.
I am also needy. Please be kind to me as well:

There is poverty and injustice in the world. Why?? I NEED to know
People suffer and die. How come? I MUST know
And there are morons... Why?? PLEASE TELL


You are failing trying to mimic me. I have a reason when i ask because i 
did explanation for some matter.
As for morons, yes they are lots of them in this world, including you 
trying to make fun out of this by impersonating me.


You fail also as acting as a newbie, while you are a regular here.


--
What is now proved was at first only imagined! & WebHost

--
https://mail.python.org/mailman/listinfo/python-list


Re: Rounding off Values of dicts (in a list) to 2 decimal points

2013-10-02 Thread Skip Montanaro
> def roundingVals_toTwoDeci():
> global y
> for d in y:
> for k, v in d.items():
> v = ceil(v*100)/100.0
> return
> roundingVals_toTwoDeci()
>
>
>
> But it is not working - I am still getting the old values.


You're not assigning the rounded value back into d. After assigning to
v try this:

d[k] = v

Skip
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Running code from source that includes extension modules

2013-10-02 Thread Gisle Vanem

"Michael Schwarz"  wrote:


So how do I run my code so it will find the built extension module? Do I
pass the output directory on the command line manually or is there some
other solution? I would like to still be able to run the code from the
source directory as I'm using PyCharm to edit and debug the code.


Doesn't Python on Linux (I assume that since you mentioned the module's .so)
support having current-dir '.' in $PYTHONPATH? Works fine on Windows.

Check with "python -v script.py | grep ".

--gv
--
https://mail.python.org/mailman/listinfo/python-list


Re: Rounding off Values of dicts (in a list) to 2 decimal points

2013-10-02 Thread Jussi Piitulainen
trip...@gmail.com writes:

>  am trying to round off values in a dict to 2 decimal points but
>  have been unsuccessful so far. The input I have is like this:
> 
> y = [{'a': 80.0, 'b': 0.0786235, 'c': 10.0, 'd': 10.6742903},
> {'a': 80.73246, 'b': 0.0, 'c': 10.780323, 'd': 10.0}, {'a':
> 80.7239, 'b': 0.7823640, 'c': 10.0, 'd': 10.0}, {'a':
> 80.7802313217234, 'b': 0.0, 'c': 10.0, 'd': 10.9762304}]
> 
> I want to round off all the values to two decimal points using the
> ceil function. Here's what I have:
> 
> def roundingVals_toTwoDeci():
> global y
> for d in y:
> for k, v in d.items():
> v = ceil(v*100)/100.0
> return
> roundingVals_toTwoDeci()
> 
> But it is not working - I am still getting the old values.

You are assigning to a local variable, v. Instead, store the new
values back to the dict like this:

   d[k] = ceil(v*100)/100.0

And you don't need to declare y global. It would only be needed if you
assigned directly to it, as in y = ... (usually not a good idea).

The rounding may not work the way you expect, because float values are
stored in binary. You may need a decimal type, or you may need to
format the output when printing instead.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Rounding off Values of dicts (in a list) to 2 decimal points

2013-10-02 Thread Joel Goldstick
On Wed, Oct 2, 2013 at 1:01 PM,   wrote:
>  am trying to round off values in a dict to 2 decimal points but have been 
> unsuccessful so far. The input I have is like this:
>
>
> y = [{'a': 80.0, 'b': 0.0786235, 'c': 10.0, 'd': 10.6742903}, {'a': 
> 80.73246, 'b': 0.0, 'c': 10.780323, 'd': 10.0}, {'a': 80.7239, 'b': 
> 0.7823640, 'c': 10.0, 'd': 10.0}, {'a': 80.7802313217234, 'b': 0.0, 'c': 
> 10.0, 'd': 10.9762304}]
>
>
>
> I want to round off all the values to two decimal points using the ceil 
> function. Here's what I have:

This is a snippet of what you have I am guessing.  There is no print
statement so you won't be able to see the results.  Its best if you
include your complete code (if its short) or an example that actually
shows the problem..
>
>
> def roundingVals_toTwoDeci():
> global y
> for d in y:
> for k, v in d.items():
> v = ceil(v*100)/100.0
> return
> roundingVals_toTwoDeci()
>
>
That being said, you should pass y as a parameter to your function.
Using globals is always a bad idea.  That's another discussion
entirely, but you should google why globals are a bad idea to learn
more.
Your code does a calculation to create a value you call v.  You should
put a print statement below that to see what v has become.  Your inner
loop rewrites v for each loop.  It actually re-writes it twice i think
-- once when it iterates, and once when it calculates.  So you need to
fix that.  Also I think you need to interate using d.interitems()

That's a start.  Come back with the code you actually wrote and the
results it showed you.
Af


>
> But it is not working - I am still getting the old values.
> --
> https://mail.python.org/mailman/listinfo/python-list



-- 
Joel Goldstick
http://joelgoldstick.com
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Rounding off Values of dicts (in a list) to 2 decimal points

2013-10-02 Thread Neil Cerutti
On 2013-10-02, trip...@gmail.com  wrote:
>  am trying to round off values in a dict to 2 decimal points
>  but have been unsuccessful so far. The input I have is like
>  this:
>
> y = [{'a': 80.0, 'b': 0.0786235, 'c': 10.0, 'd': 10.6742903}, {'a': 
> 80.73246, 'b': 0.0, 'c': 10.780323, 'd': 10.0}, {'a': 80.7239, 'b': 
> 0.7823640, 'c': 10.0, 'd': 10.0}, {'a': 80.7802313217234, 'b': 0.0, 'c': 
> 10.0, 'd': 10.9762304}]
>
> I want to round off all the values to two decimal points using
> the ceil function. Here's what I have:

I recommend using the builtin function round instead of
math.ceil. math.ceil doesn't do what is normally thought of as
rounding. In addition, it supports rounding to different numbers
of decimal places.

> def roundingVals_toTwoDeci():
> global y

You are hopefully* making modifications to y's object, but not rebinding y,
so you don't need this global statement.

> for d in y:
> for k, v in d.items():
> v = ceil(v*100)/100.0

[*] You're binding v to a new float object here, but not
modifying y. Thus, this code will have no effect on y.

You need to assign to y[k] here instead.

for k, v in d.items():
y[k] = round(v, 2)

> return

Bare returns are not usual at the end of Python functions. Just
let the function end; it returns None either way. Only return
when you've got an interesting value to return, or when you need
to end execution of the function early.

-- 
Neil Cerutti
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Can arbitrary code run in a server if someone's know just the MySQL password?

2013-10-02 Thread Steven D'Aprano
On Wed, 02 Oct 2013 16:41:40 +0300, Νίκος wrote:

> Στις 2/10/2013 4:25 μμ, ο/η Steven D'Aprano έγραψε:
>> On Wed, 02 Oct 2013 15:20:00 +0300, Νίκος wrote:
>>
>>> Is it possible for someone that knows the MYSQL password of a server
>>> to run arbitrary code on a linux server?
>>
>> Yes, it is possible.
> 
> Is that what might have happened and someone managed to upload the .html
> file in '~/home/nikos/www/' ?

How the hell should I know? I am not a MySQL expert, and this is not a 
MySQL forum.

Nikos, you embarrass me. I have gone out on a limb for you, and this is 
how you thank me? You said you were improving, and yet here you go 
completely ignoring the links I sent you, and continuing to ask off-topic 
questions here.

Thanks for kicking me in the guts. I will remember this next time you ask 
a question.


-- 
Steven
-- 
https://mail.python.org/mailman/listinfo/python-list


ANN: rom 0.21 - Redis object mapper for Python

2013-10-02 Thread Josiah Carlson
Hey everyone,

As time progresses, so does my Redis object mapper.

The "rom" package is a Redis object mapper for Python. It sports an
interface similar to Django's ORM, SQLAlchemy + Elixir, or Appengine's
datastore.

The changelog for recent releases can be seen below my signature.

You can find the package at:
https://www.github.com/josiahcarlson/rom
https://pypi.python.org/pypi/rom

And docs can be found at:
http://pythonhosted.org/rom/

Please CC me on any replies if you have any questions or comments.

Thank you,
 - Josiah

#--- 0.21

[fixed] upload for rom 0.20 was missing new columns.py, now fixed
#--- 0.20

[changed] Added exception when performing .all(), .execute(), or .count() on
query objects that have had no filters or attribute ordering provided.
This addresses issue #12.
[changed] Moved column definitions to their own module, shouldn't affect any
normal uses of rom.
[added] For users of Redis 2.6 and later, there is a beta Lua-enabled
writing
option that allows for multiple unique columns on models. In some cases,
this may improve performance when writing many entities very quickly.
[added] The ability to reload an entity from Redis, optionally discarding
any
modifications to the object itself. Check out the documentation for
Model.refresh(), Session.refresh(), and Session.refresh_all()
[added] Tests for the newly changed/added features.
[changed] Tests no longer use flushdb() - all test models/indexes/etc. are
prefixed with RomTest, and we find/delete such keys before and after any
tests are run. Now anyone can reasonably run the test suite.
#--- 0.19

[fixed] Thanks to a bug report by https://github.com/MickeyKim , was
notified
of a bug when using unique indexes, which is now fixed and has a
testcase.
#--- 0.18

[fixed] Thanks to a bug report by https://github.com/MickeyKim , was
notified
and received an interim patch for a bug that could cause deleted
entities
to be resurrected on session.commit() or session.flush() . This has now
been fixed and a testcase has been added.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Can arbitrary code run in a server if someone's know just the MySQL password?

2013-10-02 Thread Ethan Furman

On 10/02/2013 07:46 AM, Νίκος wrote:

Στις 2/10/2013 4:58 μμ, ο/η Ned Batchelder έγραψε:


As others have said in this thread, this is not a Python topic. Find
another forum for this question.  Do not ask it here again.

You've said that you can improve.  Show us by not asking non-Python
questions here.


I must know.


*plonk*
--
https://mail.python.org/mailman/listinfo/python-list


Re: Can arbitrary code run in a server if someone's know just the MySQL password?

2013-10-02 Thread Νίκος Αλεξόπουλος

Στις 2/10/2013 8:39 μμ, ο/η Steven D'Aprano έγραψε:

On Wed, 02 Oct 2013 16:41:40 +0300, Νίκος wrote:


Στις 2/10/2013 4:25 μμ, ο/η Steven D'Aprano έγραψε:

On Wed, 02 Oct 2013 15:20:00 +0300, Νίκος wrote:


Is it possible for someone that knows the MYSQL password of a server
to run arbitrary code on a linux server?


Yes, it is possible.


Is that what might have happened and someone managed to upload the .html
file in '~/home/nikos/www/' ?


How the hell should I know? I am not a MySQL expert, and this is not a
MySQL forum.

Nikos, you embarrass me. I have gone out on a limb for you, and this is
how you thank me? You said you were improving, and yet here you go
completely ignoring the links I sent you, and continuing to ask off-topic
questions here.

Thanks for kicking me in the guts. I will remember this next time you ask
a question.



I just asked your opinion at this.
But i okey i will stop since this is not going us anywhere.

Neither will i replay to any more insulting comments.

--
What is now proved was at first only imagined! & WebHost

--
https://mail.python.org/mailman/listinfo/python-list


Re: JUST GOT HACKED

2013-10-02 Thread Ravi Sahni
On Wed, Oct 2, 2013 at 10:14 PM,   wrote:
> On 10/02/2013 01:02 AM, Ravi Sahni wrote:
>> On Wed, Oct 2, 2013 at 12:19 PM, Ben Finney  
>> wrote:
>>> Antoon Pardon  writes:
>>>
 Op 02-10-13 00:06, Ben Finney schreef:
 > This is an unmoderated forum, so we have occasional spates of
 > persistent nuisances, and those who respond with the maturity level
 > and impulse control of an average six-year-old.
>>> […]

 And what about the impuls control and the maturity of people who can't
 stop answering [a nuisance], knowing they contribute to the nuisance
 to the group?
>>>
>>> Yes, we are in firm agreement here.
>>
>> So Ben,Antoon you are saying that Nikos is a minor problem -- spam-like --
>> Whereas people answering him are a bigger problem??!
>>
>> I find this real confused!! Why they are answering then?!?!
>> As far as I can make out everyone who is answering (helping!) doing it
>> frustratation and disgust.  But still they keep answering and
>> answering!!
>>
>> Makes no sense
>>
>> [Sorry -- old programmer (C,C++ etc) -- new to python. If there is
>> some secret to this list's culture that I missed will be pleased to be
>> educated!]
>
> Actually it does make sense when one thinks of the psychology.
> It is fun to bash other people on the internet.  There are few
> consequences and it makes up for the lack of authority and
> control we experience in our real daily lives.
>
> When someone like Nikos appears and irritates enough people
> to exceed a critical mass, it becomes socially ok to bash
> him and one gets a _Lord of the Flies_ [*1] effect.
>
> Further it is nothing new -- this kind of spiral down
> into chaos and noise of an unmoderated online community
> has been happening since the earliest days of the internet.
>
> For decades a useful way to combat this has been summarized
> in the phase "don't feed the trolls".  But that only works
> when people are able sacrifice their own fun (giving up the
> joy of joining in publicly bashing a scapegoat by simply not
> responding to inflammatory posts) for a common good (a mailing
> list with a good signal-to-noise ratio and non-hostile atmosphere.)
>
> It would seem that enough Python regulars here get enjoyment
> from the current state of affairs that the situation is likely
> to last indefinitely.
>
> The rest of us try to make do by using restraint, filtering and
> alternate forums (Stackoverflow, etc).
>
> 
> [*1] 
> http://www.cliffsnotes.com/literature/l/lord-of-the-flies/lord-of-the-flies-at-a-glance

That (link) is an ugly stupid view of humanness.
Why should I want to piss on you and flame you and shoot you for fun?
I have never met anyone like that and dont believe that anyone is like that.
[We are told about Hitler and Stalin and so on. I have never met them :-) ]
And if you believe everyone is like that -- sorry - please go to
psychatrist -- serious!

Basically I am a software engineer. A engineer believes in right design.
Mess happens with wrong design. Something is making ppl behave crazy.
What is it?  If we are engineers we should do analysis.

No I dont think it is Nikos. I think it is ppl answering nonsense
questions and shouting and keep on answering nonsense with more
nonsense and keep on shouting. Why this crazy behavior?? So far Anton
has given me the best explanaton

-- 
Ravi
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Running code from source that includes extension modules

2013-10-02 Thread Michael Schwarz
On 2013-W40-3, at 19:15, "Gisle Vanem"  wrote:

> "Michael Schwarz"  wrote:
> 
>> So how do I run my code so it will find the built extension module? Do I
>> pass the output directory on the command line manually or is there some
>> other solution? I would like to still be able to run the code from the
>> source directory as I'm using PyCharm to edit and debug the code.
> 
> Doesn't Python on Linux (I assume that since you mentioned the module's .so)
> support having current-dir '.' in $PYTHONPATH? Works fine on Windows.

I'm running OS X 10.8 and Python 3.2, sorry I didn't mention it. But I assume 
the differences to Linux are minimal.

The current directory is included in sys.path, otherwise I wouldn't be able to 
import modules in the same directory. But the problem is that the built 
extension module is in a subdirectory of the "build" directory:

$ find -name '*.so'
./build/lib.macosx-10.8-x86_64-3.2/_foo.so

And so I can't import it without manually adding that directory to sys.path. 
I'm convinced, someone on this list can shout at me, telling me that I got it 
completely backwards and that there's a straightforward and intuitive way to 
develop extension modules!

Michael

smime.p7s
Description: S/MIME cryptographic signature
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Tail recursion to while iteration in 2 easy steps

2013-10-02 Thread Mark Janssen
>> def fact(n): return 1 if n <= 1 else n * fact(n-1)
>>
>> into a tail recursion like
> [...]
>
> How do know that either "<=" or "*" didn't rebind the name "fact" to
> something else? I think that's the main reason why python cannot apply
> any procedural optimization (even things like inlining are impossible,
> or possible only under very conservative assumption, that make it
> worthless).

It's called "operator precedence".

-- 
MarkJ
Tacoma, Washington
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: I haev fixed it

2013-10-02 Thread Denis McMahon
On Wed, 02 Oct 2013 17:07:43 +0100, Mark Lawrence wrote:

> Pardon my ignorance but how does asking for an apology translate into
> threatening legal action, something that I've already stated that I
> won't do for several reasons, the main one of which is that I find these
> threads hilarious?

You're making the sort of demand for an apology that's usually followed 
by a comment such as "or I will sue you for defamation".

Personally I think demanding an apology is a waste of time and ng 
bandwidth, but *shrugs* whatever.

-- 
Denis McMahon, denismfmcma...@gmail.com
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Tail recursion to while iteration in 2 easy steps

2013-10-02 Thread Steven D'Aprano
On Wed, 02 Oct 2013 10:04:49 -0400, random832 wrote:

> On Wed, Oct 2, 2013, at 9:32, Steven D'Aprano wrote:
>> Python is not as aggressively functional as (say) Haskell, but it is
>> surely an exaggeration to suggest that the failure to include tail call
>> optimization means that Python "rejects" functional programming styles.
>> You can still write you code in a functional style, it just won't be as
>> heavily optimized.
> 
> IMO, tail call optimization is essential to writing in a functional
> style, since otherwise you end up with a stack overflow error on any
> input above a trivial size.

Hardly essential. Here's some functional code that doesn't rely on tail-
call optimization for efficiency:

result = map(some_function, some_iterator)

In Python 3 that even uses lazy evaluation, for free.

Or you can increase the amount of memory available in the stack. Another 
alternative would be for the compiler to convert your recursive code into 
iterative code. Well, that wouldn't work for Python.

Not all functional code is recursive, and not all recursive functional 
code is tail-recursive. So while Python's lack of tail-call optimization 
is a failure of Best Practice functional *implementation*, it doesn't 
prevent you from writing in a functional *style*.

Ultimately, Python does not pretend to be a pure-functional language. If 
you want Haskell, you know where to get it. Python steals a few good 
ideas from functional programming, like comprehensions and lazy-evaluated 
iterators, provides a few functional programming constructs like map, 
reduce, and filter, and gives you first-class functions as values. You 
can write code in a functional style in Python, but don't mistake that 
for Python being a functional language.

-- 
Steven
-- 
https://mail.python.org/mailman/listinfo/python-list


  1   2   >