Apr
24
2012
Install guest addition:
http://www.youtube.com/watch?v=mBAbcwsKog8
Shared folder:
- click Devices => Shared Folders
- run in shell terminal: mount -t vboxsf shared_folder_name guest_server_path/
- edit /etc/rc.local file and add line: mount.vboxsf -w -o uid=500 shared_folder_name guest_server_path/
Apr
22
2012
create project
zf.sh create project rsvp
Link library
ln -s /path/to/ZendFramework-1.11.11-minimal/library/Zend .
set up access permission for application/ folder by add .htaccess file with line:
deny from all
To set the project as a sub-folder instead of document root (common in shared hosting), one has to set up path redirect. First, we need to change .htaccess file under the project folder to add path rewrite function (Note: need to make sure apache httpd.conf has the “AllowOverride All” set for the folder)
RewriteRule (.*) ./public/$1
Second, we can edit configs/application.ini and add a line
settings.baseUrl = "/rsvp"
Third, edit Bootstrap.php and add a function
protected function _initBaseUrl()
{
$options = $this->getOptions();
$baseUrl = isset($options['settings']['baseUrl'])
? $options['settings']['baseUrl']
: null; // null tells front controller to use autodiscovery, the default
$this->bootstrap('frontcontroller');
$front = $this->getResource('frontcontroller');
$front->setBaseUrl($baseUrl);
}
create layout
zf.sh enable layout
and then edit application/layouts/layout.phtml to add necessary header/footer inclusion.
set up database by editing application/configs/application.ini file
resources.db.adapter = PDO_MYSQL
resources.db.params.host = localhost
resources.db.params.username = my_username
resources.db.params.password = my_password
resources.db.params.dbname = my_db
create controller
zf.sh create controller controllername
create action
zf.sh create action add controllername
zf.sh create action edit controllername
zf.sh create action delete controllername
create model
zf.sh create db-table controlername db_table_name
and then modify application/models/DbTable/ProjectName.php to add CRUD DB functions.
Feb
21
2012
There might be more than one Java classes in a Maven project that contains the main() function. To pick up a specific one to run, you can try the following command:
mvn exec:java -Dexec.mainClass="my_main_class_name"
In case the memory is not enough, try the following command:
export MAVEN_OPTS=-Xmx1024m
where 1024m is the max heap memory
Feb
07
2012
I recently removed a Maven module from my Intellij project. Shortly after, I tried to reimport the same module again, but somehow Intellij stubbornly refuse to show it in the Project panel. Eventually I looked into the MyProject.ipr file and found the module’s pom.xml file appeared in the ignoreFiles list.
<option name="ignoredFiles">
<set>
<option value="/path/to/my/module/pom.xml" />
</set>
</option>
After I deleted the specific line with the pom.xml, I was able to reimport the module successfully again.