• user warning: Unknown column 'u.signature_format' in 'field list' query: SELECT c.cid as cid,, c.nid, c.subject, c.comment, c.format, c.timestamp,, c.mail, c.homepage, u.uid, AS registered_name, u.signature, u.signature_format, u.picture,, c.thread, c.status FROM comments c INNER JOIN users u ON c.uid = u.uid WHERE c.nid = 26526 AND c.status = 0 ORDER BY c.cid LIMIT 0, 50 in /var/www/ on line 991.
  • warning: file_get_contents( [function.file-get-contents]: failed to open stream: HTTP request failed! in /var/www/ : eval()'d code on line 4.

4D is on GitHub!

by Josh Fletcher

If you're at all involved in other projects besides 4D you're probably aware of GitHub, or perhaps you've heard of it otherwise (I mentioned it during the recent webinar about SVN and 4D).


GitHub is hugely popular with the Web-development crowd and, to a larger/growing extent, anyone involved in the Open Source community. It might seem strange that 4D, being a proprietary platform vendor, would get involved with GitHub (or maybe even look like band-wagoning :). That's definitely not the case though, this is really a guerrilla effort to get the 4D community out in the open in a more structured fashion. If you want access to some cool 4D tools, or have something the contribute, read on!



Most professional developers today use some form of Revision Control (RC). The primary advantage that git offers is that it is a distributed RC system. This actually isn't all that important for 4D projects (I will explain this in detail in my next Blog).





GitHub is - among other things - a public, free git server (it has pay options too) with one catch: projects hosted for free must be open source. The reason GitHub is important (even for 4D developers) is sharing (some might say publishing). So the reason to put 4D content up on GitHub is simple: sharing. The projects hosted there will be completely open to the community and hopefully encourage community participation.


By the way if you're already using GitHub and have a project that you'd like to have listed under "4D", don't hesitate. If you've never used GitHub before, I've including some helpful tips at the end of this post.



The first new 4D project available on GitHub is CodeExport. If you missed the Practical SVN with 4D webinar or Tech Note, CodeExport is a 4D component designed to export all code to text files that are suitable for use with RC.





More importantly, CodeExport is designed to be lightweight and low impact on the host database. Anyone and everyone can start using CodeExport today with no changes to the host database.


If you are not all that interested in GitHub yet and just want to use CodeExport, do this (you don't even need a GitHub account):



You need two items from this package:


  • "CodeExport.4dbase" in the "components" folder should be installed into your database components folder.
  • "MISC I.bundle" in the "Plugins" folder should be installed to your database plug-ins folder.


Be sure to check out the readme and there's also documentation in the "doc" folder.


If you want to make sure you have the latest version, look for the text file inside the component package (e.g. "19721.txt" is version 19721). To check the latest version, look for the file via GitHub.


Finally if you want to contribute to CodeExport don't hesitate! If you want to commit changes to the official repository please heed this section of the documentation:


Keep the original design in mind. CodeExport should strive to be zero impact on the host database.


I'll be doing another Blog post soon describing the process of getting CodeExport on GitHub and spend a bit more time talking about using git with 4D projects.



These steps are updated from Alexandre Morgaut's Wakanda blog post about GitHub


From a user perspective, the biggest barrier for entry to using GitHub for a 4D developer was probably the client software. GitHub is, in part, a git server therefore you need a git client. Client software for git tended to be command-line heavy and not out-of-the-box friendly. That all changed with the recently released Windows and Mac client apps for GitHub. These clients are SUPER easy to setup and use.


Here's how to get started:



Creating your first repository:


  • Head over to Tip: you can create repositories in the GitHub client but the options are limited; I prefer the website.
  • Enter a name for the new repository, e.g. "CodeExport". Note that the naming convention used on GitHub is all lower-case with words separated by hyphens but you can use whatever you want.
  • I suggest enabling "Initialize this repository with a README"; the README file is an important part of any GitHub project.
  • Create the repository.
  • Launch the GitHub client.
  • Enter your account credentials (you only need to do this once unless you log out).
    • Click the on Windows.
    • Open GitHub Preferences on OS X.
  • The display should refresh to show the repository you just created; select it and click "Clone".
  • Right-click on the repository in the GitHub client and select "open in explorer"/"Show in Finder".
  • Move any files you want to have under revision control into the cloned folder. You can copy of course, but it just gets confusing and defeats the purpose of RC to have more than one copy on your machine.
  • Head back to the GitHub client and double-click the repository (if you didn't already open it).
  • Add a "Commit Message" (required) and description (optional) and click "commit"*.
  • Now for one tricky bit: git is a distributed RC system. The above commit only pushes the changes into a local repository. To push them up to GitHub, you need to "sync" the local changes. Click the corresponding "sync" button in either app to push the changes up to GitHub. I'll talk more about distributed RC in my next blog post.


* Note to OS X users: you shouldn't commit hidden OS X meta files like ".DS_Store". You can manage this with a .gitignore file. Luckily the GitHub client makes this super easy: just right-click on the file and choose "ignore". This will create a .gitignore file with matching pattern for the ignored file (or update an existing .gitignore). Don't forget to commit this change! That's it, you're now using git for RC of your project!


Ok, it's not always THAT simple, but GitHub has an excellent help system so be sure to check it out!


If you'd like to clone CodeExport, head to and click the "Clone in Windows" or "Clone in Mac" button; this will launch the GitHub client and take care of the cloning. Note you will not be able to sync changes to the CodeExport repository on GitHub. Read about Pull requests for info on how to contribute to a GitHub project you do not own.


RSS 2 comment(s) to this post