顯示具有 程式語言 標籤的文章。 顯示所有文章
顯示具有 程式語言 標籤的文章。 顯示所有文章

2018年9月16日 星期日

Qt

MariaDB


sudo cp /opt/lampp/lib/libmysqlclient_r.so.18 libmysqlclient_r.so.16

sudo apt-get install libqt5sql5-mysql

2015年4月1日 星期三

Linux script multithread method

#!/usr/bin/tcsh

echo "start"
./ex one &
./ex two &
wait
echo "OK"

=======================================================================
ex為執行程式
one,two為引數
wait為同步化
&代表spawn一個thread

2015年3月25日 星期三

How to compile from SDL Library

gcc hello.c -I/usr/include/SDL `sdl-config --cflags --libs` -o hello

save graphics output as Windows Bitmap(*.bmp)

Uint32 rmask, gmask, bmask, amask;

    /* SDL interprets each pixel as a 32-bit number, so our masks must depend
       on the endianness (byte order) of the machine */
#if SDL_BYTEORDER == SDL_BIG_ENDIAN
    rmask = 0xff000000;
    gmask = 0x00ff0000;
    bmask = 0x0000ff00;
    amask = 0x000000ff;
#else
    rmask = 0x000000ff;
    gmask = 0x0000ff00;
    bmask = 0x00ff0000;
    amask = 0xff000000;
#endif

w=400;
h=500;
unsigned char * pixels = new unsigned char[w*h*4]; // 4 bytes for RGBA
    glReadPixels(0,0,w, h, GL_RGBA, GL_UNSIGNED_BYTE, pixels);

     SDL_Surface * surf = SDL_CreateRGBSurfaceFrom(pixels, width, height, 8*4, width*4, rmask, gmask, bmask, amask);                                                                                      
    SDL_SaveBMP(surf, filename);

    SDL_FreeSurface(surf);
    delete [] pixels;

Linux Gimp Script from bmp to SGI (*.rgb)

bmp2rgb

#!/bin/bash
{
cat <<EOF
(define
(bmp-sgi
  input
output
)
(let*
  (
(image
  (car
(gimp-file-load
RUN-NONINTERACTIVE
input
input
)
)
)
(drawable
  (car
  (gimp-image-get-active-drawable
image
)
)
)
)
(gimp-image-flatten
  image
)
(let*
  (
  (newdrawable
(car
  (gimp-image-get-active-drawable
image
)
)
  )
)
(file-sgi-save
RUN-NONINTERACTIVE
image
newdrawable
output
output
0
)
)
)
)
EOF

for i in *.bmp; do
  echo "(gimp-message \"$i\")"
  echo "(bmp-sgi \"$i\" \"${i%%.bmp}.rgb\")"
done

echo "(gimp-quit 0)"
} | gimp -i -b -

最重要的是file-sgi-save這個函式
有六個參數 要填對

2015年1月21日 星期三

android sdk--gradle

1. download gradle file
2.export gradle-2.2.1/bin/ to path
3.test ./gradle -v

android studio 測試

step 1./src/.
建立test com example app等資料夾

step 2. build.gradle
  sourceSets {
        instrumentTest.setRoot('src/test')
    }

step 3. "Sync Project with Gradle Files"

Tool -> Android ->Sync Project with Gradle Files

如果已經有test 資料夾他就不會當作source test

中文參考
http://yrulee.logdown.com/posts/233710-android-studio-start-with-unit-test

Unit Test參考
Unit Test

2015年1月18日 星期日

材質流動效果

       將材質座標加上周期函數
        Tex0Coords[0][0]+=cos(time);
        Tex0Coords[0][1]+=sin(time);
        Tex0Coords[1][0]+=cos(time);
        Tex0Coords[1][1]+=sin(time);
       
   

2014年12月14日 星期日

android 開發 logo

 //show 像gmail鍵號
actionBar.setDisplayHomeAsUpEnabled(true);


 //show logo
actionBar.setHomeButtonEnabled(true);
actionBar.setDisplayShowHomeEnabled(true);
actionBar.setDisplayUseLogoEnabled(true);
actionBar.setLogo(R.drawable.icon);
actionBar.setDisplayShowTitleEnabled(false); //optional

2014年11月28日 星期五

The Intel Microprocessors筆記

第一章    Introduction to The Microprocessor And Computer
8086->80286->80386->80486->Pentium->Pentium II->Pentium III->Pentium 4->Intel Core 2 Duo->Core i5
L1 Cache
Figure 1-11
-7AE2=851D+0001=851E
單倍精single-precision
Binary  Normalized  Sign  Biased Exponent Mantissa
1100   1.1*2^3      0      10000010  10000000 00000000 00000000

Exp = 7F+3 = 111111+11=10000010

2014年11月5日 星期三

subversion使用

sudo svnadmin create /svn/repo/myfile

sudo chown -R www-data /svn/repo/myfile

sudo chgrp -R www-data /svn/repo/myfile

cd /svn/repo/myfile/conf

修改vim svnserv.conf


svn co htttp://127.0.0.1/svn/myfile

//input user name passwd


svn add file
svn commit -m "2014???"


2014年11月3日 星期一

Redmine git版本控制

$ git config --global user.name "lewisine"
$ git config --global user.email "lewisine@gmail.com"


git config --list

git add *
git commit  -m '20141104'
git push

redmine



2014年10月17日 星期五

nVidia gamework opengl samples build error

./../../../extensions/externals/lib/linux64/libglfw3.a(x11_gamma.c.o): In function `_glfwInitGammaRamp':
x11_gamma.c:(.text+0x49): undefined reference to `XRRGetScreenResources'
====================================================
linux ubuntu 14.04
  1. cd /usr/bin/
  2. sudo rm ld
  3. sudo ln -s ld.gold ld

2014年10月14日 星期二

安裝jre

1. 從http://www.oracle.com/technetwork/java/javase/downloads/jre7-downloads-1880261.html
下載jre runtime
2. cp -r jre-7u67-linux-x64.tar.gz /usr/local/java/
3. cd /usr/local/java
4. sudo tar xvzf jre-7u67-linux-x64.tar.gz
5. cd ~
6. sudo vim .profile
7. 加上
JAVA_HOME=/usr/local/java/jre1.7.0_67
PATH=$PATH:$HOME/bin:$JAVA_HOME/bin
export JAVA_HOME
export PATH
7. source .profile
8. java -version

2014年6月13日 星期五

如何在glsl上兩種顏色

glCompileShader  輸入shader 編號 GLuint    

glCreateProgram 有一個program number
glAttachShader時attach不同fragment shader

glLinkProgram

前置動作
===============================================================

使用
glUseProgram(program #);

==============================================================
將同一個fragment shader 的FragColor設定成兩種顏色

2014年5月14日 星期三

fixed function 和 programmable pipeline如何同時使用

void draw()
{

        glUseProgram(p);

         //draw glsl的物件

        glUseProgram(0);

       //draw fixed function

}