myspace falling objects codes
Sponsored Links
Sponsored Links
Secleted [ 0 ] software to compare
Results 1 - 15 of about 7237
MySpace Data Mining Tools 1.1
MySpace Data Mining Tools are a set of Java classes designed to mine information from MySpace profile and blog pages. more>>
MySpace Data Mining Tools are a set of Java classes designed to mine information from MySpace profile and blog pages using a multi-threaded Web page access method.
Enhancements:
- Direct database connectivity via JDBC was implemented for data storage.
- A basic user profile class was created to handle both user data compression and database access.
- Minor bugs were fixed for some of the raw data accessing routines.
<<lessEnhancements:
- Direct database connectivity via JDBC was implemented for data storage.
- A basic user profile class was created to handle both user data compression and database access.
- Minor bugs were fixed for some of the raw data accessing routines.
Download (0.035MB)
Added: 2006-07-30 License: GPL (GNU General Public License) Price:
1191 downloads
Database of Managed Objects 2.4 Beta
DMO stands for Database of Managed Objects. more>>
DMO stands for "Database of Managed Objects." This is a tool for documenting all objects within a data center.
Database of Managed Objects provides an object-based overlay on a MySQL database, with a Web-based interface, which allows new objects to be defined in a hierarchy.
Each object can have attributes defined, which are inherited by objects below in the hierarchy. Information can be imported in CSV or XML format, and reports can be produced in XML, CSV, PDF and HTML formats.
DMO uses PHP and MySQL to support documentation of all network and system objects within your computing environment. It offers a Web interface that enables easy navigation through objects, instances and attributes, with XML and access controls.
Enhancements:
- This is the first significant release of DMO for nearly two years.
- It works with Linux and Windows (XAMPP), but should work well with any LAMP stack including PHP4.
- New features include much more graphical viewing, as well as mapping objects onto maps with drill-down to additional layers of maps following dependency trails, a new Flash viewer for browsing through objects, and the ability to create chains of objects based on any attribute type (where any other object can be an attribute of any other object).
<<lessDatabase of Managed Objects provides an object-based overlay on a MySQL database, with a Web-based interface, which allows new objects to be defined in a hierarchy.
Each object can have attributes defined, which are inherited by objects below in the hierarchy. Information can be imported in CSV or XML format, and reports can be produced in XML, CSV, PDF and HTML formats.
DMO uses PHP and MySQL to support documentation of all network and system objects within your computing environment. It offers a Web interface that enables easy navigation through objects, instances and attributes, with XML and access controls.
Enhancements:
- This is the first significant release of DMO for nearly two years.
- It works with Linux and Windows (XAMPP), but should work well with any LAMP stack including PHP4.
- New features include much more graphical viewing, as well as mapping objects onto maps with drill-down to additional layers of maps following dependency trails, a new Flash viewer for browsing through objects, and the ability to create chains of objects based on any attribute type (where any other object can be an attribute of any other object).
Download (14.4MB)
Added: 2007-08-01 License: GPL (GNU General Public License) Price:
814 downloads
C++ Machine Objects 0.9.4
C++ Machine Objects class library supports a subset of the UML statechart notation. more>>
C++ Machine Objects class library supports a subset of the UML statechart notation for implementing hierarchical state machines in straight C++, similar in spirit to the GoF "State" design pattern.
The currently supported features are hierarchical states, entry and exit actions, state histories, and state variables.
Installation:
The class library as such does not need to be installed. Just include the header file Macho.hpp to make use of it. Prerequisite however is a C++ compiler with sane support for templates.
Included are the example state machines HelloWorld, Example, Microwave and Test. To make the examples run just compile them in the directory they are in, for example:
# GCC
g++ -o microwave Microwave.cpp
# MSVC7
cl /EHsc Microwave.cpp
I like the GoF "State" design pattern. It enables implementing the important concept of state machines with common programming language features. By utilising only basic language mechanisms it is easy to apply in real-life software development.
Another important property that stems from this simplicity is orthogonality, meaning that the pattern can be combined with other design elements, patterns and idioms in arbitrary ways.
In contrast stand the tool supported approaches to state machine creation (of which there is no shortage). Based on code generators and graphical editors, they tend to generate incomprehensible code and forfeit orthogonality by necessarily being outside the domain of the programming language.
Unfortunately the "State" pattern is limited in scope because it does not allow for hierarchical state machines. This is regrettable because flat state machines tend to become unwieldy when getting bigger, for the sheer number of states they produce.
Hierarchical state machines as defined by the statechart notation alleviate this problem by giving an additional structural element through grouping states into hierarchies.
The "State" pattern in its original form is not capable of modeling state hierarchies. The Macho class library extends the concept with this possibility, while keeping the properties of simplicity (there possible) and tool independence from its inspiration.
Enhancements:
- This release adds the feature of backtracking to previous states by using "Snapshots".
<<lessThe currently supported features are hierarchical states, entry and exit actions, state histories, and state variables.
Installation:
The class library as such does not need to be installed. Just include the header file Macho.hpp to make use of it. Prerequisite however is a C++ compiler with sane support for templates.
Included are the example state machines HelloWorld, Example, Microwave and Test. To make the examples run just compile them in the directory they are in, for example:
# GCC
g++ -o microwave Microwave.cpp
# MSVC7
cl /EHsc Microwave.cpp
I like the GoF "State" design pattern. It enables implementing the important concept of state machines with common programming language features. By utilising only basic language mechanisms it is easy to apply in real-life software development.
Another important property that stems from this simplicity is orthogonality, meaning that the pattern can be combined with other design elements, patterns and idioms in arbitrary ways.
In contrast stand the tool supported approaches to state machine creation (of which there is no shortage). Based on code generators and graphical editors, they tend to generate incomprehensible code and forfeit orthogonality by necessarily being outside the domain of the programming language.
Unfortunately the "State" pattern is limited in scope because it does not allow for hierarchical state machines. This is regrettable because flat state machines tend to become unwieldy when getting bigger, for the sheer number of states they produce.
Hierarchical state machines as defined by the statechart notation alleviate this problem by giving an additional structural element through grouping states into hierarchies.
The "State" pattern in its original form is not capable of modeling state hierarchies. The Macho class library extends the concept with this possibility, while keeping the properties of simplicity (there possible) and tool independence from its inspiration.
Enhancements:
- This release adds the feature of backtracking to previous states by using "Snapshots".
Download (0.035MB)
Added: 2006-06-02 License: MIT/X Consortium License Price:
1240 downloads
MySpace Blog Editor 0.3
MySpace Blog Editor is an extension which allows you to post directly from within Firefox to your MySpace blog. more>>
MySpace Blog Editor is an extension which allows you to post directly from within Firefox to your MySpace blog.
The MySpace Blog Editor allows you to post directly from within Firefox to your MySpace blog aswell as save notes, drag and drop formatted text from webpages, handle images and much more.
<<lessThe MySpace Blog Editor allows you to post directly from within Firefox to your MySpace blog aswell as save notes, drag and drop formatted text from webpages, handle images and much more.
Download (0.030MB)
Added: 2007-04-10 License: MPL (Mozilla Public License) Price:
975 downloads
MySpace Feed 1.01
MySpace Feed tool lets you important headlines from your blog, LiveJournal, a news feed, or other source into your MySpace. more>>
MySpace Feed tool lets you important headlines from your blog, LiveJournal, a news feed, or other source into your MySpace (or Friendster) page.
MySpace Feed converts the headline text into an image. We have a script that updates the images once a day.
<<lessMySpace Feed converts the headline text into an image. We have a script that updates the images once a day.
Download (0.072MB)
Added: 2006-09-07 License: GPL (GNU General Public License) Price:
1146 downloads
MySpace Friend Renamer .86
MySpace Friend Renamer provides an extension that allows you to rename your MySpace Friends. more>>
MySpace Friend Renamer provides an extension that allows you to rename your MySpace Friends.
This adds a right click option to Myspace Pages and allows you to change the display name for any of your friends. Handy if your friends change names often, or pick strange and obscure names.
Also in response to comments. If a tab is not in focus when the page loads, the extension will not rename.
I believe that the extension will conflict with other extensions that change pages when they load. If I find a better way to do it, I will change it.
<<lessThis adds a right click option to Myspace Pages and allows you to change the display name for any of your friends. Handy if your friends change names often, or pick strange and obscure names.
Also in response to comments. If a tab is not in focus when the page loads, the extension will not rename.
I believe that the extension will conflict with other extensions that change pages when they load. If I find a better way to do it, I will change it.
Download (0.004MB)
Added: 2007-04-05 License: MPL (Mozilla Public License) Price:
934 downloads
HTML Objects 1.2.4
HTML Objects is a Perl module library for turning HTML tags into Perl objects. more>>
HTML Objects is a Perl module library for turning HTML tags into Perl objects. HTML Objects allows Web pages to be manipulated as a data structure rather than text.
Once manipulation is done, the entire page is generated via depth-first recursion.
<<lessOnce manipulation is done, the entire page is generated via depth-first recursion.
Download (0.025MB)
Added: 2006-05-09 License: GPL (GNU General Public License) Price:
1263 downloads
C++ XML Objects 1.0.0.7
C++ XML Objects is a framework for persisting hierarchies of C++ objects to and from XML. more>>
C++ XML Objects is a framework for persisting hierarchies of C++ objects to and from XML. Boost, The STL and Patterns are used extensively. All platforms which support Boost will be supported.
Sometimes there is a need to save hierarchies of C++ objects to a file (or DB etc), and then retrieve them at a later date. This project allows your classes to derive from a single object (called "xmlobj"), provide a few extra methods which allow the visitor pattern to work on them and register them so that they can be read or written to an XML stream.
The only overhead is a per-class type and name of each object (as std::string). The members dont need to be wrapped which means that your memory footprint wont really get any larger.
There are actually 2 separate projects which are combined to make "cppxmlobj". The first is a called "cppreflect" and provides a framework for providing reflection to C++ objects. Reflection is the mechanism by which your class members can be referenced by a string name. To achieve this, "cppreflect" uses the visitor pattern. The other project is "cpppersist" which adds the right methods to each object so that it can be read or written to some type of stream.
These projects are included as part of this (they arent separate SourceForge projects), but they are completely independent of each other, so you could build your own scheme to persist your objects to a different type of file, or provide some other type of mechanism to read and write your objects data.
To interoperate, these two projects share a common base class which is provided by another independent project called "cppcommon". This is a simple class which provides the abstract interfaces necessary for an object to provide different types of facilities.
The project uses all the facilities of Boost for the build system (and for a bunch of the implementation) so you will need to get and build it. It uses the same license as Boost which means you can freely use it (its really only useful as source code anywhere), as long as you dont change the copyright message at the top of the files.
If you find it useful, or find some bugs (and fix them, then get back to me and Ill incorporate the changes. If you do this through SourceForge, then we can track the bugs etc.
Enhancements:
- Added in delayed loading. This allows a system to only load in an object in an XML file when the object is actually referenced. Added in "platforms" to documentation for supported platforms. Now builds on OS X Tiger, GCC 4.0 and latest BOOST (1.33.1). Also builds on latest Linux. Change the documentation layout (thanks Spirit), and added Generic objects. Also changed to use a single license.txt referenced at the top of each file. Since this code has been stable and working for a while, next release will be beta if I can build on a few more systems.
<<lessSometimes there is a need to save hierarchies of C++ objects to a file (or DB etc), and then retrieve them at a later date. This project allows your classes to derive from a single object (called "xmlobj"), provide a few extra methods which allow the visitor pattern to work on them and register them so that they can be read or written to an XML stream.
The only overhead is a per-class type and name of each object (as std::string). The members dont need to be wrapped which means that your memory footprint wont really get any larger.
There are actually 2 separate projects which are combined to make "cppxmlobj". The first is a called "cppreflect" and provides a framework for providing reflection to C++ objects. Reflection is the mechanism by which your class members can be referenced by a string name. To achieve this, "cppreflect" uses the visitor pattern. The other project is "cpppersist" which adds the right methods to each object so that it can be read or written to some type of stream.
These projects are included as part of this (they arent separate SourceForge projects), but they are completely independent of each other, so you could build your own scheme to persist your objects to a different type of file, or provide some other type of mechanism to read and write your objects data.
To interoperate, these two projects share a common base class which is provided by another independent project called "cppcommon". This is a simple class which provides the abstract interfaces necessary for an object to provide different types of facilities.
The project uses all the facilities of Boost for the build system (and for a bunch of the implementation) so you will need to get and build it. It uses the same license as Boost which means you can freely use it (its really only useful as source code anywhere), as long as you dont change the copyright message at the top of the files.
If you find it useful, or find some bugs (and fix them, then get back to me and Ill incorporate the changes. If you do this through SourceForge, then we can track the bugs etc.
Enhancements:
- Added in delayed loading. This allows a system to only load in an object in an XML file when the object is actually referenced. Added in "platforms" to documentation for supported platforms. Now builds on OS X Tiger, GCC 4.0 and latest BOOST (1.33.1). Also builds on latest Linux. Change the documentation layout (thanks Spirit), and added Generic objects. Also changed to use a single license.txt referenced at the top of each file. Since this code has been stable and working for a while, next release will be beta if I can build on a few more systems.
Download (0.40MB)
Added: 2006-04-05 License: Freeware Price:
736 downloads
Falling 1.0 RC1
Falling is a fast-paced survival game involving a ball falling through wooden planks. more>>
Falling is a fast-paced survival game involving a ball falling through wooden planks.
Falling is a survival game where the user controls a small steel ball and tries to roll it through holes in floors which are constantly moving up.
Avoid being crushed between the top of the window and a floor, avoid mechanical sticks of TNT that explode on contact, and avoid magnetic balloons which pull you to the top of the screen.
Collect jewels for extra points. Try to survive as long as possible!
<<lessFalling is a survival game where the user controls a small steel ball and tries to roll it through holes in floors which are constantly moving up.
Avoid being crushed between the top of the window and a floor, avoid mechanical sticks of TNT that explode on contact, and avoid magnetic balloons which pull you to the top of the screen.
Collect jewels for extra points. Try to survive as long as possible!
Download (1.0MB)
Added: 2006-11-06 License: GPL (GNU General Public License) Price:
1083 downloads
Active Objects 2007-03-04
Active Objects is an implementation of the Active Object concept based on the boost::thread, boost::bind, boost::function libs. more>>
Active Objects is an implementation of the Active Object concept based on the boost::thread, boost::bind, and boost::function libraries.
The point of the library is to make taking advantage of multiprocessor machines as easy as possible. The library provides two types of functionality. The first is the ability to execute a function in a separate thread and automatically synchronize with the thread when the return value is needed.
The second is the ability to easily create a message cue for any existing class, and have that class process its messages asynchronously.
Enhancements:
- Minor code cleanup and code documentation updates.
<<lessThe point of the library is to make taking advantage of multiprocessor machines as easy as possible. The library provides two types of functionality. The first is the ability to execute a function in a separate thread and automatically synchronize with the thread when the return value is needed.
The second is the ability to easily create a message cue for any existing class, and have that class process its messages asynchronously.
Enhancements:
- Minor code cleanup and code documentation updates.
Download (0.32MB)
Added: 2007-03-07 License: Other/Proprietary License with Source Price:
961 downloads
Python Web Objects 1.3
Python Web Objects is a dynamic page generation system that allows the developer to embed Python code inside HTML. more>>
Python Web Objects is a dynamic page generation system that allows the developer to embed Python code inside HTML. It is similar in function to what JSP is to Java. ts a module that runs under mod_python and the Apache webserver. It is designed to offer a good balance between a providing a clean way to integrate design content from code, while doing so as fast as possible.
Download the latest version, then read the documentation. If youre into antiques, you can always browse the archives, but theres no reason to use an old version.
To install PWO, first decompress the tarball you downloaded.
$ gunzip pwo-0.XX.tar.gz
$ tar xvf pwo-0.XX.tar
Then, copy the pwo.py module into some location in your PYTHONPATH. The proper location is usually /usr/local/lib/python2.x/site-packages/
$ cp pwo-0.XX/pwo.py /usr/local/lib/python2.2/site-packages/
PWO should now be ready to use.
To configure a directory to make PWO pages, you first need to make sure that the directory is visible on the web. Ask your friendly Apache sysadmin if you dont know what this means. In this document, the path youll be keeping your .pwo files in is called /path/to/pwodir/, and its corresponding URL is http://yourserver/url/to/pwodir/.
Let Apache and mod_python know that the pwo.py will be handling requests to .pwo files in that directory. Do this by adding a few lines to our entry in your httpd.conf file.
AddHandler python-program .pwo
PythonHandler pwo
PythonDebug On
The PythonDebug directive is optional, but you will most likely want it enabled while you are developing. It will make exceptions print tracebacks to the browser in plain-text format. For security reasons, you should comment it out on production systems.
Now a file /path/to/pwodir/some_file.pwo will generate its page at http://yourserver/url/to/pwodir/some_file.pwo. Try copying a simple one of the included samples, like hello.pwo, to this directory to test your installation.
If youve never used PWO before, learn the syntax, and/or check out some sample pages.
<<lessDownload the latest version, then read the documentation. If youre into antiques, you can always browse the archives, but theres no reason to use an old version.
To install PWO, first decompress the tarball you downloaded.
$ gunzip pwo-0.XX.tar.gz
$ tar xvf pwo-0.XX.tar
Then, copy the pwo.py module into some location in your PYTHONPATH. The proper location is usually /usr/local/lib/python2.x/site-packages/
$ cp pwo-0.XX/pwo.py /usr/local/lib/python2.2/site-packages/
PWO should now be ready to use.
To configure a directory to make PWO pages, you first need to make sure that the directory is visible on the web. Ask your friendly Apache sysadmin if you dont know what this means. In this document, the path youll be keeping your .pwo files in is called /path/to/pwodir/, and its corresponding URL is http://yourserver/url/to/pwodir/.
Let Apache and mod_python know that the pwo.py will be handling requests to .pwo files in that directory. Do this by adding a few lines to our entry in your httpd.conf file.
AddHandler python-program .pwo
PythonHandler pwo
PythonDebug On
The PythonDebug directive is optional, but you will most likely want it enabled while you are developing. It will make exceptions print tracebacks to the browser in plain-text format. For security reasons, you should comment it out on production systems.
Now a file /path/to/pwodir/some_file.pwo will generate its page at http://yourserver/url/to/pwodir/some_file.pwo. Try copying a simple one of the included samples, like hello.pwo, to this directory to test your installation.
If youve never used PWO before, learn the syntax, and/or check out some sample pages.
Download (0.017MB)
Added: 2006-06-23 License: BSD License Price:
1218 downloads
Mock Objects for C++ 1.16.1
mockpp is a platform-independent generic unit testing framework for C++. more>>
mockpp is a platform independent generic unit testing framework for C++. Mock Objects for C++ goal is to facilitate developing unit tests in the spirit of Mock Objects for Java, EasyMock and jMock.
Mock objects allow you to set up predictible behaviour to help you test your production code by emulating some functionality your code depends on. This might for example be a huge database which is too difficult and time consuming to maintain just for testing purposes.
Originally I started with a port of MockObjects to C++ and wanted to keep the same interfaces. But in the meanwhile I found out more about Java and its differencens to C++ (its funny reflection api for example ) and so I had to change a bunch of details.
Additionally I included the working method of EasyMock. From my limited understanding of Java there seems to be something similar in MockObjects but I guess EasyMock is easier to use and certainly was easier to port to C++.
Enhancements:
- This release fixes a compilation issue on Mac OS platforms and a parsing problem with mockpp2xml.
<<lessMock objects allow you to set up predictible behaviour to help you test your production code by emulating some functionality your code depends on. This might for example be a huge database which is too difficult and time consuming to maintain just for testing purposes.
Originally I started with a port of MockObjects to C++ and wanted to keep the same interfaces. But in the meanwhile I found out more about Java and its differencens to C++ (its funny reflection api for example ) and so I had to change a bunch of details.
Additionally I included the working method of EasyMock. From my limited understanding of Java there seems to be something similar in MockObjects but I guess EasyMock is easier to use and certainly was easier to port to C++.
Enhancements:
- This release fixes a compilation issue on Mac OS platforms and a parsing problem with mockpp2xml.
Download (0.68MB)
Added: 2007-06-16 License: GPL (GNU General Public License) Price:
864 downloads
Falling Up 004
Falling Up its another tetris clone. more>>
Falling Up its another tetris clone. No, Im not trying to make any money off of it or claim it as particularly unique. It is fun. Try it. Its evil. Im told that frequently.
People have even praised it. I wrote it as a precursor to other games, a way to learn new technologies (GLUT, OpenGL, OpenAL, NSIS, ...), and to brush up on old ones (c, for that matter).
The source code is essentially free to do with as you please, if you like. If you "steal" most of it, Id prefer you give credit back to here, but really... whatever. I learned from lots of places and anything I can do to pay that back is cool.
The game is... tetris. You have the same old blocks, and they fall down. You use left and right to move blocks left and right, up to rotate, down to move down a line, and spacebar to drop.
Theres a next item (optional), sound (optional), and... stuff like that. Please, just download it and play it already! Geeze! Youd think I was just rambling...
Enhancements:
- The score file was adding 1 to the "level" the score was attained at every time a new high score was made, give or take; that is fixed.
- I added a background image (doesnt work with trails, may slow down on slower systems), and made F4 quit out of playing the game.
<<lessPeople have even praised it. I wrote it as a precursor to other games, a way to learn new technologies (GLUT, OpenGL, OpenAL, NSIS, ...), and to brush up on old ones (c, for that matter).
The source code is essentially free to do with as you please, if you like. If you "steal" most of it, Id prefer you give credit back to here, but really... whatever. I learned from lots of places and anything I can do to pay that back is cool.
The game is... tetris. You have the same old blocks, and they fall down. You use left and right to move blocks left and right, up to rotate, down to move down a line, and spacebar to drop.
Theres a next item (optional), sound (optional), and... stuff like that. Please, just download it and play it already! Geeze! Youd think I was just rambling...
Enhancements:
- The score file was adding 1 to the "level" the score was attained at every time a new high score was made, give or take; that is fixed.
- I added a background image (doesnt work with trails, may slow down on slower systems), and made F4 quit out of playing the game.
Download (0.45MB)
Added: 2005-12-06 License: GPL (GNU General Public License) Price:
1422 downloads
CSVObjects 0.5b
CSVObjects is a Java-based CSV mapper/parser library and framework. more>>
CSVObjects is a free and open sourced Java based framework for transparently parsing and unmarshalling Comma Separated Value (CSV) files and records into Plain Old Java Objects without the need to code the parsing logic manually.
Instead, the parsing library relies on declarative mapping of CSV fields and data types to Java Bean attributes, via a mapping XML file. This is similar to the manner in which Hibernate provides relational table mapping for Java Beans.
The Framework is built upon Stephen Ostermillers excellent CSV reader/parser classes.
Also, the framework provides convenience Xdoclet support for specifying the CSV to Java mapping in the Java source code itself by using Javadoc markup, thereby reducing the burden on the developer to manually maintain separate configuration files.
Installation:
If you have downloaded the binary file release, then you need to include the
CSVObjects- .jar file in your projects library or classpath, ensure that the dependency libraries are also present in the classpath, and thats it!
<<lessInstead, the parsing library relies on declarative mapping of CSV fields and data types to Java Bean attributes, via a mapping XML file. This is similar to the manner in which Hibernate provides relational table mapping for Java Beans.
The Framework is built upon Stephen Ostermillers excellent CSV reader/parser classes.
Also, the framework provides convenience Xdoclet support for specifying the CSV to Java mapping in the Java source code itself by using Javadoc markup, thereby reducing the burden on the developer to manually maintain separate configuration files.
Installation:
If you have downloaded the binary file release, then you need to include the
CSVObjects- .jar file in your projects library or classpath, ensure that the dependency libraries are also present in the classpath, and thats it!
Download (2.17MB)
Added: 2005-09-26 License: GPL (GNU General Public License) Price:
1488 downloads
Net::DBus::Tutorial::ExportingObjects 0.33.4
Net::DBus::Tutorial::ExportingObjects is a Perl module that contains tutorials on providing a DBus service. more>>
Net::DBus::Tutorial::ExportingObjects is a Perl module that contains tutorials on providing a DBus service.
This document provides a tutorial on providing a DBus service using the Perl Net::DBus application bindings. This examples in this document will be based on the code from the Music::Player distribution, which is a simple DBus service providing a music track player.
CREATING AN OBJECT
The first step in creating an object is to create a new package which inherits from Net::DBus::Object. The Music::Player::Manager object provides an API for managing the collection of music player backends for different track types. To start with, lets create the skeleton of the package & its constructor. The constructor of the super type, Net::DBus::Object expects to be given to parameters, a handle to the Net::DBus::Service owning the object, and a path under which the object shall be exported. Since the manager class is intended to be a singleton object, we can hard code the path to it within the constructor:
package Music::Player::Manager;
use base qw(Net::DBus);
sub new {
my $class = shift;
my $service = shift;
my $self = $class->SUPER::new($service, "/music/player/manager");
bless $self, $class;
return $self;
}
1;
Now, as mentioned, the manager with handle a number of different player backends. So we need to provide methods for registering new backends, and querying for backends capable of playing a particular file type. So modifying the above code we add a hash table in the constructor, to store the backends:
sub new {
my $class = shift;
my $service = shift;
my $self = $class->SUPER::new($service, "/music/player/manager");
$self->{backends} = {};
bless $self, $class;
return $self;
}
And now a method to register a new backend. This takes a Perl module name and uses it to instantiate a backend. Since the backends are also going to be DBus objects, we need to pass in a reference to the service we are attached to, along with a path under which to register the backend.
We use the get_service method to retreieve a reference to the service the manager is attached to, and attach the player backend to this same service: When a method on DBus object is invoked, the first parameter is the object reference ($self), and the remainder are the parameters provided to the method call. Thus writing a method implementation on a DBUs is really no different to normal object oriented Perl (cf perltoot):
sub register_backend {
my $self = shift;
my $name = shift;
my $module = shift;
eval "use $module";
if ($@) {
die "cannot load backend $module: $@" ;
}
$self->{backends} = $module->new($self->get_service,
"/music/player/backend/$name");
}
Looking at this one might wonder what happens if the die method is triggered. In such a scenario, rather than terminating the service process, the error will be caught and propagated back to the remote caller to deal with.
The player backends provide a method get_track_types which returns an array reference of the music track types they support. We can use this method to provide an API to allow easy retrieval of a backend for a particular track type. This method will return a path with which the backend object can be accessed
sub find_backend {
my $self = shift;
my $extension = shift;
foreach my $name (keys %{$self->{backends}}) {
my $backend = $self->{backends}->{$name};
foreach my $type (@{$backend->get_track_types}) {
if ($type eq $extension) {
return $backend->get_object_path;
}
}
}
die "no backend for type $extension";
}
Lets take a quick moment to consider how this method would be used to play a music track. If youve not already done so, refresh your memory from Net::DBus::Tutorial::UsingObjects. Now, we have an MP3 file which we wish to play, so we search for the path to a backend, then retrieve the object for it, and play the track:
...get the music player service...
# Ask for a path to a player for mp3 files
my $path = $service->find_backend("mp3");
# $path now contains /music/player/backend/mpg123
# and we can get the backend object
my $backend = $service->get_object($path);
# and finally play the track
$backend->play("/vol/music/beck/guero/09-scarecrow.mp3");
<<lessThis document provides a tutorial on providing a DBus service using the Perl Net::DBus application bindings. This examples in this document will be based on the code from the Music::Player distribution, which is a simple DBus service providing a music track player.
CREATING AN OBJECT
The first step in creating an object is to create a new package which inherits from Net::DBus::Object. The Music::Player::Manager object provides an API for managing the collection of music player backends for different track types. To start with, lets create the skeleton of the package & its constructor. The constructor of the super type, Net::DBus::Object expects to be given to parameters, a handle to the Net::DBus::Service owning the object, and a path under which the object shall be exported. Since the manager class is intended to be a singleton object, we can hard code the path to it within the constructor:
package Music::Player::Manager;
use base qw(Net::DBus);
sub new {
my $class = shift;
my $service = shift;
my $self = $class->SUPER::new($service, "/music/player/manager");
bless $self, $class;
return $self;
}
1;
Now, as mentioned, the manager with handle a number of different player backends. So we need to provide methods for registering new backends, and querying for backends capable of playing a particular file type. So modifying the above code we add a hash table in the constructor, to store the backends:
sub new {
my $class = shift;
my $service = shift;
my $self = $class->SUPER::new($service, "/music/player/manager");
$self->{backends} = {};
bless $self, $class;
return $self;
}
And now a method to register a new backend. This takes a Perl module name and uses it to instantiate a backend. Since the backends are also going to be DBus objects, we need to pass in a reference to the service we are attached to, along with a path under which to register the backend.
We use the get_service method to retreieve a reference to the service the manager is attached to, and attach the player backend to this same service: When a method on DBus object is invoked, the first parameter is the object reference ($self), and the remainder are the parameters provided to the method call. Thus writing a method implementation on a DBUs is really no different to normal object oriented Perl (cf perltoot):
sub register_backend {
my $self = shift;
my $name = shift;
my $module = shift;
eval "use $module";
if ($@) {
die "cannot load backend $module: $@" ;
}
$self->{backends} = $module->new($self->get_service,
"/music/player/backend/$name");
}
Looking at this one might wonder what happens if the die method is triggered. In such a scenario, rather than terminating the service process, the error will be caught and propagated back to the remote caller to deal with.
The player backends provide a method get_track_types which returns an array reference of the music track types they support. We can use this method to provide an API to allow easy retrieval of a backend for a particular track type. This method will return a path with which the backend object can be accessed
sub find_backend {
my $self = shift;
my $extension = shift;
foreach my $name (keys %{$self->{backends}}) {
my $backend = $self->{backends}->{$name};
foreach my $type (@{$backend->get_track_types}) {
if ($type eq $extension) {
return $backend->get_object_path;
}
}
}
die "no backend for type $extension";
}
Lets take a quick moment to consider how this method would be used to play a music track. If youve not already done so, refresh your memory from Net::DBus::Tutorial::UsingObjects. Now, we have an MP3 file which we wish to play, so we search for the path to a backend, then retrieve the object for it, and play the track:
...get the music player service...
# Ask for a path to a player for mp3 files
my $path = $service->find_backend("mp3");
# $path now contains /music/player/backend/mpg123
# and we can get the backend object
my $backend = $service->get_object($path);
# and finally play the track
$backend->play("/vol/music/beck/guero/09-scarecrow.mp3");
Download (0.092MB)
Added: 2006-11-13 License: Perl Artistic License Price:
1075 downloads
Secleted [ 0 ] software to compare
Copyright Notice:
Software piracy is theft, Using crack, password, serial numbers, registration codes, key generators is illegal and prevent future software development. The above myspace falling objects codes search only lists software in full, demo and trial versions for free download. Download links are directly from our mirror sites or publisher sites, torrent files or links from rapidshare.com, yousendit.com or megaupload.com are not allowed