All Posts

Bundle Error Middleman El-capitan

If your computer has OSX 10.11 El Capitan, and try to create middleman project then write bundle to install gems. But you can get

1
2
3
4
5
6
Installing eventmachine 1.0.7 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
In file included from binder.cpp:20:
./project.h:116:10 fatal error: 'openssl/ssl.h' file not found
include <openssl/ssl.h>
1 error generated

like above error. You have to solve problem with openssl . For fix it ;

1
brew link openssl —force

then you can run bundle now. For detail about this problem please look at this link

I hope helped to you .

written   bundle, elcapitan, error, gem, middleman, openssl, ruby

Bootstrap Active Class Solution for Navbar in Rails

Sometimes while you are adding bootstrap to your rails app, you can getting some problem on javascript side. In this article I try to explain how we can fix active class to navbar . For fixing, you can write in helper active_class method like below

1
2
3
4
5
module ApplicationHelper
  def active_class(link_path)
    current_page?(link_path) ? 'active' : ""
  end
end

written   active, active_class, application, bootstrap, bug, fix, haml, helper, js, li, nav, navbar, problem, rails, ror, route, ruby, sass, solutions, tip, tricks, ul Read more

Tricks on Rails

  • rake db:migrate for an existing model

Firstly I created new rails app, after that created several models, or you make some changes on your model manually(wrong way), while you are running rake db:migrate getting error for an existing model in your app. For fix that issue you can write,

1
rake db:schema:load

or

1
2
3
4
5
rake db:drop
rake db:create
rake db:migrate
rake db:schema:dump
rake db:text:prepare

written   bg, cap, capistrano, control, create, db, deploy, error, exist, image, mandrill, migrate, model, public, radio-button, rails, recipes-matic, schema, server, ssh, tips, tricks Read more

Google App Engine - PHP

App engine ve PHP

Uzun zamandır ingilizce olarak yazdığım yazılara ufak bir ara verip, türkçe yazılar paylaşmaya çalışacağım. Tabi amaç dile yatırım yapmak, neyse lafı daha fazla uzatmadan biz konumuza dönelim. Bu yazımda, App engine ile PhpStorm üzerinde nasıl çalışır, nasıl proje oluşturulur ve nasıl deploy edilir işlemlerinden bahsetmeye çalışacağım.

Google App Engine

Öncelikle herhangi bir google hesabınızla Google App engine sisteme giriş yapmanız, hesabınız yoksada basit bir google hesabı oluşturmanız gerekmekte, siz hesabı oluşturduktan sonra google size ücretsiz 25 repoluk bir sistem oluşturuyor. Giriş yaptığınız sistemden öncelikle bir proje oluşturuyorsunuz. Sistemde proje oluştururken dikkat etmeniz gereken nokta Application Identifier kısmı zira burda aslında sayfanızın url kısmını belirlemiş oluyorsunuz (proje_id.appspot.com). Tabi belirledikten sonra daha önce böyle bir adres kullanılmışmı diye kontrol etmeniz gerekmektedir, yoksa projeyi oluşturamıyorsunuz.

Ardından localinizde PhpStorm’u çalıştırıp, Create New Project kısmından yeni bir proje oluşturup,

1
2
3
Project name: blog-leylakapi
Location: /Workspace/PhpstormProjects/blog-leylakapi
Project type: App engine Project

kısımlarını girdikten sonra, Phpstorm sizden

1
2
3
Application ID: blog-leylakapi
SDK directory: /home/leylakapi/google_appengine
Python executable: /usr/bin/python

written   app, deploy, engine, google, php, programming, start, tool, tr Read more

Rails Fix N+1 Query

How to fix N+1 query in Rails ?

I try to explain fix N+1 on example. Let’s start, firstly, in your rails application, you created association between user and user_profile models like below :

1
2
3
class User < ActiveRecord::Base
   has_one :profile, class_name: 'UserProfile'
end

and

1
2
3
class UserProfile < ActiveRecord::Base
  belongs_to :user
end

written   association, bug, controller, fix, model, n+1, query, rails, ruby Read more

How to Use getExtra and putExtra in Android for String Data

Use getExtra and putExtra

You want to get some information like name, surname, email when user login on Android, and show on second activity these information , we can use getExtra and putExtra . There are a lot of method for getting information from first to second activity, I try to explain getting with getExtra and putExtra on getting user name and surname to show second activity, let ’s start,

  • Firstly I created two label(TextView) for definition to name and surname and EditText for enter name and surname to users on activity_main.xml,

  • Then we created new class under src folder and under the package name SecondActivity.java, and under the /res/layout/ folder created secondactivity.xml .

  • For definite and connect between main and second activity open AndroidManifest.xml and create new activity for second .

1
2
3
4
5
6
7
8
9
<activity
    android:name=".SecondActivity"
    android:label="Second Activity"
    >
    <intent-filter >
        <action android:name="com.example.package_path.SecondActivity"/>
        <category android:name="android.intent.category.DEFAULT" />
    </intent-filter>
</activity>

written   android, application, data, en, get, getExtra, mobile, put, putExtra, set, string, user Read more

Note: Go Back to Previous Activity on Android

Method for go previous activity

If you make connection between first and second activity, this means, you can go to from first activity to second activity but you can not return to previous page, for return to first page, we can use very common method, onBackPressed().

Where you want to use button for return from second to first, open your secondactivity.xml

1
2
3
4
5
<Button
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:onClick="ReturnHome"
    android:text="Return Previous Page" />

written   activity, android, connection, en, intent, method, mobile, pages, start-learning Read more

Türkçe Makalelerim

Uzun zamandır düşündüğüm bloguma türkçe destek eklemekti. Bunun nedeni ise birçok yabancı konunun (yazılım anlamında) türkçe desteğinin olmamasıdır. Umarım faydalı olur.

Teşekkür ederim.

written   blog, blogger, tr, türkçe

Note: How to Install Sticker-notes to Ubuntu Desktop?

I want to sticker notes for my pc, when I search about it, I found sticky notes for Ubuntu 13.10 . This notes provide to reminder of something like a agenda, when you wrote some notes inside, you see always the notes. If you want to add sticker notes you can use below command.

1
$ sudo add-apt-repository ppa:umang/indicator-stickynotes

written   en, notes, pc, stick, sticker, ubuntu Read more

How to Add Multi-lingual Support to Your Web-page in Middleman

Multi-Lingual Support

Firstly you should create middleman project , if doesn’t exist it. Then in your project, open config.rb file add below code,

1
activate :i18n

when you add above code, you can active to :i18n. i18n extension provides a way to localize your site. After that you should add path of your locale directories in your project roots ~/MyProject/locales directory and code should be seems like below

1
activate :i18n, :path => "/:locale/"

written   en, i18n, languages, locales, localization, middleman, page, yml Read more

What’s the Vagrant ?

How to Set Up Vagrant on Ubuntu Desktop?

Vagrant is a application which improved your application in virtual machine, this means that, you can create your project environment on virtual machine. Thanks to vagrant, you cloned local environment on virtual machine. So, when you sent to your project to server, you can’t see any bug or error on your server. On the other hand vagrant is useful, while you are working in a team.

For the install and use vagrant, you should follow below steps respectively.

Let’s look, how to set up and use Vagrant in Ubuntu desktop,

  • Install Vagrant
  • Create Vagrant Folders
  • Install Precise32 Box
  • Set up new Virtual Machine
  • Install Virtual Machine configuration

written   en, script, shell, ssh, vagrant, virtual-box, virtual-machine, vm Read more

Trick: Add Page Number With Javascript ?

How can you show page number in js ?

If you create middleman or rails project and you want to add pagination in your pages with js. You can make easily with below codes

1
2
3
4
5
6
7
8
9
  var numberOfPages = 14;
  function addPage(page, book) {
    if (!book.turn('hasPage', page)) {
      setTimeout(function(){
        element.html('<div class="data">Data for page '+page+'</div>');
      }, 14);
    }
  }
    $('#number-pages').html(numberOfPages);

in haml page can be like

written   en, frontend, haml, js, number, pages, pagination Read more

How to Create Scroll-page for Rails Project

Create scroll page with sass and javascript

While I was creating demo for scroll page, firstly I created middleman project according to haml and sass, but if you want to embed in your for example rails project, you can embed in it. In this post, I try to explain creating scroll page according to middleman page.

home-page

Let’s look the codes for scroll page

written   en, haml, js, pages, parallax, rails, ror, sass, scroll Read more

Create Icon Set for Your Rails Project

How created your icon-set for your rails project ?

  • Firstly, you should go to icomoon.io website.
  • You need to create new app on right-up corner of webpage
  • Now upload your font-icons after press import icons buttons,
  • Be careful, because your fonts format must be svg format,
  • When upload your icons, you should rename your icons,
  • Now select which rename icons, and go to download your icons,
  • When you download icomoon which provide to you with css and js files for font.
  • When you are opening which download file, you can see this file and copy font directory and paste in your assets for rails projects.
  • Go to css file in which download icomoons files, copy css file and paste in your style file (If you are using sass or less, you should convert to sass or less). Another way, you can create new file in stylesheet folder like

written   css, en, font, ico-moon, icon-set, js, rails Read more

Fix After Destroy User Model Try Add User Model

After you made rails destroy Users and you want to create again User model, When you create, if you’ re getting like this error,

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
$ leylakapicmd@leylakapicmd:~/workspace/project-library$ rails g model User provider uid name oauth_token
 /home/leylakapicmd/.rbenv/versions/2.0.0-p451/lib/ruby/gems/2.0.0/gems/activesupport-4.1.1/lib/active_support/inflector/methods.rb:238:in const_get: uninitialized constant User (NameError)
$ leylakapicmd@leylakapicmd:~/workspace/project-library$ rails g model User
/home/leylakapicmd/.rbenv/versions/2.0.0-p451/lib/ruby/gems/2.0.0/gems/activesupport-4.1.1/lib/active_support/inflector/methods.rb:238:inconst_get': uninitialized constant User (NameError)
from /home/leylakapicmd/.rbenv/versions/2.0.0-p451/lib/ruby/gems/2.0.0/gems/activesupport-4.1.1/lib/active_support/inflector/methods.rb:238:inblock in constantize'
from /home/leylakapicmd/.rbenv/versions/2.0.0-p451/lib/ruby/gems/2.0.0/gems/activesupport-4.1.1/lib/active_support/inflector/methods.rb:236:ineach'
from /home/leylakapicmd/.rbenv/versions/2.0.0-p451/lib/ruby/gems/2.0.0/gems/activesupport-4.1.1/lib/active_support/inflector/methods.rb:236:ininject'
from /home/leylakapicmd/.rbenv/versions/2.0.0-p451/lib/ruby/gems/2.0.0/gems/activesupport-4.1.1/lib/active_support/inflector/methods.rb:236:inconstantize'
from /home/leylakapicmd/.rbenv/versions/2.0.0-p451/lib/ruby/gems/2.0.0/gems/devise-3.2.4/lib/devise.rb:297:inget'
from /home/leylakapicmd/.rbenv/versions/2.0.0-p451/lib/ruby/gems/2.0.0/gems/devise-3.2.4/lib/devise/mapping.rb:77:into'
from /home/leylakapicmd/.rbenv/versions/2.0.0-p451/lib/ruby/gems/2.0.0/gems/devise-3.2.4/lib/devise/mapping.rb:72:inmodules'
from /home/leylakapicmd/.rbenv/versions/2.0.0-p451/lib/ruby/gems/2.0.0/gems/devise-3.2.4/lib/devise/mapping.rb:89:inroutes'
from /home/leylakapicmd/.rbenv/versions/2.0.0-p451/lib/ruby/gems/2.0.0/gems/devise-3.2.4/lib/devise/mapping.rb:156:indefault_used_route'
from /home/leylakapicmd/.rbenv/versions/2.0.0-p451/lib/ruby/gems/2.0.0/gems/devise-3.2.4/lib/devise/mapping.rb:66:ininitialize'
from /home/leylakapicmd/.rbenv/versions/2.0.0-p451/lib/ruby/gems/2.0.0/gems/devise-3.2.4/lib/devise.rb:331:innew'
from /home/leylakapicmd/.rbenv/versions/2.0.0-p451/lib/ruby/gems/2.0.0/gems/devise-3.2.4/lib/devise.rb:331:inadd_mapping'
from /home/leylakapicmd/.rbenv/versions/2.0.0-p451/lib/ruby/gems/2.0.0/gems/devise-3.2.4/lib/devise/rails/routes.rb:221:inblock in devise_for'
from /home/leylakapicmd/.rbenv/versions/2.0.0-p451/lib/ruby/gems/2.0.0/gems/devise-3.2.4/lib/devise/rails/routes.rb:220:ineach'
from /home/leylakapicmd/.rbenv/versions/2.0.0-p451/lib/ruby/gems/2.0.0/gems/devise-3.2.4/lib/devise/rails/routes.rb:220:indevise_for'
from /home/leylakapicmd/workspace/project-library/config/routes.rb:3:inblock in <top (required)>'
from /home/leylakapicmd/.rbenv/versions/2.0.0-p451/lib/ruby/gems/2.0.0/gems/actionpack-4.1.1/lib/action_dispatch/routing/route_set.rb:335:ininstance_exec'
from /home/leylakapicmd/.rbenv/versions/2.0.0-p451/lib/ruby/gems/2.0.0/gems/actionpack-4.1.1/lib/action_dispatch/routing/route_set.rb:335:ineval_block'
from /home/leylakapicmd/.rbenv/versions/2.0.0-p451/lib/ruby/gems/2.0.0/gems/actionpack-4.1.1/lib/action_dispatch/routing/route_set.rb:313:indraw'
from /home/leylakapicmd/workspace/project-library/config/routes.rb:1:in<top (required)>'
from /home/leylakapicmd/.rbenv/versions/2.0.0-p451/lib/ruby/gems/2.0.0/gems/railties-4.1.1/lib/rails/application/routes_reloader.rb:40:inblock in load_paths'
from /home/leylakapicmd/.rbenv/versions/2.0.0-p451/lib/ruby/gems/2.0.0/gems/railties-4.1.1/lib/rails/application/routes_reloader.rb:40:ineach'
from /home/leylakapicmd/.rbenv/versions/2.0.0-p451/lib/ruby/gems/2.0.0/gems/railties-4.1.1/lib/rails/application/routes_reloader.rb:40:inload_paths'
from /home/leylakapicmd/.rbenv/versions/2.0.0-p451/lib/ruby/gems/2.0.0/gems/railties-4.1.1/lib/rails/application/routes_reloader.rb:16:inreload!'
from /home/leylakapicmd/.rbenv/versions/2.0.0-p451/lib/ruby/gems/2.0.0/gems/railties-4.1.1/lib/rails/application/routes_reloader.rb:26:inblock in updater'
from /home/leylakapicmd/.rbenv/versions/2.0.0-p451/lib/ruby/gems/2.0.0/gems/activesupport-4.1.1/lib/active_support/file_update_checker.rb:75:incall'
from /home/leylakapicmd/.rbenv/versions/2.0.0-p451/lib/ruby/gems/2.0.0/gems/activesupport-4.1.1/lib/active_support/file_update_checker.rb:75:inexecute'
from /home/leylakapicmd/.rbenv/versions/2.0.0-p451/lib/ruby/gems/2.0.0/gems/railties-4.1.1/lib/rails/application/routes_reloader.rb:27:inupdater'
from /home/leylakapicmd/.rbenv/versions/2.0.0-p451/lib/ruby/gems/2.0.0/gems/railties-4.1.1/lib/rails/application/routes_reloader.rb:7:inexecute_if_updated'
from /home/leylakapicmd/.rbenv/versions/2.0.0-p451/lib/ruby/gems/2.0.0/gems/railties-4.1.1/lib/rails/application/finisher.rb:71:inblock in <module:Finisher>'
from /home/leylakapicmd/.rbenv/versions/2.0.0-p451/lib/ruby/gems/2.0.0/gems/railties-4.1.1/lib/rails/initializable.rb:30:ininstance_exec'
from /home/leylakapicmd/.rbenv/versions/2.0.0-p451/lib/ruby/gems/2.0.0/gems/railties-4.1.1/lib/rails/initializable.rb:30:inrun'
from /home/leylakapicmd/.rbenv/versions/2.0.0-p451/lib/ruby/gems/2.0.0/gems/railties-4.1.1/lib/rails/initializable.rb:55:inblock in run_initializers'
from /home/leylakapicmd/.rbenv/versions/2.0.0-p451/lib/ruby/2.0.0/tsort.rb:150:inblock in tsort_each'
from /home/leylakapicmd/.rbenv/versions/2.0.0-p451/lib/ruby/2.0.0/tsort.rb:183:inblock (2 levels) in each_strongly_connected_component'
from /home/leylakapicmd/.rbenv/versions/2.0.0-p451/lib/ruby/2.0.0/tsort.rb:219:ineach_strongly_connected_component_from'
from /home/leylakapicmd/.rbenv/versions/2.0.0-p451/lib/ruby/2.0.0/tsort.rb:182:inblock in each_strongly_connected_component'
from /home/leylakapicmd/.rbenv/versions/2.0.0-p451/lib/ruby/2.0.0/tsort.rb:180:ineach'
from /home/leylakapicmd/.rbenv/versions/2.0.0-p451/lib/ruby/2.0.0/tsort.rb:180:ineach_strongly_connected_component'
from /home/leylakapicmd/.rbenv/versions/2.0.0-p451/lib/ruby/2.0.0/tsort.rb:148:intsort_each'
from /home/leylakapicmd/.rbenv/versions/2.0.0-p451/lib/ruby/gems/2.0.0/gems/railties-4.1.1/lib/rails/initializable.rb:54:inrun_initializers'
from /home/leylakapicmd/.rbenv/versions/2.0.0-p451/lib/ruby/gems/2.0.0/gems/railties-4.1.1/lib/rails/application.rb:288:ininitialize!'
from /home/leylakapicmd/workspace/project-library/config/environment.rb:5:in<top (required)>'
from /home/leylakapicmd/.rbenv/versions/2.0.0-p451/lib/ruby/gems/2.0.0/gems/railties-4.1.1/lib/rails/application.rb:264:inrequire_environment!'
from /home/leylakapicmd/.rbenv/versions/2.0.0-p451/lib/ruby/gems/2.0.0/gems/railties-4.1.1/lib/rails/commands/commands_tasks.rb:147:inrequire_application_and_environment!'
from /home/leylakapicmd/.rbenv/versions/2.0.0-p451/lib/ruby/gems/2.0.0/gems/railties-4.1.1/lib/rails/commands/commands_tasks.rb:133:ingenerate_or_destroy'
from /home/leylakapicmd/.rbenv/versions/2.0.0-p451/lib/ruby/gems/2.0.0/gems/railties-4.1.1/lib/rails/commands/commands_tasks.rb:51:ingenerate'
from /home/leylakapicmd/.rbenv/versions/2.0.0-p451/lib/ruby/gems/2.0.0/gems/railties-4.1.1/lib/rails/commands/commands_tasks.rb:40:inrun_command!'
from /home/leylakapicmd/.rbenv/versions/2.0.0-p451/lib/ruby/gems/2.0.0/gems/railties-4.1.1/lib/rails/commands.rb:17:in<top (required)>'
from bin/rails:4:inrequire'
from bin/rails:4:in<main>'

written   User, destroy, devise, en, g, rails Read more

Rails Active_admin Gem Bug

Fix to admin_active gem bug

You add adminactive gem to your Gemfile, then when you’re running to bundle on your terminal, you’ re getting like,

1
2
3
4
5
6
7
8
9
$ bundle
Fetching gem metadata from https://rubygems.org/..........
Fetching additional metadata from https://rubygems.org/..
Resolving dependencies…
Bundler could not find compatible versions for gem "rails":
  In Gemfile:
    activeadmin (~> 0.6.3) ruby depends on
      rails (< 4, >= 3.0.0) ruby
    rails (4.1.4

written   Gemfile, active_admin, bug, en, gem, rails Read more

Error Compiling Sass Assets

Middleman sass compiling error

While you were made web template with haml and sass, if you use middleman and bootstrap for your web template and your project give you like,

1
2
Error compiling CSS asset
NoMethodError: undefined method </span><span class="n">font_path</span><span class="err"> for nil:NilClass

error.

written   assets, bootstrap, compiling, en, middleman, sass Read more

How to Make a Release ?

Make a release

When you start to make a release, I think if you look at your commit it can be better

1
git log

then if you make some wrong commit, you can delete wrong commit with

1
git rebase -i HEAD~2

command.

written   en, git, gitHub, release Read more

Bounce Effect With CSS3

How to give effect to arrow like bounce with CSS3 ?

You want to use arrow in your web-page with animation like bounce ball. HOW ?

Firstly, you should use this haml in your code, where you want to use section in your page,

1
2
3
4
%p.scroll-down
   .bounce
     %a{href: '#section2'}
        %i.fa.fa-angle-double-down.fa-5x

In your sass file, you should use

written   animation, bounce, css3, effect, en, font-awesome, haml Read more

How to Deploy Your Project to Heroku ?

Deploy to Heroku

You have a rails application, and finished your application want to deploy with Heroku, HOW ?

You should open your rails application, and in your application find Gemfile. Open Gemfile write this command

1
gem 'heroku'

in your terminal

written   deploy, en, heroku, project, rails Read more

Recreate Octopress Blog for Another Computer

How I recreate octopress blog another computer ?

I formatted my computer and then for my octopress blog What can I do ? reinstall or WHAT?

In this post I try to explain, if you have a new computer (after format, buy new computer…etc)but you have octopress blog how to entegrated each other?

written   computer, en, octopress, recreate Read more

How Do Google-analytics Add to Octopress?

Google – analytics for Octopress

Firstly, if you don’t have a google-analytics account, you should create it. Then when you create account, google-analytics provide to tracking ID for your octopress blog. This tracking ID like

AB-12345678-9

and then you should get this id, opened _config.yml in your octopress blog project,

written   en, google, google-analytics, octopress Read more

How to Change DNS Settings on Ubuntu Desktop?

How to change DNS settings (ip address) or How to set up Google public DNS for Ubuntu Desktop?

Firstly, we should look at Google Public DNS.

What is the Google Public DNS?

Google DNS created by Prem Ramaswami at 2009 . Google Public DNS provide to free DNS settings. Without DNS, it wil be difficult to know IP address of websites which visit daily.

written   DNS,, en, ip Read more

Middleman Blog

How to create middleman blog for middleman project?

  • Middleman supported blogging in your project or your blog.

If you create a blog, I think you should with middleman blogging. I hear, you say ‘ WHY ? ’

WHY?

written   blogging, en, middleman, Read more

CSS - Sprite Use in SASS

What is the CSS sprite? Why do we need to this ?

CSS Sprite means that combine all images in a single image file. The aim is that, when we upload several image file for use in css or sass file, you should upload to each.

written   ,Sprite,, CSS, SASS, en Read more

Brief Info About Hash

What is the hash in ruby ?

Hash, hash, hash ?

  • Hashes are one of the biggest property which separated another language in ruby.
  • Hash was known associative array in another programming language.
  • In hash, elements keep ‘key => value’ format in ruby . Like

1
hash_example = { 'name' => 'John', 'surname' => 'doe' }

written   Hash, Ruby,, en Read more

What Is the Ruby on Rails?

What is the Ruby On Rails and How install?

Ruby

  • Object oriented programming language
  • Created in 1995 by Matz
  • Used for many purpose, not only web app.

written   en, rails, ruby, Read more

Markdown Article Some Style

Write article with markdown

  • When you start to write article with markdown, we can recognize to writing regularly and reading easily.

Firstly

How to write header in markdown?

written   Markdown, en Read more

Meaning of Abbreviations

What is the meaning of abbreviation for HTML, CSS, …?

  • HTML : Hyper text markup language
  • CSS : Cascading Stylesheet
  • Haml : HTML Abstraction markup language
  • SASS: Syntactically Awesome Stylesheets

written   abbreviation, en, meaning