My Blog

contains PHP and other web related content. (Sometimes there are some off topic things - don't freak out!)

Posts Tagged ‘IDE and Web Dev Tools’

Exploring MySQL in Eclipse PDT

Monday, February 15th, 2010

As you probably know by now, I’m a huge fan of Eclipse PDT. Well, I wanted to stop using MySQL GUI tools for a bit and explore Eclipse tools.

Get the SQL Explorer Plugin


The first thing to do is to get the Eclipse SQL Explorer plugin. You can get that at the update URL:
http://eclipsesql.sourceforge.net/

Install this software like you normally would. Accept the license and you’re ready to go with the plugin. I would recommend letting Eclipse restart after the installation.

Eclipse Uses JDBC

Eclipse uses JDBC connections to connect to MySQL. You can get this on the MySQL connectors page:
Connector

Simply unzip the connector into your Eclipse program directory and move on.

Open Eclipse

Next, Open eclipse (if its not already open.) First step is to choose the SQL Explorer perspective. This can be done by going to the Window menu, clicking Open Perspective and choosing Other. Then, select the perspective from the list.

Now, create a connection profile. This is done by clicking on the Create New Connection Profile link. From here, name your connection, choose your adapter and fill in the proper credentials. (If you’re not familiar with this style credentials, you can visit this website: http://www.connectionstrings.com

What if I can’t find my Driver in the list?

There is a good chance that the driver may not be in the list by default.
Follow the following steps.

1) On the connection profile screen, click the ‘Add/Edit’ button
2) Select the MysQL driver in the list.
3) Click the Edit button on the right hand side.
4) If you do not see your driver in the list of Java Class Paths, click on the Extra Class Path tab.
5) Browse to find your most recent driver download and select that jar file.
6) Click on the list drivers button. com.mysql.jdbc.Driver should appear in the Driver Class Name box. If not, select it.
7) Click OK and then OK again to return to the connection profile box

Now you should be able to use the MySQL driver from the list.

Browsing the Database

After configuring the connection profile, you should see it in your list of connections. Once you expand it and double click the user, you will be prompted to enter your password (as well as choose some other connection profile options).

From here, you’re good to go! You can browse the databases in the Database Structure tab, you can edit SQL in the SQL Editor tab, etc.

Firebug for Internet Explorer

Monday, November 2nd, 2009

During the creation of my websites, I develop solely in Firefox. When it comes to testing, I run it through IE tester. One thing that I really miss is my Firebug.

Enter Firebug Lite

Firebug Lite is a stripped down version of Firebug. For the details of the current release, look at the firebug lite features.

For my code, I decided to only include the firebug lite code from their distribution when not in production. This is how I do it in my code:

1
2
3
if (!ENVIRONMENT_LIVE && strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== false) {
    echo '<script type="text/javascript" src="http://getfirebug.com/releases/lite/1.2/firebug-lite-compressed.js"></script>';
}

In this case, whenever the code is not in production and the agent is a version of Internet Explorer, the code is loaded.

Issues with Firebug Lite

Regular Firebug has spoiled me. The lite version has a few issues:

  • The inspect feature is somewhat quirky. Sometimes it clicks links instead of selecting the DOM element. It also has a delay.
  • The CSS view shows the whole entire computed style, not just items you’ve added.
  • You can’t do any inline editing of elements in the DOM tree.

Overall, its a real nice addition to my IE debugging back.

Bluefish Editor could help you leak your PHP!

Friday, October 23rd, 2009

The BlueFish editor is a primarily linux based visual editor for various web languages. Visit the site for more…

One thing I had noticed about a few projects I was working on was the presence of files named things like:
index.php~
settings.php~

After opening them up, I noticed that they were straight PHP code. The settings file particularly was intriguing – as it had db credentials in it. These were in our deployment… so anyone who surfed to http://domain.com/settings.php~ could see our code. Not good.

I talked with the other developers to see why this was happening. The most irritating response I received was “just add it as a php mime type so we don’t have to worry about it.” Grrarr!

BlueFish OptionsTurns out it was one of the developers using the Bluefish editor – and then committing his entire working directory. Bluefish has an auto backup process that creates a backup of a file before a save. Its default setting was to use a tilde with the file name. This option is found under the Edit -> Preferences menu option.

So my suggestions are to a) be very careful what you commit, b) turn off that function if its not needed or at least c) check mark the ‘remove backup file on close’ option.

Seems to me that some clever google queries may be able to help us find this problem elsewhere out in the wild…

Trac Bookmarklet: load ticket number easily

Saturday, January 31st, 2009

While communicating with other coworkers, they generally just give me a trac ticket # and not the full URL. And, as a lazy programmer, I hate typing in the full URL or loading up trac and searching the #. So, I generated this bookmarklet. Replace the url with the root path to your trac instance. Finally, create a bookmark and put the following content in it:

1
javascript:var url='http://domain.com/trac';var p=prompt('Ticket #?');if(p)document.location.href=url+'/ticket/'+p;

Eclipse PDT: Integrating Apache Bench for load testing

Friday, January 23rd, 2009

When I use an IDE, I expect for it to do everything I need for my project, from start to finish. As you may have read in earlier entries, I enjoy using Eclipse PDT. I think its time to include load testing into my arsenal of tools inside of eclipse. I’m going to focus on apache’s AB for this article.

(more…)

Convert from VMWare Player to VMWare Server

Tuesday, September 2nd, 2008

At superdev, we have a distribution of a gentoo image made with vmware workstation. This works fine in vmware player – but not the free vmware server – and I wanted to have vmware server running so I could have more than one server running on my windows laptop. Well, there are two small simple edits I had to do – and it was all good.

First of all, I grabbed my favorite free hex editor and evilly smiled. Open XVI32.

Second, edit the file named VirtualMachineName.vmx. Replace the virtualHW.version = “6″ with virtualHW.version = “4″. SAVE.

Finally, edit the file named VirtualMachineName.vmxd. If you have more than one (like -1, -2, use the one without the suffix. Those are the data files, the vmxd is the config). Once again, replace the virtualHW.version = “6″ with virtualHW.version = “4″. SAVE.

Other things I ran into…
For whatever reason, my eth0 turned into eth1 once I transferred. So I had to do that modification. (Also, my dhcp on my network stopped responding to the vm, but I changed it to NAT anyway – because I wanted it as a local connection anyways.)

Useful Eclipse Plugin: Find a file name in project immediately

Monday, September 1st, 2008

Unfortunately, at #superdev, there are times when the include_path in PHP is calculated. It is not always clear where to find a file. Other times there are just too many places to find the file. Because of this – and Eclipse PDT’s inability to find a file from an include or include_once statement when you ctrl click it, I needed to find a tool to find files fast.

Don’t be Lazy – use ‘Teh Google’

So for the longest time, I would determine what classes or functions were being used from the included file, and then do a search of the code base for “function functionName()” because I knew it would find that file … eventually.

Well, turns out, there is a better way.

Goto File Eclipse Plugin

I found this great plugin for eclipse: GotoFile @ muermann.org. I wish I had thought that this could be done – and searched earlier! heh. Turns out this plugin adds a new menu to your search menu by which you can launch the dialog window. Then, just start typing the name of the file and it live searches for you. When you finally find it, just double click it – and it’ll open up the file it found in your project. It appears to work for any file in your project – which is amazing. For more features and details, check out hte GotoFile Eclipse Plugin Home Page.

XDebug and Eclipse PDT on Windows – From Start to Finish

Tuesday, May 20th, 2008

XDebug and Eclipse PDT on Windows – From Start to Finish

With our recent upgrade to php at “the triangle,” I felt it was time to start working on using a debugging and code profiling tool. When I say felt like it was time… I meant our PHP version finally supported it. *sigh*. Anyway, from start to finish, this is what I did in order to get Xdebug to integrate into my current eclipse PDT – as well as investigate the other features of xdebug. I tried to detail all of the mistakes I made as well as what I figured out. Let’s go:

(more…)

Eclipse Testing with TPTP – help me?

Monday, December 10th, 2007

I recently came across this tutorial here about Testing with TPTP- and I’m confused. Whats the benefit of this type of testing (um… creating JAVA code for a JUnit test… right?) compared to running some PHPUnit, Selenium and AB (from apache, or something…)? What am I missing – does anyone have any other good hands-on tutorials?

Use MySQL Gui tools to securely connect to remote database

Saturday, October 27th, 2007

This particular example is going to be based on a connection from Windows XP using Putty, MySQL GUI tools and Dreamhost.

Quick summary of issue: I want to use MySQL Query Browser to access my database on my dreamhost account. The database allows connections from the webserver only – nothing external. I have an SSH account on the webserver.

Quick answer: This requires us to tunnel from our machine to the webserver and connect through this tunnel to the database server.

Lets take a look on how we can accomplish this:

(more…)

  • twitter loader

Follow me on twitter: @aaronsaray

The views on this website are my own and do not reflect the opinions of my employer or clients.
Creative Commons License Home | Open Source | Book | Music | Art | Bio | Resume | Contact
My Baby