- download *.rpm from oracle
- sudo alien to install rpms
- vi /etc/ld.so.conf.d/
oracle-instantclient11.2-basic.conf - /lib
- /usr/lib/oracle/11.2/client64/lib
- sudo ldconfig
Friday, November 25, 2011
install oracle instance client on ubuntu 11.10 x64
Monday, November 21, 2011
mysql testdb
mysql> create database testdb;
Query OK, 1 row affected (0.03 sec)
mysql> create user 'testuser'@'localhost' identified by 'password';
Query OK, 0 rows affected (0.06 sec)
mysql> use testdb;
Database changed
mysql> grant all on testdb.* to 'testdb'@'localhost';
Query OK, 0 rows affected (0.00 sec)
mysql>flush privileges
mysql>select user, host from mysql.user;
Tuesday, November 8, 2011
DNS wildcard and DHCP with BIND vs dnsmasq
set up DNS wildcard for blah.dev
BIND configuration
/etc/bind/named.conf.localzone "dev" {
type master;
file "/etc/bind/db.dev";
};
run"named-checkconf named.conf.local"
/etc/bind/db.dev: use the loopback address so the IP address is not affected by DHCP.dev. 86400 IN SOA dev. hostmaster.dev. (
20111101; serial yyyy-mm-dd
10800; refresh every 15 min
3600; retry every hour
3600000; expire after 1 month +
86400 ); min ttl of 1 day
IN NS dev.
IN MX 10 dev.
IN A 127.0.0.1
*.dev. IN A 127.0.0.1
named-checkzone dev db.dev
DHCP client configuration
- uncomment the line in /etc/dhcp/dhclient.conf: prepend domain-name-servers 127.0.0.1;
- sudo dhclient
- sudo /etc/init.d/bind9 restart
Testing
ping blah.dev will return 127.0.0.1
disable dnsmasq from networkmanager
sudo vim /etc/NetworkManager.conf. comment out dnsmasq
Install and configure dnsmasq
ping blah.dev will return 127.0.0.1
Set up dnsmasq for local DNS cache and DHCP
disable dnsmasq from networkmanager
sudo vim /etc/NetworkManager.conf. comment out dnsmasq
sudo service network-manager restart
- sudo apt-get install dnsmasq
- sudo vim /etc/dnsmasq.conf
- listen-address=127.0.0.1
- address=/dev/127.0.0.1
- address=/prod/127.0.0.1
- sudo service dnsmasq restart
Set up Apache for vhost_alias
mod_vhost_alias
# get the server name from the Host: header and put in %0
# this is for dev
RewriteCond %{HTTP_HOST} ^mongo.dev$
RewriteRule (.*) http://localhost:28017/_replSet
RewriteCond %{HTTP_HOST} ^mongo.snap$
RewriteRule (.*) http://192.168.1.100:28000/_replSet
UseCanonicalName Off
# include the server name in the filenames used to satisfy requests
VirtualDocumentRoot /var/www/vhosts/%0
<Directory />
# Global settings
Options FollowSymLinks
AllowOverride All
</Directory>
</VirtualHost>
- sudo a2enmod vhost_alias (this will enable module vhost_alias for loading).
- sudo vi /etc/apache2/mods-available/vhost_alias.conf (create one if not existing)
# get the server name from the Host: header and put in %0
# this is for dev
RewriteCond %{HTTP_HOST} ^mongo.dev$
RewriteRule (.*) http://localhost:28017/_replSet
RewriteCond %{HTTP_HOST} ^mongo.snap$
RewriteRule (.*) http://192.168.1.100:28000/_replSet
UseCanonicalName Off
# include the server name in the filenames used to satisfy requests
VirtualDocumentRoot /var/www/vhosts/%0
<Directory />
# Global settings
Options FollowSymLinks
AllowOverride All
</Directory>
</VirtualHost>
Sunday, October 30, 2011
install Plone 4.1.x
Ubuntu: 11.10
Install all the required package
Install all the required package
sudo apt-get install build-essential sudo apt-get install libssl-dev sudo apt-get install libxml2-dev sudo apt-get install libbz2-dev
sudo apt-get install libjpeg62-dev sudo apt-get install libreadline6-dev
./install.sh --target=/home/vyang/opt/plone --with-python=/usr/bin/python2.6 standalone
Tuesday, October 25, 2011
Install RVM and Ruby
rvm, virutualenv
Remove ubuntu's ruby-rvm
sudo apt-get --purge ruby-rvm
Install
curl -L https://get.rvm.io | bash -s stablervm list known
rvm install 1.9.3-head
Configuration (.bashrc)
PATH=$PATH:$HOME/.rvm/bin # Add RVM to PATH for scripting
source /home/victor.yang/.rvm/scripts/rvm | |
Install sproutcore
Ubuntu 11.10
Step 1 has be done before step 2, otherwise the ruby will complain about "zlib not installed"
Step 1 has be done before step 2, otherwise the ruby will complain about "zlib not installed"
- apt-get install zlib1g-dev libssl-dev libreadline5-dev libxml2-dev libsqlite3-dev
- Follow steps in install sproutcore on linux
Monday, October 24, 2011
install sun-jdk 6, 7 on Ubuntu 12.04
http://www.devsniper.com/ubuntu-12-04-install-sun-jdk-6-7/
sudo update-alternatives --config java
sudo update-alternatives --config javac
sudo update-alternatives --install "/usr/bin/java" "java" "/usr/lib/jvm/jdk1.7.0/bin/java" 1 sudo update-alternatives --install "/usr/bin/javac" "javac" "/usr/lib/jvm/jdk1.7.0/bin/javac" 1 sudo update-alternatives --install "/usr/bin/javaws" "javaws" "/usr/lib/jvm/jdk1.7.0/bin/javaws" 1
Sunday, October 23, 2011
Tuesday, October 11, 2011
Python study notes
python overview
python user defined class design
object is first class
- abstraction:
- type: dynamic binding, strong type(for catching bugs)
- object is first class:objects can be freely passed around, inspected, and placed in various data structures (e.g., lists or dictionaries) at run-time.
- organizing code: package, module, class,method, function.
- flow control: if/else,while, iterator,generator, coroutine
- error handling: try/except/finally
- Influenced by ABC
python user defined class design
- runtime data structure of instances and class, inheritance
- instance dict, class dict
- why "self" is needed
- class implementation requires no special syntax: just a collection of functions (methods), variables (class variables), computed attributed(properties).
- new style classes,
- __new__(cls,*args,**kwargs) is used for change value for subclassing immutable type
- Attributes,Properties and Descriptors
- History of descriptor,staticmethod, classmethod, property
- metaclass explained: metaclass
-
-
type(name, bases, dict) Return a new type object. This is essentially a dynamic form of the
class statement. Python will look for
__metaclass__in the class definition. If it finds it, if will use it to create the object classFoo. If it doesn't, it will usetypeto create the class.
-
type(name, bases, dict) Return a new type object. This is essentially a dynamic form of the
class statement. Python will look for
object is first class
- how to make method first class? via bound and unbound method
- benefit: share the same grammar rule, and hence the compiler could use the same byte code generation function for all of them.
- early days implemented as string token (from Modula-3)
- user defined class as replacement
Monday, October 10, 2011
cpython source code study note
Python 2.7.2 source code
- main():Modules/python.c
- Py_Main():Modules/main.c
- Py_Initialize(): Python/pythonrun.c
- PyRun_SimpleFileExFlags
- PyRun_FileExFlags
- PyParser_ASTFromFile returns AST module
- Parser build CST: PyParser_ParseFileFlagsEx: Parser/parsetok.c
- Transform CST to AST: PyAST_FromNode(): Python/ast.c
- run_mod(mod)
- PyAST_Compile(mod) compile AST into byte code
- PyEval_EvalCode runs the byte code
- create first interpreter PyInterperterState_New()
- create first thread PyThreadState_New()
- initialize __builtin__ module: _PyBuiltin_Init()
- initialize sys module: _PySys_init()
Saturday, September 17, 2011
DNS query tracing
dig @dns.server target.dns +tracing
watch it under wireshark, It is very useful to understand how DNS query works especially for a non-cached look up.
- As a DNS client, dig will send a standard DNS query to the target DNS server via UDP port 53.
- For a non-cached look up, dig will ask the answer from root server, TLD (Top Level Domain) server, specific domain server in that order.
Sunday, September 11, 2011
Packet crafting and sniffing with Python extensions
- libpcap: sudo apt-get install libpcap-dev
- download and install pypcap, dpkt, dnet
- pypcap 's installation is tricky: download the pyrex and recompile the pcap.pyx file will work. Furthermore, use Makefile instead of setup.py seems fixed issues.
Wednesday, August 24, 2011
Sunday, January 23, 2011
Friday, January 21, 2011
Tab to space for indentation: Configure Eclipse and Pydev editors
Configure Eclipse and Pydev editors
- Go to "Window > Preferences > General > Editors > Text Editors"
- Set "Displayed tab width" to 4 and make sure "Insert spaces for tabs" is checked
- Go to "Window > Preferences > Pydev > Editor"
- Set "Tab length" to 4 and make sure "Replace tabs with spaces..." is checked
Oracle Net: TNS and EasyConnect
- sqlplus id/pwd@
- sqlplus id/pwd@server:port/service (service is schema that is given by DBA)
Thursday, December 23, 2010
cx_Oracle
Follow http://mostperfect.net/blog/2010/07/28/installing-cx_oracle-on-windows/,
A looking at cx_Oracle.pyd with dependency walker (from MS) will show it depends on OCI.dll.
As a result, we need to install Oracle Instant Client from here
As a result, we need to install Oracle Instant Client from here
Thursday, November 25, 2010
Customize the Nginx Server:Apache
- vi src/http/ngx_http_header_filter_module.c
- static char ngx_http_server_string[] = "Server: Apache" CRLF;
- static char ngx_http_server_full_string[] = "Server: Apache" CRLF;
- configure, make, make install.
Subscribe to:
Posts (Atom)
