If you need a local instance of a mysql database for experiments and don’t really care about security as it’s not any production system here’s a quick way to install a mysql database on your OSX (tested with 10.9+)
- Download the latest OSX native package installation from the
download page. It should be a dmg
- Install it as any other OSX application. It will create under
/usr/local/mysql-x.y.z with a symlink to /usr/local/mysql the
entire directory structure that will be needed by mysql. From now
on I will refer as /usr/local/mysql directory.
- sudo rm -r /usr/local/mysql/data
- sudo mkdir /usr/local/mysql/data
- sudo chown -R <youruser> /usr/local/mysql/data
If everything worked out fine you should be able to start it with
$ mysqld_safe &
to stop it
$ mysqladmin -u root shutdown
I’ve created a couple of aliases and exports in my ~/.profile to ease the tasks
alias mysql-start="mysqld_safe &"
alias mysql-stop="mysqladmin -u root shutdown"
$ gpg -d /path/to/file.sql.gz.gpg | gunzip | mysql -u root mydb
and the other way round
$ mysqldump -u root mydb | gzip | gpg -e -r firstname.lastname@example.org > mydb.sql.gz.gpg
Replace accordingly 🙂
During these weeks I was too busy for contributing the weekly link. Here it is one for this week 🙂
Maven is good, but needs some love
…But Maven needs a proper and clean environment…
Functional Programming Concepts in JDK 7 | Javalobby
Kent Beck’s Test Driven Development Screencasts
Following the recommendations of Corey Haines, Michael Guterl, James Martin and Michael Hunger I decided to get Kent Beck’s screencasts on Test Driven Development which have been published by the Pragmatic Programmers.
Testing REST Web Services With JPA and Spring
REST Web Services can be particularly difficult to test, with the need for networking, a web container, multiple threads and transaction management creating extra complexity beyond your standard unit test. In this article I demonstrate patterns designed to address this complexity while enabling complete testing of your REST web service stack.
Oracle shuts down open source test servers
No One Nos: Learning to Say No to Bad Ideas
No. One word, a complete sentence. We all learned to say it around our first birthday, so why do we have such a hard time saying it now when it comes to our work?
Kick Ass Kickoff Meetings
Every meeting is an opportunity. Why waste your first one?
5 things you didn’t know about … Java Database Connectivity
JDBC is more than a background player in database connectivity. The more you know about it, the more efficient your RDBMS interactions will be.
Have you upgraded your Java 1.6_21 to Java 1.6_21?
Selenium 2/Web Driver – the land where Page Objects are king!
12 Things A Programmer Really Needs To Know
Spring Reading – Getting Started with Spring Framework
Profile Your Applications with Java VisualVM | Javalobby
When you need to discover what part of an application is consuming more CPU or memory, you need to use a profiler. One profiler, packed by default with the Sun JDK is Java VisualVM.
How Can Oracle Make JavaFX More Popular? | Javalobby
A nice reflection (especially in comments) about this Oracle/Sun technology.
Patterns For Better Unit Testing With JPA | Javalobby
An example on hot handle Unit Tests and generally TDD for applications that highly interact with a database.
Steve On Java » Open Source JavaFX Petition
A petition for asking Oracle to make JavaFX open source.
Betwixt the Brackets
A nice and concise explanation on how to convert java object into XML.
It may happens if you are silly like me, that you just inserted a lot of records and then realized that you have inserted a mistaken date. In my case the date was a 3 years earlier than the required.
In order to fix it rapidly with mysql you can use the date_add function. Following a quick ad self explaining statement
update <table> set <field>=date_add(<field>,interval 3 year) where id>3289;
It happens (often to me) that as an external (consultant) member, for company policies I cannot have even read access to production DB tables.
This will come to be very unproductive when I have to test for the integrity of some records or for the motivation of the behavior of an application.
The solution I’ve found every time is to create on my local MySQL database the same table structure of the production environment and then ask to someone who has access to DB tables to make me an export in order to import it in my tables.
Generally this export come out as CSV file but with semicolon (;) as field separator.
MySQL offer a very cool command for import large amount of data into table: load data statement.
Starting from the point that your user has privileges for doing this operation, the command is like the following
load data local infile ‘path/to/your/file.txt‘ into table your_table fields terminated by ‘;’;
Here is an hibernate configuration file that works under WSAD/Websphere with an Oracle9i. Just remember to fix datasource and default_schema.