StupidTextField for iOS

apple
Standard

1st public iOS Class on GitHub

Not too long ago I released A UITextField Subclass with a custom keyboard (input view) called StupidTextField. This UITextView subclass comes with a custom keyboard that randomly changes key-board layout everytime it’s activated. Not sure if it’s useful to anyone. But, the project I worked on has a requirement spec like this. It is available here at https://github.com/jinseokoh/StupidTextField.

JIRA installation on a clean installation of Ubuntu 14.04 LTS

Standard
  1. begin with the usual stuffs

    sudo apt-get update

    sudo apt-get upgrade

  2. set the system language

    sudo locale-gen en_US.UTF-8

  3. edit /etc/environment to add the following lines

    LANGUAGE=en_US.UTF-8

    LC_ALL=en_US.UTF-8

  4. edit /etc/network/interface to add the following line

    dns-nameservers 211.45.150.201 211.45.151.201

  5. install openssh server

    sudo apt-get install openssh-server

  6. then, go to download folder and run the following command

    chmod a+x atlassian-jira-6.2.4-x64.bin

  7. install PostgreSQL; steps are well documented at https://help.ubuntu.com/community/PostgreSQL

    sudo -u postgres createuser -D -A -P jirauser

    sudo -u postgres createdb -O jirauser jiradb

  8. then execute the .bin file

    • choose 2 to custom installation
    • JIRA Home Directory to be /opt/atlassian/jira
    • default data location to be /var/atlassian/application-data/jira
    • HTTP port: 8080, Control port: 8005
  9. create /opt/atlassian/jira/dbconfig.xml

    <?xml version="1.0" encoding="UTF-8"?>
    
    <jira-database-config>
    <name>defaultDS</name>
    <delegator-name>default</delegator-name>
        <database-type>postgres72</database-type>
    <schema-name>public</schema-name>
    <jdbc-datasource>
    <url>jdbc:postgresql://localhost:5432/jiradb</url>
    <driver-class>org.postgresql.Driver</driver-class>
    <username>jirauser</username>
    <password>compia</password>
    <pool-min-size>20</pool-min-size>
    <pool-max-size>20</pool-max-size>
    <pool-max-wait>30000</pool-max-wait>
    <pool-max-idle>20</pool-max-idle>
    <pool-remove-abandoned>true</pool-remove-abandoned>
    <pool-remove-abandoned-timeout>300</pool-remove-abandoned-timeout>
    <validation-query>select version();</validation-query>
    <min-evictable-idle-time-millis>60000</min-evictable-idle-time-millis>
    <time-between-eviction-runs-millis>300000</time-between-eviction-runs-millis>
    <pool-test-while-idle>true</pool-test-while-idle>
    </jdbc-datasource>
    </jira-database-config>
    

Laravel Application Development Cookbook

laravel-cookbook
Standard

Laravel Application Development Cookbook

One of the nicest things to read a well written cookbook is that the author’s hands-on expertise will rub off on you with minimum effort. This book is not an exception. It contains 11 chapters which cover almost every aspect of making modern websites. You can’t learn all the details you’ll ever need to know by reading a single book but, this could rather be a great starting point. Even though it’s a cookbook with various topics and solutions. The step by step approach begining from installation to more complex tasks makes it easy to read and follow. I’ve learned many great online resources that I wasn’t aware of.

I’m hoping that my next project can leverage some of those. Maybe there’re other aspects of learning and using frameworks like this. Things like how to implement Single Responsibility Principle, and how to refactor your code with intent. That’s not covered with it. Don’t bother! There’re better books for that. This book stands out when you need a seasoned programmer’s code recipes for the things you are working on or planning to do. As a matter of fact, I’m officially translating this book into Korean. So my fellow Korean PHP programmers can also leverage this great framework for their next projects. I could be a big time Laravel evangelist here in Korea then. :) I’d give it 4 out of 5.

Head First Design Patterns

book
Standard

다양한 Laravel 4 추천서들과 튜토리얼들을 접하다 보면, 심심치 않게 아니 사실은 너무나 자주 OOP 디자인 패턴들의 용어가 언급되곤 한다. 이 책은 아주 오래전부터 회사 동료들로부터 추천받았었던 디자인 패턴책들중 하나다. 한글책이라 눈에 빨리 들어온다. 나도 Laravel 4 책 한권을 번역하기로 마음먹고 에이콘 출판사와도 이미 이야기를 나눴던 터라, 한국 번역서를 읽는 것이 나한테는 다양한 의미가 있기도 하다. 이 책의 경우, 번역의 질이 괜찮았지만, 한글 번역본을 읽으면서 느끼게되는 불만 또한 역시 존재했다. 원래부터 한글이 언어로서 갖고 있는 비논리적 성격에서 발생하는 한계뿐만 아니라, 논리적으로 이해하기 어렵게 이야기를 나열하거나, 오자로 인해 전혀 다른 뜻이 되버린 문장, 원문과 연관이 어려운 한자단어사용 (예컨대 concrete class 를 `구상클래스` 로 번역해 놓아서 처음엔 추상클래스의 오자인줄로 착각했다.) 뭐 이런것들…

번역의 창의적인 요소를 싸구려 기능으로 취급하는 국내 실정에서 필연적으로 나올 수 밖에 없는 한계인듯 싶어 씁슬하다. 창의성이 나와서 하나만 덧 붙이자면, 정작 디자인 패턴을 다룬 책 디자인에 epic design 요소가 없어서, 내가 이 책을 늦게 집었던 이유가 되지 않았나 싶다. 이렇게 출판했더라면 훨씬 빨리 눈길이 닿았을 법한데…

Event logic

Standard

This is an example to illustrate when and how to use events. you can exploit built-in model events like saving, saved, updating, updated, etc. for query caching.

app/routes.php

[php]
Event::listen(‘meetup.change’, function()
{
Cache::forget(‘query.meetup.all’);
});

Route::resource(‘meetups’, ‘MeetupsController’)

[/php]

app/controllers/MeetupsController.php

[php]
class MeetupsController extends BaseController {

public function index()
{
return Meetup::remember(10, ‘query.meetup.all’)->get();
}

public function store()
{
Meetup::create([‘name’ => ‘Seoul’]);
}

public function destroy()
{
Meetup::first()->delete();
}

public function udpate()
{
$meetup = Meetup::first();
$meetup->name = ‘Pusan’;
$meetup->save();
}
}
[/php]

app/models/Meetup.php

[php]
<!–?php <br ?–>
class Meetup extends Eloquent {

protected $guarded = [];

public static function boot()
{
static::saving(function()
{
Event::fire(‘meetup.change’);
});
}

}
[/php]

So where you can place event listeners?

1) you can place them in `app/start/global.php`
2) you can attach `require app_path().’/events.php’` line to `app/start/global.php` and place them in app/events.php
3) you can use a dedicated ServiceProvider like EventServiceProvider. (make sure to list your EventServiceProvider in your providers array in app/config/app.php)

Blade Templating Engine

Standard

Dayle Rees’s explanation on Blade templates is so much better than what it is on the current L4’s docs. Looks like the latter is merely an abridged version of Dayle’s. So, this time, oddly enough, you are encouraged to read his great post at http://daylerees.com/codebright/blade first.

The following is a hands-on tip from Jeffrey to update meta description in your Blade templates.

app/views/layouts/master.blade.php

[html]
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta description="@yield(‘meta_description’, ‘The worst blog on the web’)">
<title>Sagage</title>
</head>

<body>
@yield(‘content’)
</body>
</html>
[/html]

app/views/home.blade.php

[html]
@extends(‘layouts.master’)

@section(‘content’)
<h1>Homepage</h1>
@stop
[/html]

app/views/lesson.blade.php

[html]
@extends(‘layouts.master’)

@section(‘meta_description’, strip_tags($lesson))

@section(‘content’)
<h1>{{ $lesson }}</h1>
@stop
[/html]

app/routes.php

[php]
<?php

Route::get(‘/’, function()
{
return View::make(‘home’);
});

Route::get(‘Lessons/{slug}’, function()
{
return View::make(‘Lesson’)
});

[/php]

More hands-on tips for structuring your view templates with L4 is available here at http://scotch.io/tutorials/simple-laravel-layouts-using-blade and http://scotch.io/bar-talk/quick-tip-using-laravel-blade-with-angularjs.

bugsnag

Standard

Among other paid web services I’m keeping an eye on, bugsnag.com is noteworthy to mention. The price is well deserved for what they had to offer.

They offer notification system and apis to deliver error/exception reports in real-time for seemingly all types of web/mobile applications. They even provide Laravel specific plugin. If you haven’t heard of ’em, you should check ’em out. Pretty cool.

Will definitely consider using it for my next projects.

A Laravel book review

Standard

Laravel Application Development Blueprints

This is the Laravel 4 book I recently had a chance to grab. If you’ve just read through Laravel 4 documents and want to play with it by making simple things up and running, you’ll get some useful ideas from the examples throughout this book. You can’t say that the way they implemented is ideal though.

I’ve found many typos and even inconsistent file names which lead me to think if the authors actually run the test with the codes. But, fortunately, nothing major. With all those explanations, it’s not hard to get the idea of what they’re trying to do. Besides, it’s always good to have a look at others’ implementations when you are new at it I guess.

It’s not exactly a type of book I want to keep for a reference. But, if you feel a bit overwhelmed even after reading through Laravel 4 documents and don’t know how to start putting things together. Their step-by-step instructions will help you get the hang of it. Recommended to beginner level Laravel 4 developers. As a side note, I found it super easy to copy-and-paste source codes from ebook format.

I’d give it 3 out of 5.

How to simplify the way to log into your Amazon EC2 server

Standard

Up until now I had to repeat to type what it seems to be impossible to memorize whenever I need to log into my company’s EC2 account. But, there’s a better way:

1st off, copy your RSA public key into your Mac’s clipboard.

[bash]
cat ~/.ssh/id_rsa.pub | pbcopy
[/bash]

2ndly, log in to your EC2 account.

[bash]
ssh -i hongcode.pem passin.kr -l ubuntu
[/bash]

finally, you can now go back to your remote server, and open the following file and paste your key there.

[bash]
vim ~/.ssh/authorized_keys
[/bash]

Now that you can login to the account by typing `ssh ubuntu@hongcode.com`. We can improve it further here.

[bash]
vim ~/.ssh/config
[/bash]

Then, copy the following entries into the file. If you want to access multiple sites, just repeat the 3 entries accordingly and append ’em to the file.

[code]
Host passin
HostName passin.kr
User ubuntu
[/code]

Then, you can login into the server by just typing `ssh passin`. you can use the same settings for scp and sftp like this;

[code]
scp -r ./somedirs passin:/home/ubuntu
[/code]

Cool!