Category Archives: PHP-MySQL

Long time no write – Cloud9IDE

It’s been quite a while I didn’t write anything, mostly due to the fact I simply didn’t take the time to do so. I will try and get back into the habit of making this at least a weekly thing, but we’ll see if that’s realistic 🙂

Cloud9IDE

cloud9ide logo

 

For the past couple of weeks, I have been trying out Cloud9 IDE over the weekends and am really happy I did. I made the switch to a full cloud work environment about 6 months ago, but hadn’t tried actually developing that way (my current job doesn’t require me to do a lot of actual coding) so I thought it a good idea to give it a go with a small project and see how it would work.

Starter: Sign-up to new project

The initial sign-up is very smooth and quick. Not many details to fill-in and, most importantly: they do not force you to give a credit card (A REAL TRIAL! :)). You can then go on and create 1 private (as in, without anyone else being able to look at your source code) project with the free account and that is where the real fun starts.

When you create a new project, this is called a “Workspace” in Cloud9. You can choose from a variety of starter packs (that pre-configure your workspace for the types of technology you’re going to use) or simply go for something “custom”. The first interesting thing I saw whilst creating this workspace was “clone from url”. This option enabled me to specify a github url and create a workspace directly linked to it (pulling the code and letting me commit without a problem). That was a really nice surprise to start off with, as I was anxious as to how I would solve problems with getting stuff into the cloud during my development process.

First steps

The IDE looks pretty neat from the first try. Here is an example of both the first page you see (upon project creation — node.js here) and some syntax highlighting

cloud9 new project screenCloud 9 screen with syntax highlights

The editor is really smooth and definitely works as nicely as any text-editor I have used natively (granted, I haven’t tried a 3000 line file yet, but still). It is very easy to create files, write code and most importantly… run it…

Running your code

It is in running, testing and debugging my code that I see the enormous benefit of using cloud9. A couple of things quickly jump to mind:

  1. Live-preview in the same browser tab. It simply updates as you save your files
  2. SauceLabs integration enables you to test in ANY browser you want – MOBILE INCLUDED. Yup, you heard that right: it takes 10 seconds to save your file and have it run on both an emulated android and an ios device…

cloud9 mobile testing with saucelabs

  1. Live link. If the “live preview” is not good enough for you and you want to test your code outside of the cloud9IDE preview, you can simply take the link and open it up in another tab, to test it the old fashioned way.

Wonderful easter-eggs

Whilst getting to grips with Cloud9, I was trying to learn a little on html5 mobile app development at the same time, so I wanted to use phonegap and, more specifically, ionic (a framework based around phonegap for html5 mobile development). That is when the power of the terminal became really apparent. I thought I would have to go through all the trouble to get node.js installed and then make it work with phonegap, but no. Node.js was already fully running and the only command I had to put into the terminal was “npm install -g cordova ionic”. That was it… and I’m not even kidding… No errors, no hassle, everything simply installed and my whole workspace was set-up to start developing apps for mobile…

Another useful thing was that at some point I wanted a public URL for my app. As it was HTML5 I also wanted to support normal browsers so I decided to get a heroku app and push it there. Again, I thought I would have to set up the heroku toolbelt and some other things to get this working, but no… IT WAS ALREADY THERE. This meant that the whole process of pushing my code live on a new heroku app took under a minute (setting up the new heroku app INCLUDED).

Conclusion

After 3 days (over the space of 3 weeks) with Cloud9IDE, I am completely sold. I think it is one of the better applications I have tried out over the last years and definitely feels like a major leap forward in the development landscape in general.

I haven’t tried out very heavy set-ups yet, so I’m not saying this is for everyone and every project, but I am definitely recommending this for small to medium-scale web development and any html5 mobile development.

Hope this overview was useful, but let me know if you have any thoughts / comments!

 

 

A developer / entrepreneurial Windows setup

As I’ve now been under Windows 7 for a couple of months, I’ve had to struggle really getting adapted from my previous Linux setup and thought I’d share my resulting setup, in the hopes it might help someone else out. I will write this in two posts, as it would become a little too long if I didn’t Smile.

VirtualBox

Many years back, when I started developing under WIndows, I was using EasyPHP and so that was my first reaction as soon as I was back. However, now that I am so used to my flexible environment in Linux, EasyPHP simply didn’t do the job any more. Luckily there is VirtualBox and with some tweaking, I managed to set up a really neat development environment.

  • Ubuntu Server 12.04
  • VirtualBox network configured to pass requests for localhost on to the virtual machine
  • Windows host file used to provide actual development names for my websites
  • Map /var/www/ to /sf_media/www, which is a share folder in virtualbox, linking to a folder under my Windows (host) machine

This enables me to go to mydevelopmentdomain.dev in windows and it will serve-up the website in /var/www/mydevelopmentdomain on my virtual development server. I get to fully develop under my Windows environment and still have the full power of a linux server to tweak / debug.

Zend Studio / Eclipse

Without these tools, my life would be a lot harder. Luckily, they are as much available under Windows as they are under Linux, so no real change here. I user Zend for my Web development and Eclipse for any other development.

Github

I had a hard time getting on to it, but I have finally taken the plunge and haven’t regretted it. Github is now my go-to place for source control and luckily they have a very good Windows app available, providing me full git command-line functionality even under Windows ! (or UI if you prefer that).

Next week

This weeks post was focused mostly on the Development setup. Next week I’ll be diving deeper into all the rest (Twitter, Outlook, etc.).

Web development tools for Linux

linux-mascotteI have been developing websites and applications since quite a while now (since I was 12) and have used various applications from NotePad to DreamWeaver through PHPEdit, etc.

When I made the switch to « the better operating system », I needed quite a while to adapt properly. I wasn’t having a really hard time, but I couldn’t find the same quality web development tools I was used to with Windows. Today, however, I am really happy with the development tools that I use (which, for most of them, can also be found on Windows by the way) and thought I’d share them with anyone that would maybe want to use them but doesn’t know they exist.

IDE

For anyone who’s seriously into developing, an IDE can make you save a lot of time (and money). I have been a long-time fan of Notepad++, but it’s no match for a full-blown IDE if you know how to use it.

Linux had a very small choice of IDEs, especially in web-development. For me, there actually wasn’t any that managed to have all the functions I required and was used to coming from Windows. After quite some research, I found Eclipse PDT and it’s professionnal counterpart Zend Studio.

Eclipse PDT is a framework on top of the Eclipse IDE (which is known especially for JAVA development) that supports many web development features. Some of the key features include :

On top of that, it has a healthy repository of plug-ins written by the community which enable you to build some other features on-top.

zend-studioZend Studio is Eclipse PDT with a layer on top. It has very nice code-completion features, nice FTP integration and tends to be a little faster. On top of that, it comes with pre-configured installers for different Linux flavors, which is very straight-forward.

With Zend Studio, you’re basically paying for peace-of-mind. If you do not want to go through the hassle of looking for different plug-ins and need your development environment to just that extra bit faster and stable, you should definitely go for Zend Studio, it’s the best PHP IDE I have been able to find, lucky for me it is cross-platform.

MySQL Workbench

Mysql workbenchThis is magnificent tool to get your database analysis work done in a visual way. You can set it all up with a nice UI, connect to your local DB and the application automatically replicates your model into an existing database. On top of that, if you need to change anything later on, it has the possibility to “ synchronize” both your model and your development database.

I have been late in discovering this tool, but it has become completely indispensable since I got used to it.

FileZilla

filezillaZend Studio has an integrated FTP; but I have found myself often wanting more anyways. FileZilla enables you to connect to different sources at the same time, synchronize without any problems and get your work uploaded without hassle. It is a cross-platform and very stable, mature program.

Litmus

litmusOne big disadvantage of coding on Linux is the absence of the most popular Internet browser “Internet Explorer”. I know, I don’t like it either, but as a professional web developer you have to make your site compatible with Microsoft’s Internet navigator.

For this reason, I use a web-based service named “Litmus”. It costs quite a lot (49$ / month), but if you develop a lot, it is surely worth it. What it will do is simply take a screenshot of your website in different Internet navigators and on different operating systems. It enables yo to win the extra 30 minutes on every CSS you have to deal with.

Forums

Very often, forums are too slow to be of actual help when you’re under time-pressure (which is usually the case when you’re working on professional projects).

Sometimes, however, you are able to finish your day with a problem that you cannot seem to deal with in an easy and quick manner. In that case, it is always a good idea to leave a quick message on a forum for someone who might be able to give provide a solution to your problem. That way, when you get back the following morning, you’re able to use the solution directly and not lose another 2 hours only to find out it could have been done in 2 minutes worth of work-time.

The forums I use are www.dreamincode.net . They are not the most active, but a very helpful community that know what they are talking about. You can check them out and use whatever forum you prefer, but this is a nice start-point.

Any suggestions ?

I am a professional web developer, knowing my way around the existing applications, but I am not perfect. If you have any suggestions and / or comments, please do not hesitate to contact me. I am always looking forward to find ways to cut development time (without cutting on quality) !

Simple log class

As I am back to programming, I thought I’d start sharing some of the work I have been doing so that people can comment on it, use it and give me some feedback :). I wrote some small log class a few weeks ago and thought I might start off with that, so here it goes. This class simply creates a new csv file in /includes/logs every day and logs the information you want in it. It also passes on the class that uses it, to be able to trave it a little better.

class Log {
	// Stores the path of the logfile
	private $logPath;
	private $logFileName;
	private $fileReference;

	public function setLogPath($logPathIn) {
		$this->logPath = $logPathIn;
	}

	public function getLogPath() {
		return $this->logPath;
	}

	public function setLogFileName($logFileNameIn) {
		$this->logFileName = $logFileNameIn;
	}

	public function setFileReference($fileReferenceIn) {
		$this->fileReference = $fileReferenceIn;
	}

	public function getFileReference() {
		return $this->fileReference;
	}

	function __construct($textToWrite = "none", $class = "none") {
		$this->setLogPath(LOG_FILE_PATH);

		$time = time();
		$this->setLogFileName(date("d-m-y", $time) . ".log.csv");
		$this->setFileReference($this->logPath . $this->logFileName);

		if(!file_exists($this->getFileReference())) {
			$file = fopen($this->getFileReference(), "a+") or die("Something went wrong while creating the log file.");
			fwrite($file, "Time; Class; Error logged;n");
			fclose($file);
		}

		if($textToWrite != "none")
			$this->writeLog($textToWrite, $class);
	}

	function writeLog($textToWriteIn, $classIn = "none") {

		if($classIn != "none")
			$class = get_class($classIn);
		else
			$class = "none";
		$time = time();
		$date = date("H:i:s", $time);
		$textToWrite = $date . "; " . $class . "; " . $textToWriteIn;

		$file = fopen($this->fileReference, "a");
		fwrite($file, $textToWrite . "n");
		fclose($file);
	}
}

Please let me know if you have anything to add / comment