We're growing into something new. Read More
rocktronica

Tommy


Docs = {
    base: 'http://php.net',
    functionList: {},
    functionDetails: {},
    getFunctions: function(callback) {

        var site = Docs.base + '/quickref.php';
        var yql = 'http://query.yahooapis.com/v1/public/yql?q=' + encodeURIComponent('select * from html where url="' + site + '"') + '&format=xml';

        $.ajax({
            url: yql,
            dataType: 'jsonp',
            success: function(data) {
                if (data.results[0]) {
                    $(data.results[0]).find('#quickref_functions a').each(function() {
                        var functionName = $(this).text();
                        Docs.functionList[functionName] = {
                            name: functionName,
                            link: Docs.base + $(this).attr('href')
                        };
                    });
                    callback(Docs.functionList);
                }
            }
        });
    },
    getDetails: function(name, callback) {
        if (Docs.functionList[name]) {

            var yql = 'http://query.yahooapis.com/v1/public/yql?q=' + encodeURIComponent('select * from html where url="' + Docs.functionList[name].link + '"') + '&format=xml';

            $.ajax({
                url: yql,
                dataType: 'jsonp',
                success: function(data) {
                    $data = $(data.results[0]);
                    $data = $data.find('.refentry');

                    var para = [];
                    $('.parameters .term .parameter', $data).each(function() {
                        para.push($.trim($(this).text()));
                    });

                    var details = {
                        synopsis: $.trim($('.methodsynopsis', $data).text()),
                        description: $.trim($('.rdfs-comment', $data).text()),
                        parameters: para,
                        returnValues: $.trim($('.returnvalues .para', $data).text())
                    };
                    Docs.functionDetails = details;

                    callback(Docs.functionDetails);
                }
            });
        }
    }
};‚Äč

PHP Doc reference in Javascript

This is something I hacked together. It can be a million times better, so it'd be nice if someone would like to contribute to this idea. Here is what it does: provides you with 4,936 function names in PHP, and allows you to retrieve a functions synopsis, description, paramaters, and return values, all through the PHP.net Documentation, and Yahoo's API First, include this code in your doc. Then call the following: Docs.getFunctions(function(data){ // Your Code Here }); Raw The object data passed as a parameter will contain a list of functions with the following structure: data = { abs: { link: "php.net/manual/en/…", name: "abs" }, acos: { link: "php.net/manual/en/…", name: "acos" }, addslashes: { link: "php.net/manual/en/…", name: "addslashes" } }; Raw It will also be accessible via Docs.functionList. From THERE, go ahead and call the following function: Docs.getDetails('mail', function(data){ // Your Code Here }); Raw Once that function has ran, it will pass the results as the data parameter, and also assign the results to Docs.functionDetails It will have the following format: data = { description: "Sends an email.", parameters: ["to", "subject", "message", "additional_headers", "additional_parameters"], returnValues: "Returns TRUE if the mail was successfully accepted for delivery, FALSE otherwise.It is important to note that just because the mail was accepted for delivery, it does NOT mean the mail will actually reach the intended destination.", synopsys: "bool mail (string $to , string $subject , string $message [, string $additional_headers [, string $additional_parameters ]] )" }; Raw Enjoy

Discussion

Licensing and Copyright (and code ownership and all that fun stuff)

So, @chrisjones and I work for ourselves and we're contracted to the same 3rd party. This company has hired us to produce a CMS (and, likely, other products in the future) for them using Django and whatever other tools we deem necessary. The code that we've produced hasn't been licensed one way or another, and neither of us have signed any contracts of any sort with the company. Surprisingly, this isn't a post about failure to pay. We've been blogging about the code we've been producing on our site Brack3t and this recently came to the attention of the company owner. He, of course, panicked, but we were able to explain that nothing we've posted is threatening his business in any way and wouldn't produce any sort of turn-key solution for a competitor to launch a site in competition to his own. He understands but would like notice when we post anything else. I think this is fair when it comes to posts that extensively detail how our specific-to-this-client business logic works. We, also, obviously, don't plan on revealing code that would harm his business. We're merely interested in an answer out of curiosity and future protection of ourselves, our business(es), and our code. Now, here come the questions. since Django is BSD-licensed, am I wrong in my reading of the BSD license that all code produced with Django needs to be licensed the same way? since no contracts exist, under US law, wouldn't all the code produced by @chrisjones and myself be copyrighted to us?

Keep It Sticky

For those fellow Forrst'ers who were there for me from the beginning...They're back in action! If you would like to see the original post, please jump to my collection and click the very first entry! It's been a while! For more details, check out store.bearkid.com/category/…

@lmklater - Never forget anything again!

Use twitter to set short timely reminders! Thought a few of our friends here at forrst might benefit from this app @rfunduk and I have been working on. Ryan developed the core using Ruby, Sinatra and Mongodb for the database. I designed the ui and coded the interface using less and haml. There are a few bugs and edgecases that are still being worked out but more or less the app is stable. By sending an @ reply via twitter to lmklater you can set a reminder and receive a tweet for a future date and time. Use a semicolon to separate the reminder and time. "Feed dog ; 7pm" The system accepts many human readable times such as "tomorrow at 3pm" Hope you find it useful!

Discussion

Tubalr.com ... its been just over a year!

So its been just over a year and I thought I would share some stats/info for my little side project, tubalr. Forrst was the first community I showed tubalr to and I've been getting feedback over the past year to make it the best I can. I'm really thankful for all the support and feedback Forrst has given me over the past year, really... it helped me land the job I have right now. Anyways, the stats below are nothing special at all, but I thought someone out there might enjoy them. If anyone has any questions, I'd be more than happy to answer anything I can. The Stats (9/12/10 - 9/20/11): 5,561 Absolute Unique Visitors - 9,343 Visits - 22,118 Pageviews United States 5,724 visits United Kingdom 589 visits Poland 447 visits Canada 398 visits Spain 242 visits 52.56% Chrome - 23.27% Firefox - 12.62% Safari - 7.36% Internet Explorer Some posts I've made over the past year about tubalr.com: forr.st/… forr.st/… forr.st/… forr.st/… forr.st/… forr.st/… forr.st/… forr.st/… forr.st/… forr.st/… forr.st/…

Prettier PHP Exceptions.

As part of a large project I'm working on, decided to implement a prettier, friendlier and more useful exception screen. The developer is faced with a random error-related haiku, some quick-n-dirty information on just what happened, and the option to go more in depth, if needed, with one or two clicks.

Discussion

So you want to learn to code?

Many people post on Forrst stating that they want to learn a language, and I'm beginning to tire of seeing the repetitiveness of the posts, and the repetition of the answers. So, here is how I have learnt to code. If you have learnt to code in another way, please post it as a comment. I will then link to it from the main post so that in future cases when people are wondering how to learn to code, this can be used as a reference point that will help anyone and everyone choose the best way that suits them. Also, at the bottom, there will be a list of links that I find are more useful that others, and some that should be taken with a pinch of salt. I am happy to add extras etc... How did I learn? The best method of learning is doing, the old saying of practice makes perfect could not be more true. Of course, you have to have a certain mindset to even consider the possibility of learning through practice. If you're the type of person that will give up when they get an error, or who thinks they are about as thick as the mould on a 25 year old piece of bread, then ignore this method. If you think you're pretty intuitive, and have the perseverance to fight through your problems, and solve them. You will become a good programmer, but not just that, you will become a bloody good debugger. Ultimately trial and error is what this method is, take code, break the code, fix the code, pat self on back! How do I practice to become perfect when I know nothing? I understand where you're coming from, you need to start basic, you need to work your way up to the task that you want to finally make. I gave the same advice to a rather reluctant @justinsherrard on Twitter, he has followed me for many months/years and has had an interest in learning PHP, but hadn't got round to it. He started a while back making a member system - you register, you login, you have a profile (I think!). Simple, nothing complex, or hard to the seasoned programmer. But to a new guy, this opens up a HUGE array of tasks... in brief: How do I interact with a database? How do I make a database with PHPMyAdmin? How do I handle a form posting? How do I even consider storing a password? How can I log someone in, and keep them loggedin? Sessions Cookies SQL Injections Salting Hashing Email confirmation Password reminders CAPTCHA integration The list goes on - but what you have on that list there is the barebones of what you will use day in & day out with PHP - all wrapped into a nice project. After he had got that running & 'working' to a point he was happy with, he moved on to a very ambitious forum system. Not trying to be the next huge board provider or anything, but to learn! So how do you start if you actually don't know anything? You use something called time, you use something called, the internet, and you look things up. You type into Google 'handle form post with php' and read the sites that popup - you read what people have put and play with their code. If you're coming at a language with no prior coding knowledge, it's worth following a brief tutorial on a website such as Tizag. It will guide you through the basic syntax, and usage. I would advise that you read through it with your project in mind. I have never done a tutorial that a site has offered - ever - I have taken my project, read what code was provided at a tutorial and editted it to match etc. I have no idea what to do for a small project to learn! Well if you have no idea, then you need to think of something simple, it could be something like a calculator, or just something in jQuery that will enhance picture display. Or you might want to try some fun with the language, and perhaps solve some of the Euler Project questions that exist, that or try to solve FizzBuzz in a stupidly short number of characters. Other ideas could be: Display twitter stream [any language] Create some crazy Forrst Stats page with the Forrst API. User management system Client interaction system Poll system (allow create/edit polls & people to vote etc) Image hosting site* many many more. I used an image hosting site as my first project, it started off very basic with PHP when I was learning. It soon escalated to a site that was pulling in just over 1TB of traffic a month, and about 13million hits. I incidentally closed it down due to my inability to fund it - it is back in the pipeline for re-release. So how do you learn? Take something you want to make (not something stupidly complicated, something stupidly basic!), make it. Then build it up. Use some of the sites that are mentioned throughout & at the end of the post for help & guidance. Don't give up either, just because you can't do it, doesn't mean it's impossible. I'll suggest 3 little things to do throughout your learning experience: Post your code for review If you are new to coding & haven't written much in a language before, post on Forrst - state that you haven't done the language before and would like some tips on whether the methods/syntax you are using is best. If it's a language I know, I'll happily jump in & write you a lengthy comment explaining stuff etc. Read other people's code If you find a code post here on Forrst in a language you're wanting to learn, go read the code, if you don't understand what stuff does, post saying so. Forrst is here to be used & abused, and to be quite honest, as a beginner you should be hugged, loved, cuddled, stroked and guided through anything that you need help with. If people flame you for asking a stupid question - just flag their comment. ASK FOR HELP! While the other suggestions pretty much match this, I'll mention it, there are lots of sites out there including Forrst where you can get help - StackOverflow springs to mind, as well as other specialised forums. [When I learnt JavaScript, I posted on a support forum for a remotely hosted forum company which I later then became a moderator of due to my learned skills etc]. I've rambled a bit, and will probably refactor most of this message, but the message is there, determination will get you through. I will leave you with one quote that I love, I can't remember the source but hey ho: He who asks now is a fool for 5 minutes, he who doesn't ask is a fool forever Helpful sites PHP.net - official documentation site for the PHP Language jQuery Docs - jQuery documentation Tizag StackOverflow Forrst http://www.w3schools.com/ - Please take this site with a pinch of salt, it is not always accurate, but is helpful for basics. Google - if in doubt, google your question My Twitter Account - *I am always happy to answer any coding questions over Twitter - if it's a complex question, I'll normally throw you my Skype or email! * Questions: Feel free to post any questions, corrections or additions. I apologise that it seems as if the post has been tailored more towards PHP, the basics remain for any programming language. Last Updated: 23rd Aug 2011 @ 00:04

The Reverend Danger website

been MIA setting up shop in san diego. finally tossed the new company website live. really excited about it, and i welcome any feedback. i'm still making changes so any help would be reeeeally useful.