Recent Notes
Displaying keyword search results 1 - 10
Created by magnum on September 11, 2012 12:10:03
Last update: September 11, 2012 12:10:46
Sample code for UDP client and server in C. The server simply echos back the client message. The client stays in "receive" loop to demonstrate the connection-less nature of the UDP protocol. Server code:
#include <stdio.h> #include <stdlib.h> #incl... Client code: #include <stdio.h> #include <stdlib.h> #incl... Try it out: Start the server with: ./udpserver 8888 Send message to server: ./udpclient localhost 8888 "Hi, it's me! " Server console displays: Received from 127.0.0.1:41776: Hi, it's me! UDP is connectionless. Send a message from a second client to the first client: $ ./udpclient localhost 41776 "From client 2" First client console displays: $ ./udpclient localhost 8888 "Hi, it's me! " Re... It should be noted that the distinction between client and server is blurry. The only major...
Created by timo on January 25, 2012 20:13:13
Last update: January 25, 2012 20:13:13
The MIPS CPU is able to run both big-endian and little-endian. So a system built on MIPS can be either big-endian (mips) or little-endian (mipsel).
The file command shows the architecture:
$ file ls
ls: ELF 32-bit LSB executable, MIPS, ...
but readelf will tell the endianness:
$ readelf -h ls
ELF Header:
Magic: 7f 45...
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 27, 2011 13:57:23
Last update: October 03, 2011 13:02:34
After an IPSec connection is established, all traffic between the network interfaces named in /etc/ipsec.conf are tunneled through IPSec. And only the protocols and ports listed in /etc/ipsec.conf are allowed. For example, if you were able to ssh to the server, after IPSec connection ssh is no longer working if port 22 is not listed. Assume that you set up IPSec tunnel between the hosts 192.168.0.1 and 192.168.0.101 , these tests will show that the IPSec connection is successfully working. Before bringing up IPSec connection If IPSec connection is already established, bring it down:
# ipsec auto --down TCP8080-PSK-CLIENT Monitor server port 8080 with tcpdump ( 192.168.0.1 ): # tcpdump -i eth0 port 8080 -X On server side ( 192.168.0.1 ), listen on port 8080:...
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 freyo on July 29, 2011 16:04:45
Last update: July 29, 2011 16:04:45
To start the Settings application:
# am start -n com.android.settings/.Settings
St...
To start the Browser :
# am start -n com.android.browser/.BrowserActivity...
To start the phone dialer:
# am start tel:210-385-0098
Starting: Intent { ...
Help for am command:
# am
usage: am [subcommand] [options]
...
Created by nogeek on November 11, 2010 22:48:50
Last update: December 27, 2010 08:28:42
I need to create a Tomcat only configuration for JBoss 3.2.7. These are the steps:
Copy the minimal configuration to new configuration:
cd $JBOSS_HOME/server
cp -R minimal tomcatonly
...
Copy tomcat service from the default configuration to the new configuration:
cp -R default/deploy/jbossweb-tomcat50.sar tomcato...
Edit jboss-tomcat50.sar/META-INF/jboss-service.xml , comment out SecurityManagerService :
<!-- A mapping to the server security manager serv...
and TransactionManager :
<!--
<depends>jboss:service=TransactionManager<...
Copy jbosssx.jar , jboss-j2ee.jar and jboss.jar from default/lib to tomcatonly/lib .
Edit tomcatonly/conf/jboss-service.xml , change port 1098, 1099 to 1100, 1101.
Edit tomcatonly/deploy/jbossweb-tomcat50.sar/server.xml , change port 8080 to 8081; change port 8009 to 8010.
Start new configuration with:
bin/run.sh -c tomcatonly
Created by Fang on July 26, 2010 19:18:28
Last update: August 18, 2010 19:13:02
The tags <c:import> The <c:import> tag imports the contents of a URL and expose that in one of three ways: Import contents from a URL and write it out to the page (url may be relative or absolute):
<c:import url="theUrl" /> Import contents from a URL and save it to a scoped variable string named by the var attribute. Use the scope attribute to define the scope of the exported variable. <c:import url="theUrl" var="importTest" scope="ses... Import a URL and expose to a Reader object named by the varReader attribute. The scope attribute does not apply. The varReader scoped variable can only be accessed within the body of <c:import> . <c:import url="theUrl" varReader="theReader"/> <c:url> The <c:url> tag constructs a URL and writes it out to the...