SoulMazer 26 Posting Whiz in Training

If you're just doing this for yourself and are not too concerned about efficiency, this should suffice:

from socket import * 

if __name__ == '__main__':
	target = "localhost"
	targetIP = gethostbyname(target)
	print 'Starting scan on host ', targetIP

	#scan reserved ports
	for i in range(20, 1025):
		s = socket(AF_INET, SOCK_STREAM)

		result = s.connect_ex((targetIP, i))

		if(result == 0) :
			print 'Port %d: OPEN' % (i,)
		s.close()

You could always consult Wikipedia's reserved port list to tell what service a user is most likely running.

Also, if you are interested in efficiency (by means of threading), just post back and I'll give you some more code.

SoulMazer 26 Posting Whiz in Training

Thanks for the great suggestions! I will have to try those things out.

SoulMazer 26 Posting Whiz in Training

Thanks for all the great feedback, I think I'll be rewriting my GUI with wxPython now.

Thanks again.

SoulMazer 26 Posting Whiz in Training

@vegaseat: I plan to make this a very flexible music player, and I wish to make it quickly handle as many songs as possible. I try to use myself as an example, and I have at least 12,000 songs, so I think that might be out of the question.

@langsor: Thanks for the suggestion, I think I will have to go with sqlite and store the path of the song, the name, the artist, etc. in the database.

Thanks for your comments.

SoulMazer 26 Posting Whiz in Training

Hah you seem very enthusiastic about wxPython! Would you highly recommend it over PyQT? I have heard both are highly recommended but I'm not quite sure which to choose. And to answer your questions: it is open source, it uses Snack for music playing, and I plan to add video playback in the near future.

Also, I love constructive criticism, so if you have any ideas/concerns please feel free to say them.

Thanks again.

SoulMazer 26 Posting Whiz in Training

Sorry, I'm currently using Tkinter.

And what would you recommend as a better color scheme?

SoulMazer 26 Posting Whiz in Training

Hello, I'm writing a music player and I'm having trouble with one of the most important concepts of it: remembering songs you add to your "Library". The main draw of my music play is being quick and efficient at everything, and keeping that in mind, what would be the best way to store the user's library? A local database? A simple text file?

Thanks in advance.

SoulMazer 26 Posting Whiz in Training

Okay, being a Linux guy, I absolutely hate it when applications are not cross-platform (Windows only). So, I decided to write myself a cross-platform media player. I have spent quite the bit of time making it look great on Linux, but I am unable to do the same on Windows since it does not allow custom scrollbar colors, menubar colors, etc.

Here are some pictures for some visual data:
On Linux...
On Windows

So, my question is this: is there any toolkit or any way I can create a COMPLETELY custom window? As in no title-bar and no "X" to close the application? Is this possible?

Thanks in advance.

(I thought you would appreciate the Eagles screenshot Paul)

SoulMazer 26 Posting Whiz in Training

In Linux you have to use an "@" sign in front of the filename, but
root.wm_iconbitmap('@'+fname)
yields an "error reading bitmap file". I opened it in GIMP and it is fine, and tried ico, gif, and bmp with the same results. This is something that is not critical but we should know the solution, so I'll look some more tonight, and perhaps someone else has ideas as well.

Edit: Apparently it has to be an xbm image. I used ImageMagick's convert (convert ./fname.gif ./fname.xbm or do a 'man convert') to change a gif to an xbm an it worked fine with the '@' in front of the file name.

Well, what you said worked woooee. The xbm image did it. If you discover anything else, I'll make sure to keep watching this thread. But why does the "@" sign in front of the filename matter? I have never seen this before.

SoulMazer 26 Posting Whiz in Training

Okay, thanks for backing up my idea. Could you comment on this oh great vegaseat? Moderators seem to have much more leverage.

SoulMazer 26 Posting Whiz in Training

@snipp: It didn't find the icon. Here's an "ls" to prove that the icon is in fact there.

$ ls /home/foo/Desktop | grep snowman
snowman.ico

@vegaseat: Thanks, but that didn't work either.

Could this be a Tk bug? Because I know I am not screwing anything up that we have discussed so far.

EDIT: And if you didn't read the edit on my other post, this DID work on Windows but it does not on Linux.

Thanks again.

SoulMazer 26 Posting Whiz in Training

Well, I am positive the file is in the correct directory. (The icon is "CAKE.ico" and the script is "CAKE.py"):

~/Documents/pyscripts/CAKE/Dev/trunk$ ls
CAKE.ico CAKE.py

Also, I am saving the .ico file via GIMP; I am positive it is an .ico file, but it also gives me specific options:

1 bpp, 1-bit alpha, 2-slow palette
4 bpp, 1-bit alpha, 16-slow palette
8 bpp, 1-bit alpha, 256-slow palette
24 bpp, 1-bit alpha, no palette
32 bpp, 8-bit alpha, no palette

Does it matter which one I choose?

@Dan: It is both in the same working directory AND I am also using the full path.

Thanks again.

EDIT: Also, it must not be the icon's problem, as I downloaded some .ico file from the web and still nothing.
EDIT 2: Well, I just tried this out on my Windows VM and have come to the conclusion that it works on Windows and not on Linux (using the same icon). Any ideas?

SoulMazer 26 Posting Whiz in Training

I'm trying to bind a Tkinter widget to a method in another file. I'm not quite sure how to do this, but let me show you what I have so far.

#!/usr/bin/python
# File1.py

from Tkinter import *
import File2

class MyFile:
    def __init__(self):
        master = Tk()
        
        obj = File2.DoStuff(master)
        obj.pack()
        
        master.mainloop()
        
    def entryClick(self):
        print "I was clicked!"
        
myclass = MyFile()
#!/usr/bin/python
# File2.py

from Tkinter import *

class DoStuff(Frame):
    def __init__(self, master):
        Frame.__init__(self, master)
        frame = Frame(self); frame.pack(side=LEFT, expand=YES, fill=BOTH)
        myEntry = Entry(frame)
        myEntry.pack()
        #myEntry.bind('<Button-1>', ?)  # I want to bind this to the entryClick method of File1

As you can see in line 12 of File2, I am trying to bind a click inside the widget to the "entryClick" method in File1. How can I do this?

Thanks in advance.

SoulMazer 26 Posting Whiz in Training

Hi, I'm trying to add an icon to my Tkinter GUI window and have had no luck. After some searching, I came up with the same piece of code which does not work.

Here is a snippet of my code:

from Tkinter import *

root = Tk()
root.minsize(290, 700)
root.title("My Window")
root.wm_iconbitmap('MyIcon.ico')
root.mainloop()

The traceback:

File "/usr/lib/python2.6/lib-tk/Tkinter.py", line 1525, in wm_iconbitmap
return self.tk.call('wm', 'iconbitmap', self._w, bitmap)
_tkinter.TclError: bitmap "MyIcon.ico" not defined

What can I do to change that danged icon?

Thanks in advance.

SoulMazer 26 Posting Whiz in Training

@paul: Sorry for the late reply, I fell asleep at the keyboard. Anyways, thanks for the reply. That's exactly what I wanted.

@rehber: Okay, well I implemented Paul's idea and now I have it working flawlessly. Here's the full working code if you want it.

#!/usr/bin/python

from os import walk
from os.path import join
from os.path import splitext

class Indexer:
    def __init__(self, targetDir):
        self.allFiles = {}
        for base, directoryList, fileList in walk(targetDir):
            if fileList != []:
                for file in fileList:
                    for acceptedEnding in [".mp3", ".wav"]:
                        if splitext(file)[1] == acceptedEnding:
                            file = file.replace(acceptedEnding, "")
                            fullPath = join(base, file)
                            pathParts = fullPath.split("/")
                            artist = pathParts[-3]
                            album = pathParts[-2]
                            self.allFiles[file] = (fullPath, artist, album)
    def returnFiles(self):
        return self.allFiles
    
myIndexer = Indexer("/home/pat/Music")
allSongs = myIndexer.returnFiles()

for song in allSongs:
    print "Song name =", song
    print "Song path =", allSongs[song][0]
    print "Artist name =", allSongs[song][1]
    print "Album name =", allSongs[song][2]
    print

Thanks again Paul.

SoulMazer 26 Posting Whiz in Training

Okay, well I have to say I am completely stumped where to go from here. I am writing a media player and I am currently working on song indexing. I have figured out how to extract the song name and its complete path using os.walk(); however, I have no idea how I would find the artist or album of the song. I have an idea, but let me show you my code first.

#!/usr/bin/python

from os import walk
from os.path import join
from os.path import splitext

class Indexer:
    def __init__(self):
        self.allFiles = {}
        for base, directoryList, fileList in walk("/home/foo/Music"):
            if fileList != []: #Make sure the entry isn't empty
                for file in fileList:
                    for acceptedEnding in [".mp3", ".wav"]:
                        if splitext(file)[1] == acceptedEnding:
                            fullPath = join(base, file)
                            self.allFiles[file] = fullPath
    def returnFiles(self):
        return self.allFiles
    
myIndexer = Indexer()
fileDict = myIndexer.returnFiles()

So let me give a possible idea if anybody could tell me how to do this. Let's say you have a directory such as so: "/home/foo/Music/". Generally, songs by "The Eagles" in the album "Hell Freezes Over" would be located in the directory "/home/foo/Music/The Eagles/Hell Freezes Over/<songname>". How could I extract the "/The Eagles/Hell Freezes Over" part in order to get the artist and album?

Or if anybody has a better/more efficient method, that would be great!

Thanks in advance.

EDIT: I am of course still learning, and I noticed that my code is not quite easy on the eyes. Any ideas how I could improve its …

SoulMazer 26 Posting Whiz in Training

Hi, so as an excuse to learn Java (I currently only know Python), I would like to write a simple 2D web-based game. How would you recommend me doing this? Should I write the entire game from the ground up? Should I use a game engine?

If you would like me to be more specific, I would like to rewrite the classic old game "Block Dude" (introducted on the TI-83 calculator). You can find an example of what I would like to do here.

Thanks in advance.

SoulMazer 26 Posting Whiz in Training

Thanks peter, you solved my immediate problem. However, thank you stephen for the amazingly informative post. I'll definitely have to go over the style guides you linked me to.

Anyways, when I try a "javac -version", I am informed that I am running the "Eclipse Java Compiler 0.894_R34x, 3.4.2 release". Would you recommend that I use a different compiler? If so, how would I go about doing that. Also, would you recommend that I compile/run my code from within an IDE (like Eclipse, Netbeans) or do it manually for now?

Thanks again.

SoulMazer 26 Posting Whiz in Training

Okay, thanks for the suggestions. First of all, I actually am using the javac compiler. But let me just show you some terminal output that might help.

pat:~/Desktop/java$ls
test2.java
pat:~/Desktop/java$javac test2.java
pat:~/Desktop/java$ls
Hello.class test2.class test2.java
pat:~/Desktop/java$java test2.class
<error>

Thanks again.

SoulMazer 26 Posting Whiz in Training

So...I have just begun to whet my appetite for Java today, and I have already run into a stumbling block. When I put my code in a .java file and compile it (via javac), I receive no errors. However, when I actually run my script, I receive quite the nasty error which I seem to not be able to comprehend. The error is as follows:

Exception in thread "main" java.lang.NoClassDefFoundError: test2.class
at gnu.java.lang.MainThread.run(libgcj.so.90)
Caused by: java.lang.ClassNotFoundException: test2.class not found in gnu.gcj.runtime.SystemClassLoader{urls=[file:./], parent=gnu.gcj.runtime.ExtensionClassLoader{urls=[], parent=null}}
at java.net.URLClassLoader.findClass(libgcj.so.90)
at gnu.gcj.runtime.SystemClassLoader.findClass(libgcj.so.90)
at java.lang.ClassLoader.loadClass(libgcj.so.90)
at java.lang.ClassLoader.loadClass(libgcj.so.90)
at gnu.java.lang.MainThread.run(libgcj.so.90)

Probably the weirdest thing about this error is the fact that I only receive it when I run it via the terminal. If I run it via my IDE (Eclipse), I get no error! What's the deal here?

By the way, he is my code:

public class test2 {
	public static void main(String[] args) {
		Hello h = new Hello();
		h.hi();
	}

}

class Hello {
	void hi() {
		System.out.println("Hello");
	}
}

Thank you very much in advance.

SoulMazer 26 Posting Whiz in Training

Hi, I'm mostly a Python programmer but I now want to move to more web-based applications. What languages would you guys recommend for creating online games/applications? I already have a few Java books as I have been itching to learn it; would it be a good choice for web development? Or should I try HTML 5?

Thanks for any feedback.

SoulMazer 26 Posting Whiz in Training

Thanks for all the information, except they all deal only with keys, not the mouse (PyMouse, from what I have seen, only creates mouse-clicks and the like, but it does not detect them).

I have however worked out a type of solution. I used xbindkeys for it, instead of the python-xlib library. I guess my problem is solved now!

Thank you for your suggestions everybody.

SoulMazer 26 Posting Whiz in Training

@woooee: Thanks for the code. However, it gives me the following error:

X protocol error:
<class 'Xlib.error.BadAccess'>: code = 10, resource_id = 117, sequence_number = 7, major_opcode = 2, minor_opcode = 0

With a search from Google, I have come up with almost nothing. The closest thing I could find is that the "hotkey" I am using is already bound with something? I'm not quite sure. A 'ps -e | grep X' reveals nothing that should be already consuming hotkeys.

@vegaseat: You might be looking for something like this.

@scru: Correct me if I'm wrong, but it seems you intended to include a link or something but didn't.

Thanks again.

SoulMazer 26 Posting Whiz in Training

Okay, well I've been looking for at least an hour now for some straight-forward python-xlib documentation, and I have been unable to find any. Luckily...I have quite the easy problem.

If somebody would be able to help me create a simple script that would say "Hello" every time the left mouse button is clicked, I have the rest of what I would like to do figured out

This is what I have so far, to no avail:

#!/usr/bin/python

import Xlib
import Xlib.display

def main():
    display = Xlib.display.Display()
    root = display.screen().root
    while True:
        event = root.display.next_event()
        if event:
            print "Hello"

if __name__ == "__main__":
    main()

Thank you so much in advance.

SoulMazer 26 Posting Whiz in Training

Well, the solution was much simpler than I thought. After reading this page ("[apply] is called automatically to process the data, *after* the dialog is destroyed"), I did not know that you could simple call the apply method again via the class instance.

Thank you very much for the response. Problem solved.

SoulMazer 26 Posting Whiz in Training

Well, my mistake, vegaseat was correct. I got confused as the "print d" statement printed out only the "c" variable so I assumed that it was only set to "c". What?! Python...not-intuitive? That's a first!

Thank you for the correction vegaseat.

SoulMazer 26 Posting Whiz in Training

Okay, when you are prompted, type nothing, and just press enter, the variable is set to the following: ""

As for the reason why your code doesn't work:

The line "d = (a and b and c)" is actually doing the following:

d = a
d = b
d = c

So, it is overwriting the value of d three times. Unless I am mistaken, this is not what you want. This is more like what you want (this is the "long way")

a = raw_input("Enter your first name:")
b = raw_input("Enter your last name:")
c = raw_input("Enter your phone number:")

if a == "":
	print "You did not give your first name."
if b == "":
	print "You did not give your last name."
if c == "":
	print "You did not give your last name."

print "Thank you!"

Post back if you have any more questions.

SoulMazer 26 Posting Whiz in Training

Okay, well I'm having trouble getting a variable from one place to the other. I have two scripts: for now, let's call them MainScript.py and ChildScript.py.

#!/usr/bin/python
# MainScript.py

import ChildScript
from Tkinter import *

class GetVariable:
   def __init__(self):
      master = Tk()
      master.withdraw()

      ChildScript.VariableDialog(master)
      
      # From right here, I would like to be able to print the value of 'buttonstatus'.
      
myapp = GetVariable()
#!/usr/bin/python
# ChildScript.py

import tkSimpleDialog
from Tkinter import *

class VariableDialog(tkSimpleDialog.Dialog):
   def body(self, master):
      self.status = IntVar()
      Checkbutton(master, text="Variable", variable=self.status).grid(row=1)
      
   def apply(self):
      buttonstatus = self.status.get()
      
      # Now, I have the status of the checkbutton locally.
      # How can I get it to the MainScript script?

However, I would like to do all of this without any globals. I resent them!

Thank you in advance.

SoulMazer 26 Posting Whiz in Training

"victory" is a variable that is set to "True" if the user guesses the number or "False" if they do not. At the end of the script, the last two lines check what "victory" is. If it is False (they have not guessed the number), it prints that statement.

If you want the script to also tell you what the number was, add this line right after "print "Sorry, you didn't guess the number."".

print "The number was", number

As for the line "for x in range(0,7)"...think of it this way. For every number between 0 and 7 (there are 7 of them)....it will call the following code. So: it calls that part of the code (called a block) seven times!

SoulMazer 26 Posting Whiz in Training

Try this:

import random

number=random.randint(1,100)
victory = False

for x in range(0,7):
    guess=input("please enter your guess: ")
    if guess<number:
        print "too low"
    if guess>number:
        print"too high"
    if guess == number:
        print "Correct!"
        victory = True

if victory == False: #If they didn't guess the number by the end...
    print "Sorry, you didn't guess the number."

If you need any more help, feel free to post back.

SoulMazer 26 Posting Whiz in Training

Thanks for the solutions guys. They solved my problem.

SoulMazer 26 Posting Whiz in Training

So, I have a script that needs to "clean up" when it is exited: it needs to clear a special logging file and other small things that affect the next startup of the script. The script has a GUI written in Tkinter, if that is relevant at all.

Is there any way to run some "cleanup code" regardless of how the script is exited?

Thanks in advance.

SoulMazer 26 Posting Whiz in Training

Okay, well I just got it working on Windows also. I have discovered that I can get the process id the same way as in Linux, os.getpid(). I used the following piece of code to actually end the process:

subprocess.Popen("taskkill /F /T /PID %i"% pid , shell=True)
SoulMazer 26 Posting Whiz in Training

Okay, well after some testing around I got the first one to work flawlessly. I'm only going to be running the Windows version of my script through Cygwin, so I'm not sure if that supports the same PID system as Linux, but I'll post back when I know more.

Thank you so much!

SoulMazer 26 Posting Whiz in Training

Okay, so I'm having a little trouble. Let's say I run "scriptA.py" and it has a GUI (Tkinter) and it is running in its mainloop. I want to create a "scriptB.py" that can end "scriptA.py"; would there be a way to do this regardless of the OS it is on (as in no Windows-only or Linux-only solutions please)?

Thanks in advance.

SoulMazer 26 Posting Whiz in Training

Okay, well after about an hour of finding nothing, I worked out a perfect solution. So, it turns out that there is a part of the xlib that Tech B mentioned named "xbindkeys". After installing it, you can configure hotkeys in your .xbindkeysrc file and have the system run the file of your choice upon pressing a hotkey: this is exactly what I wanted.

Thanks for the ideas guys. Problem solved.

SoulMazer 26 Posting Whiz in Training

Okay, thanks for the idea/link. But is there any way at all I could make this compatible with Linux?

SoulMazer 26 Posting Whiz in Training

Okay, so I am writing a media player and I would like to be able to control the entire thing without the use of a GUI. So...are there any libraries or anything that would allow me to collect keystrokes on any OS (not just Windows)?

Thanks in advance.

SoulMazer 26 Posting Whiz in Training

Okay, I would like to start by say I'm sorry if this forum has a strict "no-bump after x days" etiquette, but I found a solution to my problem and I thought I would share. Although I did successfully have the latest JRE installed, I guess I didn't have a Java plugin installed for my browser. Being on Linux, I have no idea why my package manager would install only the JRE and not the browser plugin...oh well.

SoulMazer 26 Posting Whiz in Training

Hi, I'm looking for a little help with the function "getattr". Here's my code:

class MyClass:
      def __init__(self):
            trycmd = getattr(self, "cmd_testing")
            try:
                  trycmd()
            except:
                  print "Fail."
                  
      def cmd_testing(self):
            print "Victory!"
            
obj = MyClass()

So, when I run this code, I get the output "Fail.". I'm not sure what I'm doing wrong, but as I have tested a little more, I have come to the conclusion that it is not finding the right method (cmd_testing). How can I make this work?

Thanks in advance.

EDIT: My bad, I found out I did a really stupid mistake. I forgot the "None" argument when I set the "trycmd" variable. Problem resolved.

SoulMazer 26 Posting Whiz in Training

That's perfect! Ok, my problem's solved. Thank you very much.

SoulMazer 26 Posting Whiz in Training

@Gribouillis: I tried the code you gave me, except I receive an error about an unexpected tag:

HTMLParser.HTMLParseError: bad end tag: u"</SCR');\ndocument.write('IPT>"
...blah...
File "/usr/lib/python2.6/HTMLParser.py", line 115, in error
raise HTMLParseError(message, self.getpos())

Since the source of the HTML page is too long to post, just view the page source via your browser: http://www.xfire.com/friends/soulmazer/.

@paulthom: Well, I would prefer to just parse it myself, as the example I gave is less confusing than what I am actually trying to accomplish (get information from a profile). Except, how could I get the unparsed HTML of a web page via a script?

SoulMazer 26 Posting Whiz in Training

Instead of hi-jacking a thread, please make a new one. But are there still no answers for my problem.

Sorry, I had a brain fart. My first post said you should change the file to a .pyc (WRONG), you should make it a ".pyw" as jice said.

To do this, just save the file as a .pyw file instead of a .py from whatever text editor you are using and it should work.

Alternatively, you could use the "withdraw()" method of your root window. Example:

import Tkinter
root = Tk()
root.withdraw()
SoulMazer 26 Posting Whiz in Training

Don't want to hijack this but I'm interested in compiling a tkinter gui app with py2exe -- the catch -- I'm using python 3.1.1 or whatever the latest version is.

I only see py2exe up until 2.6/7?

I used cxfreeze, and it gave me a .exe file... however when I open the .exe file it just displays a console window for about 1/10 of a second and then closes. I think it has something to do with tkinter because when I used cxfreeze on a plain old user input, then print user input program it worked fine.

Should I just make my code in 2.6 or is there a better solution for converting a tkinter gui app into a .exe?

I don't think Tkinter is your problem, the fact that you are using Python 3.x is the problem. As far as I know, py2exe is not compatible with Python 3.0x. I would probably just convert all my code to 2.6/7 for the time being if I were you.

SoulMazer 26 Posting Whiz in Training

You have two options.

1. Save the file as a .pyc instead of a .py.
2. Try "root.withdraw()". (replace root with whatever you named your root widget)

Or you could compile it with py2exe if you want to get fancy and Windows only. (if you choose this option, let me know, there's an extra step)

SoulMazer 26 Posting Whiz in Training

So, I have a rather simple question today. I'll try to explain it by using an example. Let's say there is a line of HTML in the page "www.mywebsite.com/py" that says "<tr colData0='Friday'>". However, this line of code can change to be "Sunday", "Tuesday", etc. What would be the easiest way for me to extract the data (Monday, Wednesday, etc.) from that line of code via a Python script?

Thanks in advance.

SoulMazer 26 Posting Whiz in Training

Ok, well it's rather hard for me to test as whenever I visit the page with my applet on it, my browser crashes (so all I know is that it doesn't work).

And both my .class file and my .html file are already in the same directory. I have also added a "codebase" element to my applet tag.

Updated code:

<HTML>
<HEAD>
<TITLE>Test Applet</TITLE>
</HEAD>
<BODY>
<applet codebase="/" code="TestApplet.class" width="300" height ="300">
</applet>
</BODY>
</HTML>

Thanks for all the great help. But have any more ideas?

SoulMazer 26 Posting Whiz in Training

1. Yes, Java is enabled.
2. Both of the files have read/write/execute access.
3. Sorry, could you explain this a little bit?
4. No, I received no error messages in Linux or Windows.

If you would like to see this for yourself, (in no way am I advertising my website) you can see it here: http://patbriggs.net/mytest.html

Thanks for the ideas.

SoulMazer 26 Posting Whiz in Training

Thanks for the link, except that example is not even working. I copied and pasted the code verbatim and I still get a little gray box of nothing.

Thanks again.

EDIT: Well, this is odd. I am able to view my applet within an IDE but not through a browser (Firefox 3.5). Any ideas to why this is?

SoulMazer 26 Posting Whiz in Training

Ok, well I am JUST beginning to learn Java, and I have run into a little stumbling block. I am attempting to write a little applet, but it doesn't seem to want to run.

My Java code:

import java.awt.*;
import java.applet.*;

public class TestApplet extends Applet {
	public void paint(Graphics g) {
			g.drawString("Please work my little applet!", 20, 30);
	}
}

My HTML:

<HTML>
<HEAD><TITLE>Test Applet</TITLE></HEAD>
<BODY>
<applet code="TestApplet.class" width="300" height ="300">
</BODY>
</HTML>

So...I'm not quite sure where I am going wrong. I receive no errors while compiling and there isn't much code for me to mess up.

Could anybody help me with this problem?

Thanks in advance.