Tuesday, September 13, 2016

[mysql] How to install mysql in centos

mysql CENTOS 7 installation

安裝 MySQL Repository:

# rpm -Uvh http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm

安裝 MySQL Server, MySQL client 已經包括在 server 套件內:

# yum install mysql-community-server

開機自動啟動 MySQL

# /usr/bin/systemctl enable mysqld

啟動 MySQL

# /usr/bin/systemctl start mysqld

MySQL 預設為空密碼, 執行以下指令修改:

# /usr/bin/mysql_secure_installation




to enter client

$ mysql -uroot

Monday, April 13, 2015

tcp tunnel, old way but easy to use

iOS NSURLRequest does not have cookie info in the allhttpheaderfields api.
I am confused and I think I don't have cookie...but actually there is.
So to get the real sent request header, ether check nshttpcookie by yourself,
or simply use the tcp tunnel to dump the request.


java -classpath soap-2.3.jar org.apache.soap.util.net.TcpTunnelGui 8080 yourserver 8080

although soap is out, I still like this tiny tool. XD


Monday, February 2, 2015

[mongo] delete all data in database

mongo //will start the mongodb shell

show dbs //will list existing databases

use  // is the database you'd like to drop

db //should show  just to be sure I'm working with the right database

db.dropDatabase() //will delete the database and return { "dropped" : "", "ok" : 1 }

Friday, December 5, 2014

build ejabberd mac osx 10.9.5

try to build ejabberd from source on mac osx 10.9.5.
after installing homebrew, autoconf, automaker, libtool, erlang, I still have an error when making.

configure: error: libyaml library was not found

brew install libyaml does not help. and manually download libyaml and make install does not help either. although it's indeed in /usr/local/include

After installing  xcode 6.1 and command line tools for osx 10.9 for xcode 6.1,
the issue is gone. ^_^

Thursday, December 4, 2014

osx install brew autoconf automake

install brew and others in osx

install homebrew first

  ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
  brew install autoconf

  brew install automake


Tuesday, July 8, 2014

[ios] how to tell ios binary is 32 or 64 bit


use lipo command
xcrun -sdk iphoneos lipo -info $(FILENAME)

Monday, August 12, 2013

[ios] uiimage low memory warning for large images


when i load a very large image like > 5M jpg, I got low memory warning, and finally crash.

how to downsize a very large image
https://developer.apple.com/library/ios/samplecode/LargeImageDownsizing/Introduction/Intro.html#//apple_ref/doc/uid/DTS40011173

Wednesday, May 22, 2013

[ios] iphone simulator file system location

open a terminal, then cd ~/Library/Application\ Support/iPhone\ Simulator
then I can see 6.1 folder.
The app folder will be in 6.1/Applications/xxxxx  where xxxx is the app id. or you can check all folders to find where is your app.

Thursday, May 16, 2013

[ios] some issue: async, guid, priority queue, view fade-in, image reflection



How do I wait for an asynchronously dispatched block to finish?


http://stackoverflow.com/questions/4326350/how-do-i-wait-for-an-asynchronously-dispatched-block-to-finish


Waiting on asynchronous methods using NSCondition


http://stackoverflow.com/questions/14013947/waiting-on-asynchronous-methods-using-nscondition




How to create a GUID/UUID using the iPhone SDK


http://stackoverflow.com/questions/427180/how-to-create-a-guid-uuid-using-the-iphone-sdk


/ JCPriorityQueue


https://github.com/jessedc/JCPriorityQueue/tree/experimental/heap-queue


Fade/dissolve when changing UIImageView's image


http://stackoverflow.com/questions/7638831/fade-dissolve-when-changing-uiimageviews-image


No-fuss reflections – generating reflections the easy way in iOS


http://aptogo.co.uk/2011/08/no-fuss-reflections/

[ios] the correct behavior of nsoperation waitUntilFinished


from network search: 
think you may have missed expectations for the behavior. If you are expecting the completionBlock to be fired beforewaitUntilFinished releases the control flow, then your expectations are out of alignment. The completion block is dispatched asynchronously back to the success/failure queue, so its not going to be triggered until the run loop spins.
What you can do instead is waitUntilFinished and then access the responsePropertyList and errorproperties of the operation instead of the completion block.

Thursday, April 18, 2013

[ios] IBOutlet but no synthesize


In Xcode 4.4 (specifically, the LLVM 4.0 Compiler), synthesis of properties happens by default if there's no @synthesize directive. It's equivalent to:
@synthesize nameField = _nameField;

Wednesday, March 13, 2013

ffmpeg strip video


ffmpeg strip video, from http://howto-pages.org/ffmpeg/#strip
ffmpeg -i mandelbrot.flv -vn -acodec copy mandelbrot.mp3

convert m4a to mp3
ffmpeg -i xxxx.m4a -acodec libmp3lame -ab 128k xxxx.mp3

Monday, January 7, 2013

Android Eclipse on Ubuntu

1. download Eclipse 4.2.1 linux 64bit, and extract it
2. sudo apt-get install openjdk-6-jdk
3. run eclispe
4. goto Help -> Install New Software
5. add https://dl-ssl.google.com/android/eclipse/ and install
6. download android sdk
7. got an error -> adb: no such file
8. do "sudo apt-get install ia32-libs"

Thursday, January 3, 2013

Build directshow strmbase.lib in Windows 8

To build directshow strmbase.lib, here is the step when using dx9b.
Open \dx90bsdk\Samples\C++\DirectShow\BaseClasses\baseclasses.sln
in Visual Studio 2012.
Compile and fix error:
1. add c/c++ prepocessor definitions:
    POINTER_64=__ptr64
2. fix for loop variable declare

outputq.cpp:
for (long iDone = 0;
-->
long iDone;
for (iDone = 0;

winutil.cpp:
for (UINT Count = 0;Count < Result;Count++) {
->
UINT Count = 0;
for (Count = 0;Count < Result;Count++) { 


wxdebug.cpp
static g_dwLastRefresh = 0;
->
static int g_dwLastRefresh = 0;



3. sysclock.cpp, add g_Templates & g_cTemplates to fix link error
//#ifdef FILTER_DLL
/* List of class IDs and creator functions for the class factory. This
   provides the link between the OLE entry point in the DLL and an object
   being created. The class factory will call the static CreateInstance
   function when it is asked to create a CLSID_SystemClock object */
CFactoryTemplate g_Templates[1] = {
    {NULL, &CLSID_SystemClock, CSystemClock::CreateInstance}
};
int g_cTemplates = sizeof(g_Templates) / sizeof(g_Templates[0]);
//#endif    


Monday, November 19, 2012

[wp8] windows phone 8 can't download app from market

I got the new lumia 920 but after I setup microsoft account, I can't download apps from market.
After surfing the net, there is one reason that the phone time is incorrect.
SO, I go to setting -> time -> and disable auto. then setup my timezone and time correctly.
I can download apps now!
what a waste of time!!

Thursday, November 8, 2012

[WP8] windows phone 8 app models

2 models:
1. xaml app with c#/vb
   * reuse c++ via winrt component
   * direct3d interop
2. direct3d app with c++

Tuesday, November 6, 2012

Bracket names

() parentheses
[] square brackets
{} curly brackets

Monday, November 5, 2012

[WP8] html5 on windows phone 8

In current wp8 design, how to use html5:
1. in c# xaml project, add webbrowser control
2. you can only notify to c# code from javascript. you cannot access winrt API
3. you can run script or access script objects from c# code
The design is similar to webkit on android.