Monday, September 23, 2013

Fix ADB Unauthorized(Esp Windows + Wi-fi)

If you get in trouble with unauthorized device message, copy adbkey file to ~/.android 

Saturday, September 7, 2013

GPT to MBR(+ext3)

My external HDD is "Seagate Backup Plus 500 GB USB 3.0"
I want to use it for NAS(dd-wrt firmed) ,  I changed it to MBR and ext3.

-> gdisk and mkfs.ext3 is best solution!

http://www.ehow.com/how_12119053_convert-gpt-mbr-linux.html


* If you want to use only data storage, you can remove reserved space which is 5% of whole disk.
sudo tune2fs -m 0 /dev/sdb1

(http://geekyprojects.com/ubuntu/how-to-format-a-usb-external-hard-drive-for-linux/)

Thursday, September 5, 2013

Raspbian gitlab issue

1. bundle install fail
-> Define highest version of "therubyracer and libv8" in Gemfile, Gemfile.lock

In Gemfile

gem "therubyracer", "0.12.0"


In Gemfile.lock

therubyracer (0.12.0)
libv8 (3.16.14.3)


2. When first connect, very very very slow.
-> You must extend timeout both unicorn and nginx
-> config/unicorn.rb , /etc/nginx/nginx.conf -> timeout 3000

Wednesday, September 4, 2013

Raspbian locale problem on OSX

When using raspbian with ssh connect on OSX, you can see error message like belows

locale: Cannot set LC_CTYPE to default locale: No such file or directory
locale: Cannot set LC_ALL to default locale: No such file or directory

-> Just comment out "SendEnv LANG LC_*" in /etc/ssh_config on your OSX.



Friday, August 30, 2013

htpasswd without apache

Source
http://forum.nginx.org/read.php?6,210155,210168#msg-210168

1. echo -e "your-username:`perl -le 'print crypt("your-password","salt")'`" > /etc/nginx/htpasswd

2. online tool: http://www.htaccesstools.com/htpasswd-generator/

3. ruby -le 'print "your-username: #{%Q{your password}.crypt(%Q{salt})}"'


Thursday, August 29, 2013

WWDC 2013 Summary : 226-HD Implementing Engaging UI on iOS


-> Custom Transition
-> UISnapshotting -> Improvement on  [CALayer renderInContext]
snapshotView : Fastest
drawViewHierarchyInRect : Faster
Making Blurred Background -> drawViewHierarchyInRect & applyLightEfftect

-> Custom Appearance  : self.window setTintColor
[UIImage resizableImageWithCapInsets]


minimum height - 44px
Focus & Intent!

Affirmative(positive) button -> right

WWDC 2013 Summary : 228-HD Hidden Gems in Cocoa and Cocoa Touch


<NSHipster>

<Xcode>
OpenQuickly : cmd-shift-o
Related Files : ctl + 1
Breakpoint Actions
Debug description : 
(NSString *)debugDescription{ return @"Verbose debugging string";} -> (lldb) po self.rootViewController -> Verbose debugging string
Recursive description

<OBJC>
Custom-indexed Subscripting
NSOperation
NSExpression
NSSet & NSOrderedSet
Collection Tricks - reverseObjectEnumerator.allObjects -> reverse
NSFastEnumeration -> for in 
NSValue
NSValue withPoint, Range
Custom Value -> typedef struct RGB { float red, green, blue; } _RGB; RGB Color={1.0f, 0.0f, 0.0f}; -> [NSValue valueWithBytes: &color objCType:@encode(RGB)];
Key & Value Coding
-String
NSDataDetector - Dates, Addresses, Links, Phone Numbers, Transit information
CFStringTransform - esp name unicode characters, transliterate between orthographies(안녕하세요->annyeonghaseyo,  ひらがな<ー>かたかな、romaji)
Normalizing Input -> all english char .. etc..

<Core Animation>
CAGradientLayer
CAShapeLayer
CAMediaTiming for interactive animation

<Core Data>
NSPrivateQuqueConcurrencyType
NSIncrementalStore

Monday, August 26, 2013

Java8 Features

Good link

http://www.techempower.com/blog/2013/03/26/everything-about-java-8/

Linux Redmine-Thin Systemd(Systemctl) Service Daemon Registration - Not working



1. Create service script

Create file /etc/systemd/system/redmine.service with the content:

/etc/systemd/system/redmine.service
[Unit]
Description=Redmine server
After=syslog.target
After=network.target

[Service]
Type=forking
User=redmine
Group=redmine

ExecStart=/usr/bin/ruby /usr/share/webapps/redmine/script/rails server thin -e production -p 6000

# Give a reasonable amount of time for the server to start up/shut down
TimeoutSec=300

[Install]
WantedBy=multi-user.target

2. Reload daemon

systemctl daemon-reload

3. Enable & Start Service

systemctl enable redmine

systemctl start redmine


If you have trouble with start service, Check permission - user/group in service script


https://wiki.archlinux.org/index.php/Systemd/Services#redmine

Sunday, August 25, 2013

Cocos2d-html5 has some difference with JSB


There still some differences between JSB and Html5. For example, there are not cc.Color4B cc.RectMake in JSB, instead, you could use cc.cc4b and cc.rect for both JSB and Html5.


From : http://www.cocos2d-x.org/boards/20/topics/32390

Friday, August 23, 2013

iOS Dev Weekly Memo - Issue 108 - 23rd August 2013



Issue 108 - 23rd August 2013











--> If your apps use the MAC address to identify an iOS device, the system will return the same static value for all devices running iOS 7. Please update your apps to use the identifierForVendor property of UIDevice. If you need an identifier for advertising purposes, use the advertisingIdentifier property of ASIdentifierManager.



Boost up gem install

Without doc!

http://stackoverflow.com/a/17201281

install: --no-document
update: --no-document
or
gem: --no-document

Git over HTTP Memo


Good link : http://www.parallelsymmetry.com/howto/git.jsp

1. HTTPD (Nginx, Apache .. ) setup

2. git init --bare foo.git

3. mv hooks/post-update.sample hook/post-update

4. git update-server-info(not necessary?)

5. git config http.receivepack true
--> If you want global -> git config --global http.receivepack true : Not work

6. Permission(chmod -R)

* If you upload big size push

--> git config http.postBuffer 524288000
--> Size up http server buffer :
   In case of nginx ->
   client_body_buffer_size 32K;
   client_max_body_size 100M;

http://stackoverflow.com/questions/7489813/github-push-error-rpc-failed-result-22-http-code-413

Thursday, August 22, 2013

Linux Nginx Systemd(Systemctl) Service Daemon Registration

1. Create service script

Create file /etc/systemd/system/nginx.service with the content:
[Unit]
Description=Nginx
After=syslog.target network.target

[Service]
Type=forking
ExecStart=/usr/local/nginx/sbin/nginx
ExecReload=/usr/local/nginx/sbin/nginx -s reload

[Install]
WantedBy=multi-user.target
http://stackoverflow.com/questions/9782895/passenger-with-nginx-not-registered-as-service-in-fedora


2. Reload daemon

systemctl daemon-reload

3. Enable & Start Service

systemctl enable nginx

systemctl start nginx

Javascript code completion editor compare

I want JS code completion when using model based library(like Knockout.js)
This is result of a day searching.
Maybe some of contents are wrong.
Please comment to me when you find out mistakes.

1. Eclipse
 - JSDT(Javascript Development Tools) : Can't detect modal based library
 - VJET : I don't understand how to attach javascript library

2. Netbeans
 Powerful auto completion. But it doesn't seems to be support model based library

3.  TernJS with SublimeText2
 Better. Sublime text is free and I like this editor :) But working

4. Webstorm(Intellij IDEA)
 Best. Full supports and good IDE. But it's a commercial tool.


Wednesday, August 21, 2013

Redmine on ArchLinux

Basically, Read Offical Site.

http://www.redmine.org/projects/redmine/wiki/RedmineInstall

If you have a trouble with paths, see archlinux wiki

https://wiki.archlinux.org/index.php/Redmine#Installation

In my case, I skipped rmagick

bundle install --without development test rmagick

In my case use thin behinds nginx


http://rohitbhute.in/2012/07/10/redmine-thin-nginx/


http://wiki.nginx.org/Redmine


http://www.redmine.org/boards/2/topics/37072

http://code.macournoyer.com/thin/usage/


Jenkins-CI on ArchLinux via Nginx Proxy

1. pacman -S jenkin-ci
(Maybe default port is 8090, you can edit at /etc/conf.d/jenkins)

2. edit /etc/nginx/nginx.conf

server {
  listen 80;
  server_name jenkins.domain.tld;

  location / {
    proxy_pass              http://localhost:8090;
    proxy_set_header        Host $host;
    proxy_set_header        X-Real-IP $remote_addr;
    proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_connect_timeout   150;
    proxy_send_timeout      100;
    proxy_read_timeout      100;
    proxy_buffers           4 32k;
    client_max_body_size    8m;
    client_body_buffer_size 128k;

  }
}

Source : Jenkins behind an NGinX reverse proxy

NOTICE :
In my case, /etc/hosts setting is not allowed localhost.
So I use proxy_pass http://127.0.0.1:8090;

Get rid of annoying "__rvm_add_to_path :command not found"

rm /etc/profile.d/rvm.sh

http://stackoverflow.com/a/9556172

Arch Linux $Path Environment Variable

1. ~/.bashrc
2. ~/.bash_profile
3. ~/.profile
4. /etc/profile
5. /etc/bashrc

Tuesday, August 20, 2013

Today Simple Memo

1. Sublime Text2 Plugin


2. Human Readable Web 80 Port Hooking (like Apache Httpd) - ngrep

ngrep port 80

3.  Opened File ( |grep $filename is optional)

lsof

4. Terms

Business Logic : The part of the program that connect between DB and User
DAO : Data access object

5. SyntaxHighlighting on Blogger

6. Process : ps aux | grep $process_name

iOS Development Memo

[Tool]
1. Instruments Profile
2. LLDB Debugging
3. Automated Testing - XCUnit & Bots(or Jenkins(ray's automate tutorial))
4. i18n - UILocalizedIndexedCollation
5. Paintcode
6. Apple Doc

[Resources]
1. Apple Guideline and Reference Documents
2. WWDC
3. Raywenderlich
4. Effective Objective-C (Not Yet)
5. Cocoa Control
6. Stackoverflow, Developer Forum, gist.github.com
7. iOS Dev Weekly
8. NSHipster
9. NSConference
10. NSScreencast

[Beta Ver Distributor]
1. Test Flight
2. Hockeykit

[Crash Log]
1. crashlytics

[Lib]
1. SSToolkit
2. TapkuLibrary
3. Nimbuskit
4. iRate
5. appirater(Review)
6. DB - MagicalRecord
7. GPUImage
8. Date Formatter - iso8601unparser
9. BlocksKit
10. ReactiveCocoa
11. RestKit (Ray's Tutorial)
12. SocketRocket(Websocket)
13. AFNetworking
14.

Objective-C Singleton


Use dispatch_once !

http://objcolumnist.com/2011/07/06/creating-singletons-using-dispatch_once/

Monday, August 19, 2013

jqTree - Keyboard Unbind

I like jqTree. Recently it supports keyboard navigation.
But I don't want to use keyboard navigation.  And there is no option.
So I unbind manually(jQuery)

-> $(document).unbind('keydown.jqtree');

[MYSQL] Get Auto Incremented Key when INSERT INTO

CLI : SELECT LAST_INSERT_ID();
-> http://viralpatel.net/blogs/get-autoincrement-value-after-insert-query-in-mysql/

PHP : mysqli_insert_id();

Friday, August 16, 2013

Wednesday, August 14, 2013

PHP Array Issue when using as parameter

1. PHP function passes arguments with copying

--> you can use &

ex)
function addSomeValueIntoArray(&$targetArray, $value)

2. Order of array_push when using nested array

ex)
<BAD>
$parentArray = array();
$childArray = ["foo" => bar];
array_push($parentArray, $childArray);
//Not reflected in parentArray
array_push($childArray, ["hello" => "world"]);

<Correct>
$parentArray = array();
$childArray = ["foo" => bar];
array_push($childArray, ["hello" => "world"]);
array_push($parentArray, $childArray);



Monday, August 12, 2013

Raywenderlich Summary - Shooting Game with Cocos2d

Keep in mind : Many of pages are out of dated. Just see points which he is explaining

Cocos2d-JS

Cocos2d-JS Game Overall
Cocos2d-JS Deploy


Trigonometry for Game Programming(Shooting!)

Trigonometry for Game Programming -1
Trigonometry for Game Programming -2

Tower Defense Game



Multi Play

How To Make a Multiplayer iPhone Game Hosted on Your Own Server -1
How To Make a Multiplayer iPhone Game Hosted on Your Own Server -2

TileMap

How to make a RPG
Cocos2d-x how to make tile-based game
Cocos2d-x tilemap-1
Cocos2d-x tilemap-2

Cocos2d-Turn-Based Strategy Game-1
Cocos2d-Turn-Based Strategy Game-2



Collision detect

Cocos2d collision detect with box2d(+bounds tracer)


Sprite Cutting Effect

Cocos2d A Game Like Fruit Ninja With Box2D-1



Components & Not use this time

Cocos2d - Create Your Own Level Editor -1
Cocos2d - Create Your Own Level Editor -2
Cocos2d - Create Your Own Level Editor -3

Cocos2d Monkey Jump Game with TexturePacker & PhysicsEditor-1 (+bounds tracer)
Cocos2d Monkey Jump Game with TexturePacker & PhysicsEditor-2
Cocos2d Monkey Jump Game with TexturePacker & PhysicsEditor-3(+ Asset Secret & Performance)

Cocos2d Buttons

Cocos2d Drag and Drop sprite (+background moving)

Cocos2d HUD

Cocos2d Sprite Masking


Cocos2d-x Bouncing Ball
Cocos2d-x Create A Breakout Game(Arknoid) with Box2D-1
Cocos2d-x Create A Breakout Game(Arknoid) with Box2D-2

Cocos2d-x Create A Game Like Tiny Wing-1
Cocos2d-x Create A Game Like Tiny Wing-2



Tools :

CocosBuilder

TiledMapEditor

Code'n Web : TexturePacker & PhysicsEditor
TexturePacker Tutorial

How To Use SpriteHelper and LevelHelper Tutorial(Commercial Tool)

Another Tutorials(Not ray)

Bootstrap Align

1. Text

Left : .text-left
Right : .text-right
Center : .text-center

2. Element

Left : .pull-left
Right : .pull-right
Center : Set container ".text-center"

Thursday, August 8, 2013

TernJS - The best code completion for cocos2d-HTML5

The lack of code completion makes me crazy when developing cocos2d-HTML5.

I found TernJS helps me.

TernJS is code-analysis engine for JavaScript.

My recommendation is using TernJS with Sublime Text 2(3, or the other editor).


Tip. If you want to check JS syntax error, JSHint will help you.

Xcode 5 and LLVM Build Recommendation both iOS and OSX

- Turn On below feature for optimization

1. Enforce Strict Aliasing

YES (Default YES)

2. Link-Time Optimization(LTO)

YES (Default NO)

3. Vectorize Loops

YES (Default NO)

4. Optimization Level :

-Ofast (Default release -Os)

*Caution
  1) Do not use if your application has high level floating point precision requirement
  2) Does not enable LTO(2.)
  3) Test Carefully

--> For best performance : Two options
 -Ofast or -O3 with LTO

- Use Static Analyzer

- Warnings : Documentation Comments



From : WWDC 2013 -  402 What's New in the LLVM Compiler
                                      408 Optimize Your Code Using LLVM

Xcode - Move Focus

Cmd + J

Remarkable - in iOS 7 UI Transition Guide

1. Because UIWindow inherits from UIView, you can specify a tint color for the entire app by setting the window’s tint property using code like this:

window.tintColor = [UIColor purpleColor];

2.Dynamic Type Font

 use the UIFont method preferredFontForTextStyle to get a font, instead of specifying font names or sizes.

3. Imbedded Picker in table row

Hide status bar in iOS7

- (BOOL)prefersStatusBarHidden
{
    return YES;

}

Wednesday, August 7, 2013

10 Useful Xcode(5) Things

1. Documentation Integration!

option + click or Quick Help can show built-in help(document)

Now, you can describe own code documents.

- Doxygen Syntax


http://www.doxygen.org
https://developer.apple.com/library/mac/documentation/DeveloperTools/Conceptual/HeaderDoc/intro/intro.html

+ New feature : Documentation Window


2. Ctrl + 1

Show related files in jump bar










3. Cmd + Option Click

Jump to definition in assistant editor

(or) cmd + option + shift click can select editor area

--> option / option + shift work same behaviour other places(jump bar, navigator...)


4. Open Quickly

Cmd + shift + O



5. Custom Code Snippets

- Adding : Just source code (hold click and) drag in to snippet panel.
- Customizing :
    1) Create Token : <# token #>
    2) Shortcut


6. Replace - Except certain result in found

 +

select and just type "delete key"



7. Analyze single file

Product -> Perform Action -> Analyze "ooo.o"



8. Custom Behavior

In preferences.

9. Run Instruments while app running

10. Quick view when debugging.



In WWDC 2013 - 401 Xcode Core Concepts

+ Control + Shift + Click in Xcode5 Interface builder, you can select behind object
(In WWDC 2013 - 406 Taking control of Auto layout in Xcode5)