Overview:
Because they are often large and complex, GUI programming tool kits can be hard to use. wxPython is a combination of the Python programming language and the wxWidgets toolkit, which allows programmers to create programs with a robust, highly functional graphical user interface, simply and easily. wxPython combines the power of an exceptionally complete user interface toolkit with an exceptionally flexible programming language. The result is a toolkit that is unique in the ease with which complex applications can be built and maintained.
Tuesday, March 23, 2010
Wxpython in Action by Noel Rappin
Diposting oleh RoemahInformatika 0 komentar
Label: EBOOKS
28 Python eBooks
001. [(Start with Python), Rev]
002. [A Byte of Python, Version 1.2.0]
003. [Beginning Python]
004. [Dive into Python, Version 5.4]
005. [Foundations of Python Network Programming]
006. [Game Programming with Python, Lua, and Ruby]
007. [How to Think Like a Computer Scientist Learning with Python]
008. [Jython for Java Programmers]
009. [Learning Python, Second Edition]
010. [Making Use of Python]
011. [Programming Python, Third Edition]
012. [Python and XML]
013. [Python 2.1 Bible]
014. [Python Cookbook, Second Edition]
015. [Python Developer's Handbook]
016. [Python How to Program]
017. [Python in a Nutshell, Second Edition]
018. [Python Phrasebook]
019. [Python Programming for the Absolute Beginner]
020. [Python Programming with the Java Class Libraries A Tutorial for_]
021. [Python Scripting in Computational Science]
022. [Python Standard Library]
023. [Python Tutorial Learning to Program, Version 22 January 2006]
024. [Python]
025. [Text Processing in Python]
026. Python.3rd.Edition.Aug.2006
027. Python.in.a.Nutshell.2nd.Edition.Jul.2006
028. wxPython in Action
Diposting oleh RoemahInformatika 0 komentar
Label: EBOOKS
Python - Port Scanner 1.0 (console)
#! /usr/bin/env python3.1
# 13.09.2009 <> 14.09.2009
# Port Scanner (console)
import sys, threading, socket
class Scan(threading.Thread):
def __init__(self, ip, port):
threading.Thread.__init__(self)
self.ip = ip
self.port = port
def run(self):
result = socket.socket(socket.AF_INET, socket.SOCK_STREAM).connect_ex((self.ip, self.port))
if not result:
print("{}:{}".format(self.ip, str(self.port)))
class PS:
def __init__(self, args):
usage = """\t\t Port Scanner 1.0
\t Usage: PortScanner.py ip_range_or_list port_range_or_list timeout
Where ip_range_or_list is the IP range separated by "::" or the file path to a list with IPs
port_range_or_list is the PORT range separated by "::" or the file path to a list with PORTs
timeout is a digit (seconds)
\t Example: PortScanner.py C:\path\ip_list.txt 135::135 0.1"""
MAX_THREADS = 50
if len(args) in range(3, 5):
try:
print("Please wait ...")
self.update(args[1], args[2], float(args[3]))
for ip in self.ip_generator:
for port in self.port_generator:
while threading.activeCount() > MAX_THREADS:
pass
x = Scan(ip, port)
x.start()
except Exception as message:
print("An error occurred: {}".format(message))
except:
print("Unknown error.")
finally:
x.join()
print("Ready !")
else:
print(usage)
input()
def update(self, ip, port, timeout):
socket.setdefaulttimeout(timeout)
if ip.count("::") == 1:
ip_start, ip_end = ip.split("::")[0], ip.split("::")[1]
a1, b1, c1, d1 = int(ip_start.split(".")[0]), int(ip_start.split(".")[1]), int(ip_start.split(".")[2]), int(ip_start.split(".")[3])
a2, b2, c2, d2 = int(ip_end.split(".")[0]), int(ip_end.split(".")[1]), int(ip_end.split(".")[2]), int(ip_end.split(".")[3])
self.ip_generator = (".".join([str(a), str(b), str(c), str(d)]) for a in range(a1, a2 + 1) for b in range(b1, b2 + 1) for c in range(c1, c2 + 1) for d in range(d1, d2 + 1))
else:
self.ip_generator = (line.strip("\n") for line in open(ip, "r"))
if port.count("::") == 1:
port_start, port_end = int(port.split("::")[0]), int(port.split("::")[1])
self.port_generator = (n for n in range(port_start, port_end + 1))
else:
self.port_generator = (int(line.strip("\n")) for line in open(port, "r"))
if __name__ == "__main__":
PS(sys.argv)
Diposting oleh RoemahInformatika 0 komentar
Label: Code
Title: Software Engineering Software Engineering: A
Practitioner's Approach 6th edition
Author: Roger S. Pressman, Roger Pressman
Publisher: McGraw-Hill Science/Engineering/Math; 6 edition
Media: Books
Format: Paperback
Language: English
Page Count: 880
ISBN-10: 0071238409
ISBN-13: 9780071238403
Diposting oleh RoemahInformatika 0 komentar
Label: EBOOKS
Software Engineering for Modern Web Applications
Description:
As modern organizations migrate from older information architectures to new Web-based systems, the discipline of software engineering is changing both in terms of technologies and methodologies. There is a need to examine this new frontier from both a theoretical and pragmatic perspective, and offer not only a survey of new technologies and methodologies but discussions of the applicability and pros/cons of each.
Software Engineering for Modern Web Applications: Methodologies and Technologies presents current, effective software engineering methods for the design and development of modern Web-based applications, offering scholars, researchers, and practitioners innovative research on the theoretical frameworks, structures, management, and implications software engineering for modern Web applications.
Key Features:
* Introduction and discussion of key web software technical and business issues
* Development and illustration of powerful web software engineering methodologies
* Coverage of full web software lifecycle including design, development, prototyping, testing, component reuse, outsourcing, and
project management
* Implementation examples of concepts introduced
* Comprehensive bibliography of web software engineering resources
Diposting oleh RoemahInformatika 0 komentar
Label: EBOOKS
GPS - Making Your Own Data Cables
Now that you are familiar with the different types of cables that you can combine with your
GPS,it’s time to take a look at how to make some of them.I’ll begin by taking you through the
process of making a data cable.Specifically,this data cable is one for a Garmin eTrex GPS unit.
Materials You Will Need
To successfully build a data cable,you will need the following supplies and tools:
- A suitable connector for your GPS (these are available from www.pfranc.com or
www.lynks.co.uk).
- A cable with a 9-pin D connector on the end—any old serial port cable will do,such as an old
mouse or modem cable.Failing that,you will have to buy a cable).
Soldering iron
- Solder
- Pliers/wire cutters
- Screwdriver (Crosspoint or Phillips)
- Electronic multimeter or circuit tester (if you have a multimeter,it will have an “ohms”
setting—use this for circuit testing).
Cable Assembly You assemble the cable as follows:
1. Take the wire with the 9-pin D connector at one end and cut off any connector at the opposite
end. Cut the outer sheathing off the trimmed end and expose the inner core of wires,as shown in Figure :
2. Strip the ends of the wires,as shown in Figure
3. Using a multimeter,you need to determine which wires corresponds to the data in and
data out and ground pin on the 9-pin connector,as shown in Figure 2-7.To do this,set
the multimeter to “ohms”(the 20 ohms setting will do just fine).Attach one probe to the
bare wire;wrap a length of paper clip around the other probe,and probe the holes in the
connector.Try them in turn;you are looking for a reading of zero,indicating that you
have the right wire for the pin.The pins are as follows:
■ Pin 2:Data out
■ Pin 3:Data in
■ Pin 5:Ground
Carefully note which wires correspond to each pin.If each is colored,make a note ofthis.
4. Trim back all the unneeded wires and cut the wires from pins 2,3,and 5 to a length of
approximately 1 inch (25 mm).Trim the sheath from these wires back about 1 ⁄4 of an
inch (6 mm),as shown in Figure.
5. Now take a look at the pFranc eTrex connector shown in Figure .Notice that it has
four pins.The pins are numbered 1,2,3,and 4,with pin number 1 being the pin furthest
away from the cable.The pins are as follows:
■ Pin 1:Power supply (+)
■ Pin 2:RXD (data in)
■ Pin 3:TXD (data out)
■ Pin 4:GND (-)
6. Time to begin assembly of the pFranc connector.The connector includes five parts:
■ Three plastic parts that make up the connector assembly
■ One metal screw
■ One strip of metal that has the four or eight pins attached to it (depending on the kit you receive),as shown in Figure.
7. Carefully break off the pins (you only need three if you are making a data cable) from the
sheet of metal by bending them off the metal strip.Take care and you will end up with
four pins.
8. After breaking the pins free from the metal strip,bend them to 90 degrees as shown in
below Figure .
9. Now it’s time to solder the wires to the pins.At this stage,it doesn’t matter which pins
the wires are soldered to because you can rearrange them as necessary later.
After soldering,gently push each pin,one at a time,through the hole in the plastic piece
with the large rectangle opening,as shown in Figure .
10. Now you are ready to place the pins in the proper position in the plastic holder (the base
of the connector).The proper assembly is as follows:
■ The wire corresponding to pin 2 (data out on the 9-pin D connector) connects to
pin 3 (data out) on the GPS connector.
■ The wire corresponding to pin 3 (data in on the 9-pin D connector) connects to
pin 2 (data in) on the GPS connector.
■ The wire corresponding to pin 5 (ground on the 9-pin D connector) connects to
pin 4 (ground) on the GPS connector.
The fourth pin is only required if you are making a power cable or a combo cable. If you’re connecting to a 25-pin DB-25 connector, swap over pins 2 and 3 at the PC connector.
A clever way to hold the pins in place while assembling the connector is to use a piece ofwire (or a needle) through the loops of the pins to hold them in place,as shown in this Figure .This is the best hands-free way I’ve found of doing this. Remember to remove the wire after assembly.
Bring the two parts of the connector together and then place the plastic hood on theconnector. Make sure that all the cables seat properly and there is no chance ofshort-circuiting.Then add the screw and close the connector,as shown in Figure. Remove the pin,needle,or wire used to hold the pins in place and the connector is finished
Testing
You should always test your cables before first use to ensure that there are no short circuits or
bad connections.Use a multimeter to do this,as shown in Figure. Make sure that each
pin on the GPS connector corresponds to the appropriate pin on the 9-pin connector.Also
ensure there are no short circuits to any other pins. Refer to your multimeter’s user manual for details on how to operate it.
Diposting oleh RoemahInformatika 0 komentar
Label: Tips
Allocating Memory and Storing Data
One reason programmers use Windows API calls is to work with a lot of memory, and you can use the GlobalAlloc (allocate memory), GlobalLock (lock the memory and get a pointer to it), GlobalUnlock (unlock the memory), and GlobalFree (deallocate the memory) functions for that. We’ll take a look at the first two of these
functions in this topic, and the last two in the following topic. We’ll also see how to copy data into and out of our newly allocated memory with the MoveMemory function.
Here’s how you use GlobalAlloc to allocate memory; this function returns a non-zero handle to the memory if successful:
Function GlobalAlloc Lib "kernel32" (ByVal wFlags As Long, ByVal dwBytes As Long) As Long
You set the flags you want to use in wFlags, and the number of memory bytes you want in dwBytes. Here are the possible flags to use with GlobalAlloc:
GMEM_FIXED—&H0
GMEM_MOVEABLE—&H2
GMEM_NOCOMPACT—&H10
GMEM_NODISCARD—&H20
GMEM_ZEROINIT—&H40
GMEM_MODIFY—&H80
GMEM_DISCARDABLE—&H100
GMEM_NOT_BANKED—&H1000
GMEM_SHARE—&H2000
GMEM_DDESHARE—&H2000
GMEM_NOTIFY—&H4000
GMEM_LOWER—GMEM_NOT_BANK
GMEM_VALID_FLAGS—&H7F72
GMEM_INVALID_HANDLE—&H8000
To get a pointer to the memory and so put it to use, you use GlobalLock, passing it the memory
from GlobalAlloc. GlobalLock returns a non-zero pointer to the memory if successful:
Function GlobalLock Lib "kernel32" (ByVal hMem As Long) As Long
Besides GlobalAlloc and GlobalLock, you can move data into the memory you’ve allocated with MoveMemory:
Here are what the arguments to MoveMemory mean:
• dest—Pointer to the destination buffer
• src—Pointer to the source buffer
• length—Number of bytes to move
Let’s see an example. Here, we’ll store a string of text that the user types into a text box in memory; in the next topic in this chapter, we’ll read that string back. This example will give us a good general overview of working with memory and memory buffers.
We start by setting up a 40-character-long buffer for the string to store in the form’s (General) declarations section:
Const DataLength = 40
Dim outbuffer As String * DataLength
...
We also declare the memory handle and pointer we’ll use:
Const DataLength = 40
Dim outbuffer As String * DataLength
Dim hMemory As Long
Dim hMemoryPointer As Long
Finally, we declare the functions we’ll use, GlobalAlloc, GlobalLock, and MoveMemory, as well as the memory flag we’ll use, GMEM_MOVEABLE, which means that Windows can move the memory we are using if it needs to as part of its memory-handling operations:
Const DataLength = 40
Dim outbuffer As String * DataLength
Dim hMemory As Long
Dim hMemoryPointer As Long
Private Declare Function GlobalAlloc Lib "kernel32" (ByVal wFlags As_
Long, ByVal dwBytes As Long) As Long
rivate Declare Function GlobalLock Lib "kernel32" (ByVal hMem As Long) _
As Long
Private Declare Sub MoveMemory Lib "kernel32" Alias "RtlMoveMemory" _
(ByVal dest As Any, ByVal src As Any, ByVal length As Long)
Const GMEM_MOVEABLE = &H2
When the user clicks a command button, Command1, we will allocate and lock the memory, and store the text string now in Text1 in it. We start by storing the text from the text box in the buffer we’ve named outbuffer:
Private Sub Command1_Click()
outbuffer = Text1.Text
...
Next, we use GlobalAlloc to allocate the memory we’ll use:
Private Sub Command1_Click()
outbuffer = Text1.Text
hMemory = GlobalAlloc(GMEM_MOVEABLE, DataLength)
Next, we pass the memory handle from GlobalAlloc to GlobalLock to get a pointer to the memory we’ve allocated:
Private Sub Command1_Click()
outbuffer = Text1.Text
hMemory = GlobalAlloc(GMEM_MOVEABLE, DataLength)
hMemoryPointer = GlobalLock(hMemory)
Finally, we copy the data from our buffer to our newly allocated memory with MoveMemory (note that because MoveMemory is a subroutine, we use the Call keyword instead of assigning a return value to a variable):
Private Sub Command1_Click()
outbuffer = Text1.Text
hMemory = GlobalAlloc(GMEM_MOVEABLE, DataLength)
hMemoryPointer = GlobalLock(hMemory)
Call MoveMemory(hMemoryPointer, outbuffer, DataLength)
End Sub
And that’s it—when the user clicks Command1, we copy the text string to our allocated memory.
We’ve stored data in allocated memory now—how do we read it back? We’ll take a look at that in the next topic.
Diposting oleh RoemahInformatika 0 komentar
Label: Code