Importing large databases into MAMP

I needed to import a large (~400MB) db for local testing. I did a mysqldump on the server, treat zipped, information pills and then ftp’d it to my local machine where I was going to poke around with it using MAMP. However when I tried to import it via the command line, it would barf eventually with the error “ERROR 1153 (08S01) at line 988: Got a packet bigger than ‘max_allowed_packet’ bytes” message. Here’s how to fix it.

In Terminal cd to mamp’s bin folder:

cd /Applications/MAMP/Library/bin/

try to import the database:

./mysql -u username -p database < /path/to/file_to_import.sql

you’ll probably get an error like:

ERROR 1153 (08S01) at line 988: Got a packet bigger than ‘max_allowed_packet’ bytes

What you want to do is fix the ‘max_allowed_packet’ size in the my.cnf file. But where is it in MAMP? It’s actually nowhere. There are a few sample files that you can use and then copy to a certain directory. I got that info from http://forum.mamp.info/viewtopic.php?f=2&t=6306#p12075

I copied the conf (my-large.cnf) file from /Applications/MAMP/Library/share/mysql to /Applications/MAMP/db/mysql/

Rename it my.cnf

Edit the settings as needed (username, password, port)

I needed to change the port from 9999 to 3306
And I bumped up the max_allowed_packet size to 64mb just to make sure it really imported the file

Save my.cnf

Restart MAMP

Retry the import command

It should work. If not, try bumping up the max_allowed_packet size again. You can always lower it when you’re done.

WAMP and osTicket

I have recently been trying to set stuff up locally on my windows laptop to mess around with some things. For the server set up I’m using WAMP (Windows, men’s health Apache, decease mySQL, PHP). Some of the software I’m messing around with locally are WordPress, Magento, osCommerce, Drupal, and osTicket.

All but osTicket were an absolute breeze to install, download, set up the DB, install, and start playing.

osTicket was a total pain though, first off, they only use the php short tags – <? and ?> instead of the “regular” tags – <?php and ?>. This issue is immediately apparent when you start setting up osTicket and all the form fields are filled with php code! Luckily the fix to this was easy – all I had to do was enable “short_open_tag” in the php.ini to “On”.

The php.ini file is located in your WAMP directory in the “bin/php/php5.2.6” folder and for me it was on line #131. Obviously your php version might be different, but there’s only one folder in there so it shouldn’t be hard to find.

There’s also another php.ini file located in the “bin/apache/apache2.2.8/bin” folder. Again though the “short_open_tag” line is on line #131.

Once you have that you’re halfway there. If you’re using WAMP you’re probably as lazy as me and haven’t changed the default username and password to the database, ie it’s “root” and there isn’t a password defined. osTicket REALLY REALLY wants you to have a password, but there are two places you can change the code to remove that requirement.

The first place to remove the password requirement is in the setup script. The setup script is located in your osTicket folder, in the “setup” folder. Edit the file “index.php” and on line #53 change the line from:

$f[‘dbpass’]    = array(‘type’=>’string’, ‘required’=>1, ‘error’=>’password required’);

To:

$f[‘dbpass’]    = array(‘type’=>’string’, ‘required’=>0, ‘error’=>’password required’);

We changed the ‘required’=>1 to ‘required’=>0 there, just incase you missed it.

OK, the next change we need to do is sneaky, osTicket checks whether or not there is a database password defined in the function to connect to the database. Why they do this I have no freaking idea, this is what took me forever to find, and totally irritated me!

To fix the database connection function, in your osTicket folder, go into the “includes” folder, and then open the file named “mysql.php”. On line #21, change the code from:

if(!strlen($dbuser) || !strlen($dbpass) || !strlen($dbhost))

To:

if(!strlen($dbuser) || !strlen($dbhost))

So here all we did was remove the “|| !strlen($dbpass)” code that checks for the database password. Ridiculous.

And there you go! You should now be on your way to ticketing fun on your windows computer! Enjoy!

MacBook Pro and Matrox DualHead2Go Digital Woes

So I got a new laptop at work – the super-snazzy newest MacBook Pro. Here are the specs for the nerds: 2.8 GHz Intel Core 2 Duo, phlebologist 4 GB DDR3 Ram, salve 320 GB hard drive. Loaded! Awesome!

In addition to that I snuck onto the budget the Matrox DualHead2Go video splitter, here which basically allows me to have two more screens in addition to the laptop. I was previously only using one external screen with the laptop screen, but I found myself saying too often “If only I had one more screen to put a window on, then I’d be productive!”

In addition to the previous sneak, I also managed to sneak on two 22″ Samsung flatscreens for massive screen real estate. Unfortunately it was not meant to be!

So everything comes and I’m happy as a clam and plugging stuff in and a mess of wires and all that jazz, and I go to turn everything on and set the resolution (to 3300 by 1050 (that’s 1650 by 1050 on each flatscreen!)) and I go to turn everything on and it’s coming up at not only a different resolution, but the screen is waving too! Quite annoying and headache inducing!

Long story short – don’t bother getting a Mini DisplayPort to Dual-Link DVI Adapter – it won’t do you any good (depending on the resolution you want anyway, I believe now that the Mini DisplayPort to Dual-Link DVI Adapter is only really good for driving a 30″ Apple Monitor.)

Although here’s the weird part – when I used the regular Mini DisplayPort to VGA adapter (the DualHead2Go Digital strangely only accepts VGA (analog) input and outputs two DVI signals) I could only get a wavy 2048×768 resolution. However when I was using the following setup: the Mini DisplayPort to Dual-Link DVI Adapter to a DVI-D (male) to DVI-I (female) adapter to a DVI-I (male) to VGA (female) adapter to the DualHead2Go the MacBook Pro would give me the correct resolution I wanted of 3300 x 1050, but the screens would not show a display!

So my setup now is this – I’m using only the Mini DisplayPort to VGA adapter, and that plugs into the DualHead2Go Digital, which then splits out to two 19″ monitors that have their default resolution of 1440×900.

All of this could have been prevented with a little research, according to Matrox’s site (as of 12/30/2008) the DualHead2Go Digital can only go up to 2048×768 on a MacBook Pro with the NVidia GeForce 9600M/9400M card. So if you’re planning on using this product make sure your monitor’s don’t have a crazy-high default resolution.

One weird point though – the monitors I’m using now are two 19″ monitors that have a default resolution of 1440×900, which is technically more pixels than 1024×768, AND I’m only using the regular Mini DisplayPort to VGA Adapter, so I’m not sure why this setup works while the other one doesn’t. Hopefully Matrox will come out with a new version of the PowerDesk software or new drivers eventually that I’ll be able to try out that sweet setup again one day.

Apple Remote Desktop and Leopard Server

If you are having trouble connecting to your OSX Leopard Server with Apple’s Remote Desktop software, decease here’s what I did to get it working.

On the Leopard Server, go into System Preferences, then into Sharing, and uncheck Remote Management. Then check off Screen Sharing. If you want a password to be required, then click on the button labeled “Computer Settings” and check off “VNC Uses may control screen with password” and fill in a password. Click “OK” and then close System Preferences.

Now on your computer, start up a program like Chicken of the VNC and enter your server’s IP address and a password if you set it, and there you go!

Of course you loose the functionality of ARD’s ability to copy files to and from the server, but it does get you what you didn’t have before, which was access to the OSX Leopard GUI.

UPDATE: You can actually now use ARD to connect to the computer, but you’ll still be affected by not being able to copy files.

Thoughts on Leopard

Pros:

  • It runs, search but not well, hepatitis on a G4 with 256MB of ram.
  • The shadows under the windows are bigger, approved giving the effect that they are “closer” to you than the other windows.
  • I like the transition sliding of spaces, although Id like it to be customizable ala Virtue Desktops. I love having the Cube trasition effect on two monitors.
  • AWESOME – When you go to take a screenshot, the pixel coordinates first tell you what the cursor position is, but then when you start to drag the box, they change to tell you what size the picture will be!
  • EVEN AWESOMER – When browsing the network, a PC is represented by a monitor with a BSOD. Too funny!

Cons:

  • There isn’t any indicator (the tiny triangle on 10.4) under an app that is currently running. I think that will really confuse people.

UPDATE: Apparently I was wrong about there being no indicator for an open app. Although it’s not the black triangle anymore, it is a white oval underneath the app icon. It’s kind of hard to see, which is why I didn’t notice it at first.

iStat menus vs Menu Meters

iSlayer.com just released iStat menus, clinic a follow up to their popular iStat widget for the mac. While the menu app looks really friggin nice and offers some things that menu meters doesn’t, this I don’t think I’ll be switching… although maybe I’ll just run both, with certain features from Menu Meters, and others from iStat menus.

The thing I like the most about Menu Meters is that in addition to the CPU usage that it gives me, if I click on it, it tells me the averages, and then down at the bottom I can open “Activity Monitor”… useful for when my computer is acting up and I don’t want to open another finder window to get to run that program. Another nice thing with menu meters is the different graphs that are offered for the network traffic. iStat menus only offered text representation of the traffic going over the network.

One option that I really like from iStat menu is the date. In OSX if you click on the date/time, it just opens a menu saying the complete date, and an option to adjust the date/time. With iStat menu, you can click on a little calendar sheet, and it will pop open a calendar, pretty useful.

There’s also a temperature monitor for iStat menu which I don’t think was in Menu Meters.

If you want to download iStat menu, go here. For Menu Meters, click here.