Off Canvas layout is used by many apps for example facebook and other applications.
http://jasonweaver.name/lab/offcanvas/
Monday, December 2, 2013
Thursday, November 28, 2013
Learning a new Programming Language
Learning a new programming language :)
http://blog.discourse.org/wp-uploads/2013/04/cat-enters-bathtub.gif
http://blog.discourse.org/wp-uploads/2013/04/cat-enters-bathtub.gif
Monday, November 18, 2013
SSH
If you are using VPS with root access you need to connect to your server often. If already have a id_rsa.pub file you can use this to authorize your server as well.
cat ~/.ssh/id_rsa.pub
any paste the content in your servers
~/.ssh/authorized_keys
file. You will not be prompted for password again.
If you are using a server often you can add server definition to you ssh config file as well
~/.ssh/config
Add following
Host dev
HostName dev.example.com
Port 22000
User foo
After that you can connect to host with this command
ssh dev
cat ~/.ssh/id_rsa.pub
any paste the content in your servers
~/.ssh/authorized_keys
file. You will not be prompted for password again.
If you are using a server often you can add server definition to you ssh config file as well
~/.ssh/config
Add following
Host dev
HostName dev.example.com
Port 22000
User foo
After that you can connect to host with this command
ssh dev
Friday, November 15, 2013
Openning your local work to internet
You may want to show your work to other people which are not currently sitting near you. You can use localtunnel for that purpose. You can install local tunnel by using the following command. Local tunnel is using node.js therefore you also need to install nodejs first if you donot h
npm install -g localtunnel
After that use
lt --port 8000
you will see something like this
your url is: http://gqgh.localtunnel.me
which means that your local application can be accessable now over the internet. be aware that everybody can see your application now.
npm install -g localtunnel
After that use
lt --port 8000
you will see something like this
your url is: http://gqgh.localtunnel.me
which means that your local application can be accessable now over the internet. be aware that everybody can see your application now.
Thursday, November 7, 2013
Thinking in Sphinx
Thinking in Sphinx is a ruby interface for Sphinxsearch engine.
install sphinxsearch
sudo apt-get install sphinxsearch
install thinking sphinx
sudo add-apt-repository ppa:dhuggins/cmusphinx
sudo apt-get update
sudo apt-get install sphinxsearch
add required gems
gem 'mysql2'
gem 'thinking-sphinx'
install
bundle install
create a file under app/indices/ called_index.rb
add the following
After that you can test your searches in rails console
example search
Article.search params[:search]
@articles = Article.search Riddle::Query.escape(params[:search])
Links:
http://pat.github.io/thinking-sphinx/
http://blog.app2technologies.com/basic-thinking-sphinx-setup-in-rails-3.1-or-newer-on-ubuntu-12.04/
install sphinxsearch
sudo apt-get install sphinxsearch
install thinking sphinx
sudo add-apt-repository ppa:dhuggins/cmusphinx
sudo apt-get update
sudo apt-get install sphinxsearch
add required gems
gem 'mysql2'
gem 'thinking-sphinx'
install
bundle install
create a file under app/indices/ called
add the following
ThinkingSphinx::Index.define :article, :with => :active_record do
# fields
indexes title, :sortable => true
indexes content
# attributes
has created_at, updated_at
end
After that you can test your searches in rails console
example search
Article.search params[:search]
@articles = Article.search Riddle::Query.escape(params[:search])
Links:
http://pat.github.io/thinking-sphinx/
http://blog.app2technologies.com/basic-thinking-sphinx-setup-in-rails-3.1-or-newer-on-ubuntu-12.04/
Wednesday, October 30, 2013
How To Install Git on Ubuntu 1204
installing git
If you install git on your server you can easly make release checkouts and deployments. Use following command to install git
sudo apt-get install git-core
git configuration
You can edit git config by using command
sudo vim ~/.gitconfig
you can afterwards add following lines
git config --global user.name "NewUser"
git config --global user.email newuser@example.com
following command will show you available config
git config --list
Initial Server Setup with Ubuntu 12.04
When you first get a fresh server such as a Virtual Server you need to make some configuration on your server. This document guides you some basic configuration steps that will help you to setup a new box.
info any command that you run with sudo will be logged in /var/log/secure directory
info any command that you run with sudo will be logged in /var/log/secure directory
step one : root login
when you get a new VS you will get also a username with root privileges. You can login to your box as root by using ssh. but this is not recommended. you can use alternative users to login to your box and use root priviledges after you login. If you install cygwin you can use following commend othwerise you can use putty to connect to your box by using given username and pass.
ssh root@yourserverip
step two : change your password
change your password by the following command
passwd
go to the next step. you donot need to logout.
step three : create a new user
add a new user by using the following command. it can have any arbitrary name
adduser mynewusername
after you set the password you donot need to enter any further information about the new user. you can live all the lines black if you wish.
step four : root privileges
until now only root user has the root privileges. edit sudo configuration by using the following command
visudo
find selection called user privilege sepecification. it will look like this :
# User privilege specification
root ALL=(ALL:ALL) ALL
add following line
mynewusername ALL=(ALL:ALL) ALL
save and exit the file.
done!
If you want you can make root login more restrictive by reading this article
Monday, October 28, 2013
install node js on ubuntu 12 or older
sudo apt-get update
sudo apt-get install python-software-properties python g++ make
sudo add-apt-repository ppa:chris-lea/node.js
sudo apt-get update
sudo apt-get install nodejs
Tuesday, October 22, 2013
How To Install Ruby on Rails on Ubuntu 12.04 LTS with RVM
1. install ruby with rvm
- make an update
sudo apt-get update
- install curl if you do not have
sudo apt-get install curl
- install rvm with curl
\curl -L https://get.rvm.io | bash -s stable
source ~/.rvm/scripts/rvm
- install rvm requirements as well
rvm requirements
2. install ruby
- install
rvm install ruby
- tell to use recently installed version
rvm use ruby --default
3. install rubygems
rvm rubygems current
4. install rails
gem install rails
5. finished
you are instal ruby on rails. you can now use rails command for e.g.
rails new testproject
source: https://www.digitalocean.com/community/articles/how-to-install-ruby-on-rails-on-ubuntu-12-04-lts-precise-pangolin-with-rvm
Monday, October 21, 2013
Using Vagrant for Development
VAGRANT
- install vagrant project from vagrant website
- install oracle virtual box
- select a vagrant virtual machine from varant.es website
- add your selected virtual box with the following command
vagrant box add ubuntu12_04 http://cloud-images.ubuntu.com/vagrant/precise/current/precise-server-cloudimg-i386-vagrant-disk1.box
- create a project directory
e.g.
mkdir vagrant-project
mkdir mytestproject
cd vagrant-project/mytestproject
- init vagrant
vagrant init ubuntu12_04
- start vagrant
vagrant up
- connect with ssh to vagrant. user name and password is vagrant
ssh 127.0.0.1 -p 2222 -l vagrant
you can now work on your mytestproject directory. It will be available to vagrant virtual machine under the /vagrant directory.
If you change to /vagrant and create a file there it will appear on windows directory as well.
install guest additions. If you have sharefolder problems you need to install guest additions. Go to the http://download.virtualbox.org/virtualbox and find your guest additions file and install it as follows
wget -c \http://download.virtualbox.org/virtualbox/4.3.0/VBoxGuestAdditions_4.3.0.iso -O VBoxGuestAdditions_4.3.0.iso
sudo mount VBoxGuestAdditions_4.3.0.iso -o loop /mnt
sudo sh /mnt/VBoxLinuxAdditions.run --nox11
sudo umont /mnt
rm *.iso
go to host machine and restart your guest by using this command
vagrant reload
You can optionally add a name server to your VM box
sudo vim /etc/resolv.conf
and add opendns domainname servers as follows.
- install vagrant project from vagrant website
- install oracle virtual box
- select a vagrant virtual machine from varant.es website
- add your selected virtual box with the following command
vagrant box add ubuntu12_04 http://cloud-images.ubuntu.com/vagrant/precise/current/precise-server-cloudimg-i386-vagrant-disk1.box
- create a project directory
e.g.
mkdir vagrant-project
mkdir mytestproject
cd vagrant-project/mytestproject
- init vagrant
vagrant init ubuntu12_04
- start vagrant
vagrant up
- connect with ssh to vagrant. user name and password is vagrant
ssh 127.0.0.1 -p 2222 -l vagrant
you can now work on your mytestproject directory. It will be available to vagrant virtual machine under the /vagrant directory.
If you change to /vagrant and create a file there it will appear on windows directory as well.
install guest additions. If you have sharefolder problems you need to install guest additions. Go to the http://download.virtualbox.org/virtualbox and find your guest additions file and install it as follows
wget -c \http://download.virtualbox.org/virtualbox/4.3.0/VBoxGuestAdditions_4.3.0.iso -O VBoxGuestAdditions_4.3.0.iso
sudo mount VBoxGuestAdditions_4.3.0.iso -o loop /mnt
sudo sh /mnt/VBoxLinuxAdditions.run --nox11
sudo umont /mnt
rm *.iso
go to host machine and restart your guest by using this command
vagrant reload
You can optionally add a name server to your VM box
sudo vim /etc/resolv.conf
and add opendns domainname servers as follows.
nameserver 208.67.222.222 nameserver 208.67.220.220
Wednesday, July 3, 2013
IntelliJIDEA shortcuts
- list of usages: Show usages is a very simple but powerful feature. Just press Alt + Ctrl + F7 (Alt + Cmd + F7 for Mac)
- Paramter Info : The information on parameters required for a particular method is available via Ctrl + P (Cmd+P) shortcut.
- Show implementation: If you want to quickly look at the implementation of a symbol at the caret, you can call the Quick Definition by pressing
Shift + Ctrl + I (Shift + Cmd + I). - documentation : Ctrl + Q (Ctrl + J for Mac).
- last accessed file: The real time-saver here is action called Recent files via Ctrl + E (Cmd + E for Mac).
- Methods : The shortest way to do it is to press Ctrl + F12 (Cmd + F12 for Mac) if you click again you see inhrerite members
- Navigate between methods : If you need to jump over the methods quickly just press Alt + ↑↓
- Navigate to Class, File and Symbol : This feature is available via Ctrl + N
- Navigate to file : Just like for classes it works for files as well, via Ctrl + Shift + N
- Navigate to symbol : And finally the most tricky feature is to navigate to a symbol via Ctrl + Alt + Shift + N
- Navigate to line number via Ctrl + G (Cmd + G for Mac)
- Navigate to declaration via Ctrl + B (Cmd + B for Mac)
- Navigate to super via Ctrl + U (Cmd + U for Mac)
- Navigate to implementations via Ctrl + Alt + B (Alt + Cmd + B for Mac)
- Navigate to the last edit location via Shift + Ctrl + Backspace (Shift + Cmd + Backspace for Mac)
- Navigate to the next error or warning via F2
- Navigate to a related unit test via Shift + Ctrl + T (Shift + Cmd + T for Mac)
- Basic completion simply press Ctrl + Space shortcut.
- Smart completion, press Shift + Ctrl + Space.
- Statement completion automatically adds missing parentheses, brackets, braces and adds the necessary formatting. To complete a statement, just press Shift + Ctrl + Enter
- Structural selection: A definite must-know to be even more productive. Structural selection allows you to select expressions based on grammar. By pressing Ctrl + W (Cmd + W for Mac) you keep expanding your selection (starting from the caret). And vice versa, you can shrink it by pressing Shift + Ctrl + W (Shift + Cmd + W for Mac).
- Move the current line of code (or selected block) via Shift + Ctrl + Arrows (Shift + Cmd + Arrows for Mac).
- Duplicate a line of code (or selected block) via Ctrl + D (Cmd + D for Mac)
- Remove a line of code (or selected block) via Ctrl + Y (Cmd + Y for Mac)
- Comment or uncomment a line of code (or selected block) via Ctrl + / (Cmd + / for Mac) and Shift + Ctrl + / (block comment for selected code).
- Optimize imports via Ctrl + O (Cmd + O for Mac).
- Find in the currently opened file via Alt + F3 (F3 to the next match rance and Shift + F3 to the previous match). Or, replace in the currently opened file via Ctrl + R (Cmd + R for Mac).
- Enable/show soft-wraps, disabled by default.
- Paste from stack via Shift + Ctrl + V (Shift + Cmd + V for Mac).
- Navigate between opened tabs via Alt + Arrows (Ctrl + Arrows for Mac).
This article is also very good about intellij idea : http://arhipov.blogspot.de/2011/06/whats-cool-in-intellijidea-part-i.html
intellij for eclipse developers http://virgo47.wordpress.com/2011/04/10/from-intellij-idea-to-eclipse-4/
Monday, June 24, 2013
Using SQL Loader To Import Data
SQL Loader http://bit.ly/16tXiol is Database import utility for Oracle.
You can create SQL Loader Script file by using Oracle SQL Developer http://bit.ly/OjdYXF
If you want to run the SQL Loader script from java you can use ProcessBuilder http://bit.ly/YwKvNT to call external jobs as Java processes in ETL like fashion.
More information can be fount here http://oreilly.com/catalog/orsqlloader/chapter/ch01.html
Tuesday, June 4, 2013
Insert JQuery to any site.
You run the following javascript code to inject jquery to any website. After that you can run jquery command in the javascript console.
var element1 = document.createElement("script");element1.src = "http://code.jquery.com/jquery-1.10.1.min.js";element1.type="text/javascript";document.getElementsByTagName("head")[0].appendChild(element1);
Monday, May 6, 2013
Clone a website with wget
wget --wait=20 --limit-rate=20K -r -p -U Mozilla http://guides.rubyonrails.org/getting_started.html
Wednesday, May 1, 2013
How to Free up RAM On Ubuntu variants
First run the following command
and find out the available memory
after that run following commands to free up memory
this frees up memory. after that you can run free -m command again to see free memory again.
free -m
and find out the available memory
kg@kg-netbook-lubuntu:~/opt$ free -m
total used free shared buffers cached
Speicher: 2006 1739 266 0 50 1300
-/+ Puffer/Zwischenspeicher: 389 1616
Auslagerungsdatei: 2035 6 2029
after that run following commands to free up memory
kg@kg-netbook-lubuntu:~/opt$ sync
kg@kg-netbook-lubuntu:~/opt$ sudo -s echo 3 > /proc/sys/vm/drop_caches
this frees up memory. after that you can run free -m command again to see free memory again.
kg@kg-netbook-lubuntu:~/opt$ free -m
total used free shared buffers cached
Speicher: 2006 631 1374 0 11 193
-/+ Puffer/Zwischenspeicher: 427 1579
Auslagerungsdatei: 2035 6 2029
Tuesday, April 16, 2013
Chaning MySQL Text Fields for SEO Optimization
In this example I change turkish character set of name field from turkish to english words
select replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(name,'ü','u'),'ö','o'),'ı','i'),'ç','c'),'ş','s'),'ğ','g'),' ','-'),'.',''),'(','_'),')',''),',','') from geo_unit
Subscribe to:
Posts (Atom)