Importing an existing folder as a new Eclipse Project

I absolutely hate the new project dialog in eclipse. It seems like each plugin (PHP, Flex, Aptana, SVN, etc.) has its own way of doing a new project.

Here’s one reason I hate these dialogs – If I want to add a new project into my workspace, I can’t put the files there first and then make it a project. Why would I want to do this? 1)I want to clone a git project from a remote repository into my workspace. Right now there is no way to do this with an add project dialog. So the files get to my workspace, but they don’t show up as a project. Same goes for SVN stuff where I want to re-add the files as a new project without having to check the whole stinking repository out again. Plus, it would be nice if I wanted to add files first, then make projects. Is that so hard? I understand eclipse doesn’t want to muck around in a folder with no project data to make a new project, but really, is it so hard to make a non-project folder a project folder? And if eclipse isn’t meant to do this, GET RID OF THE ‘Create project from existing source’ option because it doesn’t work with many project types.

So here is a way I found that works swimmingly. I wonder if this came as an option with a plugin. If so, I am using PDT php, Aptana, Subclipse, and I think those are the main ones. If you don’t get this option in your menu, than who knows what plugin you may need. I’m just glad I got it to work for me.

SOLUTION: Screw the new project dialog. Do File->import then select the folder ‘Other’->Existing Folder as New Project. This works great for my goal of 1)having files in my workspace that are not a project in eclipse and then making that folder and all its files a new project.

bash: git-receive-pack: command not found, git-upload-pack

When doing a push to master I was getting

bash: git-upload-pack: command not found
bash: git-receive-pack: command not found

For me my server was not recognizing the git command. I had to add the server paths to my local git config

receivepack = /home3/<myusername>/local/git-1.6.4/git-receive-pack
uploadpack = /home3/<myusername>/local/git-1.6.4/git-upload-pack

where the config file is in the .git directory of my project on local. This line is under the entry for the remote I had set up called ‘origin’ (use the path on the server where the git install is located and make sure git-receive-pack is in there on the server).

BUT,I think the following is be the better solution. Editing the .bashrc worked like a charm. I added the following line to my .bashrc file (look in /etc or you home/ directory if on a shared server) and things worked swimmingly.

export PATH=”$PATH:/home3/<myusername>/local/git-1.6.4″

replace /home3/… with whatever the path to your git install may be.

I’m still not clear on why the path would be different for a bash ssh command, and a client sending a request over ssh to the server. It seems as if even though my server environment variable $PATH includes the path to the git install, the $PATH variables does not include that path if the git commands are invoked over a remote ssh request (like my eclipse working with git). But if I was logged in on a bash shell, the git commands worked great, with no ‘command not found’ errors. Make sure when you install git, that you understand how to make your server recognize the git executable commands, both from the bash and also from remote requests. I’m still unclear on the difference between 1) editing the $PATH environment variable to include your git directory 2) Editing the .bashrc with the export $PATH setting. 3) Making symbolic links from the bin folder to your git install.


make[2]: execvp: Permission denied

make[2]: execvp: true: Permission denied

You need to do chmod 755 true on the true script on your bin, For me I had followed the instructions at:

for installing git on bluehost. I had to make a script called ‘true’, and put it in my local bin to get git to compile.

make[2]: execvp: <YOUR FILE HERE>: Permission denied

These errors mean that your script does not have execute rights. You can ‘chmod 755 <YOUR FILE>’ and it should work.

Using PEAR classes with bluehost php – Edit your include_path

Getting an HTTP_Request class was pissing me off. So it seems like you can’t install PECL classes on your php install because of rights issues on a shared hosting environment.

BUT, you can get PEAR classes installed through the cPanel, using the PHP PEAR Packages link. I was adding the HTTP_Request package (HTTP_Request2 won’t install because there is no stable release as of yet).

But even after the install, the classes could not be found. Like when I did require_once(‘HTTP/Request.php’) I was getting the classic not found warning and error:

Warning: include(HTTP/Request.php) [function.include]: failed to open stream: No such file or directory
Warning: include() [function.include]: Failed opening ‘HTTP/Request.php’ for inclusion
Fatal error: Class ‘HTTP_Request’ not found

You have to edit the php.ini (or ini_set the include_path ) to include :/home/yourusername/php, or in my case the home directory is now home3 for some reason, with some weird aliasing allowing for home I think. The PEAR packages install to /home/yourusername/php, so this needs to be added to the include path.

If you still get:
PHP Fatal error:  main(): Failed opening required ‘PEAR.php’
Then your include_path may be missing :/usr/lib/php, this is the main (not your local user) php lib folder that, I think, has the main PEAR files (The ones that your local PEAR package installs like HTTP_Request will be calling). So when you install a PEAR package via the cPanel, it puts them in /home/yourusername/php, and those files will need to know about the main PEAR install in /usr/lib/php by having /usr/lib/php in the include path.

XML to HTML entities – Encoding XML document text for HTML

private function XMLtoHTMLEntities($string){
//get rid of any XML entity encoding that may have been applied (like in an RSS feed)
$unXMLEntify = str_replace ( array ( '&' , '"', '&apos;' , '<' , '>'), ->
array ( '&', '"', "'", '<', '>') , $string );
return htmlentities($unXMLEntify);

How to install the pdo myql drivers for php

First install pdo.

I already had php 5 with the pdo extension included in the build. But I needed the mysql driver for the php extension since it only came with 2 (sqlLite, sqlLite2).

To add the mysql driver for pdo in your php install, put ( – you’ll have to compile this) in your extensions directory and then enable that extension in php.ini. WTF, pretty simple but there are no web pages with instructions. And compiling in Mac OS X sucks because you need to install extra Developer tools and than run the command line compile commands.