Sunday, December 30, 2012

Install Sublime text to Ubuntu

Sublime text - text editor that Mac user love to use, so let try it in Ubuntu,
What I like:
- it is quick
- outline view of whole file on the right side.
- Columns/Block selection, how to.
- line numbers as out of the box functionality.

Instruction:

sudo add-apt-repository ppa:webupd8team/sublime-text-2
sudo apt-get update
sudo apt-get install sublime-text

Wednesday, December 26, 2012

Git - merge till certain commit

Case: you need merge your master with with development branch but till certain commit(not till HEAD ) in development branch

it is simply:
-- I presume you are at development branch --
git checkout master
git merge 37e4218a4d51ad44952d30a5906cbe6b2e0a54d2

or do it by tag name:
git merge 0.5.10

and you will merge till this(37e421) commit, that is located in development branch.

Tuesday, December 18, 2012

Git commands to remember

Here I  will post command that usually use but sometime forget syntax, so rewriting them again with explanation help me to remember them :) :

remove all files from staging area - "git reset HEAD"

add to staging area only modified files - "git add -u"

remove all newly created files from working folder - "git clean -f"

change comment of the last commit - "git commit --amend"

get all remote branches to local repository - "git fetch"

create local branch base on existent remote branch - "git checkout -b development remotes/origin/development"

push to remote branch with 'force' after rebase - "git push --force origin SYS-551"

create new branch base on non commited changes - "git checkout -b short-status-form-sb" after that do "git add filepath ; ...."

push to remote newly created local branch - "git push origin my-new-feature"

show history of changes in terminal - "git log --oneline --decorate --graph"
show history of changes in UI - "gitk" or "gitk --all"

remove branch from local repository - "git branch -D SYS-551"

remove branch from remote repository  - "git push origin --delete SYS-551"

SVN style looks for logs output - "status -sb"

See all changes that are going to be pushed - "git diff --stat origin/master" or "git diff origin/master".

Get only the work your current topic branch has introduced since its common ancestor with master: "git master...test"

Revert one commit (revert changes that were done by commit) "git revert <SHA-1>"

Remove last commit completely from local repo - "git reset HEAD~1 --hard"

Find out which branch contains a change - "git branch --contains 50f3754"

Find out if a change is part of a release - "git name-rev --name-only 50f3754"

Get rid of all changes/commits in branch to remote git state "git reset --hard origin"

Convenient aliases, source:
git config --global alias.st "status -sb"
git config --global alias.ci commit
git config --global alias.co checkout
git config --global alias.br branch
git config --global alias.bra "branch -a"
git config --global alias.chp cherry-pick
git config --global alias.pr "pull --rebase"
git config --global alias.bl "blame -b -w"
git config --global alias.cia "commit --amend"
git config --global alias.lg "log --pretty=format:'%h was %an, %ar, message: %s' --graph"
git config --global alias.who "shortlog -s --"

from Daniil Yaroslavtsev:
git config --global alias.l "log --graph --pretty=format:'%Cred%h%Creset %C(bold blue)<%an>%Creset%C(yellow)%d%Creset %s %Cgreen(%cr)' --abbrev-commit --date=relative"

Friday, December 14, 2012

Gitolite - get access to repository for all users except for one

All is written in manual :), it only takes a bit time to read all, try a lot to make it work.

general description about rules: http://sitaramc.github.com/gitolite/rules.html
Nuances about deny meaning: http://sitaramc.github.com/gitolite/g2/aac.html#deny

Deny - does not forbid read access by default.

Mu config, to give access to all except for mihail (trial group) that have access only to project3:

@trial    =  mihail

repo    project1
        -       =   @trial
        RW+     =   @all
        config gitolite-options.deny-repo = 1


repo    project2
        -       =   @trial
        RW+     =   @all
        config gitolite-options.deny-repo = 1


repo    project3
        RW+     =   @all




Unlock system user in Oracle 11 XE (CentOS)

1) sudo -iu oracle

2) make sure you have in .bashrc ". /u01/app/oracle/product/11.2.0/xe/bin/oracle_env.sh"

3) launch sqlplus
[oracle@azer ~]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.2.0 Production on Fri Dec 14 20:03:58 2012
Copyright (c) 1982, 2011, Oracle.  All rights reserved.
Connected to:
Oracle Database 11g Express Edition Release 11.2.0.2.0 - 64bit Production
SQL> ALTER USER system ACCOUNT UNLOCK;
User altered.
SQL>

Change password just in case.


[oracle@azer ~]$ sqlplus / as sysdba
SQL> alter user system identified by my-new-password;
User altered.
SQL> commit;

How to install Oracle 11g Express Edition (XE) on CentOS

Tuesday, December 11, 2012

How to create new repo at gitolite



1. get access to gitolite-admin repository

2. clone it and do changes to git/gitolite-admin/conf/gitolite.conf

3. do push

4. update Cgit website configuration at git.yourcomapny.com file /etc/cgitrc

5. provide mail notifications: copy 'config' from existing repo to new repo at server.


"<repo>/config" content:

[core]
    repositoryformatversion = 0
    filemode = true
    bare = true
[hooks]
        mailinglist = git-commit@company.com
        emailprefix="[GIT] "
    showrev = "echo "All Branches: "; git branch; echo; echo "Summary of changes:"; git log $oldrev..$newrev; echo; echo; git diff-tree -p --stat --summary --find-copies-harder $oldrev..$newrev;"




To automate all this steps please read this.

Attention: command for 'showrev' is not ideal and send empty mail in case of branch merges, and branch removal.

Monday, December 3, 2012

Gitolite - Change default config template file for repositories

We use gitolite for git server, and we use mail notifications after any push to repositories to manage and be notified about changes that are done by other developer.

After push in gitolite-admin repository, I need to login to git server and manually copy hook file and config for hook:
/home/git/repositories/REPO-NAME.git/config
/home/git/repositories/REPO-NAME.git/hooks/post-receive

My thread in google group to make automatically.


Books to read about Java and best practices

Good todo list for reading to improve your skills of java developer: http://habrahabr.ru/post/153373/
one day I will have to time, to do it :) .

How to remove Switch Workspace icon on Launcher panel in ubuntu 12.04

I have never understand why it is impossible to remove from Launcher panel(vertical panel) Trash icon and Switch Workspace icon, most people do not use them and for some people it is even dangerous.

Here is a way to remove Switch Workspace icon:
1) Apply updated for 12.04 at least for December 1, on clean 12.04 this approach did not work for me.
2) Aplly following commands, copy-paste from here.

sudo add-apt-repository ppa:ikarosdev/unity-revamped 
sudo apt-get update && apt-get dist-upgrade
3) Restart the system and open
ccsm
, go to
Ubuntu Unity Plugin
switch to the
Experimental
tab and turn off
Show "Expo Icon" in the launcher
.

Trash icon still at panel :(, If you know how to remove it, please let me know.


Update: for 13.04 - there will be standard way to do this, link.

Saturday, December 1, 2012

Hotkey Maximize and Minimize window in Ubuntu 12.04 (Unity)

In older Ubuntu there was hotkey(shortcut) to Maximize and Minimize window.
In Unity(12.04) these was changed:
Maximize - Ctrl+Super+UpArrow
Minimize - Ctrl+Super+DownArrow