Jump to content

Recommended Posts

Posted

Hi,

I'd like to learn to program, I have a couple of things in mind that I think could probably be quite easily done through a web interface that would be database driven underneath but I'm not sure where to start. I'm kind of at "hello world" stage in Javascript, not much more.

For example:

I'd like to have a page that I could enter a list of MP3 filenames into, these would be songs and ads for current "special of the week" etc etc. I'd like to be able to set the "rotation" of each file, 1-5 such that when I entered a new file it would add the file to the list higher up closer to the beginning of the list depending on the rotation entered.

I mean, if I entered a new file with rotation value of 5, it would go on the end of the list, but if it was 1, it would go in the list a fifth of the way down. For example if there were 50 filenames in the current list the new entry would take position 10, shuffling the lower ones down one... [the previous 10 would now be 11] etc.

Similarly, when a file is played it would re-shuffle itself back down the list depending on rotation value. 5 would get put right on the end of the list, higher rotation songs would be put back in the list higher up, and the rest of the songs shuffled down.

So, it's a bit of mathematics, and a form for entry and button or two for "played", "new", "delete" and so on.

If anyone could give me any tips to get started that would be great:)

Posted

Hi,

When it comes to database access Javascript won't be much use as it runs client side (i.e. in the users browser) and can't communicate directly with your database, which is on your server, i.e. server side. You need to use a server side language, such as PHP, ASP.Net, Java, Perl, Ruby or many others.

If you are just getting started I'd personally choose PHP, as it's able to run on pretty much any server, is very widely used and pretty easy to get started with. You'll find tons of help if you just Google 'learn php'. However if you have a love of Microsoft and a server that is able to run it ASP may be an option (may want to check with your server host what can run on your machine). Java, Perl, Ruby etc tend to be a bit more hardcore so I'd leave them until you get your head around the basics a bit. You are also going to have to learn a little bit of SQL, the language that is used to talk to databases, and probably a little bit about relational database theory (e.g. table normalization, indexing) although you can pick this up as you go.

I'm afraid I don't really follow you logic for what you want to do, so can't help you there, sorry.

Good luck.

Posted

Very unusual programming problem, but may I ask why you are posting this to thaivisa?

How 'bout trying a programming board. There are lots out there.

Meanwhile, read up on lists, stacks and queues.

Posted

That sounds like a very easy and suitable project to learn some programming.

If you are up for a challenge and would like to try something a bit different than most of the well-known programming languages. I would suggest that you try and have a look at ruby-on-rails. It has a quite different syntax than what most people are used to (including me), but I believe it's a language where you quickly can get something to see in your browser, and also it's free to use and the IDE is free as well, unlike Microsoft Visual Studio & Dreamweaver.

Personally I do all programming usng C# and ASP.NET and I dislike PHP to an extend where I will never touch it unless someone pays me well to do so. But starting out with C# and ASP.NET would be a bit steep I think.

I'm sure I will get some bashing for saying that, since if I would guess there to be more PHP programmers frequenting this forum than .NET'ers.

Posted

PHP is a nice and easy language to learn, and its designed as a companion to HTML. Just grab yourself a book, preferably one that leads you through a few small projects to get the hang of it.

Posted
whatever happened to COBOL, FORTRAN and RPG?...I got lost when BASIC was introduced... :)

RPG was specific to IBM mainframes and Minicomputers. I'm sure you could still get a job in it though (although pay wouldn't be great).

Fortran is actually extremely fast (it's the only thing that comes close to being as easy to compile as C), and is still used in some fairly minor algorithmic areas.

Cobol is still out there, but like RPG, tends to only still exist on the big mainframe legacy code area. If you can do it, there are probably plenty jobs (because the people that originally wrote it are all coming up for retirement).

But in all 3 cases, they predate the web, and weren't free compilers under Unix (so weren't immediately available under Linux).

C / C++ tends to be what things that have to run fast are still written in, especially cross-platform, or on Linux/Unix. (C# and .NET are microsoft only)

Java tends to be used where speed isn't as important as it's a bit easier to code in (in theory you don't have to be as careful with freeing up memory that you no longer need).

Then there's the scripting languages and things that are popular for web servers (like Ruby, although that's a proper language, PHP, Python, etc.)

For what you're doing - what you're doing it on would effectively specify the language.

i.e. If you're keeping the list in Excel, you could do it with a macro.

If it's on a database - probably SQL

If it's a list in a file - any of the above... - read in the list - rewrite the list with the new file (and "rotation") added in place.

The fun problem is adjusting the placing in the list so that as the list gets bigger, you don't find that the ones with low priority never get played at all.

Posted

Some of the older guys may remember this one .... :)

(The following appeared in the September 1986 issue of "SIGPLAN
Notices" (Volume 21, number 9) -- bcjb.)

              Selecting a Programming Language Made Easy
              ==========================================

                  Daniel Solomon & David Rosenblueth
        Department of Computer Science, University of Waterloo
                  Waterloo, Ontario, Canada N2L 3G1

  With such a large selection of programming languages, it can be
difficult to choose one for a particular project.  Reading the manuals to
evaluate the languages is a time-consuming process.  On the other hand,
most people already have a fairly good idea of how various automobiles
compare.  So in order to assist those trying to choose a language, we
have prepared a chart that matches programming languages with comparable
automobiles:

Assembler  - A Formula I race car. Very fast, but difficult to drive and
            expensive to maintain.
FORTRAN II - A Model T Ford. Once it was king of the road.
FORTRAN IV - A Model A Ford.
FORTRAN 77 - A six-cylinder Ford Fairlane with standard transmission and
            no seat belts.
COBOL      - A delivery van. It's bulky and ugly, but it does the work.
BASIC      - A second-hand Rambler with a rebuilt engine and patched
            upholstry. Your dad bought it for you to learn to drive.
            You'll ditch the car as soon as you can afford a new one.
PL/I       - A Cadillac convertible with automatic transmission, a two-
            tone paint job, white-wall tires, chrome exhaust pipes, and
            fuzzy dice hanging in the windshield
C          - A black Firebird, the all-macho car. Comes with optional
            seat belts (lint) and optional fuzz buster (escape to
            assembler).
ALGOL 60   - An Austin Mini. Boy, that's a small car.
Pascal     - A Volkswagon Beetle. It's small but sturdy. Was once
            popular with intellectuals.
Modula II  - A Volkswagon Rabbit with a trailer hitch.
ALGOL 68   - An Astin Martin. An impressive car, but not just anyone
            can drive it.
LISP       - An electric car. It's simple but slow. Seat belts are not
            available.
PROLOG/LUCID - Prototype concept-cars.
Maple/MACSYMA - All-terrain vehicles.
FORTH      - A go-cart.
LOGO       - A kiddie's replica of a Rolls Royce. Comes with a real
            engine and a working horn.
APL        - A double-decker bus. Its takes rows and columns of
            passengers to the same place all at the same time. But, it
            drives only in reverse gear, and is instrumented in Greek.
Ada        - An army-green Mercedes-Benz staff car. Power steering,
            power brakes and automatic transmission are all standard.
            No other colors or options are available. If it's good
            enough for the generals, it's good enough for you.
            Manufacturing delays due to difficulties reading the
            design specification are starting to clear up.

----------------------------------------------------------------------

PS. Sorry about the CODEBOX, it was the only way I could get it to preserve the formatting...

Posted

hey, thanks for the replies folks, there's a lot of good info there. [That's why I posted here, to answer the question above, cause I thought there'd be a lot of folks with some good ideas and this is the computer section, after all...]

I'm off to do some downloading of tutorials!

thanks:)

Posted

First off, here's a simple chart which shows you which programming languages and by extent programmers are superior

post-20814-1257924592_thumb.png

All you guys suggesting server side solutions - the problem then would be playing the actual music, no? Webservers don't usually play music so not sure how hard that would be. It's certainly not run of the mill. The algorithm is pretty simple of course.

You could run it in a simple desktop application written in Adobe Air or something like that. Even Java would work though in terms of getting results quickly, it's not recommended - too much effort.

I think there's a GUI for Ruby that would be pretty cool. Then there's Visual Studio/.Net if you want to sell your soul (and skills) to whatever the people in Redmond decide. On the plus side, you'd get the app out quickly.

If you have a Mac you can probably write an AppleScript that controls itunes...

The cool thing about Ruby is that it's completely object oriented, yet at the same time can be used as scripting language. I think it would make a great first programming language because it's so clean.

Posted

Nikster I fail to see the validity of your Hierarchy chart?

How does Ajax programming appear below PHP programming when Ajax requires both Javascript + a server side language such as PHP.

So how can knowledge of "Javascript + PHP" < "PHP Alone"?

Posted
First off, here's a simple chart which shows you which programming languages and by extent programmers are superior

post-20814-1257924592_thumb.png

All you guys suggesting server side solutions - the problem then would be playing the actual music, no? Webservers don't usually play music so not sure how hard that would be. It's certainly not run of the mill. The algorithm is pretty simple of course.

You could run it in a simple desktop application written in Adobe Air or something like that. Even Java would work though in terms of getting results quickly, it's not recommended - too much effort.

I think there's a GUI for Ruby that would be pretty cool. Then there's Visual Studio/.Net if you want to sell your soul (and skills) to whatever the people in Redmond decide. On the plus side, you'd get the app out quickly.

If you have a Mac you can probably write an AppleScript that controls itunes...

The cool thing about Ruby is that it's completely object oriented, yet at the same time can be used as scripting language. I think it would make a great first programming language because it's so clean.

I did like the comment at the bottom about Ruby programmers not realising that there are languages that don't rely on the web.

Personally, C (K&R and ANSI), C++, Visual Basic (long time ago - for DOS and Windows 3.0/3.1), Fortran 77 (even longer ago), and a bit of Cobol maintenance (around the same time as I was doing Fortran). Add in Pascal, Prolog, IMP, ML and assembler if I go back to my days at University. (that probably dates me).

Posted

Keep in mind this is programming for *the web*, not programming in general. Steve Gibson said he uses Assembler to run his web applications (I'll take his word for it) and if you're twisted enough I guess you can use nearly anything, but why put yourself through unnecessary pain? Stick to a mainstream web language like PHP and you can a) buy books off the shelf, :) sign up to a discussion forum for free help and find people who are still alive and willing to help you and c) maybe get a job with it later on and d) enjoy lots of free development tools and IDEs. The top 3 open source CMS are all PHP based by the way (Joomla, Drupal, Wordpress).

All you guys suggesting server side solutions - the problem then would be playing the actual music, no? Webservers don't usually play music so not sure how hard that would be. It's certainly not run of the mill. The algorithm is pretty simple of course.

The easiest way I've found is to put a playlist (.m3u) file on the site. This is just a text file containing links to the actual music files. When opened in a browser, the songs in the playlist will automatically begin to stream from the server.

Posted
So how can knowledge of "Javascript + PHP" < "PHP Alone"?

That's because Javascript's weight, in the global order of programming languages, is negative.

So programming JS and PHP takes away from PHP alone. Clear now?

:)

Posted
The easiest way I've found is to put a playlist (.m3u) file on the site. This is just a text file containing links to the actual music files. When opened in a browser, the songs in the playlist will automatically begin to stream from the server.

Sounds like an easy solution... pretty nice, we are solving the guy's project already :)

Posted
So how can knowledge of "Javascript + PHP" < "PHP Alone"?

That's because Javascript's weight, in the global order of programming languages, is negative.

So programming JS and PHP takes away from PHP alone. Clear now?

:)

Which is my point that this chart is just some blokes warped opinion and should should be taken as jest instead of seriously considered...

Seeing as almost every decent website out there as at least some javascript on it; knowledge of the language would obviously not be a "negative"...in fact i'd challenge you to find a couple of websites which are high traffic and contain absolutely no javascript.

(P.S and i'm not talking about a "low-hi" or Mobile version of a site, but an actual main website having no JS)

Posted

Javascript is growing in popularity again isn't it? Especially with the likes of Jquery.

I'm only learning myself but just a few thoughts.

First off a search on amazon would be a good start. I'll have to dig out the details but there's a decent Computer bookshop in fortune city, Ratchada on the second floor(The computer section obviously). I was there only a week ago and picked up Professional Javascript for Web Developers (Wrox publishing) and Jquery in Action. They also have a few O'reilly's titles as well, albeit they didn't have Javascript the Definitive Guide 5th edition in stock, which is recognised as a must have.

You may also want to check out Douglas Crockford's videos over on Yahoo videos.

As for PHP you need to check first which version/s your webhoster is using. That also goes for PHPMyAdmin, MYSQL and apache. You can then download the appropriate versions and setup a localhost on your computer for development. This is important as well with regards buying any books on PHP. No point buying a book on PHP 5 or 6 (which I made the mistake of sometime ago) if your webhoster is still only using 4.2. I've got a few O'reilly's titles on PHP/MYSql and they were/are very useful.

You'll also want to get a decent grasp on CSS as well. Javascript, Jquery and CSS go hand in hand really.

I'm new to Jquery, but in short it's a prewritten library of javascript functions/methods that you can use to create effects slides/fades and add interactivity to your site(among other things). It saves you a lot of hard work getting to grips with the DOM(Document object model), handling events and also handling cross browser functionality. It also saves you a great deal of coding. For instance a fade effect which would ordinarily maybe take up 20 lines of code, can be written in one line with a simple fadeIn().

I would say that a decent grounding in Javascript is still important though to use Jquery.

So basically Javascript, Jquery, CSS for presentation, effects and interaction. Then PHP for handling your database.

As I said at the top still learning myself, but that's my take on it.

Oh and Sitepoint is a pretty useful forum/site for advice.

Cheers

RLM

Posted

Oh I'll just add that last time I was in that Fortune City bookshop they'd just received a number of copies of the new Javascript, A Beginner's Guide Third Edition by John Pollock. I bought one of the older revisions a few years ago, and albeit that one is dated by today's standards it's a really great book. Especially for the 'Hello world' level of programmer.

It's a very easy read, and has quizzes and exercises throughout which really helps you take it all in.

RLM

Posted
The easiest way I've found is to put a playlist (.m3u) file on the site. This is just a text file containing links to the actual music files. When opened in a browser, the songs in the playlist will automatically begin to stream from the server.

this is kinda what I'm doing right now; what I want to do is to be able to modify that playlist text file on the fly - add/remove songs [and ads], and move the order of the songs around depending on rotation value.

Thanks again for all the thoughts guys, I'm enjoying reading through all these ideas.

Posted

In the real world, I was a Delphi programmer, Delphi is really object Oriented Pascal but then I went from Microsoft windows to Linux. Now I am stuck because my Delphi code will no longer compile, and there is no way I am reverting to Windows!

Any suggestions?

Colin

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.



×
×
  • Create New...