Web-Based Music Library (programming concept) - php

So, I've been tossing this idea around in my head for a while now. At its core, it's mostly a project for me to learn programming. The idea is that, I have a large set of data, my music collection. There are quite a few datasets that my music has. Format, artist, title, album, genre, length, year of release, filename, directory, just to name a few. Ideally, I'd like to create a database that has all of this data stored in it, and in the future, create a web interface on top of it that I can manage my music collection with. So, my questions are as follows:
Does this sound like a good project to begin building databases from scratch with?
What language would you recommend I start with? I know tidbits of PHP, but I would imagine it would be awful to index data in a filesystem with. Python was the other language I was thinking of, considering it's the language most people consider as a beginner language.
If you were going to implement this kind of system (the web interface) in your home (if you had PCs connected to a couple of stereos in your home and this was the software connected), what kind of features would you want to see?
My idea for building up the indexing script would be as follows:
Get it to populate the database with only the filenames
From the extension of the filename, determine format
Get file size
Using the filenames in the database as a reference, pull ID3 or other applicable metadata (artist, track name, album, etc)
Check if all files still exist on disk, and if not, flag the file as unavailable
Another script would go in later and check if the files are back, if they are not, the will remove the row from the database.

I think this is a fine project to learn programming with. By using your own "product" you can really get after things that are missing and are much more motivated to learn and better your program - this is known as dogfooding. Curiously enough, the book Dive Into Python, although a little old, covers in some detail how to extract the ID3 information of music files using Python. Since that's the book most often recommended for beginners, I bet that'd be as good a place to start as any.

Working on something you care about is the best way to learn programming, so I think this is a great idea.
I also recommend Python as a place to start. Have fun!

If you use Python, you could build it with the Google App Engine. It gives you a very nice database interface, and the tutorial will take you from 'Hello world!' to a functioning web app.
You don't even need to upload the result to Google; you can just run it in the dev environment and it will be accessible within your home network.

I think python would be excellent choice as
easy to learn but have advanced features too
good web frameworks available e.g. django which you can run on your machine
Word class Free python hosting available i.e. google app engine
Libraries available for almost anything imaginable e.g. for reading your mp3 tags you can use http://id3-py.sourceforge.net/
for searching you can use pylucene http://lucene.apache.org/pylucene/
the best search engine available.

Related

Like Google Maps - Just local

I was looking to find a solution to our product. We have a geo-location, on a web based dashboard that does not have internet connection.
I was looking for a product that allows you to have local maps and a script, I found OpenLayers which seems cool although weights 22gb.
Do you know if there are other solutions to generate map locally that takes less space?
If I assume correctly, you are basically looking for an alternative to Google Maps, i.e. an alternative mapping service where you can use your own local data, right?
Now, based on your question, its hard to tell whether you
Want to develop something for yourself or buy/adopt an already implemented software
Are looking for the serverside (i.e. tiling/caching engine, geospatial database, etc) or for the clientside or for both
I could give you an example of a possible configuration if you want to develop a clientside application yourself, but that might not be what you are exactly looking for.
For the serverside, you could use MapServer, backed by a PostGIS spatial database (PostGIS is an enhancement of PostgreSQL), and then use a client side Javascript framework BASED on OpenLayers to develop your client application (i.e., the map viewer), such as Fusion, which is also based on the MooTools Javascript Library. You could also natively develop with OpenLayers. There are a lot of possibilities in the Open Source world, it just depends on the skill and time you have.
Also, have a look at OSGEO, in the right sidebar you'll find a lot of projects that are hosted by them. It definetely is your first address for Open Source web mapping solutions.

Create and Search user posts in PHP

This is my first entry into backend development, taking mostly a design role in past projects. Im working on a personal project and have fleshed out what I feel is a logic of sorts. Just a few very basic user tasks broken down.
Core User Actions:
A user can create a new posting
A user can find posts from other users by tag, date created, and
other content. This is done in kinda a central search area. (Search
string: "Dog Saddle", retrieves posts with mentions of dog saddels,
dogs, and saddels)
A post's creator can be contacted from the post.
A user can delete their created posts.
I need guidance/suggestions with the following:
What data should I capture for users?
What framework is best for the application dynamics I've described? (ROR, Python, PHP ect. I'm a one man team currently)
Are there open source projects I may gain reference from?
I'm very dedicated to learning on my own, and can make use of good advice!
Thanks,
Given the rather generic requirements you've outlined and that you are just entering into the development arena, you should try an established framework. That way you won't need to write everything from scratch. You'll still have plenty of control, but the benefits of many commonly used functions, classes etc that will speed up your development.
Give something like CodeIgniter for PHP a try. See http://codeigniter.com/. There are a lot of tutorials online to help you get started. For example, see http://net.tutsplus.com/sessions/codeigniter-from-scratch/.
What you've described doesn't suggest a particular language at all. ROR, Python, PHP--you could use any of those to create what you've described. PHP is considered by many to have a less steep learning curve than ROR and Python, which is why I recommended it. However, there are frameworks for these other languages as well that will give you the same benefits as code igniter.

What technologies to use for Terminal-ish Text based RPG?

I want to create an old school simplistic Text based RPG. No inventory, no fighting, just finding the right way through a dungeon.
There will be a describing paragraph about each "room" and there will be choices depending on the room. IE, If there's two doors, you can choose which to go through, or if there's items you can use them and so on. As you progress, the story unfolds.
I really want to use php for it, since I don't really know alot of programming and I hear that it's an relatively easy entrance for that. I already know enough php to develop for Wordpress, as well.
I really want it to remind people about the old MUDs, designwise i want to be like a terminal or the cmd. The styling is certainly no problem with css, but i'm still not sure about what to use to make the typing feel good, but i'm currently eyeballing tryruby.org and goosh.org to get the right feel.
Any ideas on how to go forth with that? What Do I need to use? Javascript/jQuery? Any good resources for me to look at?
EDIT: Ofcourse, it's online.
Extending #rmorero answer you can use my terminal emulator, so you don't need to recreate tryruby.org look and feel http://terminal.jcubic.pl and use JSON-RPC, you can use my php library for that https://github.com/jcubic/json-rpc
It all depends on your preference.
A quick way to get started would be a html/javascript frontend and a php backend.
The javascript frontend emulates a console, the implementation at goosh.org looks like great inspiration.
Callbacks can be done through ajax, jQuery is pretty useful here.
You could also take a look at Comet if you want to push content (sending content from the server to the client without the client requesting it - or using requests several times).
PHP for the backend sounds good, you'd just implement a script that returns each location, descriptions and possible exists. I'd recommend looking into the JSON format for this, as it will allow you to return an object like:
{
"title": "A dark room",
"description": "This is a very dark and scary room. The smell is obnoxious",
"exits": {
"nw" : " A small door",
"n" : "A huge ladder"
}
}
Php has built in functions to create json objects from php objects, i.e. json_encode.
You probably want some kind of database as well, to store the locations. Here it depends on what you want to use. You can use a traditional sql database (mysql, postgresql, etc), or a no-sql database (mongodb, redis, etc).
You should look into development frameworks for interactive fiction. The two leading development tools for terminal-style games are Inform and TADS, but Quest looks good as well.
If you want to have an even lower entry barrier -- or just don't want players to type in commands, but rather click on alternative choices -- you might want to look into Choicescript or Undum. Choicescript is extremely easy to use and great for writing strictly choice-based text-adventures. For Undum, you need to know some JavaScript, but you can do more things with it. (I extended Undum once to add RPG-like dice rolls, character sheets, etc.) Quest 5.3 introduced a "Gamebook mode", which makes Choicescript-style games very easy to build as well.
I should point out that none of these environments requires PHP or indeed any sort of client-server communication. One advantage of this is that you can distribute your games very easily: a static website is fine, plus your games can be played offline. Potential disadvantages are that you don't improve your PHP skills; that your games are singleplayer only (though Undum games could be made multiplayer with some effort); and that no matter which environment you choose, you are never quite as flexible as you would have been with plain Javascript or Javascript+PHP.

A noob needs some quidance on php, mysql programming

I am working on a (dating, social) website. Basically, it's database system in which registered users can search, update their own data, send messages to each other, upload photos. I am a noob in web programming. I am writting the code (html, css, php, sql queries) line by line. It was okay when I had only 3-4 pages (registration, profile update, search, contact list), but now it's getting more complex (15-20 pages) and I find it hard to keep track of functions, variables, css ids and so on. Moreover I am asked to add more features (user blogs, forums) soon that will make it even more complicated...
I would like to get some guidance from professionals to speed up the development process. I have a half-ready system with my own database tables, php files, functions. And I have some experience in coding. I work with Eclipse, but I use it only as a text editor.
So, what's next? What development tools would you use to code such a system?
Thanks.
I have some general advice that I think will help someone starting out in any programming field
Find other people doing the same kind of thing and talk to them about how they do it. They don't all have to be experts as you can still learn from other beginners, but don't only talk to beginners or you will just learn bad habits :)
Use other people's code wherever you can. Frameworks, libraries, examples you found online. If it is a framework or library that lots of people use then go ahead and use it however you like. If its an example you found on a blog or something then make sure you really understand what it does because a lot of the stuff out there is rubbish!
Eclipse is fine as a text editor, as are many others. Changing text editor will not make your code better or easier to manage. Having development tools that you like using can make the whole process much more pleasant but it is not as important as you might guess from reading around the 'net. Spending two weeks learning a new coding environment doesn't help you get your project under control.
Try to make sure you pass as much of the Joel Test as possible, even in a team of one. You should be able to answer yes to at least questions 1, 4, 5, 6, 7 and 10.
OOP and i would advice to take a look at other open source social websites/engines to see if,
1) migration possible (since yours is half-ready, according to you)
2) reuse their framework/ underlying models possible.
and since you will add more features to your existing one, i recommend you to take a look at below:
FYI
[1] Social Engine.Net http://www.socialengine.net/
[2] Social Network Engine Comparison (by Wiki)
As for coding IDE / development tools/techniques, you will increase your productivity if your environment is php integrated(on the fly function/method lookup).
I would strongly suggest using a PHP framework like Zend, Symphony etc. than simply writing PHP files. It will help you use something called an ORM for database queries which helps you port from different database servers like Oracle, MySQL etc. Apart from that, your question needs a very detailed answer. Try looking up some of the software development practices and tools that assist in them (e.g. trac, svn etc.) I have found these to help me be organized and stick to a schedule.
And how many users are you looking to serve ? Think about the scalability of your design.

Better to use multiple language files or 1?

From your experience, is it better to use 1 language file or multiple smaller langauge files for each language in a PHP project using the gettext extension? I am not even sure if it is possible to use multiple files, it is hard for me to test since the server caches the language files.
I am doing multiple languages on a social network site, so far just the signup page which is about 1 out of 200 pages to go and it has 35 text strings to translate, at this pace the language file for each language wold be really large so I was thinking maybe it would be better to do different language files for differnt pages or perhaps sections like forums section and blogs section but if it makes no difference then I would ratther not waste my time in making multiple smaller files for each language.
I realize every situation is different and the only real answer is to test it but I am hoping to avoid that this time and just get some oppinions of people more experienced, this is my first time using gettext, thanks
I would have the language files module based. With gettext you need to specify locale for each language. It would fit best to have a separate .po/.mo files for each module or big parts of your site.
That's my opinion. :-)
I typically automate the process and have multiple languages in multiple files by using a database to edit the site (using a simple db lookup). This lets me hire translators to come in and verify the current translation easily. Deploying to production then is simply turning the database into a set of language files.
From experience i would break the languages down on a per file basis as the management overhead becomes heavy and there is great scope for duplication and mistakes.
The other advantage it that by using a directory structure and naming convention the correct language can be selected programatically more easily than the large file and it is easier to write management tools at a later stage in the project.
It is also worth looking at some of the formats other people use. Many of the Frameworks use this sort of structure, Dashcode, Symfony, Zend etc. And there is an xml format xliff which is built to handle translation and integrates with many of the tools that translators use.
Multiple files are the best way to go, but things can get disorganized.
We've just launched a free new service called String which solves most of the problems of managing multiple language files - like a basecamp for localization. You can either import existing files, or start from scratch with keys and strings in the system. When you're ready, you can export the files again to run your app. It works with PHP (array), PHP (define), po, yaml, ini and .strings formats.
String allows you to collaborate with translators easily - you just invite them to a project and set their language permissions. Translators can leave comments and questions on each string if they need more info - and you can revert strings back using the History function if things aren't quite right.
Anyway enough sales pitch!
Check it out at http://mygengo.com/string - we'd love your feedback.

Categories