Thursday, March 10, 2011

rabbit vcs on ubuntu 10.04

sudo add-apt-repository ppa:rabbitvcs/ppa

sudo apt-get update

sudo apt-get install rabbitvcs-core rabbitvcs-nautilus rabbitvcs-thunar rabbitvcs-gedit rabbitvcs-cli



that's it

Sunday, February 27, 2011

set allowNoPassword in phpmyadmin

open file /etc/phpmyadmin/config.inc.php
uncomment the line
// $cfg['Servers'][$i]['AllowNoPassword'] = TRUE;
and your good

Thursday, January 20, 2011

installing redmine on ubuntu 10.04

--------------------------first steps--------------------------

$ sudo apt-get install redmine redmine-mysql subversion

The second package, redmine-mysql, can be replaced by either redmine-pgsql or redmine-sqlite if you want to use either of those databases.

Ubuntu should prompt you for all the interesting details.

Redmine will now be installed in /usr/share/redmine and /etc/redmine

Configuration
Symlink /usr/share/redmine/public to your desired web-accessible location. E.g.:

$ ln -s /usr/share/redmine/public /var/www/redmine

By default, passenger runs as 'nobody', so you'll need to fix that. In /etc/apache2/mods-available/passenger.conf, add a PassengerDefaultUser www-data directive.

You'll also need to configure the /var/www/redmine location in /etc/apache2/sites-available/default:


RailsBaseURI /redmine
PassengerResolveSymlinksInDocumentRoot on

$ sudo a2enmod passenger

Restart apache2 and you should be good to go.

If you receive a "403: Forbidden" error after setting up Redmine, the Redmine 'public' folder may have incorrect permissions set. The executable bit on the public folder must be enabled or you will receive a "403: Forbidden" error when attempting to access Redmine.

$ sudo chmod a+x /usr/share/redmine/public


---------------- 2nd -----------------------------------------------
1. Get the Redmine source code by either downloading a packaged release or checking out the code repository. See Download.

2. Create an empty database and accompanying user named redmine for example.

For MySQL:

create database redmine character set utf8;
create user 'redmine'@'localhost' identified by 'my_password';
grant all privileges on redmine.* to 'redmine'@'localhost';
For versions of MySQL prior to 5.0.2 - skip the 'create user' step and instead:

grant all privileges on redmine.* to 'redmine'@'localhost' identified by 'my_password';
For PostgreSQL:

CREATE ROLE redmine LOGIN ENCRYPTED PASSWORD 'my_password' NOINHERIT VALID UNTIL 'infinity';
CREATE DATABASE redmine WITH ENCODING='UTF8' OWNER=redmine;
3. Copy config/database.yml.example to config/database.yml and edit this file in order to configure your database settings for "production" environment.

Example for a MySQL database:

production:
adapter: mysql
database: redmine
host: localhost
username: redmine
password: my_password
If your server is not running on the standard port (3306), use this configuration instead:

production:
adapter: mysql
database: redmine
host: localhost
port: 3307
username: redmine
password: my_password
Example for a PostgreSQL database (default port):

production:
adapter: postgresql
database:
host:
username:
password:
encoding: utf8
schema_search_path: (default - public)
4. Generate a session store secret.

rake generate_session_store
5. Create the database structure, by running the following command under the application root directory:

RAILS_ENV=production rake db:migrate
It will create tables and an administrator account.

If you get this error:

Rake aborted!
no such file to load -- net/https
you need to install libopenssl-ruby1.8, in ubuntu, just like this: apt-get install libopenssl-ruby1.8

6. Insert default configuration data in database, by running the following command:

RAILS_ENV=production rake redmine:load_default_data
This step is optional but highly recommended, as you can define your own configuration from scratch. It will load default roles, trackers, statuses, workflows and enumerations.

7. Setting up permissions

NB: Windows users have to skip this section.

The user who runs Redmine must have write permission on the following subdirectories: files, log, tmp (create the last one if not present).

Assuming you run Redmine with a redmine user:

Wednesday, January 19, 2011

Tomcat utf-8 config

make the following changes and it will ok

<connector acceptcount="100" connectiontimeout="20000" executor="tomcatThreadPool" maxkeepaliverequests="15" port="${http.port}" protocol="HTTP/1.1" redirectport="8443" URIEncoding="UTF-8"></connector>

Saturday, October 30, 2010

Eclipse javadoc in utf-8

export -> javadoc -> next -> in extra vm options write
-encoding UTF-8 -charset UTF-8 -docencoding UTF-8

Saturday, June 26, 2010

Setting up Subversion on Windows

When it comes to readily available, free source control, I don't think you can do better than Subversion at the moment. I'm not necessarily advocating Subversion; there are plenty of other great source control systems out there -- but few can match the ubiquity and relative simplicity of Subversion. Beyond that, source control is source control, as long as you're not using Visual SourceSafe. And did I mention that Subversion is ... free?
Allow me to illustrate how straightforward it is to get a small Subversion server and client going on Windows. It'll take all of 30 minutes, tops, I promise. And that's assuming you read slowly.
The first thing we'll do is download the latest Subversion Windows binary installer. At the time of writing, that's 1.46. I recommend overriding the default install path and going with something shorter:

c:\svn\
Note that the installer adds c:\svn\bin to your path, so you can launch a command prompt and start working with it immediately. Let's create our first source repository, which is effectively a system path.

svnadmin create "c:\svn\repository"
Within that newly created folder, uncomment the following lines in the conf/svnserve.conf file by removing the pound character from the start of each line:

anon-access = none
auth-access = write
password-db = passwd
Next, add some users to the conf/passwd file. You can uncomment the default harry and sally users to play with, or add your own:

harry = harryssecret
sally = sallyssecret
As of Subversion 1.4, you can easily install Subversion as a Windows service, so it's always available. Just issue the following command:

sc create svnserver binpath= "c:\svn\bin\svnserve.exe --service -r c:\svn\repository" 
displayname= "Subversion" depend= Tcpip start= auto
It's set to auto-start so it will start up automatically when the server is rebooted, but it's not running yet. Let's fix that:

net start svnserver
Note that the service is running under the Local System account. Normally, this is OK, but if you plan to implement any Subversion hook scripts later, you may want to switch the service identity to an Administrator account with more permissions. This is easy enough to do through the traditional Windows services GUI.
Subversion service screenshot
Now let's verify that things are working locally by adding a root-level folder in source control for our new project, aptly named myproject.

set SVN_EDITOR=c:\windows\system32\notepad.exe
svn mkdir svn://localhost/myproject
It's a little weird when running locally on the server, as Subversion will pop up a copy of Notepad with a place for us to enter commit comments. Every good programmer always comments their source control actions, right?
Subversion local commit, notepad comment
Enter whatever comment you like, then save and close Notepad. You'll be prompted for credentials at this point; ignore the prompt for Administrator credentials and press enter. Use the credentials you set up earlier in the conf/passwd file. If everything goes to plan, you should be rewarded with a "committed revision 1" message.

svn mkdir svn://localhost/myproject
Authentication realm: 
Password for 'Administrator': [enter]
Authentication realm: 
Username: sally
Password for 'sally': ************

Committed revision 1.
Congratulations! You just checked your first change into source control!
We specified svn:// as the prefix to our source control path, which means we're using the native Subversion protocol. The Subversion protocol operates on TCP port 3690, so be sure to poke an appropriate hole in your server's firewall, otherwise clients won't be able to connect.
Now that the server's good to go, let's turn our attention to the client. Most people use TortoiseSVN to interact with Subversion. Download the latest 32-bit or 64-bit Windows client (1.4.8.12137 as of this writing) and install it. The installer will tell you to reboot, but you don't have to.
Now create a project folder somewhere on your drive. I used c:\myproject. Tortoise isn't a program so much as a shell extension. To interact with it, you right click in Explorer. Once you've created the project folder, right click in it and select "SVN Checkout..."
Tortoise 'SVN Checkout...'
Type svn://servername/myproject/ for the repository URL and click OK.
Tortoise checkout dialog
Tortoise now associates the c:\myproject folder with the svn://servername/myproject path in source control. Anything you do on your local filesystem path (well, most things-- there are some edge conditions that can get weird) can be checked back in to source control.
There's a standard convention in Subversion to start with the "TTB folders" at the root of any project:

Because Subversion uses regular directory copies for branching and tagging (see Chapter 4, Branching and Merging), the Subversion community recommends that you choose a repository location for each project root -- the "top-most" directory which contains data related to that project -- and then create three subdirectories beneath that root: trunk, meaning the directory under which the main project development occurs; branches, which is a directory in which to create various named branches of the main development line; tags, which is a collection of tree snapshots that are created, and perhaps destroyed, but never changed.
Of course, none of this means your developers will actually understand branching and merging, but as responsible Subversion users, let's dutifully add the TTB folders to our project. Note that we can batch up as many changes as we want and check them all in atomically as one unit. Once we're done, right click the folder and select "SVN Commit..."
Tortoise 'SVN Commit...'
In the commit dialog, indicate that yes, we do want to check in these files, and we always enter a checkin comment-- right? right?
Tortoise Commit dialog
You'll have to enter your server credentials here, but Tortoise will offer to conveniently cache them for you. Once the commit completes, note that the files show up in the shell with source control icon overlays:
Tortoise folder with source control icon overlays
And now we're done. Well, almost. There are a few settings in Tortoise you need to pay special attention to. Right click and select "TortoiseSVN, Settings".

  1. See that hidden ".svn" folder? These folders are where Subversion puts its hidden metadata schmutz so it can keep track of what you're doing in the local filesystem and resolve those changes with the server. The default naming convention of these folders unfortunately conflicts with some fundamental ASP.NET assumptions. If you're an ASP.NET 1.x developer, you need to switch the hidden folders from ".svn" to "_svn" format, which is on the General options page. This hack is no longer necessary in ASP.NET 2.0 or newer.
  2. I'll never understand why, but by default, Tortoise tries to apply source control overlays across every single folder and drive on your system. This can lead to some odd, frustrating file locking problems. Much better to let Tortoise know that it should only work its shell magic on specific folders. Set this via "Icon Overlays"; look for the exclude and include paths. I set the exclude path to everything, and the include path to only my project folder(s). tortoise exclude and include paths
Unfortunately, since Tortoise is a shell extension, setting changes may mean you need to reboot. You can try terminating and restarting explorer.exe, but I've had mixed results with that.
And with that, we're done. You've successfully set up a Subversion server and client. A modern client-server source control system inside 30 minutes -- not bad at all. As usual, this is only intended as the gentlest of introductions; I encourage you to check out the excellent Subversion documentation for more depth.
I find Subversion to be an excellent, modern source control system. Any minor deficiencies it has (and there are a few, to be clear) are more than made up by its ubiquity, relative simplicity, and robust community support. In the interests of equal time, however, I should mention that some influential developers -- most notably Linus Torvalds -- hate Subversion and view it as an actual evil. There's an emerging class of distributed revision control that could eventually supercede existing all the centralized source control systems like Subversion, Vault, Team System, and Perforce.
I'm skeptical. I've met precious few developers that really understood the versioning concepts in the simple centralized source control model. I have only the vaguest of hopes that these developers will be able to wrap their brains around the vastly more complicated and powerful model of distributed source control. It took fifteen years for centralized source control usage to become mainstream, so a little patience is always advisable.

Saturday, April 3, 2010

to set default engine in mysql

Mysql's default engine is not set for foreign key constraints which really bugs me out. So I was looking for a trick to set the default engine to innodb and I finally got this worked.

The default storage engine can be changed at server startup or at runtime:
  • The default storage engine can be specified at server startup with the --default-storage-engine option.
  • For a running server, an administrator who has the SUPER privilege can change the default storage engine globally for all clients by setting the global storage_engine system variable:


    SET GLOBAL storage_engine = engine_name;
    Setting the storage engine this way affects any client that connects after the statement executes. Clients that are connected at the time of statement execution are unaffected.
  • Any client can change its own default storage engine by issuing either of these statements:

    SET SESSION storage_engine = engine_name;
    SET storage_engine = engine_name;
     
    ps: I wrote "innodb" instead of "engine_name" 
    this will only change the default engine for temporary. If you would like to set it permanently 
    you should edit the /etc/mysql/my.cnf file.

    Then under the [mysqld] add the following line as shown below! [mysqld] default-storage_engine = innodb ...

    Finally, restart mySQL;
    $ sudo service mysql restart