여기가 제일 편한 듯, 0x 붙여서 hexa값도 입력되고.
[태그:] TIME
[WordPress] 워드프레스 기본 HTML & CSS 구조
일단 테마를 위해서는 assets/style.css를 참조한다.
body element에는 모든 post page를 styling하는 post-template-default class를 볼 수 있다. postid-xxxx 같은 class도 있는데 이를 써서 각 개별 post를 style할 수 있다.
header 에는 h1.site-name element와 nav.navbar 가 있다. ul로 메뉴 아이템들을 둔다. li 에 id들이 붙는 것을 볼 수 있는데, 개별 li를 styling할 수 있다.
page content의 primary와 secondary sections이 div#content에 담긴다.
div#primary는 primary content가 담기는 곳이다. 이는 실제 post를 담는 article element를 포함하는 main#main element로 싸여 있다. article element는 많은 class를 갖고 있는데, 이들로써 그 post를 다양한 방법으로 지정할 수 있도록 한다.
article 안에는 article의 header, h2, 그리고 div.entry-meta 안에 metadata를 담고 있는 header element가 있다. datetime 속성을 가지는 time element와 작성자를 보이는 vcard 등이 있다.
div.entry-content에 article이 담긴다. h3 이하 제목과 p elements, link들 같은게 담긴다.
secondary content section은 툴바 같은 aside를 담는다.
맨 아래 footer element는 copyright 같은걸 담는다.
[Windows] BAT 파일에서 현재 시간,날짜 만들기
Stackoverflow에 외국에 맞는게 올라가 있다.
Locale 설정에 따라 달라져야 한다. 맞게 바꾸면.
set hour=%time:~0,2%
if “%hour:~0,1%” == ” ” set hour=0%hour:~1,1%
echo hour=%hour%
set min=%time:~3,2%
if “%min:~0,1%” == ” ” set min=0%min:~1,1%
echo min=%min%
set secs=%time:~6,2%
if “%secs:~0,1%” == ” ” set secs=0%secs:~1,1%
echo secs=%secs%
set year=%date:~0,4%
echo year=%year%
set month=%date:~5,2%
if “%month:~0,1%” == ” ” set month=0%month:~1,1%
echo month=%month%
set day=%date:~8,2%
if “%day:~0,1%” == ” ” set day=0%day:~1,1%
echo day=%day%
set datetimef=%year%%month%%day%_%hour%%min%%secs%
참고: http://stackoverflow.com/questions/1192476/format-date-and-time-in-a-windows-batch-script
[gcc] gcc 확장 __builtin_constant_p(exp)
Documentation/CodingStyle에서 inline disease 에 언급된 (slab 기준) kmalloc 구현을 살펴보다가 눈에 띄어서 정리해 둔다.
__builtin_constant_p(exp) 는 컴파일 타임에 상수로 정해질 수 있는 경우에 1을, 아닌 경우에는 0을 리턴한다. 따라서 이 조건에 따라 다른 코드를 사용함으로 써 최적화할 수 있도록 할 수 있다.
(이 글을 쓰는 시점인 v3.3-rc6 기준)kmalloc 의 경우 다음과 같이 구현되어 있다.
include/linux/slab_def.h
static __always_inline void *kmalloc(size_t size, gfp_t flags)
{ struct kmem_cache *cachep; void *ret; if (__builtin_constant_p(size)) { int i = 0; if (!size) return ZERO_SIZE_PTR; #define CACHE(x) \ if (size <= x) \ goto found; \ else \ i++; #include <linux/kmalloc_sizes.h> #undef CACHE return NULL; found: #ifdef CONFIG_ZONE_DMA if (flags & GFP_DMA) cachep = malloc_sizes[i].cs_dmacachep; else #endif cachep = malloc_sizes[i].cs_cachep; ret = kmem_cache_alloc_trace(size, cachep, flags); return ret; } return __kmalloc(size, flags); }
이외에도 __always_inline 사용, CACHE(x) 매크로를 상황에 따라 define하고 linux/kmalloc_sizes.h 헤더를 include 하여 사용하는 부분은 매우 흥미롭다. __always_inline 은 gcc의 function attribute 를 이용한다.
이 글의 라이센스는 GPL 을 따른다(This document is released under the GPL licence.).
참고 :
http://gcc.gnu.org/onlinedocs/gcc-4.6.3/gcc/Other-Builtins.html