Hi, I just moved my blog to http://www.yilmazhuseyin.com/blog/dev/ . I will leave this one as it is,but my new posts will be in my new location.
Ubuntu comes with some desktop effects. But you can use a lot more by installing compiz. Here is how I install compiz.
sudo apt-get install ccsm
With this package you can get com extra funtionality
sudo apt-get install confiz-fusion-plugin-extra
in ubuntu you can find compiz setting manager under System>Preferences
Lately, I decided to use emacs for all my development. If, I use emacs I will have my development environment trough terminal. so I can remotely connect my computer and do my development. When I discover how emacs works (and what emacs is), I really like the idea of using emacs for my work and personal projects.
Even though I made my mind for using emacs for development, there was a little problem. Comparing to newer IDE’s like eclipse, emacs was really hard to modify, I had really hard time to understand how it works. So I decided to write my experience for others to speed up to beginning process (which seems to be the hardest part of switching to emacs)
Before I start to write how did I setup my environment, I would like to tell you about sources I read. The best place you can go to understand how emacs work is emacs manual. This manual is about every aspect of emacs. You can also find same manual in emacs itself so try to learn how it is constructed. There is also a wiki for emacs: emacswiki.org .
Here is how to modify emacs. Emacs plug-ins are written in elisp (emacs lisp: A language specifically written to implement emacs. You can also use it in emacs to modify emacs on the fly.) When emacs is opened. ~/.emacs file is executed. There should be elisp code in this file. As a name convention you also create ~/.emacs.d directory to hold plug-in codes. emacs does not check this directory. you have to add it to emacs load path. So I created .emacs file and .emacs.d directory under my home directory. And inside .emacs file I added following code
(add-to-list ‘load-path “~/.emacs.d/”)
This turned out to be a elisp code.
Add Python Support
To use django I need to have a python environment. So I found a blog post. But this post was not telling how to set his environment but just giving the source code. Since I don’t know elisp I couldn’t really modify his version. After going trough similar pages I found a helpful page in emacs wiki. So I just follow comments in this page.
first of all I installed rope, ropemacs , pymacs and ropemode like it suggested. you can install ropemacs, ropemacs , pymacs from ubuntu repo.
sudo apt-get install python-rope python-ropemacs pymacs ropemacs can be install from its homepage. just download the package. call
python setup.py build
sudo python setup.py install
within the package.
After that I installed autocompete.el as page explains. At this point, I had auto-complete functionality for python and it is really cool. I also installed python-mode from ubuntu repo. but I don’t really know that it did to emacs. (sudo apt-get install python-mode).
Lastly I followed the wiki and installed pylookup. so I can lookup python documentation within emacs.
For now this is my set up. It is minimal but in time I will add new features to it.
Here is a screenshot of what result is look like:
Enable IDO Mode
Ido mode is what makes finding buffers and opening files a snap. normally finding a file is really really hard and if you want to open another file you have to go trough same cumbersome process. Emacs is just not usable without ido mode. Ido mode gives you autocompletion in opening buffers an files. it searches in current list and gives you your alternatives. It is just really easy to open files with ido mode. To enable it just follow instructions in emacs wiki page.
TODO: add js support. add python validation.
NOTE: I wrote another version of this post: It can be found in my new blog . In new version I covered my django emacs setup in three different blog post
I was triyng to install django and post gre on ubuntu 10.4 and I found a nice blog post here
But in this post, django is being pulled from svn repo and you have to manually connect django installation to python( Which is not hard but I am kind of lazy and unexperienced for this this process). Then I found out that django is already in ubuntu repository. With a little modification to original post I installed django and postgre with following command.
sudo apt-get install postgresql pgadmin3 python-psycopg2 python-django
This will install postgreSQL , postgreSQL admin, postgreSQL python adapter and django farmework and django framework will come pre-configured.
You still have to follow original post to set postgreisql password. Here is a sniplet from original post:
sudo su –
The last instruction should open the psql shell, where you can run the following:
ALTER USER postgres WITH ENCRYPTED PASSWORD ‘mypassword’;
First time I run a django app, a couldnt run my application. syncdb just gave a connection error. so I edit file
/etc/postgresql/8.4/main/pg_hba.conf and change the autantication type of postgres user here is the new line
# Database administrative login by UNIX sockets
local all postgres password
In the second line, I changed ‘ident’ to ‘password’
When your page is loaded you should enable logger. Because logger does not work by default. you should enable it to use it. that way you can use logger in development and disable it in production. To enable logger:
logger.enableLog = true;
To add log functionality ,start your function with
and end it with
If you call another logged function inside this one it will be showed with indent in firebug or some other console on any browser. I recommend firebug or chrome’s default console because they support timing information too.
To see timing information of your pages:
logger.showTiming = true;
It is really easy to use. Go to githup repository and see sample.html for a simple and fully woking example.
Recently, I switched from SVN to GIT for my personal projects. At first Git seemed like a lot harder, because I was using command line to manipulate my git repository. I know it sounds awful but actually it is pretty easy. Here is basic commands
This will create an empty repository on current directory. After running this command you will see a .git directory on current directory. All the repository information is under that directory. Git does not create any other directory anywhere else. For example, there won’t be any other repository under included sub-directories.
git init −−bare
This command creates an empty bare repository under current directory. Difference between bare repository and regular repository is that bare repositories does not have source code every thing under .git directory will actually be under current-directory. Bare repositories can be changed by pushing changes to them from other repositories. Therefore bare repositories act like an SVN server. For example, my main project repository is a bare repository. you can also create a backup repository and push changes to it in regular intervals.
Gives status of the git repository under current directory. you can check if there is a git repo under current direcytory , is there a updated file , is there a new or moved file.
Adds new updated or moved file to commit area. Normally when you commit updated code nothing will be commited you can tell git to track files or add updated files to next commit.
So before you commit your changes, you should tell git what to commit with calling add method for example “git add build.xml” command will add build.xml file to commit area. so next time you commit, this file will be commited. “git add .” will add everything to commit area. it will also add subdirectories recursively.
Commits changes to repository. to commit changes, first of all you should tell git what to commit, than call commit. After calling commit, git will open a text editor and let you enter a commit message. if you have a short commit message you can use -m paramether(git commit -m “commit message”).”git commit -a” will first add every change to commit area and then commit changes. So you won’t have to call “git add”.
Gives commit information. you can see commit dates ,commit messages and commit id.
“git log −−oneline” command will show you commit information but every commit will take only one line.
Used to create, delete branches. “git branch” will list branches. “git branch second” will clone current branch as a new branch named second. “git branch -d second” will delete branch second
“git checkout second” will change current branch to another branch named “second”.
git remote add
git remote rm
“git remote rm second” removes remote repository named second.
git push origin master
Pushes changes on current repository(and current branch) to a remote repository named origin(and branch named master).
git pull origin master
Pulls changes from master branch of remote repository named origin to current branch.
Gives a difference info between two branches. To use diff command, first run git log and find two commits that you want to see the diff report. Then get first four characters of commit ids in my case numbers were 4623 and 8dca so to see diff report I have to run “git diff 4623..8dca” to see I want to use head as one of the commits I can run it as “git diff 4623..HEAD” this will give diff report of commit id 4623 and the last commit on this repository.