Recent Notes
Displaying keyword search results 1 - 10
Created by nogeek on December 29, 2011 13:31:44
Last update: December 29, 2011 14:29:13
Tomcat allows you to create multiple server instances for the same installation. The installation directory is identified as CATALINA_HOME , the instance directory is identified as CATALINA_BASE . Here are the steps: Create a base directory for the new instance, for example: /home/nogeek/tomcat1 . Create the subdirectories:
mkdir -p /home/nogeek/tomcat/{bin,conf,logs,temp,w... Copy web.xml from the installation directory: cp $CATALINA_HOME/conf/web.xml /home/nogeek/tomcat... Copy logging.properties from the installation directory: cp $CATALINA_HOME/conf/logging.properties /home/no... Create server.xml under tomcat1/conf : <?xml version='1.0' encoding='utf-8'?> <Server ... Create script setenv.sh under tomcat1/bin : # Edit this file to set custom options # Tomcat... Copy startup.sh and shutdown.sh from the installation directory. Add the following two lines to the beginning of each: CATALINA_BASE=/home/nogeek/tomcat1 export CATAL... Create a soft link for catalina.sh in tomcat1/bin : $ ln -s ~/apache-tomcat-7.0.22/bin/catalina.sh cat...
Created by woolf on December 11, 2011 13:38:58
Last update: December 11, 2011 13:38:58
Install usb.essentials . Package usbutils is optional.
# opkg update
# opkg install kmod-usb2
# opk...
Install usb printer support:
# opkg install kmod-usb-printer
Install p910nd print server:
# opkg install p910nd
Edit /etc/config/p910nd :
config p910nd
option device /dev...
Configure firewall to allow port 9100 ( /etc/config/firewall ):
# Allow printer
con...
If clients are connecting from wan then the first line should be:
option src wan
Enable automatic start of print server when router boots:
#/etc/init.d/p910nd enable
Restart router:
# reboot
Created by magnum on September 27, 2011 11:57:49
Last update: October 05, 2011 12:20:00
This procedure sets up an IPSec vpn server on Linux with Preshared Key (PSK) using Openswan .
Install Openswan:
# yum install openswan
Edit /etc/ipsec.conf . This is about the minimum needed to run IPSec server. Instead of running L2TP on port 1701, I'm running TCP on port 8080 so that I can test the setup with nc later.
# /etc/ipsec.conf - Openswan IPsec configurati...
Edit /etc/ipsec.secrets .
#
# Preshared key for clients connecting from a...
Start IPSec:
# /etc/init.d/ipsec start
Check status:
# ipsec auto --status
Monitor IPSec log:
# less /var/log/secure
If IPSec is running KLIPS, you should see a new nic ( ipsec0 ). There's no ipsec0 if IPSec is running NETKEY.
# ifconfig
eth0 Link encap:Ethernet HWadd...
Created by magnum on September 28, 2011 09:31:58
Last update: September 28, 2011 09:31:58
This procedure works for xl2tpd . Edit L2TP configuration file /etc/xl2tpd/xl2tpd.conf :
; ; This is a minimal sample xl2tpd configurati... Edit PPP options file for L2TP /etc/ppp/options.xl2tpd.client : ipcp-accept-local ipcp-accept-remote refuse-... Edit PPP authentication file /etc/ppp/chap-secrets : # Secrets for authentication using CHAP # serve... Start xl2tpd : # /etc/init.d/xl2tpd start Connect to the server: # echo "c vpnserver" >/var/run/xl2tpd/l2tp-control Tail /var/log/messages , you should see something like: Sep 28 11:05:46 sta101894 pppd[26059]: pppd 2.4.5 ... ifconfig should show that ppp0 is added: # ifconfig ppp0 ppp0 Link encap:Point-to-P... To tear down the vpn: # echo "d vpnserver" >/var/run/xl2tpd/l2tp-control If authentication fails, try to set "require authentication" to no on both server and client and restart xl2tpd on both sides: # /etc/init.d/xl2tpd restart # echo "c vpnserve......
Created by magnum on September 23, 2011 16:06:02
Last update: September 28, 2011 09:29:53
This procedure works for xl2tpd .
Edit L2TP configuration file /etc/xl2tpd/xl2tpd.conf :
; Sample l2tpd.conf
;
[global]
; listen...
Edit PPP options file for L2TP /etc/ppp/options.xl2tpd :
ipcp-accept-local
ipcp-accept-remote
ms-dns ...
Edit PPP authentication file /etc/ppp/chap-secrets :
# Secrets for authentication using CHAP
# serve...
Start the server:
# /etc/init.d/xl2tpd start
Monitor the log:
# less /var/log/messages
Created by magnum on September 27, 2011 12:55:51
Last update: September 27, 2011 12:55:51
These steps set up a Linux host as IPSec client, using Openswan .
Install Openswan:
# yum install openswan
Edit /etc/ipsec.conf . Instead of L2TP on port 1701, I'm setting up TCP on port 8080 so that I can test the connection with nc .
# /etc/ipsec.conf - Openswan IPsec configuration f...
Edit /etc/ipsec.secrets .
# include /etc/ipsec.d/*.secrets
192.168.0.101 ...
Start IPSec:
# /etc/init.d/ipsec start
Connect to IPSec server:
# ipsec auto --up TCP8080-PSK-CLIENT
104 "TCP80...
Created by woolf on July 27, 2011 20:56:11
Last update: July 27, 2011 20:56:11
Install the DHCP server:
voodoo@newpc:~$ sudo apt-get install dhcp3-server
...
Edit /etc/dhcp/dhcpd.conf (this is the minimum for a local network without DNS):
ddns-update-style none;
default-lease-time ...
Start the DHCP server:
voodoo@newpc:/etc/dhcp$ sudo /etc/init.d/isc-dhcp-...
Created by freyo on July 27, 2011 13:49:26
Last update: July 27, 2011 13:52:03
Some ways to pass data from one activity to another:
Add data to the Intent :
The sending side:
// create Intent
Intent intent = new Intent();
...
The receiving side:
Bundle bundle = getIntent().getExtras();
String...
Use SharedPreferences (data is persisted in this case):
The sending side:
SharedPreferences prefs = getSharedPreferences("pr...
The receiving side:
SharedPreferences prefs = getSharedPreferences("pr...
Created by freyo on April 01, 2011 14:29:25
Last update: June 29, 2011 13:58:27
Start the emulator ( create an AVD if none exists)
$ tools/emulator -avd Simple8 Create new project $ tools/android create project \ > --package co... where " --target 2 " identifies the target platform as displayed by " tools/android list targets ", which is stored in the properties file default.properties in the project root folder. cd HelloWorld and install debug package onto the running emulator: $ ant install Buildfile: build.xml [set... Launch the Hello World application on the emulator. You'll see something like this: Edit res/values/string.xml , change the contents to: <?xml version="1.0" encoding="utf-8"?> <resourc... Edit res/layout/main.xml , change the contents to: <?xml version="1.0" encoding="utf-8"?> <LinearL... The contents of the text area now refer to a string defined in the resource file strings.xml , instead...
Created by freyo on May 17, 2011 11:13:17
Last update: May 17, 2011 11:13:17
This is an odd-ball content provider in that it doesn't provide database records, but provides a resource as a stream. It can be used to provide media files or XML resources. Start the project with:
tools/android create project --package com.android... Create assets directory and add an XML file ( assets/demo.xml ): <? xml version="1.0" encoding="UTF-8"?> <people... Edit the layout ( res/layout/main.xml ): <?xml version="1.0" encoding="utf-8"?> <LinearL... Edit src/com/android/cptest/Dummy.java : package com.android.cptest; import java.io.... Add content provider ( src/com/android/cptest/XmlResource.java ): package com.android.cptest; import java.io.... Update AndroidManifest.xml : <?xml version="1.0" encoding="utf-8"?> <manifes... Add this section to the end of build.xml : <target name="-package-resources"> <ech... Build and install: ant install Screenshot: Remove the Dummy activity ( AndroidManifest.xml ): <?xml version="1.0" encoding="utf-8"?> <manifes... Create a new project for...