sneekula 969 Nearly a Posting Maven

See also my previous efforts that ultimately did not pan out:
https://www.daniweb.com/software-development/python/threads/488454/raspberry-pi-snake#post2140739

I think Windows7 is swiss cheese when it comes to security holes!

A friend told me that Windows 8.1 is a little more secure?

sneekula 969 Nearly a Posting Maven

Why Did the Chicken Cross the Road?

KINDERGARTEN TEACHER: To get to the other side

PLATO: For the greater good.

ARISTOTLE: It is the nature of chickens to cross roads.

KARL MARX: It was a historical inevitability.

GEORGE W. BUSH: We don't really care why the chicken crossed the road.
We just want to know if the chicken is on our side of the road or not.

PROGRAMMER: It heard that they paid better on the other side.

sneekula 969 Nearly a Posting Maven

According to Einstein the Sun uses up more and more matter, its gravitational pull should lessen and the Earth should move further away.

sneekula 969 Nearly a Posting Maven

I wonder if they ever come back with a good old Western?

sneekula 969 Nearly a Posting Maven

Looking at main.py this program is a nightmare of imports.

https://github.com/PicciMario/iPhone-Backup-Analyzer-2/blob/master/main.py

sneekula 969 Nearly a Posting Maven

@RobertHDD
I tried all your suggestions, but to no avail. PriceLess keeps popping up in the Chrome browser extensions.

I took XFind.exe and searched for the string PriceLess and found it in folder ProgramData, hidden in the Wildtangent games that MS shipped with Windows7. I deleted those silly games.

Then I disabled it in the Chrome extension and so far it stays disabled. When I removed it in the past, it simply came back after a few boots.

It is also found in folder:
ProgramData/Microsoft/Application Virtualization Client/Softgrid Client/sftfs.fsd

That is a huge file and I don't want to mess with it. Let's hope it stays disabled in the Chrome extensions.

sneekula 969 Nearly a Posting Maven

Junkware Removsl Tool found a few things and removed them, but PriceLess popped up again.

sneekula 969 Nearly a Posting Maven
sneekula 969 Nearly a Posting Maven

What is your operating system?

sneekula 969 Nearly a Posting Maven

Can you give an example.

sneekula 969 Nearly a Posting Maven

I got infected right after a Java and Adobe update on my Windows7 machine.
folder \jnihmpibahpjjmcodbopcpdaelkbpjnc is most likely a random generated folder.

Note on malware PriceLess (pops up as Chrome extension, highlights strings for ads):
PriceLess is in folders:
C:\Users\HomeGroupUser$\AppData\Local\Chromatic Browser\User Data\Default\Extensions\jnihmpibahpjjmcodbopcpdaelkbpjnc\5.2
C:\Users\HomeGroupUser$\AppData\Local\Comodo\Dragon\User Data\Default\Extensions\jnihmpibahpjjmcodbopcpdaelkbpjnc\5.2
C:\Users\HomeGroupUser$\AppData\Local\Google\Chrome\User Data\Default\Extensions\jnihmpibahpjjmcodbopcpdaelkbpjnc\5.2
C:\Users\HomeGroupUser$\AppData\Local\Google\Chrome SxS\User Data\Default\Extensions\jnihmpibahpjjmcodbopcpdaelkbpjnc\5.2
C:\Users\HomeGroupUser$\AppData\Local\Torch\User Data\Default\Extensions\jnihmpibahpjjmcodbopcpdaelkbpjnc\5.2
go down to /Extensions each and delete folder \jnihmpibahpjjmcodbopcpdaelkbpjnc

do the same for folders:
C:\Users\Guest\AppData\Local\Chromatic Browser\User Data\Default\Extensions
C:\Users\Guest\AppData\Local\Comodo\Dragon\User Data\Default\Extensions
C:\Guest\AppData\Local\Google\Chrome\User Data\Default\Extensions
C:\Users\Guest\AppData\Local\Google\Chrome SxS\User Data\Default\Extensions
C:\Users\Guest\AppData\Local\Torch\User Data\Default\Extensions

also do the same for folders:
C:\Users\Administrator\AppData\Local\Chromatic Browser\User Data\Default\Extensions
C:\Users\Administrator\AppData\Local\Comodo\Dragon\User Data\Default\Extensions
C:\Users\Administrator\AppData\Local\Google\Chrome\User Data\Default\Extensions
C:\Users\Administrator\AppData\Local\Google\Chrome SxS\User Data\Default\Extensions
C:\Users\Administrator\AppData\Local\Torch\User Data\Default\Extensions

in each case remove folder /jnihmpibahpjjmcodbopcpdaelkbpjnc
contains subfolder /5.2
with files -->
background.html
content.js
lsdb.js
manifest.json --> contains ref to "PriceLess"
r1Iz.js

Do a FindFile search for
*/5.2/r1Iz.js
to make sure you deleted them all

Clear your Recycle Bin

sneekula 969 Nearly a Posting Maven

Just a little faster than isprime2():

def isprime5(n):
    if n == 2 or n == 3: return True
    if n < 2 or n%2 == 0: return False
    if n < 9: return True
    if n%3 == 0: return False
    sqr = int(n**0.5)
    f = 5
    while f <= sqr:
        if n%f == 0: return False
        if n%(f+2) == 0: return False
        # loop every 6th integer
        f += 6
    return True
sneekula 969 Nearly a Posting Maven

What does tu.done() do?

sneekula 969 Nearly a Posting Maven

You may want to add a temporay print(self.rows, len(self.add_programs)) just before line 28 to see if self.rows exceeds length - 1

It alsmost looks like self.add_programs is an empty list at that point.

sneekula 969 Nearly a Posting Maven

On my Raspberry Pi computer I did a search for PIL and matplotlib with
apt-cache search python
but could not find anything close in the list.

Is PIL/Pillow and matplotlib available for Linux and what is it called?

The Raspberry Pi has Python27 and Python32 installed.

sneekula 969 Nearly a Posting Maven

Also take a look at the turtle demo files in
C:\Python34\Lib\turtledemo
for instance

sneekula 969 Nearly a Posting Maven

PyCharm is nice.
You can tell it which Python version to use.

There is a free community edition.

sneekula 969 Nearly a Posting Maven

I wonder how many different Linux distributions there are?
It would be nice to replace the Windows OS.

Appearently only the Windows machines at SONY got hacked. The finance department used Apple OSX machines and was safe.

sneekula 969 Nearly a Posting Maven

Good news, I was able to remove the malware that seems to have come in on a Adobe or Java update.
First go to
http://downloads.malwarebytes.org/file/mbam_clean
this downloads
mbam-clean-2.1.1.1001.exe
close all Windows programs and run it
(this also removes the potentially infected MBAM program)
when this done reboot

Second go to
https://www.malwarebytes.org/antirootkit/
download and install MBAR
mbar-1.08.2.1001.exe
run it, it will scan and show any malware
when done with the scan click cleanup button
(had found a trojan.agent in a hidden folder C:\ProgramData\ )
reboot

sneekula 969 Nearly a Posting Maven

Advice from Microsoft:
Strong passwords are phrases (or sentences) at least eight characters long, longer is better, that include at least three of the following:
uppercase and lowercase letters, numerals, punctuation marks, and symbols.

Give passwords the thought they deserve, and make them memorable. One way is to base them on the title of a favorite song or book, or a familiar slogan or other phrase.

sneekula 969 Nearly a Posting Maven

Aside:
My Windows7 computer got hit by "Browser Hijacker Malware". Google Chrome shows an extension called "PriceLess" that comes back after it has been removed. One of the more obvious signs is that the yahoo sign on does not work. The program Malwarebytes does not find any malware infection, neither does Windows Security Essentials.

Should I blame North Korea for this?

So, tiny Raspberry Pi with its Linux OS to the rescue, at least I can read my e-mail again.

sneekula 969 Nearly a Posting Maven

The average American gains about 4 to 7 pounds between Thanksgiving and Christmas.

http://www.huffingtonpost.com/

sneekula 969 Nearly a Posting Maven

Okay, I got my Raspberry Pi B+ and have the Linux installed and running. Even wrote a few Python programs on the included Idle IDE.

I tried to write a Python program to turn on some of the io pins, but can't find good examples. Most of the web site references are pretty bad or nonexistent.

sneekula 969 Nearly a Posting Maven

To keep the image from being garbage-collected within the function scope, put this line canv2.image = bg_fon2 right after line 22

sneekula 969 Nearly a Posting Maven

For example:

import itertools

s = "a1 a2 a3 a4 a5 a6"
seq = s.split()
print(seq)  # test

for e in itertools.permutations(seq):
    print(" ".join(e))
sneekula 969 Nearly a Posting Maven

The shebang line is of course very useful when you write cross-platform code or in case of
if __name__ == "__main__":
when you write a module and a test for it.

To throw in function main() is a leftover from the C days. C is looking for it to start, Python could care less.

sneekula 969 Nearly a Posting Maven

Generally:

# show prime numbers
# prime numbers are only divisible by unity and themselves
# (1 is not considered a prime number)

for n in range(2, 100):
    for x in range(2, n):
        if n % x == 0:
            # found a factor
            #print(n, 'equals', x, '*', n/x)  # optional
            break
    else:
        # note this else has to line up with second for, not the if
        # means loop fell through without finding a factor
        print(n, 'is a prime number')
sneekula 969 Nearly a Posting Maven

According to your traceback you are using Python2.7

Why not use just constants:

WHITE = (255,255,255)
BLACK = (0,0,0)
RED = (215,45,45)
BLUE = (45,87,214)
YELLOW = (230,223,48)
GREEN = (45,194,64)

sneekula 969 Nearly a Posting Maven

One possibility:

def translate(text, e_s_dict):
    swed = ""
    space = " "
    for word in text.split():
        swed += e_s_dict[word] + space
    return swed


# english:swedish dictionary
e_s_dict = {"merry":"god",
"christmas":"jul",
"and":"och",
"happy":"gott",
"new":"nytt",
"year":"ĂĄr"}

# english text
eng_text = "merry christmas"

# translate to swedish text
swed_text = translate(eng_text, e_s_dict)
print(swed_text)  # result --> god jul

Use meaningful variable names. It will help you understand what is going on.

sneekula 969 Nearly a Posting Maven

What computer language and operating system are you using?

sneekula 969 Nearly a Posting Maven

You can use a while loop (stops/breaks when n is zero):

def generate_n_chars(n, ch):
    s = ""  # start with an empty string
    while n:
        s += ch  # build up the string s
        n -= 1   # decrement n by 1
    return s

# test
ch = 'z'
n = 7
print(generate_n_chars(n, ch))  # result --> zzzzzzz

To see what's going on use a temporary test print():

def generate_n_chars(n, ch):
    s = ""  # start with an empty string
    while n:
        s += ch  # build up the string s
        n -= 1   # decrement n by 1
        print(n, s)  # temporary test print
    return s

# test
ch = 'z'
n = 7
print(generate_n_chars(n, ch))  # result --> zzzzzzz
sneekula 969 Nearly a Posting Maven

Knock knock!
Who's there?
"I am the beginning of the end
and the end of space and time"
Who are you?
"e"

sneekula 969 Nearly a Posting Maven

I had some loose change in my pocket so I ordered myself a Raspberry Pi B+ Ultimate Starter Kit from Amazon.com.

I was reading up on the Raspberry Pi, an interesting little computer with Linux OS and the Python language that costs about $30 - $40. You supply the keyboard and a monitor. It can be used for a myriad of science projects.

sneekula 969 Nearly a Posting Maven

Hint:

mystring = "briyani"
for c in mystring:
    print(c)

# then this should give you the length
length = sum(1 for c in mystring)
print(length)
sneekula 969 Nearly a Posting Maven

The raspberry pi sounds interesting. Could you tell us a little bit more about your personal experience with the device?

sneekula 969 Nearly a Posting Maven

Reminds me a little bit of the algorithm that appears in the Python manual for the decimal module. Check the recipes.

sneekula 969 Nearly a Posting Maven

If you use an IDE like Ninja, then you can switch beteeen different versions of Python by following the tabs:
Edit
Preferences
Execution
then simply edit the Python Path field.
If it shows
C:/Python32/python.exe
replace the 32 with 27

The Ninja IDE is free from:
http://www.ninja-ide.org/

sneekula 969 Nearly a Posting Maven

Write these two batch files and put a shortcut of each on your desk top:

rem save as idle27.bat
rem run the IDLE IDE with Python27
C:\Python27\pythonw.exe -u  C:\Python27\Lib\idlelib\idle.pyw

and

rem save as idle32.bat
rem run the IDLE IDE with Python32
C:\Python32\pythonw.exe -u  C:\Python32\Lib\idlelib\idle.pyw
sneekula 969 Nearly a Posting Maven

Looks like you use the Gregory–Leibniz series which converges rather slowly.
A much faster series is given in the Python manual under the decimal module recipes:

import decimal

def pi_decimal(prec):
    """
    compute Pi to the current precision
    """
    # increase precision for intermediate steps
    decimal.getcontext().prec = prec + 2
    D = decimal.Decimal
    # make starting assignments
    lasts, t, s, n, na, d, da = D(0), D(3), D(3), D(1), D(0), D(0), D(24)
    while s != lasts:
        lasts = s
        n, na = n+na, na+8
        d, da = d+da, da+32
        t = (t * n) / d
        s += t
    # reset to original precision
    decimal.getcontext().prec -= 2
    # unary plus applies the reset precision
    return +s


precision = 60
print("pi calculated to a precision of {}".format(precision))
print(pi_decimal(precision))
print("compare with published pi")
print("3.14159265358979323846264338327950288419716939937510582097494")

'''result ...
pi calculated to a precision of 60
3.14159265358979323846264338327950288419716939937510582097494
compare with published pi
3.14159265358979323846264338327950288419716939937510582097494
'''
sneekula 969 Nearly a Posting Maven

Here is a nice C# tutorial:
http://zetcode.com/lang/csharp/

The Python tutorial:
http://zetcode.com/lang/python/

Might as well look at the Java tutorial too:
http://zetcode.com/lang/java/

ddanbe commented: Nice links! +15
sneekula 969 Nearly a Posting Maven

There is also IronPython that has the look of C# but the easier syntax of Python.
http://www.zetcode.com/tutorials/ironpythontutorial/

Free IronPython download from:
http://ironpython.codeplex.com/
There is a free studio like IDE at:
http://sharpdevelop.codeplex.com/
that can be used for C# and IronPython.

sneekula 969 Nearly a Posting Maven

C# has the best integrated/unified system. However, you will be married to Windows and the NET. Let's not forget that 90% of PCs and laptops in the world are Windows based. The best part is that it produces executable files (.exe).

Python has a hotch potch of IDE's, GUI toolkits, form builders and on top that two often conflicting versions. This can be very confusing to the beginner. Python should be easier to learn since it allows several programming styles and does not force you into OOP from day one, like C# and Java do.

sneekula 969 Nearly a Posting Maven

I am not a Twitterer since I don't want them to violate the privacy of my e-mail contact list.

sneekula 969 Nearly a Posting Maven

Here is an example to get you started:

''' random_sentences101.py

# use this template to add more data
adjectives.append('')
subjects.append('')
verbs.append('')
objects.append('')

'''

import random

# create lists
adjectives = []
subjects = []
verbs = []
objects = []

# add data to the lists
adjectives.append('A small')
subjects.append(' boy')
verbs.append(' walked')
objects.append(' the fence')

adjectives.append('The big')
subjects.append(' trucker')
verbs.append(' climbed')
objects.append(' a tree')

adjectives.append('A tiny')
subjects.append(' frog')
verbs.append(' jumped over')
objects.append(' a log')

adjectives.append('The tardy')
subjects.append(' teacher')
verbs.append(' fell under')
objects.append(' two tables')


# construct n random sentences
n = 5
for k in range(n):
    sentence = random.choice(adjectives)
    sentence += random.choice(subjects)
    sentence += random.choice(verbs)
    sentence += random.choice(objects)

    print(sentence)
sneekula 969 Nearly a Posting Maven

In other words:
b1 = Button(win, Point(3, 5), 5, 2, "Door 1")
b1.activate()
b2 = Button(win, Point(10, 5), 5, 2, "Door 2")
b2.activate()
b3 = Button(win, Point(17, 5), 5, 2, "Door 3")
b3.activate()

sneekula 969 Nearly a Posting Maven

Twitter Inc will begin tracking what third-party apps are installed on users' mobile devices so the social media company can deliver more tailored content, including ads.

Source:
http://news.yahoo.com/twitter-start-tracking-users-mobile-apps-163828964--finance.html

sneekula 969 Nearly a Posting Maven

... and your problem is?

sneekula 969 Nearly a Posting Maven

"If you lie often enough, it becomes the truth."
-- Karl Rove (?)

Has it's origins here:
"A lie told often enough becomes the truth."
-- Vladimir Lenin

sneekula 969 Nearly a Posting Maven

Maybe it's similar to the strange effects I encountered here:

# exploring module pygame
# draw a white ellipse on a black screen and move it
# note: rect behaves strange, stretches the ellipse!!!

import pygame as pg

black = (0, 0, 0)

# window/screen width and height
w = 600
h = 500
# default background is black
screen = pg.display.set_mode((w, h))

# set up some of the ellipse specs
# (r, g, b) tuple --> white
color = (255, 255, 255)
# optional width of the ellipse's border
# if width = 0 (or not given) the shape is filled with color
width = 0

for delta in range(0, 180, 3):
    # (x1, y1, x2, y2) upper left and lower right corner
    # coordinates of the rectangle the ellipse is bound by
    # if the recangle forms a square then a circle is drawn
    x1 = 30+delta
    y1 = 20
    x2 = 130+delta
    y2 = 120
    rect = (x1, y1, x2, y2)
    print(x1, y1, x2, y2)  # test seems okay
    # this erases the old sreen with black
    screen.fill(black)
    pg.draw.ellipse(screen, color, rect, width)
    # update screen
    pg.display.flip()
    milliseconds = 50
    pg.time.delay(milliseconds)

# event loop ...
running = True
while running:
    for event in pg.event.get():
        # quit when window corner x is clicked
        if event.type == pg.QUIT:
            running = False
sneekula 969 Nearly a Posting Maven

The British spy agency the Government Communications Headquarters (GCHQ) has used a sophistcated version of the Regin virus to infect the Belgian telecommunications company Belgacom.

By targeting engineers through a faked LinkedIn page, GCHQ was able to get deep inside the Internet provider to steal data. One of Belgacom's main clients was the European Commission, the European Parliament, and the European Council of member state leaders.

Source:
http://news.yahoo.com/now-know-developed-state-sponsored-180205552.html